2014-11-16 07:50:46 +08:00
|
|
|
var ZoneMinder = angular.module('ZoneMinderControllers', []);
|
2014-11-16 03:34:00 +08:00
|
|
|
|
2015-01-18 01:25:33 +08:00
|
|
|
ZoneMinder.controller('StateController', function($scope, State, Header) {
|
|
|
|
State.get(function(results) {
|
|
|
|
$scope.states = results.states;
|
|
|
|
});
|
|
|
|
|
|
|
|
$scope.changeState = function(newState) {
|
|
|
|
State.change(newState)
|
|
|
|
// Redirect to the dashboard on success
|
2015-02-12 03:34:10 +08:00
|
|
|
.success(function(data) { window.location = "/"; });
|
2015-01-18 01:25:33 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
Header.getDaemonStatus(function(results) {
|
|
|
|
if (results.result == 1) {
|
|
|
|
$scope.isRunning = true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
ZoneMinder.controller('HeaderController', function($scope, Header, State) {
|
2014-11-16 03:34:00 +08:00
|
|
|
Header.getLogState(function(results) {
|
|
|
|
});
|
2014-11-16 08:35:10 +08:00
|
|
|
|
|
|
|
Header.getDaemonStatus(function(results) {
|
|
|
|
if (results.result == 1) {
|
|
|
|
$scope.isRunning = true;
|
|
|
|
}
|
|
|
|
});
|
2014-11-16 03:34:00 +08:00
|
|
|
});
|
2014-11-16 07:50:46 +08:00
|
|
|
|
2014-11-22 04:06:59 +08:00
|
|
|
ZoneMinder.controller('FooterController', function($scope, Footer) {
|
2014-11-24 08:56:20 +08:00
|
|
|
Footer.getVersion(function(version) {
|
|
|
|
$scope.version = version.version;
|
|
|
|
});
|
2014-11-22 04:06:59 +08:00
|
|
|
});
|
|
|
|
|
2014-12-02 00:15:42 +08:00
|
|
|
ZoneMinder.controller('LogController', function($scope, Log) {
|
2015-01-09 05:06:13 +08:00
|
|
|
getLogsPage(1);
|
|
|
|
|
|
|
|
$scope.pageChanged = function(newPage) {
|
|
|
|
getLogsPage(newPage);
|
|
|
|
}
|
|
|
|
|
|
|
|
function getLogsPage(pageNumber) {
|
|
|
|
Log.get(pageNumber).then(function(results) {
|
|
|
|
$scope.logs = results.data.logs;
|
|
|
|
$scope.totalLogs = results.data.pagination.count;
|
|
|
|
$scope.logsPerPage = results.data.pagination.limit;
|
|
|
|
});
|
|
|
|
}
|
2014-12-02 00:15:42 +08:00
|
|
|
});
|
|
|
|
|
2015-01-21 23:23:46 +08:00
|
|
|
ZoneMinder.controller('EventsController', function($scope, Events, Console, $modal) {
|
2015-01-07 07:36:55 +08:00
|
|
|
// First thing, get page 1 of the events.
|
2015-01-21 23:23:46 +08:00
|
|
|
$scope.page = 1;
|
|
|
|
getEvents(null, $scope.page);
|
|
|
|
|
|
|
|
// Get the monitors which popular the sidebar select
|
|
|
|
Console.getMonitors().then(function(results) {
|
|
|
|
$scope.monitors = results.data.monitors;
|
|
|
|
});
|
|
|
|
|
|
|
|
$scope.filter_url = '';
|
|
|
|
|
|
|
|
var now = new Date();
|
|
|
|
var startdate = new Date(now);
|
|
|
|
startdate.setMonth(now.getMonth() - 1);
|
|
|
|
$scope.filter = {
|
|
|
|
'StartTime' : startdate,
|
|
|
|
'EndTime' : new Date()
|
|
|
|
};
|
2014-12-30 01:19:30 +08:00
|
|
|
|
2015-01-07 07:36:55 +08:00
|
|
|
// If the page is changed, get the new page of events
|
2014-12-30 01:19:30 +08:00
|
|
|
$scope.pageChanged = function(newPage) {
|
2015-01-21 23:23:46 +08:00
|
|
|
$scope.page = newPage;
|
|
|
|
getEvents($scope.filter_url, newPage);
|
2014-12-30 01:19:30 +08:00
|
|
|
};
|
|
|
|
|
2015-01-07 07:36:55 +08:00
|
|
|
// Call Events.get and pass it the page number
|
|
|
|
// Set the appropriate scope values with the results.
|
|
|
|
// The events.php file takes over and iterates over events
|
|
|
|
// and the painator uses totalEvents and eventPerPage
|
2015-01-21 23:23:46 +08:00
|
|
|
function getEvents(filter, pageNumber) {
|
|
|
|
Events.get(filter, pageNumber).then(function(results) {
|
2014-12-30 01:19:30 +08:00
|
|
|
$scope.events = results.data.events;
|
|
|
|
$scope.totalEvents = results.data.pagination.count;
|
|
|
|
$scope.eventsPerPage = results.data.pagination.limit;
|
|
|
|
});
|
|
|
|
}
|
2014-12-24 11:38:54 +08:00
|
|
|
|
2015-01-21 23:23:46 +08:00
|
|
|
$scope.filterEvents = function() {
|
|
|
|
var filters = new Array();
|
|
|
|
var url = '';
|
|
|
|
|
|
|
|
// Push all of the MonitorId's into the filters array
|
|
|
|
angular.forEach($scope.filter.MonitorId, function(value, key) {
|
|
|
|
filters.push('MonitorId:'+value);
|
|
|
|
});
|
|
|
|
|
|
|
|
var StartTime = $scope.filter.StartTime.toISOString().slice(0, 19).replace('T', ' ');
|
|
|
|
filters.push('StartTime >=:'+StartTime);
|
|
|
|
var EndTime = $scope.filter.EndTime.toISOString().slice(0, 19).replace('T', ' ');
|
|
|
|
filters.push('EndTime <=:'+EndTime);
|
|
|
|
|
|
|
|
console.log(filters);
|
|
|
|
|
|
|
|
angular.forEach(filters, function(value, key) {
|
|
|
|
url = url + value + '/';
|
|
|
|
});
|
|
|
|
|
|
|
|
length = url.length;
|
|
|
|
$scope.filter_url = url.substring(0, length - 1);
|
|
|
|
$scope.page = 1;
|
|
|
|
getEvents($scope.filter_url, 1);
|
|
|
|
}
|
|
|
|
|
2015-01-07 07:36:55 +08:00
|
|
|
// This is called when a user clicks on an event.
|
|
|
|
// It fires up a modal and passes it the EventId of the clicked event
|
|
|
|
// EventController takes over from there.
|
2015-01-10 03:24:45 +08:00
|
|
|
$scope.displayEvent = function (index) {
|
|
|
|
var event = $scope.events[index];
|
2015-01-07 07:36:55 +08:00
|
|
|
|
|
|
|
var modalInstance = $modal.open({
|
2015-02-12 03:34:10 +08:00
|
|
|
templateUrl: '/views/event.html',
|
2015-01-07 07:36:55 +08:00
|
|
|
controller: 'EventController',
|
2015-01-28 00:19:24 +08:00
|
|
|
size: 'lg',
|
2015-01-10 03:24:45 +08:00
|
|
|
resolve: {
|
|
|
|
eventId: function () { return event.Event.Id; },
|
|
|
|
index: function () { return index; }
|
|
|
|
}
|
2015-01-07 07:36:55 +08:00
|
|
|
});
|
|
|
|
|
2015-01-10 03:24:45 +08:00
|
|
|
modalInstance.result.then(function (index) {
|
|
|
|
$scope.events.splice(index, 1);
|
2015-01-21 23:29:06 +08:00
|
|
|
$scope.totalEvents = $scope.totalEvents - 1;
|
2015-01-22 00:07:29 +08:00
|
|
|
$scope.displayEvent(index);
|
2015-01-07 07:36:55 +08:00
|
|
|
}, function () {
|
|
|
|
console.log('Modal dismissed at: ' + new Date());
|
|
|
|
}
|
|
|
|
);
|
|
|
|
};
|
|
|
|
});
|
2014-11-16 07:50:46 +08:00
|
|
|
|
2015-02-12 08:16:13 +08:00
|
|
|
ZoneMinder.controller('EventController', function($scope, Event, $modalInstance, eventId, index, Config, $filter) {
|
2015-01-28 00:19:24 +08:00
|
|
|
|
|
|
|
$scope.stream = true;
|
2014-11-16 07:50:46 +08:00
|
|
|
|
2015-01-07 07:39:04 +08:00
|
|
|
Event.get(eventId).then(function(results) {
|
2014-11-16 07:50:46 +08:00
|
|
|
$scope.eventId = eventId;
|
2015-01-22 06:26:46 +08:00
|
|
|
$scope.name = results.data.event.Event.Name;
|
|
|
|
$scope.cause = results.data.event.Event.Cause;
|
2014-11-16 07:50:46 +08:00
|
|
|
$scope.startTime = results.data.event.Event.StartTime;
|
|
|
|
$scope.endTime = results.data.event.Event.EndTime;
|
2015-01-22 06:26:46 +08:00
|
|
|
$scope.width = results.data.event.Event.Width;
|
2014-11-16 07:50:46 +08:00
|
|
|
$scope.length = results.data.event.Event.Length;
|
2015-01-22 06:26:46 +08:00
|
|
|
$scope.frames = results.data.event.Event.Frames;
|
|
|
|
$scope.alarmFrames = results.data.event.Event.AlarmFrames;
|
|
|
|
$scope.totScore = results.data.event.Event.TotScore;
|
|
|
|
$scope.avgScore = results.data.event.Event.AvgScore;
|
|
|
|
$scope.maxScore = results.data.event.Event.MaxScore;
|
|
|
|
$scope.notes = results.data.event.Event.Notes;
|
|
|
|
$scope.archived = results.data.event.Event.Archived;
|
2015-01-22 06:25:56 +08:00
|
|
|
$scope.archive_text = $scope.archived == 0 ? 'Archive' : 'Unarchive';
|
2015-01-28 00:19:24 +08:00
|
|
|
$scope.eventView_text = 'Frames';
|
|
|
|
$scope.basePath = results.data.event.Event.BasePath;
|
2015-02-12 08:16:13 +08:00
|
|
|
var frames = results.data.event.Frame;
|
2015-01-28 00:19:24 +08:00
|
|
|
|
|
|
|
Config.findByName('ZM_EVENT_IMAGE_DIGITS').then(function(results) {
|
2015-02-12 08:16:13 +08:00
|
|
|
var event_image_digits = results.data.config.Value;
|
|
|
|
|
|
|
|
angular.forEach(frames, function(frame, key) {
|
|
|
|
var id = $filter('zpad')(frame.FrameId, event_image_digits);
|
|
|
|
frames[key].Path = $scope.basePath + id + '-capture.jpg';
|
|
|
|
});
|
|
|
|
|
|
|
|
$scope.frames = frames;
|
2015-01-28 00:19:24 +08:00
|
|
|
});
|
2015-02-12 08:16:13 +08:00
|
|
|
|
2015-01-07 07:36:55 +08:00
|
|
|
});
|
2014-11-16 07:50:46 +08:00
|
|
|
|
2015-01-07 07:36:55 +08:00
|
|
|
$scope.cancel = function () {
|
|
|
|
$modalInstance.dismiss('cancel');
|
|
|
|
};
|
2014-11-16 07:50:46 +08:00
|
|
|
|
2015-01-10 03:24:45 +08:00
|
|
|
$scope.delete= function() {
|
2015-01-07 07:36:55 +08:00
|
|
|
Event.delete(eventId).then(function(results) {
|
2015-01-10 03:24:45 +08:00
|
|
|
$modalInstance.close(index);
|
2015-01-07 07:36:55 +08:00
|
|
|
console.log(results);
|
|
|
|
});
|
|
|
|
};
|
2015-01-22 06:25:56 +08:00
|
|
|
|
|
|
|
$scope.archive = function() {
|
|
|
|
Event.archive(eventId).then(function(results) {
|
|
|
|
$scope.archived = results.data.archived;
|
|
|
|
$scope.archive_text = $scope.archived == 0 ? 'Archive' : 'Unarchive';
|
|
|
|
});
|
|
|
|
};
|
2015-01-28 00:19:24 +08:00
|
|
|
|
|
|
|
$scope.eventView = function() {
|
2015-01-28 00:26:01 +08:00
|
|
|
$scope.eventView_text = $scope.eventView_text == 'Stream' ? 'Frames' : 'Stream';
|
2015-01-28 00:19:24 +08:00
|
|
|
$scope.stream = $scope.stream == true ? false : true;
|
|
|
|
};
|
2014-11-16 07:50:46 +08:00
|
|
|
});
|
2014-11-19 23:53:07 +08:00
|
|
|
|
2015-02-19 01:11:55 +08:00
|
|
|
ZoneMinder.controller('MonitorController', function($scope, $state, $http, Monitor, Console) {
|
|
|
|
if ($state.params.mid) {
|
|
|
|
Monitor.getMonitor($state.params.mid).then(function(results) {
|
2014-12-22 10:44:18 +08:00
|
|
|
$scope.monitor = results.data.monitor.Monitor;
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
// Assign each monitor a random color, as opposed to them all being 'red'
|
|
|
|
var color = '#' + (Math.random() * 0xFFFFFF << 0).toString(16);
|
2014-12-18 05:08:35 +08:00
|
|
|
|
2014-12-22 10:44:18 +08:00
|
|
|
// This is where the monitor's 'form data' is saved
|
|
|
|
// It is sent to saveMonitor when the save button is clicked
|
|
|
|
$scope.monitor = {
|
|
|
|
// Set default values for a monitor
|
|
|
|
'Type' : 'Remote',
|
|
|
|
'RefBlendPerc' : 6,
|
|
|
|
'AlarmRefBlendPerc' : 6,
|
|
|
|
'Function' : 'Monitor',
|
|
|
|
'ImageBufferCount' : 100,
|
|
|
|
'WarmupCount' : 25,
|
|
|
|
'PreEventCount' : 50,
|
|
|
|
'PostEventCount' : 50,
|
|
|
|
'StreamReplayBuffer' : 1000,
|
|
|
|
'AlarmFrameCount' : 1,
|
|
|
|
'LabelFormat' : '%N - %d/%m/%y %H:%M:%S',
|
|
|
|
'LabelX' : 0,
|
|
|
|
'LabelY' : 0,
|
|
|
|
'Colours' : 3,
|
|
|
|
// Here be a bug!
|
|
|
|
// When retrieving 'Orientation', it comes back and is set a a number
|
|
|
|
// But it mustbe saved as a string (due to mysql enum)
|
|
|
|
'Orientation' : '0',
|
|
|
|
'Enabled' : true,
|
|
|
|
'Protocol' : 'http',
|
|
|
|
'SectionLength' : 600,
|
|
|
|
'EventPrefix' : 'Event-',
|
|
|
|
'FrameSkip' : 0,
|
|
|
|
'MotionFrameSkip' : 0,
|
|
|
|
'FPSReportInterval' : 1000,
|
|
|
|
'DefaultView' : 'Events',
|
|
|
|
'DefaultRate' : 100,
|
|
|
|
'DefaultScale' : 100,
|
|
|
|
'SignalCheckColour' : '#0000c0',
|
|
|
|
'Method' : 'simple',
|
|
|
|
'WebColour' : color
|
|
|
|
};
|
|
|
|
}
|
2014-12-18 05:08:35 +08:00
|
|
|
|
2014-12-22 10:44:18 +08:00
|
|
|
|
|
|
|
// Call Monitor.saveMonitor when the save button is clicked. Pass along $scope.monitor
|
2014-12-18 05:08:35 +08:00
|
|
|
$scope.submitMonitor = function() {
|
2014-12-22 10:45:44 +08:00
|
|
|
Monitor.saveMonitor($scope.monitor)
|
|
|
|
// Redirect to the dashboard on success
|
2015-02-12 03:34:10 +08:00
|
|
|
.success(function(data) { window.location = "/"; });
|
2014-12-18 05:08:35 +08:00
|
|
|
};
|
2014-12-17 06:11:28 +08:00
|
|
|
|
2015-02-10 22:58:34 +08:00
|
|
|
$scope.grid = true;
|
|
|
|
$scope.gridButton = 'glyphicon-th';
|
2015-02-12 00:32:40 +08:00
|
|
|
$scope.consoleLayout = 4;
|
2015-02-10 22:58:34 +08:00
|
|
|
|
2015-02-12 00:32:40 +08:00
|
|
|
|
|
|
|
$scope.updateLayout = function () {
|
|
|
|
var rows = [];
|
|
|
|
var monitors = $scope.monitors;
|
|
|
|
for (var i = 0; i < monitors.length; i++) {
|
|
|
|
if (i % $scope.consoleLayout == 0) rows.push([]);
|
|
|
|
rows[rows.length-1].push(monitors[i]);
|
2014-11-19 23:53:07 +08:00
|
|
|
}
|
2015-02-12 00:32:40 +08:00
|
|
|
$scope.columnSize = Math.floor(12 / $scope.consoleLayout);
|
|
|
|
return $scope.rows = rows;
|
|
|
|
};
|
2014-11-28 08:25:15 +08:00
|
|
|
|
2015-01-08 05:29:30 +08:00
|
|
|
$scope.delete = function (index) {
|
|
|
|
var monitor = $scope.monitors[index];
|
|
|
|
var id = monitor.Id;
|
|
|
|
|
2015-02-10 22:58:34 +08:00
|
|
|
if (monitor.deleteText == 'Are you sure?') {
|
|
|
|
monitor.deleteText = 'Deleting...';
|
|
|
|
Console.delete(id).then(function(results) {
|
|
|
|
$scope.monitors.splice(index, 1);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
monitor.deleteText = 'Are you sure?'
|
2015-01-08 05:29:30 +08:00
|
|
|
};
|
|
|
|
|
2014-11-28 08:25:15 +08:00
|
|
|
Console.getMonitors().then(function(results) {
|
2015-02-10 22:58:34 +08:00
|
|
|
if (results.data.monitors.length == 0) {
|
|
|
|
$scope.fresh = true;
|
|
|
|
} else {
|
|
|
|
var monitors = new Array();
|
|
|
|
var daemons = ['zmc', 'zma']; // Daemons to check for each monitor
|
|
|
|
|
|
|
|
// For each monitor
|
|
|
|
angular.forEach(results['data']['monitors'], function(value, key) {
|
|
|
|
var id = value.Monitor.Id;
|
|
|
|
var alerts = value.Monitor.alerts = new Array();
|
|
|
|
|
|
|
|
// Check if the above daemons are running for it
|
|
|
|
angular.forEach(daemons, function(daemon) {
|
|
|
|
// Ask the API for the daemonStatus of the id
|
|
|
|
Console.daemonStatus(id, daemon).then(function(results) {
|
|
|
|
value.Monitor.alerts[daemon] = results.data.status;
|
|
|
|
|
|
|
|
// If there is a failed daemon, set a generic error
|
|
|
|
if (daemon) {
|
|
|
|
value.Monitor.alert = 'zma or zmc is not running';
|
|
|
|
}
|
|
|
|
});
|
2014-11-28 08:25:15 +08:00
|
|
|
});
|
|
|
|
|
2015-02-10 22:58:34 +08:00
|
|
|
value.Monitor.deleteText = 'Delete';
|
|
|
|
monitors.push(value.Monitor);
|
|
|
|
|
|
|
|
});
|
2014-11-28 08:25:15 +08:00
|
|
|
|
2015-02-10 22:58:34 +08:00
|
|
|
$scope.monitors = monitors;
|
2015-02-12 00:32:40 +08:00
|
|
|
$scope.updateLayout();
|
2015-02-10 22:58:34 +08:00
|
|
|
}
|
2014-11-28 08:25:15 +08:00
|
|
|
});
|
2015-02-10 22:58:34 +08:00
|
|
|
|
|
|
|
$scope.consoleView = function() {
|
|
|
|
$scope.gridButton = $scope.gridButton == 'glyphicon-th' ? 'glyphicon-th-list' : 'glyphicon-th';
|
|
|
|
$scope.grid = $scope.grid == true ? false : true;
|
|
|
|
};
|
2015-02-12 02:45:07 +08:00
|
|
|
|
|
|
|
$scope.saveMonitor = function(monitor) {
|
|
|
|
var i = document.getElementById('function'+monitor.Id).parentNode.parentNode;
|
|
|
|
Monitor.saveMonitor(monitor)
|
|
|
|
.success(function(data) {
|
|
|
|
i.className = i.className + " has-success has-feedback";
|
|
|
|
|
|
|
|
});
|
|
|
|
};
|
2014-11-19 23:53:07 +08:00
|
|
|
});
|
2014-11-20 12:10:01 +08:00
|
|
|
|
|
|
|
|
|
|
|
ZoneMinder.controller('ConfigController', function($scope, $http, Config) {
|
|
|
|
|
|
|
|
Config.setConfigModel().then(function(results) {
|
|
|
|
$scope.myModel = {configData: results.data.keyValues};
|
|
|
|
});
|
|
|
|
|
2014-11-20 12:11:33 +08:00
|
|
|
Config.getCategories().then(function(results) {
|
|
|
|
// List of category names for the tabs
|
|
|
|
$scope.categories = results.data.categories;
|
|
|
|
|
|
|
|
// For each category, add all config options belonging to it to the categories array
|
|
|
|
angular.forEach(results['data']['categories'], function(value, key) {
|
|
|
|
var cat = results.data.categories[key].Config.Category;
|
|
|
|
catman(cat);
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
function catman(category) {
|
|
|
|
Config.getCategory(category).then(function(results) {
|
|
|
|
$scope[category] = results.data.config;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
$scope.updateConfig = function(configId, configName) {
|
|
|
|
var newValue = $scope.myModel.configData[configName];
|
|
|
|
var i = document.getElementById(configName).parentNode.parentNode;
|
|
|
|
var s = i.getElementsByTagName("span");
|
|
|
|
s = s[0];
|
|
|
|
|
|
|
|
Config.updateOption(configId, newValue).then(function(results) {
|
|
|
|
if (results.statusText == 'OK') {
|
|
|
|
i.className = i.className + " has-success has-feedback";
|
|
|
|
s.className = s.className + " glyphicon glyphicon-ok";
|
|
|
|
} else {
|
|
|
|
i.className = i.className + " has-failure has-feedback";
|
|
|
|
s.className = s.className + " glyphicon glyphicon-ok";
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2014-11-20 12:10:01 +08:00
|
|
|
});
|
2014-11-25 23:21:30 +08:00
|
|
|
|
2014-11-26 00:30:27 +08:00
|
|
|
ZoneMinder.controller('HostController', function($scope, Host) {
|
2015-01-27 06:22:57 +08:00
|
|
|
Host.getDiskPercent(function(diskPercent) {
|
2014-11-26 00:27:38 +08:00
|
|
|
var array = [];
|
|
|
|
angular.forEach(diskPercent.usage, function(value, key) {
|
|
|
|
var a = {
|
2015-01-27 06:22:57 +08:00
|
|
|
'value' : Math.floor(value.space),
|
2014-11-26 00:27:38 +08:00
|
|
|
'label' : key,
|
2015-01-27 06:22:57 +08:00
|
|
|
'color' : value.color
|
2014-11-26 00:27:38 +08:00
|
|
|
};
|
|
|
|
array.push(a);
|
|
|
|
});
|
|
|
|
$scope.ddata = array;
|
2015-01-27 06:22:57 +08:00
|
|
|
|
|
|
|
$scope.doptions = {
|
|
|
|
responsive: false,
|
|
|
|
segmentShowStroke : true,
|
|
|
|
segmentStrokeColor : '#fff',
|
|
|
|
segmentStrokeWidth : 2,
|
|
|
|
percentageInnerCutout : 50, // This is 0 for Pie charts
|
|
|
|
animationSteps : 1,
|
|
|
|
animationEasing : 'easeOutBounce',
|
|
|
|
animateRotate : false,
|
|
|
|
animateScale : false,
|
|
|
|
legendTemplate : '<ul class="list-inline tc-chart-js-legend"><% for (var i=0; i<segments.length; i++){%><li><span style="color:<%=segments[i].fillColor%>"><%if(segments[i].label){%><%=segments[i].label%>: <%=segments[i].value%>Gb <%}%></span></li><%}%></ul>'
|
|
|
|
};
|
|
|
|
});
|
2014-11-26 00:25:10 +08:00
|
|
|
|
|
|
|
Host.getLoad(function(load) {
|
|
|
|
$scope.loadData = {
|
|
|
|
labels: ['1 min', '5 min', '15 min'],
|
|
|
|
datasets: [{
|
|
|
|
label: 'CPU Load',
|
|
|
|
fillColor: 'rgba(220,220,220,0.2)',
|
|
|
|
strokeColor: 'rgba(220,220,220,1)',
|
|
|
|
pointColor: 'rgba(220,220,220,1)',
|
|
|
|
pointStrokeColor: '#fff',
|
|
|
|
pointHighlightFill: '#fff',
|
|
|
|
pointHighlightStroke: 'rgba(220,220,220,1)',
|
|
|
|
data: [ load.load[0], load.load[1], load.load[2] ]
|
|
|
|
}]
|
|
|
|
};
|
|
|
|
});
|
2014-11-25 23:21:30 +08:00
|
|
|
|
|
|
|
});
|