Minor UI improvements.
This commit is contained in:
parent
3284f93e3f
commit
a16e5319a4
@ -24,20 +24,23 @@ const js_beautify = beautify.js;
|
|||||||
|
|
||||||
/*@ngInject*/
|
/*@ngInject*/
|
||||||
export default function AlarmDetailsDialogController($mdDialog, $filter, $translate, types,
|
export default function AlarmDetailsDialogController($mdDialog, $filter, $translate, types,
|
||||||
alarmService, alarmId, allowAcknowledgment, allowClear, showingCallback) {
|
alarmService, alarmId, allowAcknowledgment, allowClear, displayDetails, showingCallback) {
|
||||||
|
|
||||||
var vm = this;
|
var vm = this;
|
||||||
|
|
||||||
vm.alarmId = alarmId;
|
vm.alarmId = alarmId;
|
||||||
vm.allowAcknowledgment = allowAcknowledgment;
|
vm.allowAcknowledgment = allowAcknowledgment;
|
||||||
vm.allowClear = allowClear;
|
vm.allowClear = allowClear;
|
||||||
|
vm.displayDetails = displayDetails;
|
||||||
vm.types = types;
|
vm.types = types;
|
||||||
vm.alarm = null;
|
vm.alarm = null;
|
||||||
|
|
||||||
vm.alarmUpdated = false;
|
vm.alarmUpdated = false;
|
||||||
|
|
||||||
showingCallback.onShowing = function(scope, element) {
|
showingCallback.onShowing = function(scope, element) {
|
||||||
updateEditorSize(element);
|
if (vm.displayDetails) {
|
||||||
|
updateEditorSize(element);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vm.alarmDetailsOptions = {
|
vm.alarmDetailsOptions = {
|
||||||
|
|||||||
@ -74,8 +74,8 @@
|
|||||||
<input ng-model="vm.alarmStatus" readonly>
|
<input ng-model="vm.alarmStatus" readonly>
|
||||||
</md-input-container>
|
</md-input-container>
|
||||||
</div>
|
</div>
|
||||||
<div class="md-caption" style="padding-left: 3px; padding-bottom: 10px; color: rgba(0,0,0,0.57);" translate>alarm.details</div>
|
<div ng-if="vm.displayDetails" class="md-caption" style="padding-left: 3px; padding-bottom: 10px; color: rgba(0,0,0,0.57);" translate>alarm.details</div>
|
||||||
<div flex class="tb-alarm-details-panel" layout="column">
|
<div ng-if="vm.displayDetails" flex class="tb-alarm-details-panel" layout="column">
|
||||||
<div flex id="tb-alarm-details" readonly
|
<div flex id="tb-alarm-details" readonly
|
||||||
ui-ace="vm.alarmDetailsOptions"
|
ui-ace="vm.alarmDetailsOptions"
|
||||||
ng-model="vm.alarmDetails">
|
ng-model="vm.alarmDetails">
|
||||||
|
|||||||
@ -44,6 +44,7 @@ export default function AlarmRowDirective($compile, $templateCache, types, $mdDi
|
|||||||
alarmId: scope.alarm.id.id,
|
alarmId: scope.alarm.id.id,
|
||||||
allowAcknowledgment: true,
|
allowAcknowledgment: true,
|
||||||
allowClear: true,
|
allowClear: true,
|
||||||
|
displayDetails: true,
|
||||||
showingCallback: onShowingCallback
|
showingCallback: onShowingCallback
|
||||||
},
|
},
|
||||||
parent: angular.element($document[0].body),
|
parent: angular.element($document[0].body),
|
||||||
|
|||||||
@ -22,6 +22,8 @@ export default function DefaultStateController($scope, $timeout, $location, $sta
|
|||||||
|
|
||||||
vm.inited = false;
|
vm.inited = false;
|
||||||
|
|
||||||
|
vm.skipStateChange = false;
|
||||||
|
|
||||||
vm.openState = openState;
|
vm.openState = openState;
|
||||||
vm.updateState = updateState;
|
vm.updateState = updateState;
|
||||||
vm.resetState = resetState;
|
vm.resetState = resetState;
|
||||||
@ -48,10 +50,9 @@ export default function DefaultStateController($scope, $timeout, $location, $sta
|
|||||||
params: params
|
params: params
|
||||||
}
|
}
|
||||||
//append new state
|
//append new state
|
||||||
stopWatchStateObject();
|
|
||||||
vm.stateObject[0] = newState;
|
vm.stateObject[0] = newState;
|
||||||
gotoState(vm.stateObject[0].id, true, openRightLayout);
|
gotoState(vm.stateObject[0].id, true, openRightLayout);
|
||||||
watchStateObject();
|
vm.skipStateChange = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,10 +69,9 @@ export default function DefaultStateController($scope, $timeout, $location, $sta
|
|||||||
params: params
|
params: params
|
||||||
}
|
}
|
||||||
//replace with new state
|
//replace with new state
|
||||||
stopWatchStateObject();
|
|
||||||
vm.stateObject[0] = newState;
|
vm.stateObject[0] = newState;
|
||||||
gotoState(vm.stateObject[0].id, true, openRightLayout);
|
gotoState(vm.stateObject[0].id, true, openRightLayout);
|
||||||
watchStateObject();
|
vm.skipStateChange = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,10 +87,9 @@ export default function DefaultStateController($scope, $timeout, $location, $sta
|
|||||||
|
|
||||||
function navigatePrevState(index) {
|
function navigatePrevState(index) {
|
||||||
if (index < vm.stateObject.length-1) {
|
if (index < vm.stateObject.length-1) {
|
||||||
stopWatchStateObject();
|
|
||||||
vm.stateObject.splice(index+1, vm.stateObject.length-index-1);
|
vm.stateObject.splice(index+1, vm.stateObject.length-index-1);
|
||||||
gotoState(vm.stateObject[vm.stateObject.length-1].id, true);
|
gotoState(vm.stateObject[vm.stateObject.length-1].id, true);
|
||||||
watchStateObject();
|
vm.skipStateChange = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,31 +220,23 @@ export default function DefaultStateController($scope, $timeout, $location, $sta
|
|||||||
|
|
||||||
$scope.$watch('vm.dashboardCtrl.dashboardCtx.state', function () {
|
$scope.$watch('vm.dashboardCtrl.dashboardCtx.state', function () {
|
||||||
if (vm.stateObject[0].id !== vm.dashboardCtrl.dashboardCtx.state) {
|
if (vm.stateObject[0].id !== vm.dashboardCtrl.dashboardCtx.state) {
|
||||||
stopWatchStateObject();
|
|
||||||
vm.stateObject[0].id = vm.dashboardCtrl.dashboardCtx.state;
|
vm.stateObject[0].id = vm.dashboardCtrl.dashboardCtx.state;
|
||||||
updateLocation();
|
updateLocation();
|
||||||
watchStateObject();
|
vm.skipStateChange = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
watchStateObject();
|
$scope.$watch('vm.stateObject', function(newVal, prevVal) {
|
||||||
|
if (!angular.equals(newVal, prevVal) && newVal) {
|
||||||
|
if (vm.skipStateChange) {
|
||||||
|
vm.skipStateChange = false;
|
||||||
|
} else {
|
||||||
|
gotoState(vm.stateObject[0].id, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function stopWatchStateObject() {
|
|
||||||
if (vm.stateObjectWatcher) {
|
|
||||||
vm.stateObjectWatcher();
|
|
||||||
vm.stateObjectWatcher = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function watchStateObject() {
|
|
||||||
vm.stateObjectWatcher = $scope.$watch('vm.stateObject', function(newVal, prevVal) {
|
|
||||||
if (!angular.equals(newVal, prevVal) && newVal) {
|
|
||||||
gotoState(vm.stateObject[0].id, true);
|
|
||||||
}
|
|
||||||
}, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
function gotoState(stateId, update, openRightLayout) {
|
function gotoState(stateId, update, openRightLayout) {
|
||||||
if (vm.dashboardCtrl.dashboardCtx.state != stateId) {
|
if (vm.dashboardCtrl.dashboardCtx.state != stateId) {
|
||||||
vm.dashboardCtrl.openDashboardState(stateId, openRightLayout);
|
vm.dashboardCtrl.openDashboardState(stateId, openRightLayout);
|
||||||
|
|||||||
@ -24,6 +24,8 @@ export default function EntityStateController($scope, $timeout, $location, $stat
|
|||||||
|
|
||||||
vm.inited = false;
|
vm.inited = false;
|
||||||
|
|
||||||
|
vm.skipStateChange = false;
|
||||||
|
|
||||||
vm.openState = openState;
|
vm.openState = openState;
|
||||||
vm.updateState = updateState;
|
vm.updateState = updateState;
|
||||||
vm.resetState = resetState;
|
vm.resetState = resetState;
|
||||||
@ -50,11 +52,10 @@ export default function EntityStateController($scope, $timeout, $location, $stat
|
|||||||
params: params
|
params: params
|
||||||
}
|
}
|
||||||
//append new state
|
//append new state
|
||||||
stopWatchStateObject();
|
|
||||||
vm.stateObject.push(newState);
|
vm.stateObject.push(newState);
|
||||||
vm.selectedStateIndex = vm.stateObject.length-1;
|
vm.selectedStateIndex = vm.stateObject.length-1;
|
||||||
gotoState(vm.stateObject[vm.stateObject.length-1].id, true, openRightLayout);
|
gotoState(vm.stateObject[vm.stateObject.length-1].id, true, openRightLayout);
|
||||||
watchStateObject();
|
vm.skipStateChange = true;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -73,10 +74,9 @@ export default function EntityStateController($scope, $timeout, $location, $stat
|
|||||||
params: params
|
params: params
|
||||||
}
|
}
|
||||||
//replace with new state
|
//replace with new state
|
||||||
stopWatchStateObject();
|
|
||||||
vm.stateObject[vm.stateObject.length - 1] = newState;
|
vm.stateObject[vm.stateObject.length - 1] = newState;
|
||||||
gotoState(vm.stateObject[vm.stateObject.length - 1].id, true, openRightLayout);
|
gotoState(vm.stateObject[vm.stateObject.length - 1].id, true, openRightLayout);
|
||||||
watchStateObject();
|
vm.skipStateChange = true;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -94,11 +94,10 @@ export default function EntityStateController($scope, $timeout, $location, $stat
|
|||||||
|
|
||||||
function navigatePrevState(index) {
|
function navigatePrevState(index) {
|
||||||
if (index < vm.stateObject.length-1) {
|
if (index < vm.stateObject.length-1) {
|
||||||
stopWatchStateObject();
|
|
||||||
vm.stateObject.splice(index+1, vm.stateObject.length-index-1);
|
vm.stateObject.splice(index+1, vm.stateObject.length-index-1);
|
||||||
vm.selectedStateIndex = vm.stateObject.length-1;
|
vm.selectedStateIndex = vm.stateObject.length-1;
|
||||||
gotoState(vm.stateObject[vm.stateObject.length-1].id, true);
|
gotoState(vm.stateObject[vm.stateObject.length-1].id, true);
|
||||||
watchStateObject();
|
vm.skipStateChange = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,14 +265,22 @@ export default function EntityStateController($scope, $timeout, $location, $stat
|
|||||||
|
|
||||||
$scope.$watch('vm.dashboardCtrl.dashboardCtx.state', function () {
|
$scope.$watch('vm.dashboardCtrl.dashboardCtx.state', function () {
|
||||||
if (vm.stateObject[vm.stateObject.length - 1].id !== vm.dashboardCtrl.dashboardCtx.state) {
|
if (vm.stateObject[vm.stateObject.length - 1].id !== vm.dashboardCtrl.dashboardCtx.state) {
|
||||||
stopWatchStateObject();
|
|
||||||
vm.stateObject[vm.stateObject.length - 1].id = vm.dashboardCtrl.dashboardCtx.state;
|
vm.stateObject[vm.stateObject.length - 1].id = vm.dashboardCtrl.dashboardCtx.state;
|
||||||
updateLocation();
|
updateLocation();
|
||||||
watchStateObject();
|
vm.skipStateChange = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
watchStateObject();
|
$scope.$watch('vm.stateObject', function(newVal, prevVal) {
|
||||||
|
if (!angular.equals(newVal, prevVal) && newVal) {
|
||||||
|
if (vm.skipStateChange) {
|
||||||
|
vm.skipStateChange = false;
|
||||||
|
} else {
|
||||||
|
vm.selectedStateIndex = vm.stateObject.length - 1;
|
||||||
|
gotoState(vm.stateObject[vm.stateObject.length - 1].id, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, true);
|
||||||
|
|
||||||
if (vm.dashboardCtrl.isMobile) {
|
if (vm.dashboardCtrl.isMobile) {
|
||||||
watchSelectedStateIndex();
|
watchSelectedStateIndex();
|
||||||
@ -292,22 +299,6 @@ export default function EntityStateController($scope, $timeout, $location, $stat
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function stopWatchStateObject() {
|
|
||||||
if (vm.stateObjectWatcher) {
|
|
||||||
vm.stateObjectWatcher();
|
|
||||||
vm.stateObjectWatcher = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function watchStateObject() {
|
|
||||||
vm.stateObjectWatcher = $scope.$watch('vm.stateObject', function(newVal, prevVal) {
|
|
||||||
if (!angular.equals(newVal, prevVal) && newVal) {
|
|
||||||
vm.selectedStateIndex = vm.stateObject.length-1;
|
|
||||||
gotoState(vm.stateObject[vm.stateObject.length-1].id, true);
|
|
||||||
}
|
|
||||||
}, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
function stopWatchSelectedStateIndex() {
|
function stopWatchSelectedStateIndex() {
|
||||||
if (vm.selectedStateIndexWatcher) {
|
if (vm.selectedStateIndexWatcher) {
|
||||||
vm.selectedStateIndexWatcher();
|
vm.selectedStateIndexWatcher();
|
||||||
|
|||||||
@ -333,6 +333,7 @@ function AlarmsTableWidgetController($element, $scope, $filter, $mdMedia, $mdDia
|
|||||||
alarmId: alarm.id.id,
|
alarmId: alarm.id.id,
|
||||||
allowAcknowledgment: vm.allowAcknowledgment,
|
allowAcknowledgment: vm.allowAcknowledgment,
|
||||||
allowClear: vm.allowClear,
|
allowClear: vm.allowClear,
|
||||||
|
displayDetails: true,
|
||||||
showingCallback: onShowingCallback
|
showingCallback: onShowingCallback
|
||||||
},
|
},
|
||||||
parent: angular.element($document[0].body),
|
parent: angular.element($document[0].body),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user