From 8a1cd15a9e677626cebe4e39fef677103ef7180e Mon Sep 17 00:00:00 2001 From: pierpuccini <46226655+pierpuccini@users.noreply.github.com> Date: Mon, 4 May 2020 18:56:24 -0500 Subject: [PATCH 1/8] Added export feature in mailing lists infiniteautomation/ma-modules-public#88 --- .../components/mailingLists/mailingListSetup.html | 6 ++++++ .../ui/components/mailingListPage/mailingList.html | 5 +++++ UI/web-src/ui/components/mailingListPage/mailingList.js | 9 ++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/UI/web-src/ngMango/components/mailingLists/mailingListSetup.html b/UI/web-src/ngMango/components/mailingLists/mailingListSetup.html index 8d7c3eb18..18e9b9000 100644 --- a/UI/web-src/ngMango/components/mailingLists/mailingListSetup.html +++ b/UI/web-src/ngMango/components/mailingLists/mailingListSetup.html @@ -7,6 +7,12 @@ + + + save_alt +
diff --git a/UI/web-src/ui/components/mailingListPage/mailingList.html b/UI/web-src/ui/components/mailingListPage/mailingList.html index 6fb59a7a1..b4a8e9119 100644 --- a/UI/web-src/ui/components/mailingListPage/mailingList.html +++ b/UI/web-src/ui/components/mailingListPage/mailingList.html @@ -6,6 +6,11 @@ + + + save_alt + diff --git a/UI/web-src/ui/components/mailingListPage/mailingList.js b/UI/web-src/ui/components/mailingListPage/mailingList.js index 100ca51dc..e13dc14c7 100644 --- a/UI/web-src/ui/components/mailingListPage/mailingList.js +++ b/UI/web-src/ui/components/mailingListPage/mailingList.js @@ -33,10 +33,17 @@ class MailingLists { }); } - $onInit() {} + $onInit() { + this.getMailingList(); + } newList() { this.selectedList = new this.maMailingList(); + this.getMailingList(); + } + + getMailingList() { + this.maMailingList.list().then((list) => (this.mailingList = list)); } } From 408e6acf965c487c24914ad9a6f871f60e0436d3 Mon Sep 17 00:00:00 2001 From: pierpuccini <46226655+pierpuccini@users.noreply.github.com> Date: Mon, 4 May 2020 20:08:44 -0500 Subject: [PATCH 2/8] Added publisher export funcionality --- .../ui/components/publisherPage/publisherPage.html | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/UI/web-src/ui/components/publisherPage/publisherPage.html b/UI/web-src/ui/components/publisherPage/publisherPage.html index 360358766..12185c359 100644 --- a/UI/web-src/ui/components/publisherPage/publisherPage.html +++ b/UI/web-src/ui/components/publisherPage/publisherPage.html @@ -8,6 +8,11 @@ add + + + save_alt +
@@ -36,6 +41,12 @@
+
+ + + save_alt +
From b25c880e9baee1d19c8ce3152c26207f6be5ef14 Mon Sep 17 00:00:00 2001 From: pierpuccini <46226655+pierpuccini@users.noreply.github.com> Date: Tue, 5 May 2020 18:11:38 -0500 Subject: [PATCH 3/8] Added export feature for event detectors --- UI/classes/i18n.properties | 3 +- UI/classes/i18n_es.properties | 1 + .../bulkDataPointEditor.html | 29 ++++++++++++++++++- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/UI/classes/i18n.properties b/UI/classes/i18n.properties index d576f228d..053b309e0 100644 --- a/UI/classes/i18n.properties +++ b/UI/classes/i18n.properties @@ -1175,4 +1175,5 @@ ui.adminHome.uptime=System uptime ui.adminHome.diskSpace=Disk Space ui.adminHome.cpuLoad=CPU load % (Mango / System) -ui.app.exportAll=Export all \ No newline at end of file +ui.app.exportAll=Export all +ui.app.exportSelected=Export selected \ No newline at end of file diff --git a/UI/classes/i18n_es.properties b/UI/classes/i18n_es.properties index 843f09ef1..5a30b6f4f 100644 --- a/UI/classes/i18n_es.properties +++ b/UI/classes/i18n_es.properties @@ -1163,3 +1163,4 @@ ui.adminHome.diskSpace=Espacio en disco ui.adminHome.cpuLoad=Carga de CPU % (Mango / System) ui.app.exportAll=Exportar todo +ui.app.exportSelected=Exportar seleccionado diff --git a/UI/web-src/ngMango/components/bulkDataPointEditor/bulkDataPointEditor.html b/UI/web-src/ngMango/components/bulkDataPointEditor/bulkDataPointEditor.html index cd0621673..650f5ad8c 100644 --- a/UI/web-src/ngMango/components/bulkDataPointEditor/bulkDataPointEditor.html +++ b/UI/web-src/ngMango/components/bulkDataPointEditor/bulkDataPointEditor.html @@ -245,6 +245,34 @@

