Minor UI improvements.
This commit is contained in:
parent
3284f93e3f
commit
a16e5319a4
@ -24,20 +24,23 @@ const js_beautify = beautify.js;
|
||||
|
||||
/*@ngInject*/
|
||||
export default function AlarmDetailsDialogController($mdDialog, $filter, $translate, types,
|
||||
alarmService, alarmId, allowAcknowledgment, allowClear, showingCallback) {
|
||||
alarmService, alarmId, allowAcknowledgment, allowClear, displayDetails, showingCallback) {
|
||||
|
||||
var vm = this;
|
||||
|
||||
vm.alarmId = alarmId;
|
||||
vm.allowAcknowledgment = allowAcknowledgment;
|
||||
vm.allowClear = allowClear;
|
||||
vm.displayDetails = displayDetails;
|
||||
vm.types = types;
|
||||
vm.alarm = null;
|
||||
|
||||
vm.alarmUpdated = false;
|
||||
|
||||
showingCallback.onShowing = function(scope, element) {
|
||||
updateEditorSize(element);
|
||||
if (vm.displayDetails) {
|
||||
updateEditorSize(element);
|
||||
}
|
||||
}
|
||||
|
||||
vm.alarmDetailsOptions = {
|
||||
|
||||
@ -74,8 +74,8 @@
|
||||
<input ng-model="vm.alarmStatus" readonly>
|
||||
</md-input-container>
|
||||
</div>
|
||||
<div 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" 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" flex class="tb-alarm-details-panel" layout="column">
|
||||
<div flex id="tb-alarm-details" readonly
|
||||
ui-ace="vm.alarmDetailsOptions"
|
||||
ng-model="vm.alarmDetails">
|
||||
|
||||
@ -44,6 +44,7 @@ export default function AlarmRowDirective($compile, $templateCache, types, $mdDi
|
||||
alarmId: scope.alarm.id.id,
|
||||
allowAcknowledgment: true,
|
||||
allowClear: true,
|
||||
displayDetails: true,
|
||||
showingCallback: onShowingCallback
|
||||
},
|
||||
parent: angular.element($document[0].body),
|
||||
|
||||
@ -22,6 +22,8 @@ export default function DefaultStateController($scope, $timeout, $location, $sta
|
||||
|
||||
vm.inited = false;
|
||||
|
||||
vm.skipStateChange = false;
|
||||
|
||||
vm.openState = openState;
|
||||
vm.updateState = updateState;
|
||||
vm.resetState = resetState;
|
||||
@ -48,10 +50,9 @@ export default function DefaultStateController($scope, $timeout, $location, $sta
|
||||
params: params
|
||||
}
|
||||
//append new state
|
||||
stopWatchStateObject();
|
||||
vm.stateObject[0] = newState;
|
||||
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
|
||||
}
|
||||
//replace with new state
|
||||
stopWatchStateObject();
|
||||
vm.stateObject[0] = newState;
|
||||
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) {
|
||||
if (index < vm.stateObject.length-1) {
|
||||
stopWatchStateObject();
|
||||
vm.stateObject.splice(index+1, vm.stateObject.length-index-1);
|
||||
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 () {
|
||||
if (vm.stateObject[0].id !== vm.dashboardCtrl.dashboardCtx.state) {
|
||||
stopWatchStateObject();
|
||||
vm.stateObject[0].id = vm.dashboardCtrl.dashboardCtx.state;
|
||||
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) {
|
||||
if (vm.dashboardCtrl.dashboardCtx.state != stateId) {
|
||||
vm.dashboardCtrl.openDashboardState(stateId, openRightLayout);
|
||||
|
||||
@ -24,6 +24,8 @@ export default function EntityStateController($scope, $timeout, $location, $stat
|
||||
|
||||
vm.inited = false;
|
||||
|
||||
vm.skipStateChange = false;
|
||||
|
||||
vm.openState = openState;
|
||||
vm.updateState = updateState;
|
||||
vm.resetState = resetState;
|
||||
@ -50,11 +52,10 @@ export default function EntityStateController($scope, $timeout, $location, $stat
|
||||
params: params
|
||||
}
|
||||
//append new state
|
||||
stopWatchStateObject();
|
||||
vm.stateObject.push(newState);
|
||||
vm.selectedStateIndex = vm.stateObject.length-1;
|
||||
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
|
||||
}
|
||||
//replace with new state
|
||||
stopWatchStateObject();
|
||||
vm.stateObject[vm.stateObject.length - 1] = newState;
|
||||
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) {
|
||||
if (index < vm.stateObject.length-1) {
|
||||
stopWatchStateObject();
|
||||
vm.stateObject.splice(index+1, vm.stateObject.length-index-1);
|
||||
vm.selectedStateIndex = vm.stateObject.length-1;
|
||||
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 () {
|
||||
if (vm.stateObject[vm.stateObject.length - 1].id !== vm.dashboardCtrl.dashboardCtx.state) {
|
||||
stopWatchStateObject();
|
||||
vm.stateObject[vm.stateObject.length - 1].id = vm.dashboardCtrl.dashboardCtx.state;
|
||||
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) {
|
||||
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() {
|
||||
if (vm.selectedStateIndexWatcher) {
|
||||
vm.selectedStateIndexWatcher();
|
||||
|
||||
@ -333,6 +333,7 @@ function AlarmsTableWidgetController($element, $scope, $filter, $mdMedia, $mdDia
|
||||
alarmId: alarm.id.id,
|
||||
allowAcknowledgment: vm.allowAcknowledgment,
|
||||
allowClear: vm.allowClear,
|
||||
displayDetails: true,
|
||||
showingCallback: onShowingCallback
|
||||
},
|
||||
parent: angular.element($document[0].body),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user