From 6ec70c5aa2fe3d1445346b94cc9df715955f4e5f Mon Sep 17 00:00:00 2001 From: Shirshendu Mukherjee Date: Thu, 25 Oct 2018 11:06:20 +0530 Subject: [PATCH] Tendrl UI changes for consuming tendrl-api with glusterd2 --- src/commons/factories/cluster-factory.js | 4 +- src/commons/factories/host-factory.js | 2 +- src/commons/factories/volume-factory.js | 46 ++++++ src/commons/js/index.js | 6 +- src/commons/services/utils.js | 6 +- src/commons/stores/brick-store.js | 25 ++- src/commons/stores/cluster-store.js | 47 +++--- src/commons/stores/events-store.js | 4 +- src/commons/stores/peer-store.js | 156 ++++++++++++++++++ src/commons/stores/volume-store.js | 37 ++++- .../bricks/volume-bricks/brick-path.html | 6 +- .../volume-bricks/utilization-path.html | 2 +- .../bricks/volume-bricks/volume-bricks.html | 6 +- .../bricks/volume-bricks/volume-bricks.js | 20 +-- .../clusters/cluster-list/cluster-list.html | 1 + .../clusters/cluster-list/cluster-list.js | 2 +- .../clusters/cluster-list/cluster-list.scss | 7 + .../import-cluster/import-cluster.html | 84 ++++++---- .../clusters/import-cluster/import-cluster.js | 52 +++--- src/modules/events/event-list/event-list.html | 4 +- src/modules/hosts/host-list/host-list.js | 10 +- .../volumes/volume-list/volume-list.html | 10 +- .../volumes/volume-list/volume-list.js | 33 ++-- 23 files changed, 423 insertions(+), 147 deletions(-) create mode 100644 src/commons/stores/peer-store.js diff --git a/src/commons/factories/cluster-factory.js b/src/commons/factories/cluster-factory.js index 2dcd58d8..17e1e37e 100644 --- a/src/commons/factories/cluster-factory.js +++ b/src/commons/factories/cluster-factory.js @@ -14,12 +14,12 @@ * @desc Perform import cluster * @memberOf clusterFactory */ - vm.importCluster = function(data, clusterId) { + vm.importCluster = function(data) { var url, importRequest, request; - url = config.baseUrl + "clusters/" + clusterId + "/import"; + url = config.baseUrl + "/import"; importRequest = { method: "POST", diff --git a/src/commons/factories/host-factory.js b/src/commons/factories/host-factory.js index fe2ff9bb..729c5c83 100644 --- a/src/commons/factories/host-factory.js +++ b/src/commons/factories/host-factory.js @@ -18,7 +18,7 @@ var url = "", getObjectListRequest, request; - url = config.baseUrl +"clusters/" + clusterId +"/nodes"; + url = config.baseUrl +"clusters/" + clusterId +"/peers"; //url = "/api/GetNodeList.json"; getObjectListRequest = { diff --git a/src/commons/factories/volume-factory.js b/src/commons/factories/volume-factory.js index e061fe67..04f803a4 100644 --- a/src/commons/factories/volume-factory.js +++ b/src/commons/factories/volume-factory.js @@ -66,6 +66,52 @@ }; + vm.startVolume = function(volume, clusterId) { + var url, + startRequest, + request; + + url = config.baseUrl + "clusters/" + clusterId + "/volumes/" + volume.name + "/start"; + + startRequest = { + method: "POST", + url: url + }; + + request = angular.copy(startRequest); + return $http(request).then(function(response) { + return response.data; + }, function(e) { + utils.checkErrorCode(e); + console.log("Error Occurred: while starting volume"); + throw e; + }); + + }; + + vm.stopVolume = function(volume, clusterId) { + var url, + stopRequest, + request; + + url = config.baseUrl + "clusters/" + clusterId + "/volumes/" + volume.name + "/stop"; + + stopRequest = { + method: "POST", + url: url + }; + + request = angular.copy(stopRequest); + return $http(request).then(function(response) { + return response.data; + }, function(e) { + utils.checkErrorCode(e); + console.log("Error Occurred: while stopping volume"); + throw e; + }); + + }; + } })(); diff --git a/src/commons/js/index.js b/src/commons/js/index.js index fbeee206..bb20a789 100755 --- a/src/commons/js/index.js +++ b/src/commons/js/index.js @@ -59,8 +59,8 @@ template: "" }) .state("import-cluster", { - url: "/import-cluster/:clusterId", - template: "" + url: "/import-cluster", + template: "" }) .state("cluster-hosts", { url: "/cluster-hosts/:clusterId", @@ -216,4 +216,4 @@ }); } -}()); \ No newline at end of file +}()); diff --git a/src/commons/services/utils.js b/src/commons/services/utils.js index de9000b0..d32d8621 100644 --- a/src/commons/services/utils.js +++ b/src/commons/services/utils.js @@ -236,7 +236,7 @@ request; //url = "/api/events.json"; - url = config.baseUrl + "clusters/" + clusterId + "/notifications"; + url = config.baseUrl + "clusters/" + clusterId + "/events"; getEventListRequest = { method: "GET", @@ -245,7 +245,7 @@ request = angular.copy(getEventListRequest); return $http(request).then(function(response) { - return response.data; + return response.data.events; }, function(e) { vm.checkErrorCode(e); console.log("Error Occurred: while fetching getEventList"); @@ -310,4 +310,4 @@ }; }; -})(); \ No newline at end of file +})(); diff --git a/src/commons/stores/brick-store.js b/src/commons/stores/brick-store.js index 26bfd7c3..8e188613 100644 --- a/src/commons/stores/brick-store.js +++ b/src/commons/stores/brick-store.js @@ -55,20 +55,27 @@ store.getVolumeBrickList = function(clusterId, volId) { var subVolumes = [], + volume, deferred, len, i; deferred = $q.defer(); - brickFactory.getVolumeBrickList(clusterId, volId) + volume = volumeStore.getVolumeObject(volId); + brickFactory.getVolumeBrickList(clusterId, volume.name) .then(function(data) { - _createSubVolumes(data); - len = subVolumes.length; + //_createSubVolumes(data); + len = volume.subvols.length; for (i = 0; i < len; i++) { - subVolumes[i].utilization = _calcUtilization(subVolumes[i].bricks); + for(var j=0;j { return e.info.id == brickId })); + } + volume.subvols[i].utilization = _calcUtilization(volume.subvols[i].bricks); } + deferred.resolve(volume.subvols); - deferred.resolve(subVolumes); + //deferred.resolve(subVolumes); }).catch(function(e) { deferred.reject(e); }); @@ -104,10 +111,10 @@ total; for (i = 0; i < len; i++) { - used = parseFloat(bricks[i].utilization.used); - total = parseFloat(bricks[i].utilization.total); - utilization.used += (used * total) / 100; - utilization.total += parseFloat(bricks[i].utilization.total); + used = parseFloat(bricks[i].size.used); + total = parseFloat(bricks[i].size.capacity); + utilization.used += used; + utilization.total += total; } percent_used = (utilization.used / utilization.total) * 100; utilization.used = percent_used.toFixed(2); diff --git a/src/commons/stores/cluster-store.js b/src/commons/stores/cluster-store.js index e3590e8e..c661ed5a 100644 --- a/src/commons/stores/cluster-store.js +++ b/src/commons/stores/cluster-store.js @@ -6,7 +6,7 @@ .service("clusterStore", clusterStore); /*@ngInject*/ - function clusterStore($state, $filter, $q, $rootScope, nodeStore, clusterFactory) { + function clusterStore($state, $filter, $q, $rootScope, peerStore, volumeFactory, clusterFactory) { var store = this; store.selectedTab = 1; @@ -83,7 +83,7 @@ temp.status = nodes[i].status; temp.managed = nodes[i].is_managed === "yes" ? "Yes" : "No"; temp.ipAddress = nodes[i].ipv4_addr; - tags = nodeStore.findRole(nodes[i].tags); + tags = peerStore.findRole(nodes[i].tags); temp.role = tags ? tags.role : "None"; temp.release = tags.release !== "NA" ? (tags.release + " " + data.sds_version) : "NA"; @@ -98,18 +98,19 @@ * @desc store for import cluster * @memberOf clusterStore */ - store.importCluster = function(clusterId, enableProfiling, clusterName) { + store.importCluster = function(gd2Url, secret, clusterName) { var requestData = { - "Cluster.volume_profiling_flag": enableProfiling === "leaveAsIs" ? "leave-as-is" : enableProfiling + "gd2_url": gd2Url, + "secret": secret }, deferred; if (clusterName) { - requestData["Cluster.short_name"] = clusterName; + requestData["short_name"] = clusterName; } deferred = $q.defer(); - clusterFactory.importCluster(requestData, clusterId) + clusterFactory.importCluster(requestData) .then(function(data) { deferred.resolve(data); }).catch(function(e) { @@ -217,35 +218,37 @@ "rhgs": "RHGS" }; - temp.integrationId = cluster.integration_id; - temp.sdsVersion = cluster.sds_version; - temp.sdsName = cluster.sds_name; - temp.showSdsName = sdsMapping[cluster.sds_name.toLowerCase()]; - temp.name = (cluster.short_name && cluster.short_name !== "None") ? cluster.short_name : cluster.integration_id; - temp.clusterId = cluster.cluster_id; + temp.integrationId = cluster['cluster-id']; + temp.sdsVersion = cluster.version; + temp.sdsName = 'gluster'; // TODO cluster.sds_name; + temp.showSdsName = sdsMapping[temp.sdsName.toLowerCase()]; + temp.name = (cluster.short_name && cluster.short_name !== "None") ? cluster.short_name : cluster['cluster-id']; + temp.clusterId = cluster['cluster-id']; temp.currentTask = cluster.current_job || {}; temp.jobType = temp.currentTask.job_name; temp.currentStatus = temp.currentTask.status; - temp.managed = cluster.is_managed === "yes" ? "Yes" : "No"; + temp.managed = "Yes"; // cluster.is_managed === "yes" ? "Yes" : "No"; temp.currentTaskId = temp.currentTask.job_id; - temp.volCount = cluster.globaldetails && cluster.globaldetails.vol_count ? parseInt(cluster.globaldetails.vol_count) : 0; + //temp.volCount = cluster.globaldetails && cluster.globaldetails.vol_count ? parseInt(cluster.globaldetails.vol_count) : 0; + temp.volCount = cluster.volumes.length; temp.alertCount = cluster.alert_counters ? parseInt(cluster.alert_counters.alert_count) : 0; - temp.hostCount = cluster.nodes.length || 0; - temp.state = cluster.status; - temp.isProfilingEnabled = _getProfileStatus(temp, cluster); + temp.hostCount = cluster.peers.length; + temp.state = 'healthy';//cluster.status; + temp.isProfilingEnabled = 'TODO'// TODO - derive this from volumes store, aggregate profiling statuses of volumes as yes, no, mixed - _getProfileStatus(temp, cluster); temp.readyState = false; - temp.hosts = store.getAssociatedHosts(cluster); - temp.isAnyHostUnmanaged = nodeStore.isAnyHostUnmanaged(temp.hosts); + temp.hosts = []; // TODO store.getAssociatedHosts(cluster); + temp.isAnyHostUnmanaged = []; //nodeStore.isAnyHostUnmanaged(temp.hosts); temp.errors = cluster.errors ? cluster.errors : []; /*This block has be placed here, as it initializes statusIcon (used at line 283)*/ + // TODO - also hit peers, volumes, devices stores, find if any if (temp.managed === "Yes") { - if (cluster.globaldetails && cluster.globaldetails.status === "healthy") { + if (temp.state === "healthy") { temp.status = "HEALTH_OK"; temp.statusIcon = "Healthy"; - } else if (cluster.globaldetails && cluster.globaldetails.status === "unhealthy") { + } else if (temp.state === "unhealthy") { temp.status = "HEALTH_ERR"; temp.statusIcon = "Unhealthy"; } else { @@ -287,7 +290,7 @@ } else if (temp.managed === "Yes") { if (temp.isAnyHostUnmanaged) { - temp.message = "Expansion required"; + //temp.message = "Expansion required"; } if (temp.jobType === "ExpandClusterWithDetectedPeers" && temp.currentStatus === "in_progress") { diff --git a/src/commons/stores/events-store.js b/src/commons/stores/events-store.js index 648330d3..98695c82 100644 --- a/src/commons/stores/events-store.js +++ b/src/commons/stores/events-store.js @@ -80,7 +80,7 @@ temp = {}, temp.timeStamp = new Date(data[i].timestamp); temp.priority = data[i].priority; - temp.message = data[i].message; + temp.name = data[i].name; temp.message_id = data[i].message_id; res.push(temp); } @@ -89,4 +89,4 @@ }; } -})(); \ No newline at end of file +})(); diff --git a/src/commons/stores/peer-store.js b/src/commons/stores/peer-store.js new file mode 100644 index 00000000..d809cbb3 --- /dev/null +++ b/src/commons/stores/peer-store.js @@ -0,0 +1,156 @@ +(function() { + "use strict"; + + angular + .module("TendrlModule") + .service("peerStore", peerStore); + + /*@ngInject*/ + function peerStore($state, $q, utils, hostFactory) { + var store = this, + index; + + store.peerList = []; + + /** + * @name findRole + * @desc returns the role for a peer + * @memberOf peerStore + */ + store.findRole = function(tags) { + var role = { + "mon": "Monitor", + "osd": "OSD Host", + "server": "Gluster Peer", + "rados": "RADOS Gateway", + "central-store": "Web Admin Server" + }; + if (tags) { + if (tags.indexOf("tendrl/central-store") !== -1) { + index = tags.indexOf("tendrl/central-store"); + tags = tags[index].split("/"); + } else if (tags.indexOf("ceph/mon") !== -1) { + index = tags.indexOf("ceph/mon"); + tags = tags[index].split("/"); + } else if (tags.indexOf("ceph/osd") !== -1) { + index = tags.indexOf("ceph/osd"); + tags = tags[index].split("/"); + } else if (tags.indexOf("gluster/server") !== -1) { + index = tags.indexOf("gluster/server"); + tags = tags[index].split("/"); + } + } + + return { + + role: role[tags[1]], + release: tags ? tags[0] : "NA" + }; + }; + + /** + * @name getNodeList + * @desc returns list of peers present in Tendrl/cluster + * @memberOf peerStore + */ + store.getNodeList = function(clusterId, state) { + var list, + deferred, + associatedHosts = []; + + deferred = $q.defer(); + hostFactory.getNodeList(clusterId) + .then(function(data) { + if (data !== null) { + list = _formatHostData(data.peers); + store.peerList = list; + } + deferred.resolve(list); + }).catch(function(e) { + deferred.reject(e); + }); + + + return deferred.promise; + + function _formatHostData(list) { + var i, + j, + length = list.length, + hostList = [], + tagsList, + index, + host, stats, tags; + + for (i = 0; i < length; i++) { + host = {}; + + //host.clusterId = list[i].cluster.cluster_id || "NA"; + //host.clusterName = list[i].cluster.integration_id; + host.id = list[i].id; + host.name = list[i].name; + host.online = list[i].online; + host.ipAddress = list[i].ipv4_addr; + host.role = store.findRole(["gluster/server"]); + //host.role = store.findRole(list[i].tags) ? store.findRole(list[i].tags).role : "None"; + //host.integrationId = list[i].cluster.integration_id; + //host.version = list[i].cluster.sds_version || "NA"; + host.managed = "Yes" // list[i].is_managed === "yes" ? "Yes" : "No"; + + if (host.managed === "Yes") { + host.status = list[i].status; + host.alerts = list[i].alert_counters ? list[i].alert_counters.alert_count : "No Data"; + host.bricks = list[i].bricks_count || "No Data"; + } else { + + if (state === "expanding") { + host.status = "Importing host to expand cluster"; + } else { + host.status = "Not Managed"; + } + + host.bricks = "None"; + host.alerts = "None"; + } + + hostList.push(host); + } + return hostList; + } + }; + + store.getNodeObject = function(hostId) { + var len = store.peerList.length, + i; + + for (i = 0; i < len; i++) { + if (store.peerList[i].id === hostId) { + return store.peerList[i]; + } + } + + return null; + + }; + + store.isAnyHostUnmanaged = function(hostList) { + + return hostList.some(function(host) { + return (host.managed === "No"); + }); + }; + + function _getManagedState(clusters, host) { + var len = clusters.length, + i; + + for (i = 0; i < len; i++) { + if (clusters[i].clusterId === host.integrationId) { + return clusters[i].managed; + } + } + } + + } + +})(); diff --git a/src/commons/stores/volume-store.js b/src/commons/stores/volume-store.js index 7e9059ff..d9210eb4 100644 --- a/src/commons/stores/volume-store.js +++ b/src/commons/stores/volume-store.js @@ -37,13 +37,16 @@ for (i = 0; i < len; i++) { temp = {}; + data[i].brick_count = 0; + data[i].subvols.map((value) => data[i].brick_count = data[i].brick_count + value.bricks.length); if (data[i].deleted !== "True") { - temp.volumeId = data[i].vol_id; - //temp.status = data[i].status !== "Stopped" ? "Running": data[i].status; + temp.volumeId = data[i].id; + temp.subvols = data[i].subvols; + //temp.status = data[i].state !== "Stopped" ? "Running": data[i].state; temp.state = data[i].state; temp.status = data[i].status; temp.name = data[i].name; - temp.type = data[i].vol_type; + temp.type = data[i].type; temp.rebalStatus = data[i].rebal_status; temp.brickCount = data[i].brick_count; temp.alertCount = data[i].alert_counters ? data[i].alert_counters.alert_count : "No Data"; @@ -138,6 +141,34 @@ return deferred.promise; }; + store.startVolume = function(volume, clusterId) { + var deferred; + + deferred = $q.defer(); + volumeFactory.startVolume(volume, clusterId) + .then(function(data) { + deferred.resolve(data); + }).catch(function(e) { + deferred.reject(e); + }); + + return deferred.promise; + }; + + store.stopVolume = function(volume, clusterId) { + var deferred; + + deferred = $q.defer(); + volumeFactory.stopVolume(volume, clusterId) + .then(function(data) { + deferred.resolve(data); + }).catch(function(e) { + deferred.reject(e); + }); + + return deferred.promise; + }; + } })(); diff --git a/src/modules/bricks/volume-bricks/brick-path.html b/src/modules/bricks/volume-bricks/brick-path.html index 3092f9c4..e91799de 100644 --- a/src/modules/bricks/volume-bricks/brick-path.html +++ b/src/modules/bricks/volume-bricks/brick-path.html @@ -1,3 +1,3 @@ - - -{{value.split(":")[1]}} \ No newline at end of file + + +{{value}} diff --git a/src/modules/bricks/volume-bricks/utilization-path.html b/src/modules/bricks/volume-bricks/utilization-path.html index b6b37665..e007bce8 100644 --- a/src/modules/bricks/volume-bricks/utilization-path.html +++ b/src/modules/bricks/volume-bricks/utilization-path.html @@ -1 +1 @@ - \ No newline at end of file + diff --git a/src/modules/bricks/volume-bricks/volume-bricks.html b/src/modules/bricks/volume-bricks/volume-bricks.html index 35f0f8cf..73e8e2c4 100644 --- a/src/modules/bricks/volume-bricks/volume-bricks.html +++ b/src/modules/bricks/volume-bricks/volume-bricks.html @@ -75,8 +75,8 @@

No Bricks Detected

-
- {{subVolume.subVolumeName}} +
+ {{subVolume.name}}
@@ -104,4 +104,4 @@

No Bricks Detected

-
\ No newline at end of file + diff --git a/src/modules/bricks/volume-bricks/volume-bricks.js b/src/modules/bricks/volume-bricks/volume-bricks.js index cae140b6..b61e369c 100644 --- a/src/modules/bricks/volume-bricks/volume-bricks.js +++ b/src/modules/bricks/volume-bricks/volume-bricks.js @@ -37,7 +37,7 @@ vm.filterConfig = { fields: [{ - id: "fqdn", + id: "host", title: "Host Name", placeholder: "Filter by Host Name", filterType: "text" @@ -73,27 +73,27 @@ }; vm.volumeDetailConfig = { - selectionMatchProp: "fqdn", + selectionMatchProp: "host", itemsAvailable: true, showCheckboxes: false }; vm.volumeDetailColumns = [{ header: "Host Name", - itemField: "fqdn" + itemField: "host" }, { header: "Brick Path", - itemField: "brickPath", + itemField: "path", htmlTemplate: "/modules/bricks/volume-bricks/brick-path.html" }, { header: "Utilization", - itemField: "utilization", + itemField: "size", htmlTemplate: "/modules/bricks/volume-bricks/utilization-path.html" }, { header: "Disk Device Path", - itemField: "devices", + itemField: "device", templateFn: function(value, item) { - return value[0]; + return value; } }, { header: "Port", @@ -314,7 +314,7 @@ function _redirectToGrafana(action, brick) { var brickName = brick.brickPath.split(":")[1], - hostName = brick.fqdn.replace(/\./gi, "_"); + hostName = brick.host.replace(/\./gi, "_"); brickName = brickName.replace(/\//gi, "|"); utils.redirectToGrafana("bricks", { clusterId: vm.clusterName, hostName: hostName, brickName: brickName, volumeName: volumeStore.getVolumeObject(vm.volumeId).name }); @@ -346,8 +346,8 @@ utilization = 0, re = new RegExp(filter.value, "i"); - if (filter.id === "fqdn") { - match = brick.fqdn.match(re) !== null; + if (filter.id === "host") { + match = brick.host.match(re) !== null; } else if (filter.id === "brickPath") { //TODO: move this logic to store later on match = (brick.brickPath.split(":")[1]).match(re) !== null; diff --git a/src/modules/clusters/cluster-list/cluster-list.html b/src/modules/clusters/cluster-list/cluster-list.html index 396c7749..3bacf559 100644 --- a/src/modules/clusters/cluster-list/cluster-list.html +++ b/src/modules/clusters/cluster-list/cluster-list.html @@ -19,6 +19,7 @@
{{clusterCntrl.filteredCluster
+ diff --git a/src/modules/clusters/cluster-list/cluster-list.js b/src/modules/clusters/cluster-list/cluster-list.js index 03d71f3b..a2fef04c 100644 --- a/src/modules/clusters/cluster-list/cluster-list.js +++ b/src/modules/clusters/cluster-list/cluster-list.js @@ -353,7 +353,7 @@ * @memberOf clusterController */ function goToImportFlow(cluster) { - $state.go("import-cluster", { clusterId: cluster.integrationId }); + $state.go("import-cluster"); } function goToClusterHost(cluster) { diff --git a/src/modules/clusters/cluster-list/cluster-list.scss b/src/modules/clusters/cluster-list/cluster-list.scss index 5cf42e9b..de2ddbc6 100644 --- a/src/modules/clusters/cluster-list/cluster-list.scss +++ b/src/modules/clusters/cluster-list/cluster-list.scss @@ -134,4 +134,11 @@ .toolbar-pf-results>span { display: none; } + .btn { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + margin-left: 5px; + } + } diff --git a/src/modules/clusters/import-cluster/import-cluster.html b/src/modules/clusters/import-cluster/import-cluster.html index e259cf96..7ad4bb04 100644 --- a/src/modules/clusters/import-cluster/import-cluster.html +++ b/src/modules/clusters/import-cluster/import-cluster.html @@ -32,6 +32,24 @@

Import Cluster

Only alphanumeric and underscore characters are allowed.
+
+ +
+
+ +
+
URL
+
+
+
+ +
+
+ +
+
Only alphanumeric and underscore characters are allowed.
+
+

Ensure all hosts in the cluster are listed below, then click Import to begin importing the cluster.

@@ -48,37 +66,37 @@

Volume Profiling

-

Discovered Host(s)

-
-
-
-
- -
-
- -
- -
-
-

{{vm.filteredHostList.length}} of {{vm.hostList.length}} Discovered -- --

-
-
-
-
-
- -
-

No Hosts Detected

-
-
-
- - -
-
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
-
+
@@ -103,4 +121,4 @@

- \ No newline at end of file + diff --git a/src/modules/clusters/import-cluster/import-cluster.js b/src/modules/clusters/import-cluster/import-cluster.js index 38df194c..918b3aa4 100644 --- a/src/modules/clusters/import-cluster/import-cluster.js +++ b/src/modules/clusters/import-cluster/import-cluster.js @@ -7,9 +7,6 @@ restrict: "E", templateUrl: "/modules/clusters/import-cluster/import-cluster.html", - bindings: { - cluster: "=" - }, controller: importClusterController, controllerAs: "vm" }); @@ -107,26 +104,24 @@ * @memberOf importClusterController */ function init() { - vm.clusterId = $stateParams.clusterId; - - if (!$rootScope.clusterData) { - clusterStore.getClusterList() - .then(function(data) { - _setImportDetail(); - vm.filteredHostList = vm.hostList; - _filterChange(vm.filters); - }).catch(function(e) { - vm.hostList = []; - vm.filteredHostList = vm.hostList; - }).finally(function() { - vm.isDataLoading = false; - }); - } else { - _setImportDetail(); - vm.filteredHostList = vm.hostList; - vm.isDataLoading = false; - _filterChange(vm.filters); - } + //if (!$rootScope.clusterData) { + //clusterStore.getClusterList() + //.then(function(data) { + //_setImportDetail(); + //vm.filteredHostList = vm.hostList; + //_filterChange(vm.filters); + //}).catch(function(e) { + //vm.hostList = []; + //vm.filteredHostList = vm.hostList; + //}).finally(function() { + //vm.isDataLoading = false; + //}); + //} else { + //_setImportDetail(); + //vm.filteredHostList = vm.hostList; + //vm.isDataLoading = false; + //_filterChange(vm.filters); + //} } /** @@ -135,19 +130,18 @@ * @memberOf importClusterController */ function importCluster() { - - if (_validateFields()) { - clusterStore.importCluster(vm.clusterId, vm.enableProfiling, vm.clusterName) + //if (_validateFields()) { + clusterStore.importCluster(vm.gd2Url, vm.secret, vm.clusterName) .then(function(data) { vm.importIcon = true; vm.taskInitiated = true; - vm.jobId = data.job_id; + vm.jobId = data['cluster-id']; }).catch(function(e) { vm.importIcon = false; vm.taskInitiated = false; Notifications.message("danger", "", "Failed to initaite import."); }); - } + //} } /** @@ -253,4 +247,4 @@ } } -})(); \ No newline at end of file +})(); diff --git a/src/modules/events/event-list/event-list.html b/src/modules/events/event-list/event-list.html index 823d3c5e..3e647030 100644 --- a/src/modules/events/event-list/event-list.html +++ b/src/modules/events/event-list/event-list.html @@ -74,7 +74,7 @@

No Events Detected

-
{{event.message || "NA"}}
+
{{event.name}}
{{event.timeStamp| date: 'dd MMM yyyy HH:mm:ss'}}
@@ -85,4 +85,4 @@

No Events Detected

-
\ No newline at end of file +
diff --git a/src/modules/hosts/host-list/host-list.js b/src/modules/hosts/host-list/host-list.js index 09600b5a..3a96a955 100644 --- a/src/modules/hosts/host-list/host-list.js +++ b/src/modules/hosts/host-list/host-list.js @@ -15,7 +15,7 @@ }); /*@ngInject*/ - function hostController($scope, $filter, $rootScope, $state, $interval, $uibModal, utils, config, nodeStore, clusterStore) { + function hostController($scope, $filter, $rootScope, $state, $interval, $uibModal, utils, config, peerStore, clusterStore) { var vm = this, clusterObj, hostListTimer; @@ -139,7 +139,7 @@ itemField: "ipAddress" }]; - nodeStore.getNodeList(vm.expandCluster.clusterId) + peerStore.getNodeList(vm.expandCluster.clusterId) .then(function(list) { vm.expandCluster.hostList = $filter("filter")(list, { managed: "No" }); vm.expandCluster.filteredHostList = vm.expandCluster.hostList; @@ -175,7 +175,7 @@ .then(function(data) { $interval.cancel(hostListTimer); vm.cluster = data; - return nodeStore.getNodeList(vm.clusterId, vm.cluster.state); + return peerStore.getNodeList(vm.clusterId, vm.cluster.state); }).catch(function(e) { vm.cluster = {}; }) @@ -223,9 +223,9 @@ cls = "pficon pficon-in-progress"; } else if (host.managed === "No") { cls = "fa ffont fa-question"; - } else if (host.status === "DOWN") { + } else if (host.online === false) { cls = "fa ffont fa-arrow-circle-o-down"; - } else if (host.status === "UP") { + } else if (host.online === true) { cls = "pficon pficon-ok"; } diff --git a/src/modules/volumes/volume-list/volume-list.html b/src/modules/volumes/volume-list/volume-list.html index 6b9a1226..934093a3 100644 --- a/src/modules/volumes/volume-list/volume-list.html +++ b/src/modules/volumes/volume-list/volume-list.html @@ -46,7 +46,7 @@

No Volumes Detected

- +
@@ -57,8 +57,8 @@

No Volumes Detected

{{volume.brickCount}}
-
Running
-
{{volume.status === 'Stopped'? "No": "Yes"}}
+
Status
+
{{volume.state}}
Rebalance
@@ -76,6 +76,8 @@

No Volumes Detected

+ +
@@ -85,4 +87,4 @@

No Volumes Detected

-
\ No newline at end of file + diff --git a/src/modules/volumes/volume-list/volume-list.js b/src/modules/volumes/volume-list/volume-list.js index 8e8a94d8..cc52587b 100644 --- a/src/modules/volumes/volume-list/volume-list.js +++ b/src/modules/volumes/volume-list/volume-list.js @@ -29,6 +29,8 @@ vm.getRebalStatus = volumeStore.getRebalStatus; vm.redirectToGrafana = redirectToGrafana; + vm.startVolume = startVolume; + vm.stopVolume = stopVolume; vm.goToVolumeDetail = goToVolumeDetail; vm.addTooltip = addTooltip; vm.toggleProfiling = toggleProfiling; @@ -118,21 +120,20 @@ } function getVolumeIcon(state) { - var cls; cls = "fa ffont fa-question"; - if (state.indexOf("up") !== -1) { + if (state.indexOf("Started") !== -1) { cls = "pficon pficon-ok"; - } else if (state.indexOf("down") !== -1) { + } else if (state.indexOf("Stopped") !== -1) { cls = "fa ffont fa-arrow-circle-o-down"; - } else if (state.indexOf("partial") !== -1) { - cls = "pficon pficon-degraded icon-red"; - } else if (state.indexOf("degraded") !== -1) { - cls = "pficon pficon-degraded icon-orange"; - } else if (state.indexOf("unknown") !== -1) { - cls = "fa ffont fa-question"; - } + } else if (state.indexOf("Created") !== -1) { + cls = "pficon pficon-pending icon-green"; + } //else if (state.indexOf("degraded") !== -1) { + //cls = "pficon pficon-degraded icon-orange"; + //} else if (state.indexOf("unknown") !== -1) { + // cls = "fa ffont fa-question"; + //} return cls; } @@ -178,6 +179,16 @@ }); } + function startVolume(volume, $event) { + volumeStore.startVolume(volume, vm.clusterId).then(() => init()); + $event.stopPropagation(); + } + + function stopVolume(volume, $event) { + volumeStore.stopVolume(volume, vm.clusterId).then(() => init()); + $event.stopPropagation(); + } + function goToVolumeDetail(volume) { if (vm.clusterId) { $state.go("volume-detail", { clusterId: vm.clusterId, volumeId: volume.volumeId }); @@ -275,4 +286,4 @@ } -})(); \ No newline at end of file +})();