Showing
5 changed files
with
246 additions
and
177 deletions
@@ -64,6 +64,7 @@ | @@ -64,6 +64,7 @@ | ||
64 | "jstree-bootstrap-theme": "^1.0.1", | 64 | "jstree-bootstrap-theme": "^1.0.1", |
65 | "leaflet": "^1.0.3", | 65 | "leaflet": "^1.0.3", |
66 | "leaflet-providers": "^1.1.17", | 66 | "leaflet-providers": "^1.1.17", |
67 | + "material-steppers": "^2.0.0", | ||
67 | "material-ui": "^0.16.1", | 68 | "material-ui": "^0.16.1", |
68 | "material-ui-number-input": "^5.0.16", | 69 | "material-ui-number-input": "^5.0.16", |
69 | "md-color-picker": "0.2.6", | 70 | "md-color-picker": "0.2.6", |
@@ -179,15 +179,15 @@ function DeviceService($http, $q, $window, userService, attributeService, custom | @@ -179,15 +179,15 @@ function DeviceService($http, $q, $window, userService, attributeService, custom | ||
179 | let promise = ""; | 179 | let promise = ""; |
180 | let statisticalInfo = {}; | 180 | let statisticalInfo = {}; |
181 | for (let i = 0; i < attributesType.length; i++) { | 181 | for (let i = 0; i < attributesType.length; i++) { |
182 | - let attrribute = attributesType[i]; | ||
183 | - if (deviceRelation.attributes[attrribute] && deviceRelation.attributes[attrribute].length !== 0) { | ||
184 | - promise = attributeService.saveEntityAttributes(types.entityType.device, deviceId, types.attributesScope[attrribute].value, deviceRelation.attributes[attrribute], config).then(function () { | 182 | + let attribute = attributesType[i]; |
183 | + if (deviceRelation.attributes[attribute] && deviceRelation.attributes[attribute].length !== 0) { | ||
184 | + promise = attributeService.saveEntityAttributes(types.entityType.device, deviceId, types.attributesScope[attribute].value, deviceRelation.attributes[attribute], config).then(function () { | ||
185 | statisticalInfo.create = { | 185 | statisticalInfo.create = { |
186 | - [attrribute]: deviceRelation.attributes[attributesType[i]].length | 186 | + [attribute]: deviceRelation.attributes[attribute].length |
187 | }; | 187 | }; |
188 | }, function () { | 188 | }, function () { |
189 | statisticalInfo.error = { | 189 | statisticalInfo.error = { |
190 | - [attrribute]: deviceRelation.attributes[attributesType[i]].length | 190 | + [attribute]: deviceRelation.attributes[attribute].length |
191 | }; | 191 | }; |
192 | }); | 192 | }); |
193 | allPromise.push(promise); | 193 | allPromise.push(promise); |
@@ -234,7 +234,9 @@ function DeviceService($http, $q, $window, userService, attributeService, custom | @@ -234,7 +234,9 @@ function DeviceService($http, $q, $window, userService, attributeService, custom | ||
234 | device: 1 | 234 | device: 1 |
235 | }; | 235 | }; |
236 | saveDeviceRelarion(response.id.id, deviceParameters, config).then(function success(response) { | 236 | saveDeviceRelarion(response.id.id, deviceParameters, config).then(function success(response) { |
237 | - delete Object.assign(response, {update: response.create}).create; | 237 | + if(response.create) { |
238 | + delete Object.assign(response, {update: response.create}).create; | ||
239 | + } | ||
238 | angular.merge(statisticalInfo, response); | 240 | angular.merge(statisticalInfo, response); |
239 | deferred.resolve(statisticalInfo); | 241 | deferred.resolve(statisticalInfo); |
240 | }); | 242 | }); |
@@ -54,6 +54,8 @@ import react from 'ngreact'; | @@ -54,6 +54,8 @@ import react from 'ngreact'; | ||
54 | import '@flowjs/ng-flow/dist/ng-flow-standalone.min'; | 54 | import '@flowjs/ng-flow/dist/ng-flow-standalone.min'; |
55 | import 'ngFlowchart/dist/ngFlowchart'; | 55 | import 'ngFlowchart/dist/ngFlowchart'; |
56 | import 'jstree/dist/jstree.min'; | 56 | import 'jstree/dist/jstree.min'; |
57 | +import 'material-steppers/dist/material-steppers'; | ||
58 | +import 'material-steppers/dist/material-steppers.css' | ||
57 | import 'jstree-bootstrap-theme/dist/themes/proton/style.min.css'; | 59 | import 'jstree-bootstrap-theme/dist/themes/proton/style.min.css'; |
58 | import 'typeface-roboto'; | 60 | import 'typeface-roboto'; |
59 | import 'font-awesome/css/font-awesome.min.css'; | 61 | import 'font-awesome/css/font-awesome.min.css'; |
@@ -127,6 +129,7 @@ angular.module('thingsboard', [ | @@ -127,6 +129,7 @@ angular.module('thingsboard', [ | ||
127 | react.name, | 129 | react.name, |
128 | 'flow', | 130 | 'flow', |
129 | 'flowchart', | 131 | 'flowchart', |
132 | + 'mdSteppers', | ||
130 | thingsboardThirdpartyFix, | 133 | thingsboardThirdpartyFix, |
131 | thingsboardTranslateHandler, | 134 | thingsboardTranslateHandler, |
132 | thingsboardLogin, | 135 | thingsboardLogin, |
@@ -16,14 +16,16 @@ | @@ -16,14 +16,16 @@ | ||
16 | import './import-dialog.scss'; | 16 | import './import-dialog.scss'; |
17 | 17 | ||
18 | /*@ngInject*/ | 18 | /*@ngInject*/ |
19 | -export default function ImportDialogCsvController($scope, $mdDialog, toast, importTitle, importFileLabel, entityType, importExport, types, $timeout, $q) { | 19 | +export default function ImportDialogCsvController($scope, $mdDialog, toast, importTitle, importFileLabel, entityType, importExport, types, $mdStepper) { |
20 | 20 | ||
21 | var vm = this; | 21 | var vm = this; |
22 | 22 | ||
23 | vm.cancel = cancel; | 23 | vm.cancel = cancel; |
24 | - vm.importFromJson = importFromJson; | 24 | + vm.finishExport = finishExport; |
25 | vm.fileAdded = fileAdded; | 25 | vm.fileAdded = fileAdded; |
26 | vm.clearFile = clearFile; | 26 | vm.clearFile = clearFile; |
27 | + vm.nextStep = nextStep; | ||
28 | + vm.previousStep = previousStep; | ||
27 | 29 | ||
28 | vm.addDevices = addDevices; | 30 | vm.addDevices = addDevices; |
29 | vm.importParams = { | 31 | vm.importParams = { |
@@ -32,69 +34,28 @@ export default function ImportDialogCsvController($scope, $mdDialog, toast, impo | @@ -32,69 +34,28 @@ export default function ImportDialogCsvController($scope, $mdDialog, toast, impo | ||
32 | isHeader: true | 34 | isHeader: true |
33 | }; | 35 | }; |
34 | 36 | ||
35 | - vm.selectedStep = 0; | ||
36 | - vm.stepProgress = 1; | ||
37 | - vm.maxStep = 3; | ||
38 | - vm.showBusyText = false; | ||
39 | - vm.stepData = [ | ||
40 | - { step: 1, completed: false, optional: false, data: {} }, | ||
41 | - { step: 2, completed: false, optional: false, data: {} }, | ||
42 | - { step: 3, completed: false, optional: false, data: {} }, | ||
43 | - ]; | ||
44 | - | ||
45 | - vm.enableNextStep = function nextStep() { | ||
46 | - //do not exceed into max step | ||
47 | - if (vm.selectedStep >= vm.maxStep) { | ||
48 | - return; | ||
49 | - } | ||
50 | - //do not increment vm.stepProgress when submitting from previously completed step | ||
51 | - if (vm.selectedStep === vm.stepProgress - 1) { | ||
52 | - vm.stepProgress = vm.stepProgress + 1; | ||
53 | - } | ||
54 | - vm.selectedStep = vm.selectedStep + 1; | ||
55 | - }; | ||
56 | - | ||
57 | - vm.moveToPreviousStep = function moveToPreviousStep() { | ||
58 | - if (vm.selectedStep > 0) { | ||
59 | - vm.selectedStep = vm.selectedStep - 1; | ||
60 | - } | ||
61 | - }; | ||
62 | - | ||
63 | - vm.submitCurrentStep = function submitCurrentStep(stepData, isSkip) { | ||
64 | - var deferred = $q.defer(); | ||
65 | - vm.showBusyText = true; | ||
66 | - if (!stepData.completed && !isSkip) { | ||
67 | - //simulate $http | ||
68 | - $timeout(function () { | ||
69 | - vm.showBusyText = false; | ||
70 | - deferred.resolve({ status: 200, statusText: 'success', data: {} }); | ||
71 | - //move to next step when success | ||
72 | - stepData.completed = true; | ||
73 | - vm.enableNextStep(); | ||
74 | - }, 1000) | ||
75 | - } else { | ||
76 | - vm.showBusyText = false; | ||
77 | - vm.enableNextStep(); | ||
78 | - } | ||
79 | - }; | ||
80 | - | ||
81 | vm.importTitle = importTitle; | 37 | vm.importTitle = importTitle; |
82 | vm.importFileLabel = importFileLabel; | 38 | vm.importFileLabel = importFileLabel; |
83 | vm.entityType = entityType; | 39 | vm.entityType = entityType; |
84 | 40 | ||
41 | + vm.isVertical = true; | ||
42 | + vm.isLinear = true; | ||
43 | + vm.isAlternative = false; | ||
44 | + vm.isMobileStepText = true; | ||
45 | + | ||
85 | vm.columnsParam = []; | 46 | vm.columnsParam = []; |
86 | vm.parseData = []; | 47 | vm.parseData = []; |
87 | 48 | ||
88 | vm.delimiters = [{ | 49 | vm.delimiters = [{ |
89 | key: ',', | 50 | key: ',', |
90 | value: ',' | 51 | value: ',' |
91 | - },{ | 52 | + }, { |
92 | key: ';', | 53 | key: ';', |
93 | value: ';' | 54 | value: ';' |
94 | - },{ | 55 | + }, { |
95 | key: '|', | 56 | key: '|', |
96 | value: '|' | 57 | value: '|' |
97 | - },{ | 58 | + }, { |
98 | key: '\t', | 59 | key: '\t', |
99 | value: 'Tab' | 60 | value: 'Tab' |
100 | }]; | 61 | }]; |
@@ -107,11 +68,11 @@ export default function ImportDialogCsvController($scope, $mdDialog, toast, impo | @@ -107,11 +68,11 @@ export default function ImportDialogCsvController($scope, $mdDialog, toast, impo | ||
107 | reader.onload = function (event) { | 68 | reader.onload = function (event) { |
108 | $scope.$apply(function () { | 69 | $scope.$apply(function () { |
109 | if (event.target.result) { | 70 | if (event.target.result) { |
110 | - $scope.theForm.$setDirty(); | 71 | + vm.theFormStep1.$setDirty(); |
111 | var importCSV = event.target.result; | 72 | var importCSV = event.target.result; |
112 | if (importCSV && importCSV.length > 0) { | 73 | if (importCSV && importCSV.length > 0) { |
113 | try { | 74 | try { |
114 | - parseCSV(importCSV); | 75 | + vm.importData = importCSV; |
115 | vm.fileName = $file.name; | 76 | vm.fileName = $file.name; |
116 | } catch (err) { | 77 | } catch (err) { |
117 | vm.fileName = null; | 78 | vm.fileName = null; |
@@ -126,12 +87,15 @@ export default function ImportDialogCsvController($scope, $mdDialog, toast, impo | @@ -126,12 +87,15 @@ export default function ImportDialogCsvController($scope, $mdDialog, toast, impo | ||
126 | } | 87 | } |
127 | 88 | ||
128 | function parseCSV(importData) { | 89 | function parseCSV(importData) { |
129 | - var columnParam = {}; | ||
130 | var config = { | 90 | var config = { |
131 | delim: vm.importParams.delim, | 91 | delim: vm.importParams.delim, |
132 | header: vm.importParams.isHeader | 92 | header: vm.importParams.isHeader |
133 | }; | 93 | }; |
134 | - parseData = importExport.convertCSVToJson(importData, config); | 94 | + return importExport.convertCSVToJson(importData, config); |
95 | + } | ||
96 | + | ||
97 | + function createColumnsData(parseData) { | ||
98 | + var columnParam = {}; | ||
135 | for (var i = 0; i < parseData.headers.length; i++) { | 99 | for (var i = 0; i < parseData.headers.length; i++) { |
136 | if (vm.importParams.isHeader && parseData.headers[i].search(/^(name|type)$/im) === 0) { | 100 | if (vm.importParams.isHeader && parseData.headers[i].search(/^(name|type)$/im) === 0) { |
137 | columnParam = { | 101 | columnParam = { |
@@ -150,24 +114,14 @@ export default function ImportDialogCsvController($scope, $mdDialog, toast, impo | @@ -150,24 +114,14 @@ export default function ImportDialogCsvController($scope, $mdDialog, toast, impo | ||
150 | } | 114 | } |
151 | } | 115 | } |
152 | 116 | ||
153 | - function addDevices () { | ||
154 | - var arrayParam = [{type: "ENTITY_FIELD", key: "name", sampleData: "Device 1"}, {type: "ENTITY_FIELD", key: "type", sampleData: "test"}, {type: "SERVER_ATTRIBUTE", key: "test", sampleData: "test"}, {type: "TIMESERIES", key: "testBoolean", sampleData: false}, {type: "SHARED_ATTRIBUTE", key: "testNumber", sampleData: 123}]; // eslint-disable-line | ||
155 | - var data = {headers: ["Device 1", "test", "test", "FALSE", "123"], | ||
156 | - rows:[["Device 1", "test", "test", false, 123.5]]}; | ||
157 | - // rows:[["Device 1", "test", "test", false, 123], | ||
158 | - // ["Device 2", "test", "test", false, 124], | ||
159 | - // ["Device 3", "test", "test", false, 125], | ||
160 | - // ["Device 4", "test", "test", false, 126], | ||
161 | - // ["Device 5", "test", "test", false, 127]]}; | ||
162 | - arrayParam = vm.columnsParam; | ||
163 | - data = parseData; | ||
164 | - var arrayData = []; | 117 | + function addDevices(importData, parameterColumns) { |
118 | + var entitysData = []; | ||
165 | var config = { | 119 | var config = { |
166 | ignoreErrors: true, | 120 | ignoreErrors: true, |
167 | resendRequest: true | 121 | resendRequest: true |
168 | }; | 122 | }; |
169 | - for (var i = 0; i < data.rows.length; i ++) { | ||
170 | - var obj = { | 123 | + for (var i = 0; i < importData.rows.length; i++) { |
124 | + var entityData = { | ||
171 | name: "", | 125 | name: "", |
172 | type: "", | 126 | type: "", |
173 | attributes: { | 127 | attributes: { |
@@ -176,58 +130,86 @@ export default function ImportDialogCsvController($scope, $mdDialog, toast, impo | @@ -176,58 +130,86 @@ export default function ImportDialogCsvController($scope, $mdDialog, toast, impo | ||
176 | }, | 130 | }, |
177 | timeseries: [] | 131 | timeseries: [] |
178 | }; | 132 | }; |
179 | - for(var j = 0; j < arrayParam.length; j++){ | ||
180 | - switch (arrayParam[j].type) { | 133 | + for (var j = 0; j < parameterColumns.length; j++) { |
134 | + switch (parameterColumns[j].type) { | ||
181 | case types.entityGroup.columnType.serverAttribute.value: | 135 | case types.entityGroup.columnType.serverAttribute.value: |
182 | - obj.attributes.server.push({ | ||
183 | - key: arrayParam[j].key, | ||
184 | - value: data.rows[i][j] | 136 | + entityData.attributes.server.push({ |
137 | + key: parameterColumns[j].key, | ||
138 | + value: importData.rows[i][j] | ||
185 | }); | 139 | }); |
186 | break; | 140 | break; |
187 | case types.entityGroup.columnType.sharedAttribute.value: | 141 | case types.entityGroup.columnType.sharedAttribute.value: |
188 | - obj.attributes.shared.push({ | ||
189 | - key: arrayParam[j].key, | ||
190 | - value: data.rows[i][j] | 142 | + entityData.attributes.shared.push({ |
143 | + key: parameterColumns[j].key, | ||
144 | + value: importData.rows[i][j] | ||
191 | }); | 145 | }); |
192 | break; | 146 | break; |
193 | case types.entityGroup.columnType.timeseries.value: | 147 | case types.entityGroup.columnType.timeseries.value: |
194 | - obj.timeseries.push({ | ||
195 | - key: arrayParam[j].key, | ||
196 | - value: data.rows[i][j] | 148 | + entityData.timeseries.push({ |
149 | + key: parameterColumns[j].key, | ||
150 | + value: importData.rows[i][j] | ||
197 | }); | 151 | }); |
198 | break; | 152 | break; |
199 | case types.entityGroup.columnType.entityField.value: | 153 | case types.entityGroup.columnType.entityField.value: |
200 | - switch (arrayParam[j].key) { | 154 | + switch (parameterColumns[j].key) { |
201 | case types.entityGroup.entityField.name.value: | 155 | case types.entityGroup.entityField.name.value: |
202 | - obj.name = data.rows[i][j]; | 156 | + entityData.name = importData.rows[i][j]; |
203 | break; | 157 | break; |
204 | case types.entityGroup.entityField.type.value: | 158 | case types.entityGroup.entityField.type.value: |
205 | - obj.type = data.rows[i][j]; | 159 | + entityData.type = importData.rows[i][j]; |
206 | break; | 160 | break; |
207 | } | 161 | } |
208 | break; | 162 | break; |
209 | } | 163 | } |
210 | } | 164 | } |
211 | - arrayData.push(obj); | 165 | + entitysData.push(entityData); |
212 | } | 166 | } |
213 | - importExport.createMultiEntity(arrayData, vm.entityType, vm.importParams.isUpdate, config).then(function () { | ||
214 | - $mdDialog.hide(); | 167 | + importExport.createMultiEntity(entitysData, vm.entityType, vm.importParams.isUpdate, config).then(function (response) { |
168 | + vm.statistical = response; | ||
169 | + $mdStepper('import-stepper').next(); | ||
215 | }); | 170 | }); |
216 | } | 171 | } |
217 | 172 | ||
218 | function clearFile() { | 173 | function clearFile() { |
219 | - $scope.theForm.$setDirty(); | 174 | + vm.theFormStep1.$setDirty(); |
220 | vm.fileName = null; | 175 | vm.fileName = null; |
221 | - parseData = null; | ||
222 | - vm.columnsParam = []; | 176 | + vm.importData = null; |
177 | + } | ||
178 | + | ||
179 | + function previousStep() { | ||
180 | + let steppers = $mdStepper('import-stepper'); | ||
181 | + steppers.back(); | ||
182 | + } | ||
183 | + | ||
184 | + function nextStep(step) { | ||
185 | + let steppers = $mdStepper('import-stepper'); | ||
186 | + switch (step) { | ||
187 | + case 2: | ||
188 | + steppers.next(); | ||
189 | + break; | ||
190 | + case 3: | ||
191 | + parseData = parseCSV(vm.importData); | ||
192 | + if (parseData === -1) { | ||
193 | + clearFile(); | ||
194 | + steppers.back(); | ||
195 | + } else { | ||
196 | + createColumnsData(parseData); | ||
197 | + steppers.next(); | ||
198 | + } | ||
199 | + break; | ||
200 | + case 4: | ||
201 | + steppers.next(); | ||
202 | + addDevices(parseData, vm.columnsParam) | ||
203 | + break; | ||
204 | + } | ||
205 | + | ||
223 | } | 206 | } |
224 | 207 | ||
225 | function cancel() { | 208 | function cancel() { |
226 | $mdDialog.cancel(); | 209 | $mdDialog.cancel(); |
227 | } | 210 | } |
228 | 211 | ||
229 | - function importFromJson() { | ||
230 | - $scope.theForm.$setPristine(); | ||
231 | - $mdDialog.hide(vm.importData); | 212 | + function finishExport() { |
213 | + $mdDialog.hide(); | ||
232 | } | 214 | } |
233 | } | 215 | } |
@@ -16,87 +16,168 @@ | @@ -16,87 +16,168 @@ | ||
16 | 16 | ||
17 | --> | 17 | --> |
18 | <md-dialog aria-label="{{ vm.importTitle | translate }}"> | 18 | <md-dialog aria-label="{{ vm.importTitle | translate }}"> |
19 | - <form name="theForm" ng-submit="vm.importFromJson()"> | ||
20 | - <md-toolbar> | ||
21 | - <div class="md-toolbar-tools"> | ||
22 | - <h2 translate>{{ vm.importTitle }}</h2> | ||
23 | - <span flex></span> | ||
24 | - <md-button class="md-icon-button" ng-click="vm.cancel()"> | ||
25 | - <ng-md-icon icon="close" aria-label="{{ 'dialog.close' | translate }}"></ng-md-icon> | ||
26 | - </md-button> | ||
27 | - </div> | ||
28 | - </md-toolbar> | ||
29 | - <md-progress-linear class="md-warn" md-mode="indeterminate" ng-disabled="!$root.loading" | ||
30 | - ng-show="$root.loading"></md-progress-linear> | ||
31 | - <span style="min-height: 5px;" flex="" ng-show="!$root.loading"></span> | ||
32 | - <md-dialog-content> | ||
33 | - <div class="md-dialog-content"> | ||
34 | - <fieldset ng-disabled="$root.loading"> | ||
35 | - <div layout="column" layout-padding> | ||
36 | - <div class="tb-container"> | ||
37 | - <label class="tb-label" translate>{{ vm.importFileLabel }}</label> | ||
38 | - <div flow-init="{singleFile:true}" | ||
39 | - flow-file-added="vm.fileAdded( $file )" class="tb-file-select-container"> | ||
40 | - <div class="tb-file-clear-container"> | ||
41 | - <md-button ng-click="vm.clearFile()" | ||
42 | - class="tb-file-clear-btn md-icon-button md-primary" | ||
43 | - aria-label="{{ 'action.remove' | translate }}"> | ||
44 | - <md-tooltip md-direction="top"> | ||
45 | - {{ 'action.remove' | translate }} | ||
46 | - </md-tooltip> | ||
47 | - <md-icon aria-label="{{ 'action.remove' | translate }}" class="material-icons"> | ||
48 | - close | ||
49 | - </md-icon> | ||
50 | - </md-button> | 19 | + <md-toolbar> |
20 | + <div class="md-toolbar-tools"> | ||
21 | + <h2 translate>{{ vm.importTitle }}</h2> | ||
22 | + <span flex></span> | ||
23 | + <md-button class="md-icon-button" ng-click="vm.cancel()"> | ||
24 | + <ng-md-icon icon="close" aria-label="{{ 'dialog.close' | translate }}"></ng-md-icon> | ||
25 | + </md-button> | ||
26 | + </div> | ||
27 | + </md-toolbar> | ||
28 | + <md-progress-linear class="md-warn" md-mode="indeterminate" ng-disabled="!$root.loading" | ||
29 | + ng-show="$root.loading"></md-progress-linear> | ||
30 | + <span style="min-height: 5px;" flex="" ng-show="!$root.loading"></span> | ||
31 | + <md-dialog-content> | ||
32 | + <md-stepper id="import-stepper" md-mobile-step-text="vm.isMobileStepText" md-vertical="vm.isVertical" | ||
33 | + md-linear="vm.isLinear" md-alternative="vm.isAlternative"> | ||
34 | + <md-step md-label="Select a file"> | ||
35 | + <md-step-body> | ||
36 | + <form name="vm.theFormStep1"> | ||
37 | + <fieldset ng-disabled="$root.loading"> | ||
38 | + <div layout="column" layout-padding> | ||
39 | + <div class="tb-container"> | ||
40 | + <label class="tb-label" translate>{{ vm.importFileLabel }}</label> | ||
41 | + <div flow-init="{singleFile:true}" | ||
42 | + flow-file-added="vm.fileAdded( $file )" class="tb-file-select-container"> | ||
43 | + <div class="tb-file-clear-container"> | ||
44 | + <md-button ng-click="vm.clearFile()" | ||
45 | + class="tb-file-clear-btn md-icon-button md-primary" | ||
46 | + aria-label="{{ 'action.remove' | translate }}"> | ||
47 | + <md-tooltip md-direction="top"> | ||
48 | + {{ 'action.remove' | translate }} | ||
49 | + </md-tooltip> | ||
50 | + <md-icon aria-label="{{ 'action.remove' | translate }}" | ||
51 | + class="material-icons"> | ||
52 | + close | ||
53 | + </md-icon> | ||
54 | + </md-button> | ||
55 | + </div> | ||
56 | + <div class="alert tb-flow-drop" flow-drop> | ||
57 | + <label for="select" translate>import.drop-file-csv</label> | ||
58 | + <input class="file-input" flow-btn | ||
59 | + flow-attrs="{accept:'.csv,application/csv,text/csv'}" | ||
60 | + id="select"> | ||
61 | + </div> | ||
62 | + </div> | ||
51 | </div> | 63 | </div> |
52 | - <div class="alert tb-flow-drop" flow-drop> | ||
53 | - <label for="select" translate>import.drop-file-csv</label> | ||
54 | - <input class="file-input" flow-btn | ||
55 | - flow-attrs="{accept:'.csv,application/csv,text/csv'}" id="select"> | 64 | + <div> |
65 | + <div ng-show="!vm.fileName" translate>import.no-file</div> | ||
66 | + <div ng-show="vm.fileName">{{ vm.fileName }}</div> | ||
56 | </div> | 67 | </div> |
57 | </div> | 68 | </div> |
58 | - </div> | ||
59 | - <div> | ||
60 | - <div ng-show="!vm.fileName" translate>import.no-file</div> | ||
61 | - <div ng-show="vm.fileName">{{ vm.fileName }}</div> | ||
62 | - </div> | 69 | + </fieldset> |
70 | + </form> | ||
71 | + </md-step-body> | ||
72 | + | ||
73 | + <md-step-actions layout="row"> | ||
74 | + <span flex></span> | ||
75 | + <md-button ng-disabled="$root.loading" ng-click="vm.cancel()"> | ||
76 | + {{ 'action.cancel' | translate }} | ||
77 | + </md-button> | ||
78 | + <md-button class="md-primary md-raised" | ||
79 | + ng-disabled="$root.loading || !vm.theFormStep1.$dirty || !vm.theFormStep1.$valid || !vm.importData" | ||
80 | + ng-click="vm.nextStep(2);"> | ||
81 | + Continue | ||
82 | + </md-button> | ||
83 | + </md-step-actions> | ||
84 | + </md-step> | ||
85 | + | ||
86 | + <md-step md-label="Select config import"> | ||
87 | + <md-step-body> | ||
88 | + <div flex layout="row" layout-xs="column"> | ||
89 | + <md-input-container class="md-block" style="min-width: 120px"> | ||
90 | + <label translate>CSV delimiter</label> | ||
91 | + <md-select ng-model="vm.importParams.delim"> | ||
92 | + <md-option ng-repeat="delimiter in vm.delimiters" ng-value="delimiter.key"> | ||
93 | + {{delimiter.value}} | ||
94 | + </md-option> | ||
95 | + </md-select> | ||
96 | + </md-input-container> | ||
97 | + <md-input-container class="md-block"> | ||
98 | + <md-checkbox ng-model="vm.importParams.isHeader" aria-label="Checkbox 1"> | ||
99 | + First line is header | ||
100 | + </md-checkbox> | ||
101 | + </md-input-container> | ||
102 | + <md-input-container class="md-block"> | ||
103 | + <md-checkbox ng-model="vm.importParams.isUpdate" aria-label="Checkbox 1"> | ||
104 | + Update parameters | ||
105 | + </md-checkbox> | ||
106 | + </md-input-container> | ||
63 | </div> | 107 | </div> |
64 | - </fieldset> | ||
65 | - <div flex layout="row"> | ||
66 | - <md-input-container class="md-block" style="min-width: 120px"> | ||
67 | - <label translate>CSV delimiter</label> | ||
68 | - <md-select ng-model="vm.importParams.delim"> | ||
69 | - <md-option ng-repeat="delimiter in vm.delimiters" ng-value="delimiter.key"> | ||
70 | - {{delimiter.value}} | ||
71 | - </md-option> | ||
72 | - </md-select> | ||
73 | - </md-input-container> | ||
74 | - <md-input-container class="md-block"> | ||
75 | - <md-checkbox ng-model="vm.importParams.isHeader" aria-label="Checkbox 1"> | ||
76 | - First line is header | ||
77 | - </md-checkbox> | ||
78 | - </md-input-container> | ||
79 | - <md-input-container class="md-block"> | ||
80 | - <md-checkbox ng-model="vm.importParams.isUpdate" aria-label="Checkbox 1"> | ||
81 | - Update parameters | ||
82 | - </md-checkbox> | ||
83 | - </md-input-container> | ||
84 | - </div> | ||
85 | - <tb-table-columns-assignment the-form="theForm" columns="vm.columnsParam" entityType="vm.entityType"></tb-table-columns-assignment> | ||
86 | - </div> | ||
87 | - </md-dialog-content> | ||
88 | - <md-dialog-actions layout="row"> | ||
89 | - <span flex></span> | ||
90 | - <md-button ng-disabled="$root.loading" ng-click="vm.addDevices()" style="margin-right:20px;"> | ||
91 | - Add Device | ||
92 | - </md-button> | ||
93 | - <md-button ng-disabled="$root.loading || !theForm.$dirty || !theForm.$valid || !vm.importData" type="submit" | ||
94 | - class="md-raised md-primary"> | ||
95 | - {{ 'action.import' | translate }} | ||
96 | - </md-button> | ||
97 | - <md-button ng-disabled="$root.loading" ng-click="vm.cancel()" style="margin-right:20px;">{{ 'action.cancel' | ||
98 | - | translate }} | ||
99 | - </md-button> | ||
100 | - </md-dialog-actions> | ||
101 | - </form> | 108 | + </md-step-body> |
109 | + | ||
110 | + <md-step-actions layout="row"> | ||
111 | + <md-button ng-disabled="$root.loading" ng-click="vm.previousStep();">Back | ||
112 | + </md-button> | ||
113 | + <span flex></span> | ||
114 | + <md-button ng-disabled="$root.loading" ng-click="vm.cancel()"> | ||
115 | + {{ 'action.cancel' | translate }} | ||
116 | + </md-button> | ||
117 | + <md-button class="md-primary md-raised" ng-disabled="$root.loading" ng-click="vm.nextStep(3);"> | ||
118 | + Continue | ||
119 | + </md-button> | ||
120 | + </md-step-actions> | ||
121 | + </md-step> | ||
122 | + | ||
123 | + <md-step md-label="Select columns type"> | ||
124 | + <md-step-body> | ||
125 | + <tb-table-columns-assignment columns="vm.columnsParam" | ||
126 | + entity-type="vm.entityType"></tb-table-columns-assignment> | ||
127 | + </md-step-body> | ||
128 | + | ||
129 | + <md-step-actions layout="row"> | ||
130 | + <md-button ng-disabled="$root.loading" ng-click="vm.previousStep();">Back | ||
131 | + </md-button> | ||
132 | + <span flex></span> | ||
133 | + <md-button ng-disabled="$root.loading" ng-click="vm.cancel()"> | ||
134 | + {{ 'action.cancel' | translate }} | ||
135 | + </md-button> | ||
136 | + <md-button class="md-primary md-raised" ng-disabled="$root.loading" ng-click="vm.nextStep(4);"> | ||
137 | + Continue | ||
138 | + </md-button> | ||
139 | + </md-step-actions> | ||
140 | + </md-step> | ||
141 | + | ||
142 | + <md-step md-label="Creat new device"> | ||
143 | + <md-step-body> | ||
144 | + <md-progress-linear md-mode="determinate" value="{{vm.determinateValue}}"></md-progress-linear> | ||
145 | + </md-step-body> | ||
146 | + </md-step> | ||
147 | + <md-step md-label="Creat new Entitys"> | ||
148 | + <md-step-body> | ||
149 | + <div flex layout="row" ng-repeat="(key, value) in vm.statistical"> | ||
150 | + <md-list flex layout="column"> | ||
151 | + <md-subheader class="md-no-sticky">{{key}}</md-subheader> | ||
152 | + <md-list-item class="md-2-line" ng-repeat="(info, infoValue) in vm.statistical[key]" ng-click="null"> | ||
153 | + <div class="md-list-item-text"> | ||
154 | + <p>{{ info }}: {{ infoValue }}</p> | ||
155 | + </div> | ||
156 | + </md-list-item> | ||
157 | + </md-list> | ||
158 | + </div> | ||
159 | + </md-step-body> | ||
160 | + <md-step-actions> | ||
161 | + <span flex></span> | ||
162 | + <md-button ng-disabled="$root.loading" ng-click="vm.cancel()"> | ||
163 | + {{ 'action.cancel' | translate }} | ||
164 | + </md-button> | ||
165 | + <md-button class="md-primary md-raised" ng-disabled="$root.loading" ng-click="vm.finishExport();"> | ||
166 | + Ok | ||
167 | + </md-button> | ||
168 | + </md-step-actions> | ||
169 | + </md-step> | ||
170 | + | ||
171 | + </md-stepper> | ||
172 | + </md-dialog-content> | ||
173 | + <!--<md-dialog-actions layout="row">--> | ||
174 | + <!--<span flex></span>--> | ||
175 | + <!--<md-button ng-disabled="$root.loading || !theForm.$dirty || !theForm.$valid || !vm.importData" type="submit"--> | ||
176 | + <!--class="md-raised md-primary">--> | ||
177 | + <!--{{ 'action.import' | translate }}--> | ||
178 | + <!--</md-button>--> | ||
179 | + <!--<md-button ng-disabled="$root.loading" ng-click="vm.cancel()" style="margin-right:20px;">{{ 'action.cancel'--> | ||
180 | + <!--| translate }}--> | ||
181 | + <!--</md-button>--> | ||
182 | + <!--</md-dialog-actions>--> | ||
102 | </md-dialog> | 183 | </md-dialog> |