Add translation, help, refactorin
This commit is contained in:
parent
62186267e4
commit
8d4d1070a4
@ -64,7 +64,7 @@
|
||||
"jstree-bootstrap-theme": "^1.0.1",
|
||||
"leaflet": "^1.0.3",
|
||||
"leaflet-providers": "^1.1.17",
|
||||
"material-steppers": "git://github.com/vvlladd28/material-steppers.git#master",
|
||||
"material-steppers": "git://github.com/thingsboard/material-steppers.git#master",
|
||||
"material-ui": "^0.16.1",
|
||||
"material-ui-number-input": "^5.0.16",
|
||||
"md-color-picker": "0.2.6",
|
||||
|
||||
@ -1159,7 +1159,7 @@ function EntityService($http, $q, $filter, $translate, $log, userService, device
|
||||
break;
|
||||
}
|
||||
findIdEntity.then(function success(response) {
|
||||
saveEntityRelarion(response.id, entityType, entityParameters, config).then(function success() {
|
||||
saveEntityRelarion(entityType, response.id, entityParameters, config).then(function success() {
|
||||
statisticalInfo.update = {
|
||||
entity: 1
|
||||
};
|
||||
|
||||
@ -96,6 +96,7 @@ export default angular.module('thingsboard.help', [])
|
||||
assets: helpBaseUrl + "/docs/user-guide/ui/assets",
|
||||
devices: helpBaseUrl + "/docs/user-guide/ui/devices",
|
||||
entityViews: helpBaseUrl + "/docs/user-guide/ui/entity-views",
|
||||
entitiesImport: helpBaseUrl + "/docs/user-guide/bulk-provisioning",
|
||||
dashboards: helpBaseUrl + "/docs/user-guide/ui/dashboards",
|
||||
users: helpBaseUrl + "/docs/user-guide/ui/users",
|
||||
widgetsBundles: helpBaseUrl + "/docs/user-guide/ui/widget-library#bundles",
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
import './import-dialog.scss';
|
||||
|
||||
/*@ngInject*/
|
||||
export default function ImportDialogCsvController($scope, $mdDialog, toast, importTitle, importFileLabel, entityType, importExport, types, $mdStepper) {
|
||||
export default function ImportDialogCsvController($scope, $mdDialog, toast, importTitle, importFileLabel, entityType, importExport, types, $mdStepper, $timeout) {
|
||||
|
||||
var vm = this;
|
||||
|
||||
@ -40,6 +40,7 @@ export default function ImportDialogCsvController($scope, $mdDialog, toast, impo
|
||||
vm.isLinear = true;
|
||||
vm.isAlternative = false;
|
||||
vm.isMobileStepText = true;
|
||||
vm.isImportData = false;
|
||||
|
||||
vm.parseData = [];
|
||||
|
||||
@ -171,6 +172,7 @@ export default function ImportDialogCsvController($scope, $mdDialog, toast, impo
|
||||
});
|
||||
importExport.createMultiEntity(entitiesData, vm.entityType, vm.importParameters.isUpdate, config).then(function (response) {
|
||||
vm.statistical = response;
|
||||
vm.isImportData = false;
|
||||
$mdStepper('import-stepper').next();
|
||||
});
|
||||
}
|
||||
@ -186,7 +188,9 @@ export default function ImportDialogCsvController($scope, $mdDialog, toast, impo
|
||||
switch (step) {
|
||||
case 1:
|
||||
steppers.back();
|
||||
vm.theFormStep1.$setDirty();
|
||||
$timeout(function () {
|
||||
vm.theFormStep1.$setDirty();
|
||||
});
|
||||
break;
|
||||
default:
|
||||
steppers.back();
|
||||
@ -203,8 +207,10 @@ export default function ImportDialogCsvController($scope, $mdDialog, toast, impo
|
||||
case 3:
|
||||
parseData = parseCSV(vm.importData);
|
||||
if (parseData === -1) {
|
||||
clearFile();
|
||||
steppers.back();
|
||||
$timeout(function () {
|
||||
clearFile();
|
||||
});
|
||||
} else {
|
||||
createColumnsData(parseData);
|
||||
steppers.next();
|
||||
@ -212,6 +218,7 @@ export default function ImportDialogCsvController($scope, $mdDialog, toast, impo
|
||||
break;
|
||||
case 4:
|
||||
steppers.next();
|
||||
vm.isImportData = true;
|
||||
addEntities(parseData, vm.columnsParam);
|
||||
break;
|
||||
case 6:
|
||||
|
||||
@ -15,13 +15,14 @@
|
||||
limitations under the License.
|
||||
|
||||
-->
|
||||
<md-dialog aria-label="{{ vm.importTitle | translate }}" class="tb-import-stepper" tb-help="'import-csv'" help-container-id="help-container">
|
||||
<md-dialog aria-label="{{ vm.importTitle | translate }}" class="tb-import-stepper" tb-help="'entitiesImport'"
|
||||
help-container-id="help-container">
|
||||
<md-toolbar>
|
||||
<div class="md-toolbar-tools">
|
||||
<h2 translate>{{ vm.importTitle }}</h2>
|
||||
<span flex></span>
|
||||
<div id="help-container"></div>
|
||||
<md-button class="md-icon-button" ng-click="vm.cancel()">
|
||||
<md-button class="md-icon-button" ng-click="vm.cancel()" ng-disabled="vm.isImportData">
|
||||
<ng-md-icon icon="close" aria-label="{{ 'dialog.close' | translate }}"></ng-md-icon>
|
||||
</md-button>
|
||||
</div>
|
||||
@ -31,7 +32,7 @@
|
||||
<md-dialog-content>
|
||||
<md-stepper id="import-stepper" md-mobile-step-text="vm.isMobileStepText" md-vertical="vm.isVertical"
|
||||
md-linear="vm.isLinear" md-alternative="vm.isAlternative">
|
||||
<md-step md-label="Select a file">
|
||||
<md-step md-label="{{ 'import.stepper-text.select-file' | translate }}">
|
||||
<md-step-body>
|
||||
<form name="vm.theFormStep1">
|
||||
<fieldset ng-disabled="$root.loading">
|
||||
@ -78,27 +79,28 @@
|
||||
<md-button class="md-primary md-raised"
|
||||
ng-disabled="$root.loading || !vm.theFormStep1.$dirty || !vm.theFormStep1.$valid || !vm.importData"
|
||||
ng-click="vm.nextStep(2);">
|
||||
Continue
|
||||
{{ 'action.continue' | translate }}
|
||||
</md-button>
|
||||
</md-step-actions>
|
||||
</md-step>
|
||||
|
||||
<md-step md-label="Import configuration">
|
||||
<md-step md-label="{{ 'import.stepper-text.configuration' | translate }}">
|
||||
<md-step-body>
|
||||
<div layout="column">
|
||||
<md-input-container>
|
||||
<label translate>CSV delimiter</label>
|
||||
<label translate>import.csv-delimiter</label>
|
||||
<md-select ng-model="vm.importParameters.delim">
|
||||
<md-option ng-repeat="delimiter in vm.delimiters" ng-value="delimiter.key">
|
||||
{{delimiter.value}}
|
||||
</md-option>
|
||||
</md-select>
|
||||
</md-input-container>
|
||||
<md-checkbox ng-model="vm.importParameters.isHeader" aria-label="First line contains column names">
|
||||
First line contains column names
|
||||
<md-checkbox ng-model="vm.importParameters.isHeader"
|
||||
aria-label="First line contains column names">
|
||||
{{ 'import.csv-first-line-header' | translate }}
|
||||
</md-checkbox>
|
||||
<md-checkbox ng-model="vm.importParameters.isUpdate" aria-label="Update attributes/telemetry">
|
||||
Update attributes/telemetry
|
||||
{{ 'import.csv-update-data' | translate }}
|
||||
</md-checkbox>
|
||||
</div>
|
||||
</md-step-body>
|
||||
@ -111,12 +113,12 @@
|
||||
{{ 'action.cancel' | translate }}
|
||||
</md-button>
|
||||
<md-button class="md-primary md-raised" ng-disabled="$root.loading" ng-click="vm.nextStep(3);">
|
||||
Continue
|
||||
{{ 'action.continue' | translate }}
|
||||
</md-button>
|
||||
</md-step-actions>
|
||||
</md-step>
|
||||
|
||||
<md-step md-label="Select columns type">
|
||||
<md-step md-label="{{ 'import.stepper-text.column-type' | translate }}">
|
||||
<md-step-body>
|
||||
<form name="vm.theFormStep3">
|
||||
<tb-table-columns-assignment columns="vm.columnsParam" the-form="vm.theFormStep3"
|
||||
@ -134,28 +136,32 @@
|
||||
<md-button class="md-primary md-raised"
|
||||
ng-disabled="$root.loading || !vm.theFormStep3.$dirty || !vm.theFormStep3.$valid"
|
||||
ng-click="vm.nextStep(4);">
|
||||
Continue
|
||||
{{ 'action.continue' | translate }}
|
||||
</md-button>
|
||||
</md-step-actions>
|
||||
</md-step>
|
||||
|
||||
<md-step md-label="Creating new entities">
|
||||
<md-step md-label="{{ 'import.stepper-text.creat-entities' | translate }}">
|
||||
<md-step-body>
|
||||
<md-progress-linear class="md-warn tb-import-progress" md-mode="determinate" value="{{vm.progressCreate}}"></md-progress-linear>
|
||||
<md-progress-linear class="md-warn tb-import-progress" md-mode="determinate"
|
||||
value="{{vm.progressCreate}}"></md-progress-linear>
|
||||
</md-step-body>
|
||||
</md-step>
|
||||
<md-step md-label="Done">
|
||||
<md-step md-label="{{ 'import.stepper-text.done' | translate }}">
|
||||
<md-step-body layout="column">
|
||||
<div>
|
||||
<p class="md-body-1" ng-if="vm.statistical.create && vm.statistical.create.entity">{{vm.statistical.create.entity}} new entities were successfully created.</p>
|
||||
<p class="md-body-1" ng-if="vm.statistical.update && vm.statistical.update.entity">{{vm.statistical.update.entity}} entities were successfully updated.</p>
|
||||
<p class="md-body-1" ng-if="vm.statistical.error && vm.statistical.error.entity">There was an error creating {{vm.statistical.error.entity}} entities.</p>
|
||||
<p class="md-body-1" translate translate-values="{count: vm.statistical.create.entity}"
|
||||
ng-if="vm.statistical.create && vm.statistical.create.entity">import.message.create-entities</p>
|
||||
<p class="md-body-1" translate translate-values="{count: vm.statistical.update.entity}"
|
||||
ng-if="vm.statistical.update && vm.statistical.update.entity">import.message.update-entities</p>
|
||||
<p class="md-body-1" translate translate-values="{count: vm.statistical.error.entity}"
|
||||
ng-if="vm.statistical.error && vm.statistical.error.entity">import.message.error-entities</p>
|
||||
</div>
|
||||
</md-step-body>
|
||||
<md-step-actions layout="row">
|
||||
<span flex></span>
|
||||
<md-button class="md-primary md-raised" ng-disabled="$root.loading" ng-click="vm.nextStep(6);">
|
||||
Ok
|
||||
{{ 'action.ok' | translate }}
|
||||
</md-button>
|
||||
</md-step-actions>
|
||||
</md-step>
|
||||
|
||||
@ -802,7 +802,7 @@ export default function ImportExport($log, $translate, $q, $mdDialog, $document,
|
||||
let csvlines = csvdata.split(/[\r\n]+/);
|
||||
let csvheaders = splitCSV(csvlines[0], delim);
|
||||
if (csvheaders.length < 2) {
|
||||
toast.showError($translate.instant('entity.import-csv-number-columns-error'));
|
||||
toast.showError($translate.instant('import.import-csv-number-columns-error'));
|
||||
return -1;
|
||||
}
|
||||
let csvrows = header ? csvlines.slice(1, csvlines.length) : csvlines;
|
||||
@ -819,7 +819,7 @@ export default function ImportExport($log, $translate, $q, $mdDialog, $document,
|
||||
|
||||
let rowitems = splitCSV(row, delim);
|
||||
if (rowitems.length !== result.headers.length) {
|
||||
toast.showError($translate.instant('entity.import-csv-invalid-format-error', {line: (header ? result.rows.length + 2: result.rows.length + 1)}));
|
||||
toast.showError($translate.instant('import.import-csv-invalid-format-error', {line: (header ? result.rows.length + 2: result.rows.length + 1)}));
|
||||
return -1;
|
||||
}
|
||||
for (let i = 0; i < rowitems.length; i++) {
|
||||
|
||||
@ -20,9 +20,9 @@
|
||||
<thead md-head>
|
||||
<tr md-row>
|
||||
<th md-column> </th>
|
||||
<th md-column>Example value data</th>
|
||||
<th md-column>Column type</th>
|
||||
<th md-column>Name attributes/telemetry</th>
|
||||
<th md-column>{{ 'import.column-example' | translate }}</th>
|
||||
<th md-column>{{ 'import.column-type.column-type' | translate }}</th>
|
||||
<th md-column>{{ 'import.column-key' | translate }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody md-body>
|
||||
@ -31,7 +31,7 @@
|
||||
<td md-cell>{{column.sampleData}}</td>
|
||||
<td md-cell>
|
||||
<md-select ng-model="column.type" required name="columnType"
|
||||
aria-label="{{ 'entity-group.column-type' | translate }}">
|
||||
aria-label="{{ 'import.column-type.column-type' | translate }}">
|
||||
<md-option ng-repeat="type in vm.columnTypes" ng-value="type.value" ng-disabled="type.disable">
|
||||
{{type.name | translate}}
|
||||
</md-option>
|
||||
@ -43,9 +43,9 @@
|
||||
column.type != vm.columnTypes.type.value &&
|
||||
column.type != vm.columnTypes.accessToken.value">
|
||||
<input required name="columnKeyName"
|
||||
placeholder="{{ 'entity-group.column-value' | translate }}"
|
||||
placeholder="{{ 'import.column-value' | translate }}"
|
||||
ng-model="column.key"
|
||||
aria-label="{{ 'entity-group.column-value' | translate }}">
|
||||
aria-label="{{ 'import.column-value' | translate }}">
|
||||
</md-input-container>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -48,7 +48,8 @@
|
||||
"paste-reference": "Paste reference",
|
||||
"import": "Import",
|
||||
"export": "Export",
|
||||
"share-via": "Share via {{provider}}"
|
||||
"share-via": "Share via {{provider}}",
|
||||
"continue": "Continue"
|
||||
},
|
||||
"aggregation": {
|
||||
"aggregation": "Aggregation",
|
||||
@ -778,27 +779,7 @@
|
||||
"details": "Entity details",
|
||||
"no-entities-prompt": "No entities found",
|
||||
"no-data": "No data to display",
|
||||
"columns-to-display": "Columns to Display",
|
||||
"import-csv-number-columns-error": "A file should contain at least two columns",
|
||||
"import-csv-invalid-format-error": "Invalid file format. Line: '{{line}}'"
|
||||
},
|
||||
"entity-group": {
|
||||
"column-value": "Value",
|
||||
"column-title": "Title",
|
||||
"column-type": {
|
||||
"column-type": "Column type",
|
||||
"client-attribute": "Client attribute",
|
||||
"shared-attribute": "Shared attribute",
|
||||
"server-attribute": "Server attribute",
|
||||
"timeseries": "Timeseries",
|
||||
"entity-field": "Entity field",
|
||||
"access-token": "Access token"
|
||||
},
|
||||
"entity-field": {
|
||||
"name": "Name",
|
||||
"type": "Type",
|
||||
"assigned_customer": "Assigned Customer"
|
||||
}
|
||||
"columns-to-display": "Columns to Display"
|
||||
},
|
||||
"entity-view": {
|
||||
"entity-view": "Entity View",
|
||||
@ -1118,7 +1099,39 @@
|
||||
"import": {
|
||||
"no-file": "No file selected",
|
||||
"drop-file": "Drop a JSON file or click to select a file to upload.",
|
||||
"drop-file-csv": "Drop a CSV file or click to select a file to upload."
|
||||
"drop-file-csv": "Drop a CSV file or click to select a file to upload.",
|
||||
"column-value": "Value",
|
||||
"column-title": "Title",
|
||||
"column-example": "Example value data",
|
||||
"column-key": "Attribute/telemetry key",
|
||||
"csv-delimiter": "CSV delimiter",
|
||||
"csv-first-line-header": "First line contains column names",
|
||||
"csv-update-data": "Update attributes/telemetry",
|
||||
"import-csv-number-columns-error": "A file should contain at least two columns",
|
||||
"import-csv-invalid-format-error": "Invalid file format. Line: '{{line}}'",
|
||||
"column-type": {
|
||||
"name": "Name",
|
||||
"type": "Type",
|
||||
"column-type": "Column type",
|
||||
"client-attribute": "Client attribute",
|
||||
"shared-attribute": "Shared attribute",
|
||||
"server-attribute": "Server attribute",
|
||||
"timeseries": "Timeseries",
|
||||
"entity-field": "Entity field",
|
||||
"access-token": "Access token"
|
||||
},
|
||||
"stepper-text":{
|
||||
"select-file": "Select a file",
|
||||
"configuration": "Import configuration",
|
||||
"column-type": "Select columns type",
|
||||
"creat-entities": "Creating new entities",
|
||||
"done": "Done"
|
||||
},
|
||||
"message": {
|
||||
"create-entities": "'{{count}}' new entities were successfully created.",
|
||||
"update-entities": "'{{count}}' entities were successfully updated.",
|
||||
"error-entities": "There was an error creating '{{count}}' entities."
|
||||
}
|
||||
},
|
||||
"item": {
|
||||
"selected": "Selected"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user