You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2021/07/15 10:40:13 UTC
[brooklyn-ui] 05/09: fixes for issues related to logbook
This is an automated email from the ASF dual-hosted git repository.
heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git
commit 27c02fbfdf459cbca427539e63a7995767610994
Author: zan-mateusz <ma...@cloudsoftcorp.com>
AuthorDate: Wed Jul 14 13:59:14 2021 +0100
fixes for issues related to logbook
---
.../home/app/views/about/about.controller.js | 68 +++++++++-------------
.../home/app/views/about/about.template.html | 30 +++++-----
2 files changed, 42 insertions(+), 56 deletions(-)
diff --git a/ui-modules/home/app/views/about/about.controller.js b/ui-modules/home/app/views/about/about.controller.js
index cafdf23..86479d6 100644
--- a/ui-modules/home/app/views/about/about.controller.js
+++ b/ui-modules/home/app/views/about/about.controller.js
@@ -64,10 +64,9 @@ export function aboutStateConfig($stateProvider) {
export function aboutStateController($scope, $element, $q, $uibModal, brBrandInfo, version, states, serverApi) {
$scope.$emit(HIDE_INTERSTITIAL_SPINNER_EVENT);
$scope.getBrandedText = brBrandInfo.getBrandedText;
- this.serverApi = serverApi;
- this.serverVersion = version.data;
- this.states = states.data;
- this.buildInfo = {
+ $scope.serverVersion = version.data;
+ $scope.states = states.data;
+ $scope.buildInfo = {
buildVersion: BUILD_VERSION,
buildName: BUILD_NAME,
buildBranch: BUILD_BRANCH,
@@ -75,34 +74,31 @@ export function aboutStateController($scope, $element, $q, $uibModal, brBrandInf
brooklynVersion: BROOKLYN_VERSION,
};
- this.container = $element[0];
- this.now = Date.now();
- this.expectedNodeCounter = Object.keys(this.states.nodes).length;
- this.template = 'haStatusTemplate';
+ $scope.container = $element[0];
+ $scope.now = Date.now();
+ $scope.expectedNodeCounter = Object.keys($scope.states.nodes).length;
+ $scope.template = 'haStatusTemplate';
let modalInstance = null;
- this.openDialog = function (states, nodeId, serverApi, container) {
+ $scope.openDialog = function (states, container) {
if (!modalInstance) {
modalInstance = $uibModal.open({
template: nodeManagementTemplate,
- controller: ['$scope', '$uibModalInstance', 'node', 'serverApi', nodeManagementController],
+ controller: ['$scope', '$uibModalInstance', 'node', nodeManagementModalController],
controllerAs: 'vm',
backdrop: 'static',
windowClass: 'quick-launch-modal',
size: 'md',
resolve: {
node: function () {
- return states.nodes[nodeId];
- },
- serverApi: function () {
- return serverApi;
+ return states.nodes[states.ownId];
}
}
});
modalInstance.result.then(
(promiseList) => {
- this.template = 'spinnerTemplate';
+ $scope.template = 'spinnerTemplate';
Promise.allSettled(promiseList).then((values) => {
let event = new CustomEvent('update-states', {});
container.dispatchEvent(event);
@@ -110,7 +106,7 @@ export function aboutStateController($scope, $element, $q, $uibModal, brBrandInf
modalInstance = null;
},
() => {
- this.template = 'spinnerTemplate';
+ $scope.template = 'spinnerTemplate';
let event = new CustomEvent('update-states', {});
container.dispatchEvent(event);
modalInstance = null;
@@ -120,7 +116,7 @@ export function aboutStateController($scope, $element, $q, $uibModal, brBrandInf
};
- function nodeManagementController($scope, $uibModalInstance, node, serverApi) {
+ function nodeManagementModalController($scope, $uibModalInstance, node) {
let vm = this;
@@ -131,16 +127,6 @@ export function aboutStateController($scope, $element, $q, $uibModal, brBrandInf
vm.now = Date.now();
vm.showEditOptions = false;
- vm.setHaStatus = function () {
- let result = serverApi.setHaStatus(vm.newStatus);
- vm.node.status = vm.newStatus;
- }
-
- vm.setHaPriority = function () {
- let result = serverApi.setHaPriority(vm.newPriority);
- vm.node.priority = vm.newPriority;
- }
-
vm.applyChangesAndQuit = function () {
let promiseList = [];
if (vm.node.priority !== vm.newPriority) {
@@ -167,38 +153,38 @@ export function aboutStateController($scope, $element, $q, $uibModal, brBrandInf
}
- this.removeNode = function (nodeId) {
- this.template = 'spinnerTemplate';
+ $scope.removeNode = function (nodeId) {
+ $scope.template = 'spinnerTemplate';
let removeNode = serverApi.removeHaTerminatedNode(nodeId);
removeNode.then(data => {
- this.expectedNodeCounter--;
+ $scope.expectedNodeCounter--;
let event = new CustomEvent('update-states', {});
- this.container.dispatchEvent(event);
+ $scope.container.dispatchEvent(event);
});
}
- this.removeAllTerminatedNodes = function () {
- this.template = 'spinnerTemplate';
+ $scope.removeAllTerminatedNodes = function () {
+ $scope.template = 'spinnerTemplate';
let removeNodes = serverApi.removeHaTerminatedNodes();
removeNodes.then(data => {
- for (const node in this.states.nodes) {
- if (this.states.nodes[node].status === "TERMINATED") this.expectedNodeCounter--;
+ for (const node in $scope.states.nodes) {
+ if ($scope.states.nodes[node].status === "TERMINATED") $scope.expectedNodeCounter--;
}
let event = new CustomEvent('update-states', {});
- this.container.dispatchEvent(event);
+ $scope.container.dispatchEvent(event);
});
}
$element.bind('update-states', (event) => {
let updateStates = serverApi.getHaStates();
updateStates.then(data => {
- if (Object.keys(data.data.nodes).length === this.expectedNodeCounter) {
- this.states = data.data;
- this.now = Date.now();
- this.template = 'haStatusTemplate';
+ if (Object.keys(data.data.nodes).length === $scope.expectedNodeCounter) {
+ $scope.states = data.data;
+ $scope.now = Date.now();
+ $scope.template = 'haStatusTemplate';
} else {
let event = new CustomEvent('update-states', {});
- this.container.dispatchEvent(event);
+ $scope.container.dispatchEvent(event);
}
})
})
diff --git a/ui-modules/home/app/views/about/about.template.html b/ui-modules/home/app/views/about/about.template.html
index 1051df2..db492e3 100644
--- a/ui-modules/home/app/views/about/about.template.html
+++ b/ui-modules/home/app/views/about/about.template.html
@@ -32,19 +32,19 @@
<h2>Version Information</h2>
<ul class="list-group">
- <li class="list-group-item" ng-if="vm.buildInfo.buildVersion">
+ <li class="list-group-item" ng-if="buildInfo.buildVersion">
<span class="badge">
- {{vm.buildInfo.buildVersion}}
+ {{buildInfo.buildVersion}}
</span>
<h4 class="list-group-item-heading">{{ getBrandedText('product.name') }}</h4>
</li>
<li class="list-group-item">
- <span class="badge">{{vm.buildInfo.brooklynVersion}}</span>
+ <span class="badge">{{buildInfo.brooklynVersion}}</span>
<h4 class="list-group-item-heading">Apache Brooklyn UI</h4>
- <small class="list-group-item-text" ng-if="vm.buildInfo.buildBranch || vm.buildInfo.buildCommitId">
+ <small class="list-group-item-text" ng-if="buildInfo.buildBranch || buildInfo.buildCommitId">
Built from
- <span ng-if="vm.buildInfo.buildBranch">branch <strong>{{vm.buildInfo.buildBranch}}</strong></span>
- <span ng-if="vm.buildInfo.buildCommitId">commit <strong>{{vm.buildInfo.buildCommitId}}</strong></span>
+ <span ng-if="buildInfo.buildBranch">branch <strong>{{buildInfo.buildBranch}}</strong></span>
+ <span ng-if="buildInfo.buildCommitId">commit <strong>{{buildInfo.buildCommitId}}</strong></span>
</small>
</li>
<li class="list-group-item">
@@ -56,12 +56,12 @@
<h2>
HA status
- <button ng-if="vm.states.nodes[vm.states.ownId].status === 'MASTER'"
- ng-click="vm.removeAllTerminatedNodes()" class="btn btn-sm btn-default"
+ <button ng-if="states.nodes[states.ownId].status === 'MASTER'"
+ ng-click="removeAllTerminatedNodes()" class="btn btn-sm btn-default"
style="float: right;">Remove terminated nodes</button>
</h2>
- <ng-include src="vm.template"></ng-include>
+ <ng-include src="template"></ng-include>
<script type="text/ng-template" id="haStatusTemplate">
@@ -73,19 +73,19 @@
</tr>
</thead>
<tbody>
- <tr ng-repeat="node in vm.states.nodes track by node.nodeId"
+ <tr ng-repeat="node in states.nodes track by node.nodeId"
ng-class="{success: node.state === 'online', danger: node.state === 'offline'}"
ng-mouseover="row = $index" ng-mouseleave="row = -1">
<td>
{{node.nodeId}}
<button class="btn btn-sm btn-default" style="float: right;"
- ng-if="node.nodeId === vm.states.ownId"
- ng-click="vm.openDialog(vm.states, vm.states.ownId, vm.serverApi, vm.container)"
+ ng-if="node.nodeId === states.ownId"
+ ng-click="openDialog(states, container)"
ng-show="row == $index">Manage</button>
<button class="btn btn-sm btn-default" style="float: right;"
- ng-if="(node.status === 'TERMINATED') && (vm.states.nodes[vm.states.ownId].status === 'MASTER')"
- ng-click="vm.removeNode(node.nodeId)" ng-show="row == $index">Remove</button>
- <span ng-if="node.nodeId === vm.states.ownId" class="label label-info">current</span>
+ ng-if="(node.status === 'TERMINATED') && (states.nodes[states.ownId].status === 'MASTER')"
+ ng-click="removeNode(node.nodeId)" ng-show="row == $index">Remove</button>
+ <span ng-if="node.nodeId === states.ownId" class="label label-info">current</span>
<span ng-if="node.status === 'MASTER'" class="label label-success">master</span><br>
</td>
<td>