[ISSUE #22]Optimizing the ops page. (#23)

Co-authored-by: zhangjidi <zhangjidi@cmss.chinamobile.com>
This commit is contained in:
zhangjidi2016
2021-09-27 11:35:00 +08:00
committed by GitHub
parent 8b12e8e7d7
commit 9e9762ef44
2 changed files with 10 additions and 4 deletions

View File

@@ -16,17 +16,18 @@
*/ */
app.controller('opsController', ['$scope', '$location', '$http', 'Notification', 'remoteApi', 'tools', '$window', function ($scope, $location, $http, Notification, remoteApi, tools, $window) { app.controller('opsController', ['$scope', '$location', '$http', 'Notification', 'remoteApi', 'tools', '$window', function ($scope, $location, $http, Notification, remoteApi, tools, $window) {
$scope.namesvrAddrList = ""; $scope.namesvrAddrList = [];
$scope.useVIPChannel = true; $scope.useVIPChannel = true;
$scope.useTLS = false; $scope.useTLS = false;
$scope.userRole = $window.sessionStorage.getItem("userrole"); $scope.userRole = $window.sessionStorage.getItem("userrole");
$scope.writeOperationEnabled = $scope.userRole == null ? true : ($scope.userRole == 1 ? true : false); $scope.writeOperationEnabled = $scope.userRole == null ? true : ($scope.userRole == 1 ? true : false);
$scope.inputReadonly = !$scope.writeOperationEnabled;
$http({ $http({
method: "GET", method: "GET",
url: "ops/homePage.query" url: "ops/homePage.query"
}).success(function (resp) { }).success(function (resp) {
if (resp.status == 0) { if (resp.status == 0) {
$scope.namesvrAddrList = resp.data.namesvrAddrList.join(";"); $scope.namesvrAddrList = resp.data.namesvrAddrList;
$scope.useVIPChannel = resp.data.useVIPChannel; $scope.useVIPChannel = resp.data.useVIPChannel;
$scope.useTLS = resp.data.useTLS; $scope.useTLS = resp.data.useTLS;
} else { } else {
@@ -34,11 +35,15 @@ app.controller('opsController', ['$scope', '$location', '$http', 'Notification',
} }
}); });
$scope.eleChange = function (data){
$scope.namesvrAddrList = data;
}
$scope.updateNameSvrAddr = function () { $scope.updateNameSvrAddr = function () {
$http({ $http({
method: "POST", method: "POST",
url: "ops/updateNameSvrAddr.do", url: "ops/updateNameSvrAddr.do",
params: {nameSvrAddrList: $scope.namesvrAddrList} params: {nameSvrAddrList: $scope.namesvrAddrList.join(";")}
}).success(function (resp) { }).success(function (resp) {
if (resp.status == 0) { if (resp.status == 0) {
Notification.info({message: "SUCCESS", delay: 2000}); Notification.info({message: "SUCCESS", delay: 2000});

View File

@@ -18,7 +18,8 @@
<div class="page-content"> <div class="page-content">
<h2 class="md-title">NameServerAddressList</h2> <h2 class="md-title">NameServerAddressList</h2>
<div class="pull-left"> <div class="pull-left">
<input type="text" class="form-control" ng-model="namesvrAddrList" ng-disabled="{{!writeOperationEnabled}}"/> <md-chips ng-model="namesvrAddrList" md-on-add="eleChange(namesvrAddrList)"
md-on-remove="eleChange(namesvrAddrList)" readonly="inputReadonly" md-removable="ctrl.removable"></md-chips>
</div> </div>
<div class="pull-left"> <div class="pull-left">
<button class="btn btn-raised btn-sm btn-primary" type="button" ng-show="{{writeOperationEnabled}}" <button class="btn btn-raised btn-sm btn-primary" type="button" ng-show="{{writeOperationEnabled}}"