+ + + more_vert + + + + + +
+
+ save_alt +
+
+
+ + +
+
+ save_alt +
+
+
+
+
help @@ -253,7 +281,6 @@

- From 2c9c2a3ec1c8373309723000051f6365c2864f64 Mon Sep 17 00:00:00 2001 From: pierpuccini <46226655+pierpuccini@users.noreply.github.com> Date: Tue, 5 May 2020 23:57:13 -0500 Subject: [PATCH 4/8] Added user export button, missing confirmation as to where it will finally go --- UI/web-src/ui/components/usersPage/usersPage.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/UI/web-src/ui/components/usersPage/usersPage.html b/UI/web-src/ui/components/usersPage/usersPage.html index 61d5a21c8..238c2b775 100644 --- a/UI/web-src/ui/components/usersPage/usersPage.html +++ b/UI/web-src/ui/components/usersPage/usersPage.html @@ -5,6 +5,11 @@ delete  + + + save_alt + Date: Wed, 6 May 2020 15:54:33 -0500 Subject: [PATCH 5/8] Added export all button to data-points table --- .../bulkDataPointEditor/bulkDataPointEditor.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/UI/web-src/ngMango/components/bulkDataPointEditor/bulkDataPointEditor.html b/UI/web-src/ngMango/components/bulkDataPointEditor/bulkDataPointEditor.html index 650f5ad8c..b3a85fe1f 100644 --- a/UI/web-src/ngMango/components/bulkDataPointEditor/bulkDataPointEditor.html +++ b/UI/web-src/ngMango/components/bulkDataPointEditor/bulkDataPointEditor.html @@ -66,7 +66,13 @@ delete_forever - + + + + save_alt + + From 16b0f737c6571e68c75b9d90b41e74b8fd1283ae Mon Sep 17 00:00:00 2001 From: pierpuccini <46226655+pierpuccini@users.noreply.github.com> Date: Wed, 6 May 2020 17:45:29 -0500 Subject: [PATCH 6/8] Added watchlist export button for infiniteautomation/ma-modules-public#88 --- .../components/pointBrowser/pointBrowser.html | 7 +- .../components/pointBrowser/pointBrowser.js | 217 +++++++++++------- 2 files changed, 140 insertions(+), 84 deletions(-) diff --git a/UI/web-src/ngMango/components/pointBrowser/pointBrowser.html b/UI/web-src/ngMango/components/pointBrowser/pointBrowser.html index 64447aef0..ffad24ba6 100644 --- a/UI/web-src/ngMango/components/pointBrowser/pointBrowser.html +++ b/UI/web-src/ngMango/components/pointBrowser/pointBrowser.html @@ -1,5 +1,5 @@ - + @@ -18,6 +18,11 @@ + + + save_alt +
diff --git a/UI/web-src/ngMango/components/pointBrowser/pointBrowser.js b/UI/web-src/ngMango/components/pointBrowser/pointBrowser.js index 212f9a43c..085ad439d 100644 --- a/UI/web-src/ngMango/components/pointBrowser/pointBrowser.js +++ b/UI/web-src/ngMango/components/pointBrowser/pointBrowser.js @@ -9,10 +9,27 @@ import pointBrowserTemplate from './pointBrowser.html'; const types = ['watchList', 'deviceName', 'dataSource', 'tags']; class PointBrowserController { - static get $$ngIsClass() { return true; } - - static get $inject() { return ['maTranslate', 'maRqlBuilder', 'maWatchList', 'maDataSource', '$timeout']; } - constructor(maTranslate, maRqlBuilder, maWatchList, maDataSource, $timeout) { + static get $$ngIsClass() { + return true; + } + + static get $inject() { + return [ + 'maTranslate', + 'maRqlBuilder', + 'maWatchList', + 'maDataSource', + '$timeout', + ]; + } + + constructor( + maTranslate, + maRqlBuilder, + maWatchList, + maDataSource, + $timeout + ) { this.maTranslate = maTranslate; this.maRqlBuilder = maRqlBuilder; this.maWatchList = maWatchList; @@ -26,78 +43,104 @@ class PointBrowserController { this.ngModelCtrl.$render = () => { if (this.ngModelCtrl.$viewValue !== undefined) { this.selected = this.ngModelCtrl.$viewValue; - - types.forEach(name => { + + types.forEach((name) => { delete this[name]; }); if (!this.selected) return; - + if (!this.selected.isNew()) { this.listType = 'watchList'; this.watchList = this.selected; - } else if (this.selected.type === 'tags' && this.selected.tags) { + } else if ( + this.selected.type === 'tags' && + this.selected.tags + ) { this.listType = 'tags'; this.tags = this.selected.tags; - } else if (this.selected.type === 'query' && this.selected.deviceName) { + } else if ( + this.selected.type === 'query' && + this.selected.deviceName + ) { this.listType = 'deviceName'; this.deviceName = this.selected.deviceName; - } else if (this.selected.type === 'query' && this.selected.dataSource) { + } else if ( + this.selected.type === 'query' && + this.selected.dataSource + ) { this.listType = 'dataSource'; this.dataSource = this.selected.dataSource; } } }; - + if (this.loadItem) { // setting the view value from $onInit doesn't seem to work, only affects the device name // watch list type as its the only type that doesn't do http request before setting view value - this.$timeout(() => { - this.createWatchListFromItem(this.loadItem); - }, 0, false); + this.$timeout( + () => { + this.createWatchListFromItem(this.loadItem); + }, + 0, + false + ); } else { this.listType = 'watchList'; } } - + $onChanges(changes) { - if (changes.loadItem && !changes.loadItem.isFirstChange() && this.loadItem) { + if ( + changes.loadItem && + !changes.loadItem.isFirstChange() && + this.loadItem + ) { this.createWatchListFromItem(this.loadItem); } } filterChanged() { - this.nameQuery = this.filter ? {name: this.filter} : null; + this.nameQuery = this.filter ? { name: this.filter } : null; + this.filter + ? (this.downloadQuery = `match(name,*${this.filter}*)&sort(name)`) + : (this.downloadQuery = ''); } - + setViewValue() { this.ngModelCtrl.$setViewValue(this.selected); } - + createWatchListFromItem(item) { if (item.firstWatchList) { this.listType = 'watchList'; - this.maWatchList.objQuery({ - limit: 1, - sort: 'name' - }).$promise.then(lists => { - if (lists.length) { - this.watchList = lists[0]; - this.itemSelected('watchList'); - } - }); + this.maWatchList + .objQuery({ + limit: 1, + sort: 'name', + }) + .$promise.then((lists) => { + if (lists.length) { + this.watchList = lists[0]; + this.itemSelected('watchList'); + } + }); } else if (item.watchListXid) { this.listType = 'watchList'; - this.maWatchList.get({xid: item.watchListXid}).$promise.then(wl => { - this.watchList = wl; - this.itemSelected('watchList'); - }, angular.noop); + this.maWatchList + .get({ xid: item.watchListXid }) + .$promise.then((wl) => { + this.watchList = wl; + this.itemSelected('watchList'); + }, angular.noop); } else if (item.dataSourceXid) { this.listType = 'dataSource'; - this.maDataSource.get({xid: item.dataSourceXid}).$promise.then(ds => { - this.dataSource = ds; - this.itemSelected('dataSource'); - }, angular.noop); + this.maDataSource + .get({ xid: item.dataSourceXid }) + .$promise.then((ds) => { + this.dataSource = ds; + this.itemSelected('dataSource'); + }, angular.noop); } else if (item.deviceName) { this.deviceName = item.deviceName; this.listType = 'deviceName'; @@ -110,28 +153,32 @@ class PointBrowserController { this.listType = 'watchList'; } } - + itemSelected(type) { // de-select other types - types.filter(prop => prop !== type).forEach(name => { - delete this[name]; - }); - - switch(type) { - case 'watchList': - this.selected = this.watchList; - break; - case 'deviceName': - this.createDeviceNameWatchList(); - break; - case 'dataSource': - this.createDataSourceWatchList(); - break; - case 'tags': - this.createTagsWatchList(); - break; + types + .filter((prop) => prop !== type) + .forEach((name) => { + delete this[name]; + }); + + switch (type) { + case 'watchList': + this.selected = this.watchList; + break; + case 'deviceName': + this.createDeviceNameWatchList(); + break; + case 'dataSource': + this.createDataSourceWatchList(); + break; + case 'tags': + this.createTagsWatchList(); + break; + default: + break; } - + this.setViewValue(); } @@ -144,12 +191,14 @@ class PointBrowserController { this.selected = new this.maWatchList({ type: 'query', - name: this.maTranslate.trSync('ui.app.deviceNameX', [this.deviceName]), + name: this.maTranslate.trSync('ui.app.deviceNameX', [ + this.deviceName, + ]), query, - deviceName: this.deviceName + deviceName: this.deviceName, }); } - + createDataSourceWatchList() { const query = new this.maRqlBuilder() .eq('dataSourceXid', this.dataSource.xid) @@ -159,34 +208,38 @@ class PointBrowserController { this.selected = new this.maWatchList({ type: 'query', - name: this.maTranslate.trSync('ui.app.dataSourceX', [this.dataSource.name]), + name: this.maTranslate.trSync('ui.app.dataSourceX', [ + this.dataSource.name, + ]), query, - dataSource: this.dataSource + dataSource: this.dataSource, }); } - + createTagsWatchList() { - const params = Object.keys(this.tags).map(tagKey => { - const tagValues = this.tags[tagKey]; - if (Array.isArray(tagValues) && tagValues.length) { - return { - name: tagKey, - type: 'tagValue', - options: { - multiple: true, - fixedValue: tagValues, - restrictions: {}, - tagKey - } - }; - } - }).filter(p => p != null); - + const params = Object.keys(this.tags) + .map((tagKey) => { + const tagValues = this.tags[tagKey]; + if (Array.isArray(tagValues) && tagValues.length) { + return { + name: tagKey, + type: 'tagValue', + options: { + multiple: true, + fixedValue: tagValues, + restrictions: {}, + tagKey, + }, + }; + } + }) + .filter((p) => p != null); + this.selected = new this.maWatchList({ type: 'tags', name: this.maTranslate.trSync('ui.app.newTagWatchList'), params, - tags: this.tags + tags: this.tags, }); } @@ -201,11 +254,9 @@ export default { controller: PointBrowserController, bindings: { listType: '@?', - loadItem: ' Date: Thu, 7 May 2020 15:34:32 -0500 Subject: [PATCH 7/8] Showing export button --- .../components/mailingListPage/mailingList.html | 3 +-- .../components/mailingListPage/mailingList.js | 17 +++++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/UI/web-src/ui/components/mailingListPage/mailingList.html b/UI/web-src/ui/components/mailingListPage/mailingList.html index b4a8e9119..84f7a5f38 100644 --- a/UI/web-src/ui/components/mailingListPage/mailingList.html +++ b/UI/web-src/ui/components/mailingListPage/mailingList.html @@ -6,8 +6,7 @@ - + save_alt diff --git a/UI/web-src/ui/components/mailingListPage/mailingList.js b/UI/web-src/ui/components/mailingListPage/mailingList.js index e13dc14c7..767a94151 100644 --- a/UI/web-src/ui/components/mailingListPage/mailingList.js +++ b/UI/web-src/ui/components/mailingListPage/mailingList.js @@ -16,9 +16,14 @@ import './mailingList.css'; const $inject = Object.freeze(['$scope', '$mdMedia', 'maMailingList']); class MailingLists { - static get $inject() { return $inject; } - static get $$ngIsClass() { return true; } - + static get $inject() { + return $inject; + } + + static get $$ngIsClass() { + return true; + } + constructor($scope, $mdMedia, maMailingList) { this.$scope = $scope; this.$mdMedia = $mdMedia; @@ -32,7 +37,7 @@ class MailingLists { this.$scope.$broadcast('addNewMailingList', true); }); } - + $onInit() { this.getMailingList(); } @@ -51,5 +56,5 @@ export default { template: componentTemplate, controller: MailingLists, bindings: {}, - require: {} -}; \ No newline at end of file + require: {}, +}; From 21f971d55b7d1d309fe8d056fd3b158873e4a1b4 Mon Sep 17 00:00:00 2001 From: pierpuccini <46226655+pierpuccini@users.noreply.github.com> Date: Thu, 7 May 2020 15:39:13 -0500 Subject: [PATCH 8/8] Changed watchlist export translation --- UI/web-src/ngMango/components/pointBrowser/pointBrowser.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UI/web-src/ngMango/components/pointBrowser/pointBrowser.html b/UI/web-src/ngMango/components/pointBrowser/pointBrowser.html index ffad24ba6..40e196dd5 100644 --- a/UI/web-src/ngMango/components/pointBrowser/pointBrowser.html +++ b/UI/web-src/ngMango/components/pointBrowser/pointBrowser.html @@ -20,7 +20,7 @@ - + save_alt