From 9e95addf36084442aa4d53c3a2a8f64528ac45c3 Mon Sep 17 00:00:00 2001 From: a2batic Date: Tue, 7 Nov 2017 13:18:02 +0530 Subject: [PATCH] Fixes filter bugs Bug id: #638 #726 --- src/commons/stores/user-store.js | 6 +- src/modules/alerts/alerts.html | 17 +++--- src/modules/alerts/alerts.js | 32 ++++++---- .../bricks/host-bricks/host-bricks.html | 19 +++--- src/modules/bricks/host-bricks/host-bricks.js | 24 +++++++- .../clusters/cluster-list/cluster-list.html | 22 ++++--- .../clusters/cluster-list/cluster-list.js | 41 +++++++++++-- src/modules/hosts/host-list/host-list.html | 44 ++++++------- src/modules/hosts/host-list/host-list.js | 61 +++++++++++++++++-- src/modules/tasks/task-list/tasks.html | 15 ++--- src/modules/tasks/task-list/tasks.js | 29 +++++++-- src/modules/users/user-list/users.html | 19 +++--- src/modules/users/user-list/users.js | 35 +++++++++-- .../volumes/volume-list/volume-list.html | 22 ++++--- .../volumes/volume-list/volume-list.js | 50 +++++++++++++-- 15 files changed, 324 insertions(+), 112 deletions(-) diff --git a/src/commons/stores/user-store.js b/src/commons/stores/user-store.js index 824a45a4..634a5f45 100644 --- a/src/commons/stores/user-store.js +++ b/src/commons/stores/user-store.js @@ -42,7 +42,11 @@ } else if (data[i].status === "false") { user.status = "disabled"; } - user.role = data[i].role; + if (data[i].role === "limited") { + user.role = "read-only"; + } else { + user.role = data[i].role; + } user.notification = data[i].email_notifications; user.email = data[i].email; userList.push(user); diff --git a/src/modules/alerts/alerts.html b/src/modules/alerts/alerts.html index 5c2bc236..444ece0e 100644 --- a/src/modules/alerts/alerts.html +++ b/src/modules/alerts/alerts.html @@ -5,16 +5,17 @@

Alerts

- +
- + +
- +
@@ -48,7 +49,7 @@

Alerts

