summaryrefslogtreecommitdiffstats
path: root/usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller
diff options
context:
space:
mode:
Diffstat (limited to 'usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller')
-rw-r--r--usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller/alarmController.js270
-rw-r--r--usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller/left-menuController.js11
-rw-r--r--usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller/performance-detailsController.js157
-rw-r--r--usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller/performanceController.js211
4 files changed, 417 insertions, 232 deletions
diff --git a/usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller/alarmController.js b/usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller/alarmController.js
index b268ed31..a7fd1c7a 100644
--- a/usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller/alarmController.js
+++ b/usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller/alarmController.js
@@ -13,88 +13,68 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
-app.controller('perCtrl', function ($scope) {
-
-});
-
-app.controller('alarmGridCtrl', ['$scope','$log', '$http', '$timeout', '$interval', 'uiGridConstants', 'uiGridGroupingConstants',
- function ($scope,$log, $http, $timeout, $interval) {
+app.controller('alarmGridCtrl', ['$scope', '$log', '$http', '$timeout', '$interval' , '$window' ,'uiGridConstants', 'uiGridGroupingConstants',
+ function ($scope, $log, $http, $timeout, $interval,$window) {
$scope.selectedRows = new Array();
- var mydefalutData = [
- {name: "shebei1", Id: "22", State: '1', Cpu: "40%", Memory: "60,0", Disk: "60,000", Network: "60,000"},
- {name: "shebei1", Id: "226", State: '2', Cpu: "40%", Memory: "60", Disk: "60,", Network: "60,000"},
- {
- name: "shebei1",
- Id: "225",
- State: '2',
- Cpu: "40%",
- Memory: "60,000",
- Disk: "60,000",
- Network: "60,000"
- },
- {name: "shebei1", Id: "224", State: '3', Cpu: "40%", Memory: "600", Disk: "60,000", Network: "60,000"},
-
- {
- name: "shebei1",
- Id: "223",
- State: '2',
- Cpu: "40%",
- Memory: "60,000",
- Disk: "60,000",
- Network: "60,000"
- },
- {
- name: "shebei1",
- Id: "221",
- State: '3',
- Cpu: "40%",
- Memory: "60,000",
- Disk: "60,000",
- Network: "60,000"
- }
-
- ];
- $scope.items = [
- 'The first choice!',
- 'And another choice for you.',
- 'but wait! A third!'
- ];
-
- $scope.toggled = function(open) {
- $log.log('Dropdown is now: ', open);
- };
-
- $scope.status = {
- isopen: false
- };
-
- $scope.toggleDropdown = function($event) {
- $event.preventDefault();
- $event.stopPropagation();
- $scope.status.isopen = !$scope.status.isopen;
- };
-
- $scope.appendToEl = angular.element(document.querySelector('#dropdown-long-content'));
+ $scope.condition1 = "";
+ $scope.condition2 = "";
+ $scope.condition3 = "";
+ $scope.condition4 = "";
+ $scope.condition5 = "";
+ $scope.alarmStatus = "null";
+ $scope.vfstatus = "null";
+ $scope.toggled = function (open) {
+ $log.log('Dropdown is now: ', open);
+ };
+ $scope.status = {
+ isopen: false
+ };
+ $scope.toggleDropdown = function ($event) {
+ $event.preventDefault();
+ $event.stopPropagation();
+ $scope.status.isopen = !$scope.status.isopen;
+ };
+ var getPage = function (curPage, pageSize) {
+ var firstRow = (curPage - 1) * pageSize;
+ var url = global_url+'/alarm/' + curPage + '/' + pageSize + '';
+ url += arguments[2] === "" ? "/null" : "/" + arguments[2];
+ url += arguments[3] === "" ? "/null" : "/" + arguments[3];
+ url += arguments[4] === "" ? "/null" : "/" + arguments[4];
+ url += arguments[5] === "" ? "/null" : "/" + arguments[5];
+ url += arguments[6] === "" ? "/null" : "/" + arguments[6];
+ url += arguments[7] === "" ? "/null" : "/" + arguments[7];
+ url += arguments[8] === "" ? "/null" : "/" + arguments[8];
+ console.info(url);
+ $http.get(url, {
+ headers: {
+ 'Access-Control-Allow-Origin': "*",
+ "Content-Type": "application/json",
+ "Authorization": "Basic " + btoa("usecase" + ':' + "usecase")
+ }
+ })
+ .success(function (data) {
+ $scope.gridOptions.totalItems = data.totalRecords;
+ //console.info($scope.gridOptions.totalItems);
+ $scope.gridOptions.data = data.alarms;
+ });
+ };
$scope.gridOptions = {
- data: 'myData',
- columnDefs: [{
- field: 'name',
- displayName: 'name',
- width: '8%',
- enableColumnMenu: false,
- enableHiding: false,
- suppressRemoveSort: true,
- enableCellEdit: false
- },
- {field: "Id"},
- {field: "State",cellFilter:'mapGender'},
- {field: "Cpu"},
- {field: "Memory"},
- {field: "Disk"},
- {field: "Network"},
- {field: "Action", cellTemplate :
- '<div uib-dropdown style="position: absolute;padding-left: 4%;"><button id="btn-append-to-single-button" type="button" style="padding:0;" class="btn btn-primary" uib-dropdown-toggle>Action<span class="caret"></span></button><ul class="dropdown-menu" uib-dropdown-menu role="menu" aria-labelledby="btn-append-to-single-button"><li role="menuitem"><a href="#">clear</a></li><li role="menuitem"><a href="#">2</a></li><li role="menuitem"><a href="#">3</a></li></ul></div>'
- , enableCellEdit:false},
+ columnDefs: [
+ {field: "alarmsHeader.eventId", displayName: 'Id', enableCellEdit: false},
+ {
+ field: 'alarmsHeader.eventName',
+ displayName: 'eventName',
+ width: '8%',
+ enableColumnMenu: false,
+ enableHiding: false,
+ suppressRemoveSort: true,
+ enableCellEdit: false
+ },
+ {field: "alarmsHeader.vfStatus", displayName: 'IsOpen', enableCellEdit: false},
+ {field: "alarmsHeader.status", displayName: 'Status', cellFilter: 'mapGender', enableCellEdit: false},
+ {field: "alarmsInformation[0].name", displayName: 'Name', enableCellEdit: false},
+ {field: "alarmsInformation[0].value", displayName: 'Value', enableCellEdit: false},
+ {field: "alarmsHeader.createTime", displayName: 'CreateTime', enableCellEdit: false},
],
enableSorting: true,
useExternalSorting: false,
@@ -103,7 +83,6 @@ app.controller('alarmGridCtrl', ['$scope','$log', '$http', '$timeout', '$interva
enableHorizontalScrollbar: 1,
enableVerticalScrollbar: 0,
enableFiltering: true,
-
enablePagination: true,
enablePaginationControls: true,
paginationPageSizes: [10, 15, 20],
@@ -112,7 +91,6 @@ app.controller('alarmGridCtrl', ['$scope','$log', '$http', '$timeout', '$interva
//paginationTemplate:"<div></div>",
totalItems: 0,
useExternalPagination: true,
-
enableFooterTotalSelected: true,
enableFullRowSelection: true,
enableRowHeaderSelection: true,
@@ -127,9 +105,7 @@ app.controller('alarmGridCtrl', ['$scope','$log', '$http', '$timeout', '$interva
modifierKeysToMultiSelect: false,
multiSelect: true,
noUnselect: false,
- selectionRowHeaderWidth: 20,
-
-
+ selectionRowHeaderWidth: 28,
//---------------api---------------------
onRegisterApi: function (gridApi) {
$scope.gridApi = gridApi;
@@ -139,48 +115,50 @@ app.controller('alarmGridCtrl', ['$scope','$log', '$http', '$timeout', '$interva
getPage(newPage, pageSize);
}
});
-
$scope.gridApi.selection.on.rowSelectionChanged($scope, function (row, event) {
if (row) {
- var num = $.inArray(row.entity.Id, $scope.selectedRows);
+ var num = $.inArray(row.entity.alarmsHeader.eventId, $scope.selectedRows);
if (num == -1) {
- $scope.selectedRows.push(row.entity.Id);
+ $scope.selectedRows.push(row.entity.alarmsHeader.eventId);
}
else {
$scope.selectedRows.splice(num, 1);
}
}
});
- $scope.gridApi.grid.registerRowsProcessor( $scope.singleFilter, 200 );
+ $scope.gridApi.grid.registerRowsProcessor($scope.singleFilter, 200);
}
};
-
- var getPage = function (curPage, pageSize) {
- var firstRow = (curPage - 1) * pageSize;
- $scope.gridOptions.totalItems = mydefalutData.length;
- $scope.gridOptions.data = mydefalutData.slice(firstRow, firstRow + pageSize);
-
- //$scope.myData = mydefalutData.slice(firstRow, firstRow + pageSize);
- };
- getPage(1, $scope.gridOptions.paginationPageSize);
-
- $scope.trashcan = function () {
- alert('delete ' + $scope.selectedRows);
+ getPage(1, $scope.gridOptions.paginationPageSize, $scope.condition1===""?"":$scope.condition1,
+ $scope.condition2===""?"":$scope.condition2, $scope.condition3===""?"":$scope.condition3,
+ $scope.condition4===""?"":$scope.condition4, $scope.condition5===""?"":$scope.condition5,
+ $scope.alarmStatus, $scope.vfstatus);
+
+ $scope.generateCsv = function () {
+ if ($scope.selectedRows.length == 0){
+ alert("please select row!");
+ }else{
+ $window.location = global_url+"/alarm/genCsv/"+$scope.selectedRows;
+ }
};
-
$scope.status = [
- {id: 1, name: 'danger', count: 10},
- {id: 2, name: 'warming', count: 8},
- {id: 3, name: 'normal', count: 7},
+ {id: 1, name: 'CRITICAL', count: 10},
+ {id: 2, name: 'MALOR', count: 8},
+ {id: 3, name: 'MINOR', count: 7},
+ {id: 4, name: 'WARNING', count: 8},
+ {id: 5, name: 'NORMAL', count: 7},
{id: undefined, name: 'All', count: 7}
];
-
$scope.selectStatus = function (v) {
+ $scope.alarmStatus = typeof(v) == "undefined" ? "" : v;
+ getPage(1, $scope.gridOptions.paginationPageSize, $scope.condition1===""?"":$scope.condition1,
+ $scope.condition2===""?"":$scope.condition2, $scope.condition3===""?"":$scope.condition3,
+ $scope.condition4===""?"":$scope.condition4, $scope.condition5===""?"":$scope.condition5,
+ $scope.alarmStatus, $scope.vfstatus);
$scope.selectedStatus = v;
- $scope.gridApi.grid.refresh();
+
};
$scope.activeStatus = function (status_id) {
-
return status_id == $scope.selectedStatus;
};
$scope.open = [
@@ -190,63 +168,61 @@ app.controller('alarmGridCtrl', ['$scope','$log', '$http', '$timeout', '$interva
];
$scope.selectOpen = function (v) {
+ $scope.vfstatus = typeof(v) == "undefined" ? "null" : v;
+ getPage(1, $scope.gridOptions.paginationPageSize, $scope.condition1===""?"":$scope.condition1,
+ $scope.condition2===""?"":$scope.condition2, $scope.condition3===""?"":$scope.condition3,
+ $scope.condition4===""?"":$scope.condition4, $scope.condition5===""?"":$scope.condition5,
+ $scope.alarmStatus, $scope.vfstatus);
$scope.selectedOpen = v;
- $scope.gridApi.grid.refresh();
};
$scope.activeOpen = function (open_id) {
-
return open_id == $scope.selectedOpen;
};
-
$scope.singleFilter = function (renderableRows) {
var matcher = new RegExp($scope.selectedStatus);
renderableRows.forEach(function (row) {
- var match = false;
- ['State'].forEach(function (field) {
- if (row.entity[field].match(matcher)) {
- match = true;
- }
- });
+ var match = true;
if (!match) {
row.visible = false;
}
});
return renderableRows;
};
-//input
-$scope.menuState={show: false}
- $scope.toggleMenu=function()
- {
- $scope.menuState.show=!$scope.menuState.show;
- }
-
- $scope.singleModel = 1;
-
- $scope.radioModel = 'Middle';
-
- $scope.checkModel = {
- open: false,
- close: true
- };
-
- $scope.checkResults = [];
+ $scope.menuState = {show: false}
+ $scope.toggleMenu = function () {
+ $scope.menuState.show = !$scope.menuState.show;
+ }
+ $scope.singleModel = 1;
+ $scope.radioModel = 'Middle';
- $scope.$watchCollection('checkModel', function () {
- $scope.checkResults = [];
- angular.forEach($scope.checkModel, function (value, key) {
- if (value) {
- $scope.checkResults.push(key);
- }
- });
- });
+ $scope.checkModel = {
+ open: false,
+ close: true
+ };
+ $scope.checkResults = [];
+ $scope.$watchCollection('checkModel', function () {
+ $scope.checkResults = [];
+ angular.forEach($scope.checkModel, function (value, key) {
+ if (value) {
+ $scope.checkResults.push(key);
+ }
+ });
+ });
+ $scope.alarmSearch = function () {
+ getPage(1, $scope.gridOptions.paginationPageSize, $scope.condition1===""?"":$scope.condition1,
+ $scope.condition2===""?"":$scope.condition2, $scope.condition3===""?"":$scope.condition3,
+ $scope.condition4===""?"":$scope.condition4, $scope.condition5===""?"":$scope.condition5,
+ $scope.alarmStatus, $scope.vfstatus);
+ };
}]).filter('mapGender', function () {
var genderHash = {
- 1: 'danger',
- 2: 'alarm' ,
- 3: 'normal'
+ 1: 'CRITICAL',
+ 2: 'MAJOR',
+ 3: 'MINOR',
+ 4: 'WARNING',
+ 5: 'NORMAL'
};
-
return function (input) {
if (!input) {
return '';
@@ -254,5 +230,5 @@ $scope.menuState={show: false}
return genderHash[input];
}
}
-
+
}); \ No newline at end of file
diff --git a/usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller/left-menuController.js b/usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller/left-menuController.js
index abd58cef..985ec877 100644
--- a/usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller/left-menuController.js
+++ b/usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller/left-menuController.js
@@ -13,14 +13,19 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
+var currentTab = 'app/uui/fusion/scripts/view-models/alarm.html';
+
app.controller('cmCtrl',['$scope',function ($scope) {
$scope.routeData = [
{name : 'Services' , url : 'app/uui/fusion/scripts/view-models/lifecyclemanagement.html' , nclass : 'fa fa-users'},
{name : 'Alarm' , url : 'app/uui/fusion/scripts/view-models/alarm.html' , nclass : 'fa fa-users'},
- {name : 'Performance' , url : 'app/uui/fusion/scripts/view-models/performance.html', nclass : 'fa fa-cog'},
- {name : 'About Performance Froms' , url : 'app/uui/fusion/scripts/view-models/performance-details.html', nclass : 'fa fa-cubes'},
+ {name : 'Performance' , url : 'app/uui/fusion/scripts/view-models/performance.html', nclass : 'fa fa-cog'}
];
- $scope.currentTab = 'app/uui/fusion/scripts/view-models/alarm.html';
+ $scope.currentTab = currentTab;
+ $scope.$watch('currentTab', function(newValue, oldValue) {
+ if (newValue === oldValue) { return; } // AKA first run
+ // $scope.onClickTab(newValue);
+ });
$scope.onClickTab = function (url) {
$scope.currentTab = url;
};
diff --git a/usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller/performance-detailsController.js b/usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller/performance-detailsController.js
index 64ee382e..f74928c3 100644
--- a/usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller/performance-detailsController.js
+++ b/usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller/performance-detailsController.js
@@ -13,12 +13,155 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
-app.controller('pertabCtrl',['$scope',function ($scope) {
+app.controller('pertabCtrl', ['$scope', '$http', '$routeParams', function ($scope, $http, $routeParams) {
+ $scope.tabes = [
+ {title: 'one hour'},
+ {title: 'one day'},
+ {title: 'one month'},
+ {title: 'one year'}
+ ];
+ $scope.barChart = function (unit) {
+ $http.get(global_url + '/performance/diagram/' + unit + '/' + permanceId, {
+ headers: {
+ 'Access-Control-Allow-Origin': "*",
+ "Content-Type": "application/json"
+ }
+ })
+ .success(function (data) {
+ if (unit === "hour") {
+ $scope.valuess = [];
+ for(var i=0;i<4;i++){
+ $scope.valuess[i] = [
+ {"x": '15min', "y": 4}, {"x": '30min', "y": 4}, {"x": '45min', "y": 12},
+ {"x": '60min', "y": 3.27}
+ ];
+ };
+ var v = 0;
+ var i = 0;
+ angular.forEach(data, function (obj) {
+ for (var j = 0; j < obj.length; j++, i++) {
+ if (i >= 4) {
+ v++;
+ i = 0;
+ }
+ $scope.valuess[v][i].y = obj[j];
+ }
+ });
+ console.info($scope.valuess);
+ for (var i = 0; i < 5; i++) {
+ window.setTimeout(function () {
+ redraw("", $scope.valuess);
+ }, 1500);
+ };
+ }
+ if (unit === "day") {
+ $scope.valuess = [];
+ for(var i=0;i<4;i++){
+ $scope.valuess[i] = [
+ { "x":'1h' , "y":4}, { "x":'2h' , "y":4}, { "x":'3h' , "y":12},
+ { "x":'4h' , "y":3.27}, { "x":'5h' , "y":34}, { "x":'6h' , "y":34}, { "x":'7h' , "y":34},
+ { "x":'8h' , "y":34}, { "x":'9h' , "y":34}, { "x":'10h' , "y":34}, { "x":'11h' , "y":34},
+ { "x":'12h' , "y":56}, { "x":'13h' , "y":34}, { "x":'14h' , "y":34}, { "x":'15h' , "y":34},
+ { "x":'16h' , "y":12}, { "x":'17h' , "y":34}, { "x":'18h' , "y":50}, { "x":'19h' , "y":34},
+ { "x":'20h' , "y":34}, { "x":'21h' , "y":54}, { "x":'22h' , "y":34}, { "x":'23h' , "y":34},
+ { "x":'24h' , "y":36}
+ ];
+ };
+ var v = 0;
+ var i = 0;
+ angular.forEach(data, function (obj) {
+ for (var j = 0; j < obj.length; j++, i++) {
+ if (i >= 24) {
+ v++;
+ i = 0;
+ }
+ $scope.valuess[v][i].y = obj[j];
+ }
+ });
+ console.info($scope.valuess);
+ for (var i = 0; i < 5; i++) {
+ window.setTimeout(function () {
+ redraw("1", $scope.valuess);
+ }, 1500);
+ };
+ }
+ if (unit === "month") {
+ $scope.valuess = [];
+ for(var i=0;i<4;i++){
+ $scope.valuess[i] = [
+ { "x":'1d' , "y":4}, { "x":'2d' , "y":4}, { "x":'3d' , "y":12},
+ { "x":'4d' , "y":3.27}, { "x":'5d' , "y":34},{ "x":'6d' , "y":4}, { "x":'7d' , "y":4}, { "x":'8d' , "y":12},
+ { "x":'9d' , "y":3.27}, { "x":'10d' , "y":34}, { "x":'11d' , "y":34}, { "x":'12d' , "y":34}, { "x":'13d' , "y":4}, { "x":'14d' , "y":4}, { "x":'15' , "y":12},
+ { "x":'16d' , "y":3.27}, { "x":'17d' , "y":34},{ "x":'18d' , "y":4}, { "x":'19d' , "y":4}, { "x":'20d' , "y":12},
+ { "x":'21d' , "y":3.27}, { "x":'22d' , "y":34}, { "x":'23d' , "y":34}, { "x":'24d' , "y":34}, { "x":'25d' , "y":4}, { "x":'26d' , "y":12},
+ { "x":'27d' , "y":3.27}, { "x":'28d' , "y":34}, { "x":'29d' , "y":34}, { "x":'30d' , "y":34}, { "x":'31d' , "y":34}
+ ];
+ };
+ var v = 0;
+ var i = 0;
+ angular.forEach(data, function (obj) {
+ for (var j = 0; j < obj.length; j++, i++) {
+ if (i >= 31) {
+ v++;
+ i = 0;
+ }
+ $scope.valuess[v][i].y = obj[j];
+ }
+ });
+ console.info($scope.valuess);
+ for (var i = 0; i < 5; i++) {
+ window.setTimeout(function () {
+ redraw("2", $scope.valuess);
+ }, 1500);
+ };
+ }
+ if (unit === "year") {
+ $scope.valuess = [];
+ for(var i=0;i<12;i++){
+ $scope.valuess[i] = [
+ {"x": 'Jan', "y": 4}, {"x": 'Feb', "y": 4}, {"x": 'Mar', "y": 12},
+ {"x": 'Apr', "y": 3.27}, {"x": 'May', "y": 4}, {"x": 'June', "y": 4}, {"x": 'July', "y": 12},
+ {"x": 'Aug', "y": 3.27}, {"x": 'Sept', "y": 4}, {"x": 'Oct', "y": 4}, {"x": 'Nov', "y": 12},
+ {"x": 'Jan', "y": 3.27}
+ ];
+ };
+ var v = 0;
+ var i = 0;
+ angular.forEach(data, function (obj) {
+ for (var j = 0; j < obj.length; j++, i++) {
+ if (i >= 12) {
+ v++;
+ i = 0;
+ }
+ $scope.valuess[v][i].y = obj[j];
+ }
+ });
+ console.info($scope.valuess);
+ for (var i = 0; i < 5; i++) {
+ window.setTimeout(function () {
+ redraw("3", $scope.valuess);
+ }, 1500);
+ };
+ }
+ });
+ };
+ $scope.oneHour = function () {
+ changerotate(0);
+ $scope.barChart('hour');
- $scope.tabes = [
- { title:'one hour'},
- { title:'one day' },
- { title:'one month' },
- { title:'one year' }
- ];
+ };
+ $scope.oneHour();
+ $scope.oneDay = function () {
+ changerotate(90);
+ $scope.barChart('day');
+ };
+ $scope.oneMonth = function () {
+ changerotate(80);
+ $scope.barChart('month');
+
+ };
+ $scope.oneYear = function () {
+ changerotate(0);
+ $scope.barChart('year');
+ };
}]);
diff --git a/usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller/performanceController.js b/usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller/performanceController.js
index 02e74c98..3ff06582 100644
--- a/usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller/performanceController.js
+++ b/usecaseui-monitor/src/main/webapp/app/uui/fusion/scripts/controller/performanceController.js
@@ -13,117 +13,178 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
-app.controller('perCtrl',function ($scope) {
-
-});
-app.controller('perGridCtrl', ['$scope', '$http', '$timeout', '$interval', 'uiGridConstants', 'uiGridGroupingConstants',
- function ($scope, $http, $timeout, $interval) {
-
- var mydefalutData = [
- { name: "Moroni", age: 50, birthday: "Oct 28, 1970", salary: "60,000" },
- { name: "shebei1", Id: "22", State: 50, Cpu: "40%", Memory: "60,0", Disk: "60,000", Network: "60,000" },
- { name: "shebei1", State: 50, Cpu: "40%", Memory: "60", Disk: "60,", Network: "60,000" },
- { name: "shebei1", State: 50, Cpu: "40%", Memory: "60,000", Disk: "60,000", Network: "60,000" },
- { name: "shebei1", State: 50, Cpu: "40%", Memory: "600", Disk: "60,000", Network: "60,000" },
- { name: "shebei1", State: 50, Cpu: "40%", Memory: "60,000", Disk: "60,000", Network: "60,000" },
- { name: "shebei1", State: 50, Cpu: "40%", Memory: "60,000", Disk: "60,000", Network: "60,000" }
- ];
- $scope.jump = function (){
- console.log(1);
- $scope.currentTab = '#/pre-details';
- };
+//
+var permanceId="";
+app.controller('perGridCtrl', ['$scope', '$http', '$timeout', '$interval', '$window', 'uiGridConstants', 'uiGridGroupingConstants',
+ function ($scope, $http, $timeout, $interval,$window) {
+ $scope.jump = function(value){
+ console.info(value);
+ permanceId=value;
+ var obj = $("#lm");
+ angular.element(obj).scope().currentTab = "app/uui/fusion/scripts/view-models/performance-details.html";
+ //angular.element(obj).scope().$apply();
+ };
+ $scope.selectedRows = new Array();
+ $scope.seek1 = "";
+ $scope.seek2 = "";
+ $scope.seek3 = "";
+ $scope.seek4 = "";
+ $scope.seek5 = "";
+ $scope.getSearch = function (){
+ getPage(1, $scope.gridOptions.paginationPageSize, $scope.seek1===""?"null":$scope.seek1,
+ $scope.seek2===""?"null":$scope.seek2, $scope.seek3===""?"null":$scope.seek3,
+ $scope.seek4===""?"null":$scope.seek4, $scope.seek5===""?"null":$scope.seek5);
+ };
$scope.gridOptions = {
- data: 'myData',
- columnDefs: [{ field: 'name',
+ columnDefs: [{
+ field: 'performanceHeader.eventName',
displayName: 'name',
width: '10%',
enableColumnMenu: false,
enableHiding: false,
suppressRemoveSort: true,
- enableCellEdit: false ,
- cellTemplate:'<a ng-click="jump()">shebei1</a>'
- },
- { field: "Id",},
- { field: "State"},
- { field: "Cpu"},
- { field: "Memory"},
- { field: "Disk"},
- { field: "Network"}
+ enableCellEdit: false
+ }, {
+ field: "performanceHeader.eventId",
+ enableCellEdit: false,
+ displayName: 'Id',
+ cellTemplate: '<a ng-click="grid.appScope.jump(row.entity.performanceHeader.eventId)"; style="cursor:pointer" href="">{{row.entity.performanceHeader.eventId}}</a>',
+ },
+ {field: "performanceHeader.eventName", displayName: 'State',enableCellEdit: false},
+ {field: "performanceHeader.eventName", displayName: 'Cpu',enableCellEdit: false},
+ {field: "performanceHeader.eventName", displayName: 'Memory',enableCellEdit: false},
+ {field: "performanceHeader.eventName", displayName: 'Disk',enableCellEdit: false},
+ {field: "performanceHeader.eventName", displayName: 'Network',enableCellEdit: false}
],
-
enableSorting: true,
useExternalSorting: false,
enableGridMenu: true,
showGridFooter: true,
- enableHorizontalScrollbar : 1,
- enableVerticalScrollbar : 0,
+ enableHorizontalScrollbar: 1,
+ enableVerticalScrollbar: 0,
enableFiltering: true,
//
enablePagination: true,
enablePaginationControls: true,
paginationPageSizes: [10, 15, 20],
- paginationCurrentPage:1,
+ paginationCurrentPage: 1,
paginationPageSize: 10,
//paginationTemplate:"<div></div>",
- totalItems : 0,
+ totalItems: 0,
useExternalPagination: true,
-
-
- //-
enableFooterTotalSelected: true,
- enableFullRowSelection : true,
- enableRowHeaderSelection : true,
- enableRowSelection : false,
- enableSelectAll : true,
- enableSelectionBatchEvent : true,
- isRowSelectable: function(row){
- if(row.entity.age > 45){
+ enableFullRowSelection: true,
+ enableRowHeaderSelection: true,
+ enableRowSelection: false,
+ enableSelectAll: true,
+ enableSelectionBatchEvent: true,
+ isRowSelectable: function (row) {
+ if (row.entity.age > 45) {
row.grid.api.selection.selectRow(row.entity);
}
},
- modifierKeysToMultiSelect: false ,
- multiSelect: true ,
+ modifierKeysToMultiSelect: false,
+ multiSelect: true,
noUnselect: false,
- selectionRowHeaderWidth:30 ,
-
-
+ selectionRowHeaderWidth: 30,
//---------------api---------------------
- onRegisterApi: function(gridApi) {
+ onRegisterApi: function (gridApi) {
$scope.gridApi = gridApi;
- gridApi.pagination.on.paginationChanged($scope,function(newPage, pageSize) {
- if(getPage) {
+ gridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) {
+ if (getPage) {
getPage(newPage, pageSize);
}
});
-
- /*$scope.gridApi.selection.on.rowSelectionChanged($scope,function(row,event){
- if(row){
- $scope.testRow = row.entity;
+ $scope.gridApi.selection.on.rowSelectionChanged($scope, function (row, event) {
+ if (row) {
+ var num = $.inArray(row.entity.performanceHeader.eventId, $scope.selectedRows);
+ if (num == -1) {
+ $scope.selectedRows.push(row.entity.performanceHeader.eventId);
+ }
+ else {
+ $scope.selectedRows.splice(num, 1);
+ }
}
- });*/
- }
+ });
+ $scope.gridApi.grid.registerRowsProcessor($scope.singleFilter, 200);
+ } };
+
+ $scope.singleFilter = function (renderableRows) {
+ var matcher = new RegExp($scope.selectedStatus);
+ renderableRows.forEach(function (row) {
+ var match = true;
+ /*['State'].forEach(function (field) {
+ if (row.entity[field].match(matcher)) {
+ match = true;
+ }
+ });*/
+ if (!match) {
+ row.visible = false;
+ }
+ });
+ return renderableRows;
};
+ $scope.menuState = {show: false}
+ $scope.toggleMenu = function () {
+ $scope.menuState.show = !$scope.menuState.show;
+ }
+ $scope.singleModel = 1;
+ $scope.radioModel = 'Middle';
+
+ $scope.checkModel = {
+ open: false,
+ close: true
+ };
+ $scope.checkResults = [];
-
- var getPage = function(curPage, pageSize) {
+ $scope.$watchCollection('checkModel', function () {
+ $scope.checkResults = [];
+ angular.forEach($scope.checkModel, function (value, key) {
+ if (value) {
+ $scope.checkResults.push(key);
+ }
+ });
+ });
+ var getPage = function (curPage, pageSize) {
var firstRow = (curPage - 1) * pageSize;
- $scope.gridOptions.totalItems = mydefalutData.length;
- $scope.gridOptions.data = mydefalutData.slice(firstRow, firstRow + pageSize);
-
- //$scope.myData = mydefalutData.slice(firstRow, firstRow + pageSize);
+ var url = global_url+'/performance/' + curPage + '/' + pageSize + '';
+ url += arguments[2] === "" ? "/null" : "/" + arguments[2];
+ url += arguments[3] === "" ? "/null" : "/" + arguments[3];
+ url += arguments[4] === "" ? "/null" : "/" + arguments[4];
+ url += arguments[5] === "" ? "/null" : "/" + arguments[5];
+ url += arguments[6] === "" ? "/null" : "/" + arguments[6];
+ console.info(url);
+ $http.get(url, {
+ headers: {
+ 'Access-Control-Allow-Origin': "*",
+ "Content-Type": "application/json",
+ "Authorization": "Basic " + btoa("usecase" + ':' + "usecase")
+ }
+ })
+ .success(function (data) {
+ $scope.gridOptions.totalItems = data.totalRecords;
+ //console.info($scope.gridOptions.totalItems);
+ $scope.gridOptions.data = data.performances;
+ });
};
-
- getPage(1, $scope.gridOptions.paginationPageSize);
-
- //input
-$scope.menuState={show: false}
- $scope.toggleMenu=function()
- {
- $scope.menuState.show=!$scope.menuState.show;
- }
-
+ getPage(1, $scope.gridOptions.paginationPageSize, $scope.seek1===""?"null":$scope.seek1,
+ $scope.seek2===""?"null":$scope.seek2, $scope.seek3===""?"null":$scope.seek3,
+ $scope.seek4===""?"null":$scope.seek4, $scope.seek5===""?"null":$scope.seek5);
+
+ $scope.generateCsv = function () {
+ if ($scope.selectedRows.length == 0){
+ alert("please select row!");
+ }else{
+ $window.location =global_url+"/performance/genCsv/"+$scope.selectedRows;
+ }
+ };
+ //input
+ $scope.menuState = {show: false}
+ $scope.toggleMenu = function () {
+ $scope.menuState.show = !$scope.menuState.show;
+ }
}]);
\ No newline at end of file