mirror of
https://github.com/ZwareBear/awx.git
synced 2026-04-05 07:31:49 -05:00
Adding the Copyright and All Rights Reserved to the JS files, as well as removing pwdmeter and 3dDonut chart (in lieu of d3.js donut chart) adding the legend and getting pie chart to donut adding data labels to donut chart working legend and tooltip job detail donut Ansible Copyright added to beginning of all JS files removing pwdmeter and d3donut fixing merge conflicts
99 lines
3.2 KiB
JavaScript
99 lines
3.2 KiB
JavaScript
/*************************************************
|
|
* Copyright (c) 2015 Ansible, Inc.
|
|
*
|
|
* All Rights Reserved
|
|
*************************************************/
|
|
|
|
/**
|
|
* @ngdoc function
|
|
* @name controllers.function:Schedules
|
|
* @description This controller's for schedules
|
|
*/
|
|
|
|
|
|
export function ScheduleEditController($scope, $compile, $location, $routeParams, SchedulesList, Rest, ProcessErrors, LoadBreadCrumbs, ReturnToCaller, ClearScope,
|
|
GetBasePath, Wait, Breadcrumbs, Find, LoadDialogPartial, LoadSchedulesScope, GetChoices, Stream) {
|
|
|
|
ClearScope();
|
|
|
|
var base, e, id, url, parentObject;
|
|
|
|
base = $location.path().replace(/^\//, '').split('/')[0];
|
|
|
|
if ($scope.removePostRefresh) {
|
|
$scope.removePostRefresh();
|
|
}
|
|
$scope.removePostRefresh = $scope.$on('PostRefresh', function() {
|
|
var list = $scope.schedules;
|
|
list.forEach(function(element, idx) {
|
|
list[idx].play_tip = (element.enabled) ? 'Schedule is Active. Click to temporarily stop.' : 'Schedule is temporarily stopped. Click to activate.';
|
|
});
|
|
});
|
|
|
|
if ($scope.removeParentLoaded) {
|
|
$scope.removeParentLoaded();
|
|
}
|
|
$scope.removeParentLoaded = $scope.$on('ParentLoaded', function() {
|
|
// Add breadcrumbs
|
|
LoadBreadCrumbs({
|
|
path: $location.path().replace(/\/schedules$/,''),
|
|
title: parentObject.name
|
|
});
|
|
e = angular.element(document.getElementById('breadcrumbs'));
|
|
e.html(Breadcrumbs({ list: SchedulesList, mode: 'edit' }));
|
|
$compile(e)($scope);
|
|
|
|
url += "schedules/";
|
|
SchedulesList.well = true;
|
|
LoadSchedulesScope({
|
|
parent_scope: $scope,
|
|
scope: $scope,
|
|
list: SchedulesList,
|
|
id: 'schedule-list-target',
|
|
url: url,
|
|
pageSize: 20
|
|
});
|
|
});
|
|
|
|
|
|
if ($scope.removeChoicesReady) {
|
|
$scope.removeChocesReady();
|
|
}
|
|
$scope.removeChoicesReady = $scope.$on('choicesReady', function() {
|
|
// Load the parent object
|
|
id = $routeParams.id;
|
|
url = GetBasePath(base) + id + '/';
|
|
Rest.setUrl(url);
|
|
Rest.get()
|
|
.success(function(data) {
|
|
parentObject = data;
|
|
$scope.$emit('ParentLoaded');
|
|
})
|
|
.error(function(data, status) {
|
|
ProcessErrors($scope, data, status, null, { hdr: 'Error!',
|
|
msg: 'Call to ' + url + ' failed. GET returned: ' + status });
|
|
});
|
|
});
|
|
|
|
$scope.refreshJobs = function() {
|
|
$scope.search(SchedulesList.iterator);
|
|
};
|
|
|
|
$scope.showActivity = function () {
|
|
Stream({ scope: $scope });
|
|
};
|
|
|
|
Wait('start');
|
|
|
|
GetChoices({
|
|
scope: $scope,
|
|
url: GetBasePath('unified_jobs'), //'/static/sample/data/types/data.json'
|
|
field: 'type',
|
|
variable: 'type_choices',
|
|
callback: 'choicesReady'
|
|
});
|
|
}
|
|
|
|
ScheduleEditController.$inject = [ '$scope', '$compile', '$location', '$routeParams', 'SchedulesList', 'Rest', 'ProcessErrors', 'LoadBreadCrumbs', 'ReturnToCaller', 'ClearScope',
|
|
'GetBasePath', 'Wait', 'Breadcrumbs', 'Find', 'LoadDialogPartial', 'LoadSchedulesScope', 'GetChoices', 'Stream' ];
|