- {{alertCntrl.severityList.warningAlerts.length}} + {{alertCntrl.severityList.warningAlerts.length}}
{{alertCntrl.severityList.errorAlerts.length}} diff --git a/src/modules/alerts/alerts.js b/src/modules/alerts/alerts.js index c2f9f321..aebfaf18 100644 --- a/src/modules/alerts/alerts.js +++ b/src/modules/alerts/alerts.js @@ -26,9 +26,12 @@ vm.severity = ""; vm.searchDescText = ""; vm.filterBy = "clusterName"; - vm.filterByText = "Filter by Cluster Name"; + vm.filterPlaceholder = "Cluster Name"; vm.searchBy = {}; vm.alertList = []; + vm.filterBy = "clusterName"; + vm.filterByValue = "Cluster"; + vm.filterByCreatedDate = filterByCreatedDate; vm.resetCount = resetCount; vm.setSeverity = setSeverity; @@ -36,7 +39,7 @@ vm.searchByDesc = searchByDesc; vm.clearAllFilters = clearAllFilters; vm.clearDate = clearDate; - vm.changeOption = changeOption; + vm.changingFilterBy = changingFilterBy; vm.date = { fromDate: "", @@ -134,28 +137,30 @@ } function setSeverity(value) { - vm.changeOption(); vm.severity = value; vm.filterBy = "severity"; + vm.filterByValue = "Severity"; vm.searchBy[vm.filterBy] = value; } - function changeOption() { - vm.searchBy = {}; - - switch (vm.filterBy) { + function changingFilterBy(filterValue) { + vm.filterBy = filterValue; + switch (filterValue) { case "clusterName": - vm.filterByText = "Filter by Cluster name"; + vm.filterByValue = "Cluster"; + vm.filterPlaceholder = "Cluster name"; break; case "fqdn": - vm.filterByText = "Filter by Host name"; + vm.filterByValue = "Host"; + vm.filterPlaceholder = "Host name"; break; case "severity": - vm.filterByText = "Filter by Severity"; + vm.filterByValue = "Severity"; + vm.filterPlaceholder = "Severity"; break; - } + }; } function searchByDesc(list) { @@ -167,13 +172,14 @@ } function clearAllFilters() { - vm.searchBy[vm.filterBy] = ""; + vm.searchBy = {}; vm.date.toDate = ""; vm.date.fromDate = ""; vm.searchDescText = ""; vm.filterBy = "clusterName"; vm.severity = ""; - vm.filterByText = "Filter by Cluster name"; + vm.filterPlaceholder = "Cluster name"; + vm.filterByValue = "Cluster"; vm.invalidToDate = false; } diff --git a/src/modules/bricks/host-bricks/host-bricks.html b/src/modules/bricks/host-bricks/host-bricks.html index ba62606e..6f3aeb87 100644 --- a/src/modules/bricks/host-bricks/host-bricks.html +++ b/src/modules/bricks/host-bricks/host-bricks.html @@ -8,20 +8,21 @@

Brick Details

- +
- + +
- +
diff --git a/src/modules/bricks/host-bricks/host-bricks.js b/src/modules/bricks/host-bricks/host-bricks.js index 86acefba..900d3f63 100644 --- a/src/modules/bricks/host-bricks/host-bricks.js +++ b/src/modules/bricks/host-bricks/host-bricks.js @@ -22,11 +22,16 @@ hostBrickTimer; vm.isDataLoading = true; + vm.flag = false; vm.brickList = []; + vm.filterBy = "brickPath"; + vm.filterByValue = "Brick Path"; + vm.filterPlaceholder = "Brick Path"; + vm.redirectToGrafana = redirectToGrafana; vm.addTooltip = addTooltip; vm.clearAllFilters = clearAllFilters; - vm.flag = false; + vm.changingFilterBy = changingFilterBy; init(); @@ -75,7 +80,7 @@ hostName = brick.brickPath.split(":")[0].replace(/\./gi, "_"); brickName = brickName.replace(/\//gi, "|"); - utils.redirectToGrafana("bricks", $event, { clusterId: vm.clusterId, hostName: hostName, brickName: brickName, volumeName: brick.volName}); + utils.redirectToGrafana("bricks", $event, { clusterId: vm.clusterId, hostName: hostName, brickName: brickName, volumeName: brick.volName }); } /*Cancelling interval when scope is destroy*/ @@ -91,6 +96,21 @@ vm.filterBy = "brickPath"; vm.searchBy = {}; } + + function changingFilterBy(filterValue) { + vm.filterBy = filterValue; + switch (filterValue) { + case "brickPath": + vm.filterByValue = "Brick Path"; + vm.filterPlaceholder = "Brick Path"; + break; + + case "status": + vm.filterByValue = "Brick Status"; + vm.filterPlaceholder = "Brick Status"; + break; + }; + } } })(); diff --git a/src/modules/clusters/cluster-list/cluster-list.html b/src/modules/clusters/cluster-list/cluster-list.html index df4f42bc..fb28a97d 100644 --- a/src/modules/clusters/cluster-list/cluster-list.html +++ b/src/modules/clusters/cluster-list/cluster-list.html @@ -9,23 +9,25 @@

Clusters

- + +
- +
+
- +
-
-
No results match the filter criteria
-
-
Suggestions
-
Please try selecting other filter criteria.
+
+
No results match the filter criteria
+
+
Suggestions
+
Please try selecting other filter criteria.
+
+ Clear All Filters
- Clear All Filters -
-
+
@@ -92,7 +94,7 @@

No Hosts Detected

- +
diff --git a/src/modules/hosts/host-list/host-list.js b/src/modules/hosts/host-list/host-list.js index 7e959ea4..dc1b99ca 100644 --- a/src/modules/hosts/host-list/host-list.js +++ b/src/modules/hosts/host-list/host-list.js @@ -21,12 +21,21 @@ hostListTimer; vm.isDataLoading = true; - vm.redirectToGrafana = redirectToGrafana; + vm.flag = false; + vm.filterBy = "name"; + vm.orderBy = "name"; + vm.orderByValue = "Name"; + vm.filterByValue = "Name"; + vm.filterPlaceholder = "Name"; vm.hostList = []; + + vm.redirectToGrafana = redirectToGrafana; vm.goToHostDetail = goToHostDetail; vm.addTooltip = addTooltip; vm.clearAllFilters = clearAllFilters; - vm.flag = false; + vm.changingOrderBy = changingOrderBy; + vm.changingFilterBy = changingFilterBy; + init(); @@ -41,7 +50,7 @@ if ($rootScope.clusterData && $rootScope.clusterData.length) { var clusters; clusters = clusterStore.formatClusterData($rootScope.clusterData); - + nodeStore.getNodeList(clusters, vm.clusterId) .then(function(list) { $interval.cancel(hostListTimer); @@ -52,11 +61,11 @@ } else { clusterStore.getClusterList() .then(function(data) { - + var clusters; $rootScope.clusterData = data; clusters = clusterStore.formatClusterData($rootScope.clusterData); - + nodeStore.getNodeList(clusters, vm.clusterId) .then(function(list) { $interval.cancel(hostListTimer); @@ -101,6 +110,48 @@ vm.searchBy = {}; vm.filterBy = "name"; } + + function changingFilterBy(filterValue) { + vm.filterBy = filterValue; + switch (filterValue) { + case "name": + vm.filterByValue = "Name"; + vm.filterPlaceholder = "Name"; + break; + + case "cluster_name": + vm.filterByValue = "Cluster"; + vm.filterPlaceholder = "Cluster Name"; + break; + + case "role": + vm.filterByValue = "Role"; + vm.filterPlaceholder = "Role"; + break; + + case "status": + vm.filterByValue = "Status"; + vm.filterPlaceholder = "Status"; + break; + }; + } + + function changingOrderBy(orderValue) { + vm.orderBy = orderValue; + switch (orderValue) { + case "name": + vm.orderByValue = "Name"; + break; + + case "cluster_name": + vm.orderByValue = "Cluster"; + break; + + case "role": + vm.orderByValue = "Role"; + break; + }; + } } })(); diff --git a/src/modules/tasks/task-list/tasks.html b/src/modules/tasks/task-list/tasks.html index 1dbadcc9..0925dc36 100644 --- a/src/modules/tasks/task-list/tasks.html +++ b/src/modules/tasks/task-list/tasks.html @@ -5,15 +5,16 @@

Tasks

- +
- + +
- +
@@ -114,4 +115,4 @@

No Tasks Detected

-
\ No newline at end of file +
diff --git a/src/modules/tasks/task-list/tasks.js b/src/modules/tasks/task-list/tasks.js index f834f882..867c39aa 100644 --- a/src/modules/tasks/task-list/tasks.js +++ b/src/modules/tasks/task-list/tasks.js @@ -21,6 +21,13 @@ count; vm.tasksStatus = ["processing", "finished", "failed"]; + vm.taskList = []; + vm.isDataLoading = true; + vm.flag = false; + vm.filterBy = "job_id"; + vm.filterByValue = "Task ID"; + vm.filterPlaceholder = "Task ID"; + count = 1; vm.goToTaskDetail = goToTaskDetail; vm.getStatusText = getStatusText; @@ -30,11 +37,8 @@ vm.filterByCreatedDate = filterByCreatedDate; vm.clearDate = clearDate; vm.clearAllFilters = clearAllFilters; - vm.taskList = []; - vm.isDataLoading = true; - count = 1; vm.addTooltip = addTooltip; - vm.flag = false; + vm.changingFilterBy = changingFilterBy; vm.date = { fromDate: "", @@ -194,9 +198,26 @@ vm.date.fromDate = ""; vm.invalidToDate = false; vm.filterBy = "job_id"; + vm.filterByValue = "Task ID"; + vm.filterPlaceholder = "Task ID"; vm.searchBy = {}; vm.tasksStatus = ["processing", "finished", "failed"]; } + + function changingFilterBy(filterValue) { + vm.filterBy = filterValue; + switch (filterValue) { + case "job_id": + vm.filterByValue = "Task ID"; + vm.filterPlaceholder = "Task ID"; + break; + + case "flow": + vm.filterByValue = "Task"; + vm.filterPlaceholder = "Task"; + break; + }; + } } })(); diff --git a/src/modules/users/user-list/users.html b/src/modules/users/user-list/users.html index 73d10727..f178c8b8 100644 --- a/src/modules/users/user-list/users.html +++ b/src/modules/users/user-list/users.html @@ -11,14 +11,15 @@

Users

- + +
- +
@@ -37,7 +38,7 @@

Users

- +
@@ -73,7 +74,7 @@

No Users Detected

{{ user.username }} {{ user.name }} - {{ user.role === 'limited' ? 'Read-Only' : user.role }} + {{ user.role}} {{ user.notification === true ? 'Enabled' : 'Disabled' }} @@ -101,4 +102,4 @@

No Users Detected

-
\ No newline at end of file + diff --git a/src/modules/users/user-list/users.js b/src/modules/users/user-list/users.js index 636a96e3..edc75c0b 100644 --- a/src/modules/users/user-list/users.js +++ b/src/modules/users/user-list/users.js @@ -23,11 +23,16 @@ vm.userList = []; vm.isDataLoading = true; + vm.filterBy = "username"; + vm.filterByValue = "User ID"; + vm.filterPlaceholder = "User ID"; + vm.addNewUser = addNewUser; vm.editUserDetail = editUserDetail; vm.deleteUser = deleteUser; vm.toggleNotification = toggleNotification; vm.clearAllFilters = clearAllFilters; + vm.changingFilterBy = changingFilterBy; init(); @@ -39,7 +44,7 @@ if (data) { vm.userList = data; } - }).catch(function(e){ + }).catch(function(e) { vm.isDataLoading = false; }); } @@ -77,7 +82,7 @@ size: "md", resolve: { selectedUser: function() { - return username ; + return username; } } }); @@ -97,9 +102,9 @@ userStore.editUser(user, "yes") .then(function(data) { init(); - Notifications.message("success", "", "Email notification is now " + emailFlag + "d for "+ user.username +"."); + Notifications.message("success", "", "Email notification is now " + emailFlag + "d for " + user.username + "."); }).catch(function(e) { - Notifications.message("danger", "", "Failed to "+ emailFlag +" email notification for " + user.username +"."); + Notifications.message("danger", "", "Failed to " + emailFlag + " email notification for " + user.username + "."); }); } @@ -107,6 +112,26 @@ vm.searchBy = {}; vm.filterBy = "username"; } + + function changingFilterBy(filterValue) { + vm.filterBy = filterValue; + switch (filterValue) { + case "username": + vm.filterByValue = "User ID"; + vm.filterPlaceholder = "User ID"; + break; + + case "name": + vm.filterByValue = "Name"; + vm.filterPlaceholder = "Name"; + break; + + case "role": + vm.filterByValue = "Role"; + vm.filterPlaceholder = "Role"; + break; + }; + } } -})(); \ No newline at end of file +})(); diff --git a/src/modules/volumes/volume-list/volume-list.html b/src/modules/volumes/volume-list/volume-list.html index 5646dc39..13383449 100644 --- a/src/modules/volumes/volume-list/volume-list.html +++ b/src/modules/volumes/volume-list/volume-list.html @@ -12,24 +12,26 @@

Volumes

- + +
- +