Showing
8 changed files
with
82 additions
and
55 deletions
... | ... | @@ -64,7 +64,7 @@ |
64 | 64 | "jstree-bootstrap-theme": "^1.0.1", |
65 | 65 | "leaflet": "^1.0.3", |
66 | 66 | "leaflet-providers": "^1.1.17", |
67 | - "material-steppers": "git://github.com/vvlladd28/material-steppers.git#master", | |
67 | + "material-steppers": "git://github.com/thingsboard/material-steppers.git#master", | |
68 | 68 | "material-ui": "^0.16.1", |
69 | 69 | "material-ui-number-input": "^5.0.16", |
70 | 70 | "md-color-picker": "0.2.6", | ... | ... |
... | ... | @@ -1159,7 +1159,7 @@ function EntityService($http, $q, $filter, $translate, $log, userService, device |
1159 | 1159 | break; |
1160 | 1160 | } |
1161 | 1161 | findIdEntity.then(function success(response) { |
1162 | - saveEntityRelarion(response.id, entityType, entityParameters, config).then(function success() { | |
1162 | + saveEntityRelarion(entityType, response.id, entityParameters, config).then(function success() { | |
1163 | 1163 | statisticalInfo.update = { |
1164 | 1164 | entity: 1 |
1165 | 1165 | }; | ... | ... |
... | ... | @@ -96,6 +96,7 @@ export default angular.module('thingsboard.help', []) |
96 | 96 | assets: helpBaseUrl + "/docs/user-guide/ui/assets", |
97 | 97 | devices: helpBaseUrl + "/docs/user-guide/ui/devices", |
98 | 98 | entityViews: helpBaseUrl + "/docs/user-guide/ui/entity-views", |
99 | + entitiesImport: helpBaseUrl + "/docs/user-guide/bulk-provisioning", | |
99 | 100 | dashboards: helpBaseUrl + "/docs/user-guide/ui/dashboards", |
100 | 101 | users: helpBaseUrl + "/docs/user-guide/ui/users", |
101 | 102 | widgetsBundles: helpBaseUrl + "/docs/user-guide/ui/widget-library#bundles", | ... | ... |
... | ... | @@ -16,7 +16,7 @@ |
16 | 16 | import './import-dialog.scss'; |
17 | 17 | |
18 | 18 | /*@ngInject*/ |
19 | -export default function ImportDialogCsvController($scope, $mdDialog, toast, importTitle, importFileLabel, entityType, importExport, types, $mdStepper) { | |
19 | +export default function ImportDialogCsvController($scope, $mdDialog, toast, importTitle, importFileLabel, entityType, importExport, types, $mdStepper, $timeout) { | |
20 | 20 | |
21 | 21 | var vm = this; |
22 | 22 | |
... | ... | @@ -40,6 +40,7 @@ export default function ImportDialogCsvController($scope, $mdDialog, toast, impo |
40 | 40 | vm.isLinear = true; |
41 | 41 | vm.isAlternative = false; |
42 | 42 | vm.isMobileStepText = true; |
43 | + vm.isImportData = false; | |
43 | 44 | |
44 | 45 | vm.parseData = []; |
45 | 46 | |
... | ... | @@ -171,6 +172,7 @@ export default function ImportDialogCsvController($scope, $mdDialog, toast, impo |
171 | 172 | }); |
172 | 173 | importExport.createMultiEntity(entitiesData, vm.entityType, vm.importParameters.isUpdate, config).then(function (response) { |
173 | 174 | vm.statistical = response; |
175 | + vm.isImportData = false; | |
174 | 176 | $mdStepper('import-stepper').next(); |
175 | 177 | }); |
176 | 178 | } |
... | ... | @@ -186,7 +188,9 @@ export default function ImportDialogCsvController($scope, $mdDialog, toast, impo |
186 | 188 | switch (step) { |
187 | 189 | case 1: |
188 | 190 | steppers.back(); |
189 | - vm.theFormStep1.$setDirty(); | |
191 | + $timeout(function () { | |
192 | + vm.theFormStep1.$setDirty(); | |
193 | + }); | |
190 | 194 | break; |
191 | 195 | default: |
192 | 196 | steppers.back(); |
... | ... | @@ -203,8 +207,10 @@ export default function ImportDialogCsvController($scope, $mdDialog, toast, impo |
203 | 207 | case 3: |
204 | 208 | parseData = parseCSV(vm.importData); |
205 | 209 | if (parseData === -1) { |
206 | - clearFile(); | |
207 | 210 | steppers.back(); |
211 | + $timeout(function () { | |
212 | + clearFile(); | |
213 | + }); | |
208 | 214 | } else { |
209 | 215 | createColumnsData(parseData); |
210 | 216 | steppers.next(); |
... | ... | @@ -212,6 +218,7 @@ export default function ImportDialogCsvController($scope, $mdDialog, toast, impo |
212 | 218 | break; |
213 | 219 | case 4: |
214 | 220 | steppers.next(); |
221 | + vm.isImportData = true; | |
215 | 222 | addEntities(parseData, vm.columnsParam); |
216 | 223 | break; |
217 | 224 | case 6: | ... | ... |
... | ... | @@ -15,13 +15,14 @@ |
15 | 15 | limitations under the License. |
16 | 16 | |
17 | 17 | --> |
18 | -<md-dialog aria-label="{{ vm.importTitle | translate }}" class="tb-import-stepper" tb-help="'import-csv'" help-container-id="help-container"> | |
18 | +<md-dialog aria-label="{{ vm.importTitle | translate }}" class="tb-import-stepper" tb-help="'entitiesImport'" | |
19 | + help-container-id="help-container"> | |
19 | 20 | <md-toolbar> |
20 | 21 | <div class="md-toolbar-tools"> |
21 | 22 | <h2 translate>{{ vm.importTitle }}</h2> |
22 | 23 | <span flex></span> |
23 | 24 | <div id="help-container"></div> |
24 | - <md-button class="md-icon-button" ng-click="vm.cancel()"> | |
25 | + <md-button class="md-icon-button" ng-click="vm.cancel()" ng-disabled="vm.isImportData"> | |
25 | 26 | <ng-md-icon icon="close" aria-label="{{ 'dialog.close' | translate }}"></ng-md-icon> |
26 | 27 | </md-button> |
27 | 28 | </div> |
... | ... | @@ -31,7 +32,7 @@ |
31 | 32 | <md-dialog-content> |
32 | 33 | <md-stepper id="import-stepper" md-mobile-step-text="vm.isMobileStepText" md-vertical="vm.isVertical" |
33 | 34 | md-linear="vm.isLinear" md-alternative="vm.isAlternative"> |
34 | - <md-step md-label="Select a file"> | |
35 | + <md-step md-label="{{ 'import.stepper-text.select-file' | translate }}"> | |
35 | 36 | <md-step-body> |
36 | 37 | <form name="vm.theFormStep1"> |
37 | 38 | <fieldset ng-disabled="$root.loading"> |
... | ... | @@ -78,27 +79,28 @@ |
78 | 79 | <md-button class="md-primary md-raised" |
79 | 80 | ng-disabled="$root.loading || !vm.theFormStep1.$dirty || !vm.theFormStep1.$valid || !vm.importData" |
80 | 81 | ng-click="vm.nextStep(2);"> |
81 | - Continue | |
82 | + {{ 'action.continue' | translate }} | |
82 | 83 | </md-button> |
83 | 84 | </md-step-actions> |
84 | 85 | </md-step> |
85 | 86 | |
86 | - <md-step md-label="Import configuration"> | |
87 | + <md-step md-label="{{ 'import.stepper-text.configuration' | translate }}"> | |
87 | 88 | <md-step-body> |
88 | 89 | <div layout="column"> |
89 | 90 | <md-input-container> |
90 | - <label translate>CSV delimiter</label> | |
91 | + <label translate>import.csv-delimiter</label> | |
91 | 92 | <md-select ng-model="vm.importParameters.delim"> |
92 | 93 | <md-option ng-repeat="delimiter in vm.delimiters" ng-value="delimiter.key"> |
93 | 94 | {{delimiter.value}} |
94 | 95 | </md-option> |
95 | 96 | </md-select> |
96 | 97 | </md-input-container> |
97 | - <md-checkbox ng-model="vm.importParameters.isHeader" aria-label="First line contains column names"> | |
98 | - First line contains column names | |
98 | + <md-checkbox ng-model="vm.importParameters.isHeader" | |
99 | + aria-label="First line contains column names"> | |
100 | + {{ 'import.csv-first-line-header' | translate }} | |
99 | 101 | </md-checkbox> |
100 | 102 | <md-checkbox ng-model="vm.importParameters.isUpdate" aria-label="Update attributes/telemetry"> |
101 | - Update attributes/telemetry | |
103 | + {{ 'import.csv-update-data' | translate }} | |
102 | 104 | </md-checkbox> |
103 | 105 | </div> |
104 | 106 | </md-step-body> |
... | ... | @@ -111,12 +113,12 @@ |
111 | 113 | {{ 'action.cancel' | translate }} |
112 | 114 | </md-button> |
113 | 115 | <md-button class="md-primary md-raised" ng-disabled="$root.loading" ng-click="vm.nextStep(3);"> |
114 | - Continue | |
116 | + {{ 'action.continue' | translate }} | |
115 | 117 | </md-button> |
116 | 118 | </md-step-actions> |
117 | 119 | </md-step> |
118 | 120 | |
119 | - <md-step md-label="Select columns type"> | |
121 | + <md-step md-label="{{ 'import.stepper-text.column-type' | translate }}"> | |
120 | 122 | <md-step-body> |
121 | 123 | <form name="vm.theFormStep3"> |
122 | 124 | <tb-table-columns-assignment columns="vm.columnsParam" the-form="vm.theFormStep3" |
... | ... | @@ -134,28 +136,32 @@ |
134 | 136 | <md-button class="md-primary md-raised" |
135 | 137 | ng-disabled="$root.loading || !vm.theFormStep3.$dirty || !vm.theFormStep3.$valid" |
136 | 138 | ng-click="vm.nextStep(4);"> |
137 | - Continue | |
139 | + {{ 'action.continue' | translate }} | |
138 | 140 | </md-button> |
139 | 141 | </md-step-actions> |
140 | 142 | </md-step> |
141 | 143 | |
142 | - <md-step md-label="Creating new entities"> | |
144 | + <md-step md-label="{{ 'import.stepper-text.creat-entities' | translate }}"> | |
143 | 145 | <md-step-body> |
144 | - <md-progress-linear class="md-warn tb-import-progress" md-mode="determinate" value="{{vm.progressCreate}}"></md-progress-linear> | |
146 | + <md-progress-linear class="md-warn tb-import-progress" md-mode="determinate" | |
147 | + value="{{vm.progressCreate}}"></md-progress-linear> | |
145 | 148 | </md-step-body> |
146 | 149 | </md-step> |
147 | - <md-step md-label="Done"> | |
150 | + <md-step md-label="{{ 'import.stepper-text.done' | translate }}"> | |
148 | 151 | <md-step-body layout="column"> |
149 | 152 | <div> |
150 | - <p class="md-body-1" ng-if="vm.statistical.create && vm.statistical.create.entity">{{vm.statistical.create.entity}} new entities were successfully created.</p> | |
151 | - <p class="md-body-1" ng-if="vm.statistical.update && vm.statistical.update.entity">{{vm.statistical.update.entity}} entities were successfully updated.</p> | |
152 | - <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> | |
153 | + <p class="md-body-1" translate translate-values="{count: vm.statistical.create.entity}" | |
154 | + ng-if="vm.statistical.create && vm.statistical.create.entity">import.message.create-entities</p> | |
155 | + <p class="md-body-1" translate translate-values="{count: vm.statistical.update.entity}" | |
156 | + ng-if="vm.statistical.update && vm.statistical.update.entity">import.message.update-entities</p> | |
157 | + <p class="md-body-1" translate translate-values="{count: vm.statistical.error.entity}" | |
158 | + ng-if="vm.statistical.error && vm.statistical.error.entity">import.message.error-entities</p> | |
153 | 159 | </div> |
154 | 160 | </md-step-body> |
155 | 161 | <md-step-actions layout="row"> |
156 | 162 | <span flex></span> |
157 | 163 | <md-button class="md-primary md-raised" ng-disabled="$root.loading" ng-click="vm.nextStep(6);"> |
158 | - Ok | |
164 | + {{ 'action.ok' | translate }} | |
159 | 165 | </md-button> |
160 | 166 | </md-step-actions> |
161 | 167 | </md-step> | ... | ... |
... | ... | @@ -802,7 +802,7 @@ export default function ImportExport($log, $translate, $q, $mdDialog, $document, |
802 | 802 | let csvlines = csvdata.split(/[\r\n]+/); |
803 | 803 | let csvheaders = splitCSV(csvlines[0], delim); |
804 | 804 | if (csvheaders.length < 2) { |
805 | - toast.showError($translate.instant('entity.import-csv-number-columns-error')); | |
805 | + toast.showError($translate.instant('import.import-csv-number-columns-error')); | |
806 | 806 | return -1; |
807 | 807 | } |
808 | 808 | let csvrows = header ? csvlines.slice(1, csvlines.length) : csvlines; |
... | ... | @@ -819,7 +819,7 @@ export default function ImportExport($log, $translate, $q, $mdDialog, $document, |
819 | 819 | |
820 | 820 | let rowitems = splitCSV(row, delim); |
821 | 821 | if (rowitems.length !== result.headers.length) { |
822 | - toast.showError($translate.instant('entity.import-csv-invalid-format-error', {line: (header ? result.rows.length + 2: result.rows.length + 1)})); | |
822 | + toast.showError($translate.instant('import.import-csv-invalid-format-error', {line: (header ? result.rows.length + 2: result.rows.length + 1)})); | |
823 | 823 | return -1; |
824 | 824 | } |
825 | 825 | for (let i = 0; i < rowitems.length; i++) { | ... | ... |
... | ... | @@ -20,9 +20,9 @@ |
20 | 20 | <thead md-head> |
21 | 21 | <tr md-row> |
22 | 22 | <th md-column> </th> |
23 | - <th md-column>Example value data</th> | |
24 | - <th md-column>Column type</th> | |
25 | - <th md-column>Name attributes/telemetry</th> | |
23 | + <th md-column>{{ 'import.column-example' | translate }}</th> | |
24 | + <th md-column>{{ 'import.column-type.column-type' | translate }}</th> | |
25 | + <th md-column>{{ 'import.column-key' | translate }}</th> | |
26 | 26 | </tr> |
27 | 27 | </thead> |
28 | 28 | <tbody md-body> |
... | ... | @@ -31,7 +31,7 @@ |
31 | 31 | <td md-cell>{{column.sampleData}}</td> |
32 | 32 | <td md-cell> |
33 | 33 | <md-select ng-model="column.type" required name="columnType" |
34 | - aria-label="{{ 'entity-group.column-type' | translate }}"> | |
34 | + aria-label="{{ 'import.column-type.column-type' | translate }}"> | |
35 | 35 | <md-option ng-repeat="type in vm.columnTypes" ng-value="type.value" ng-disabled="type.disable"> |
36 | 36 | {{type.name | translate}} |
37 | 37 | </md-option> |
... | ... | @@ -43,9 +43,9 @@ |
43 | 43 | column.type != vm.columnTypes.type.value && |
44 | 44 | column.type != vm.columnTypes.accessToken.value"> |
45 | 45 | <input required name="columnKeyName" |
46 | - placeholder="{{ 'entity-group.column-value' | translate }}" | |
46 | + placeholder="{{ 'import.column-value' | translate }}" | |
47 | 47 | ng-model="column.key" |
48 | - aria-label="{{ 'entity-group.column-value' | translate }}"> | |
48 | + aria-label="{{ 'import.column-value' | translate }}"> | |
49 | 49 | </md-input-container> |
50 | 50 | </td> |
51 | 51 | </tr> | ... | ... |
... | ... | @@ -48,7 +48,8 @@ |
48 | 48 | "paste-reference": "Paste reference", |
49 | 49 | "import": "Import", |
50 | 50 | "export": "Export", |
51 | - "share-via": "Share via {{provider}}" | |
51 | + "share-via": "Share via {{provider}}", | |
52 | + "continue": "Continue" | |
52 | 53 | }, |
53 | 54 | "aggregation": { |
54 | 55 | "aggregation": "Aggregation", |
... | ... | @@ -778,27 +779,7 @@ |
778 | 779 | "details": "Entity details", |
779 | 780 | "no-entities-prompt": "No entities found", |
780 | 781 | "no-data": "No data to display", |
781 | - "columns-to-display": "Columns to Display", | |
782 | - "import-csv-number-columns-error": "A file should contain at least two columns", | |
783 | - "import-csv-invalid-format-error": "Invalid file format. Line: '{{line}}'" | |
784 | - }, | |
785 | - "entity-group": { | |
786 | - "column-value": "Value", | |
787 | - "column-title": "Title", | |
788 | - "column-type": { | |
789 | - "column-type": "Column type", | |
790 | - "client-attribute": "Client attribute", | |
791 | - "shared-attribute": "Shared attribute", | |
792 | - "server-attribute": "Server attribute", | |
793 | - "timeseries": "Timeseries", | |
794 | - "entity-field": "Entity field", | |
795 | - "access-token": "Access token" | |
796 | - }, | |
797 | - "entity-field": { | |
798 | - "name": "Name", | |
799 | - "type": "Type", | |
800 | - "assigned_customer": "Assigned Customer" | |
801 | - } | |
782 | + "columns-to-display": "Columns to Display" | |
802 | 783 | }, |
803 | 784 | "entity-view": { |
804 | 785 | "entity-view": "Entity View", |
... | ... | @@ -1118,7 +1099,39 @@ |
1118 | 1099 | "import": { |
1119 | 1100 | "no-file": "No file selected", |
1120 | 1101 | "drop-file": "Drop a JSON file or click to select a file to upload.", |
1121 | - "drop-file-csv": "Drop a CSV file or click to select a file to upload." | |
1102 | + "drop-file-csv": "Drop a CSV file or click to select a file to upload.", | |
1103 | + "column-value": "Value", | |
1104 | + "column-title": "Title", | |
1105 | + "column-example": "Example value data", | |
1106 | + "column-key": "Attribute/telemetry key", | |
1107 | + "csv-delimiter": "CSV delimiter", | |
1108 | + "csv-first-line-header": "First line contains column names", | |
1109 | + "csv-update-data": "Update attributes/telemetry", | |
1110 | + "import-csv-number-columns-error": "A file should contain at least two columns", | |
1111 | + "import-csv-invalid-format-error": "Invalid file format. Line: '{{line}}'", | |
1112 | + "column-type": { | |
1113 | + "name": "Name", | |
1114 | + "type": "Type", | |
1115 | + "column-type": "Column type", | |
1116 | + "client-attribute": "Client attribute", | |
1117 | + "shared-attribute": "Shared attribute", | |
1118 | + "server-attribute": "Server attribute", | |
1119 | + "timeseries": "Timeseries", | |
1120 | + "entity-field": "Entity field", | |
1121 | + "access-token": "Access token" | |
1122 | + }, | |
1123 | + "stepper-text":{ | |
1124 | + "select-file": "Select a file", | |
1125 | + "configuration": "Import configuration", | |
1126 | + "column-type": "Select columns type", | |
1127 | + "creat-entities": "Creating new entities", | |
1128 | + "done": "Done" | |
1129 | + }, | |
1130 | + "message": { | |
1131 | + "create-entities": "'{{count}}' new entities were successfully created.", | |
1132 | + "update-entities": "'{{count}}' entities were successfully updated.", | |
1133 | + "error-entities": "There was an error creating '{{count}}' entities." | |
1134 | + } | |
1122 | 1135 | }, |
1123 | 1136 | "item": { |
1124 | 1137 | "selected": "Selected" | ... | ... |