Initial commit
This commit is contained in:
commit
880e39de2e
511 files changed
+38363
No files matched your search
@@ -0,0 +1,17 @@
|
||||
<div layout="row" layout-align="end center">
|
||||
<md-button class="md-icon-button" ng-click="grid.appScope.edit(row.entity)" has-permission="{{grid.appScope.Constants.Permissions.ADD_SCRIPT}}">
|
||||
<md-icon class="md-16">edit</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="left">Edit Script</md-tooltip>
|
||||
</md-button>
|
||||
|
||||
<md-button class="md-icon-button" ng-click="grid.appScope.run(row.entity)" has-permission="{{grid.appScope.Constants.Permissions.RUN_SCRIPT}}">
|
||||
<md-icon class="md-16">play_arrow</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="left">Manual Run of script</md-tooltip>
|
||||
</md-button>
|
||||
|
||||
<md-button class="md-icon-button" ng-click="grid.appScope.delete(row.entity)" has-permission="{{grid.appScope.Constants.Permissions.DELETE_SCRIPT}}">
|
||||
<md-icon class="md-16">delete</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="left">Delete Script</md-tooltip>
|
||||
</md-button>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,10 @@
|
||||
<div layout="row" layout-align="end center">
|
||||
<md-button class="md-icon-button" ng-click="grid.appScope.viewStatus(row.entity)" has-permission="{{grid.appScope.Constants.Permissions.VIEW_SCRIPT_SCHED_STATUS}}">
|
||||
<md-icon class="md-16">remove_red_eye</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="left">View Status Results</md-tooltip>
|
||||
</md-button>
|
||||
<md-button class="md-icon-button" ng-click="grid.appScope.deleteSchedule(row.entity)" has-permission="{{grid.appScope.Constants.Permissions.DELETE_SCRIPT_SCHED_STATUS}}">
|
||||
<md-icon class="md-16">delete</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="left">Delete Schedule</md-tooltip>
|
||||
</md-button>
|
||||
</div>
|
||||
@@ -0,0 +1,7 @@
|
||||
<div class="ui-grid-cell-contents"
|
||||
ng-class="{
|
||||
'text-danger': row.entity.executionStatus !== 0 && row.entity.currentExecutionCount !== null,
|
||||
'play-green': row.entity.executionStatus === 0
|
||||
}">
|
||||
{{grid.appScope.formatStatus(row.entity)}}
|
||||
</div>
|
||||
@@ -0,0 +1,21 @@
|
||||
<div class="portal-repo-bank-selector fill-height" ng-if="tab.active" ng-cloak layout="column" flex="100" ng-controller="ScriptBankCtrl">
|
||||
<md-content layout-xs="column" layout="row" layout-fill>
|
||||
<md-card class="md-padding" flex>
|
||||
<md-toolbar class="md-portal">
|
||||
<div class="md-toolbar-tools">
|
||||
<span style="padding-bottom=30px;">Available Scripts</span>
|
||||
<span flex></span>
|
||||
<md-button class="md-icon-button" ng-click="toggleFiltering()">
|
||||
<md-icon >filter</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="bottom">Filter</md-tooltip>
|
||||
</md-button>
|
||||
<md-button class="md-icon-button" ng-click="addScript()" has-permission="{{Constants.Permissions.ADD_SCRIPT}}">
|
||||
<md-icon >add</md-icon>
|
||||
<md-tooltip md-delay="500" class="mediaTileToolTip" md-direction="bottom">Add New Script</md-tooltip>
|
||||
</md-button>
|
||||
</div>
|
||||
</md-toolbar>
|
||||
<div class="panel-body padding-none" ui-grid="scriptGrid" ng-if="tab.active" ui-grid-pagination ui-grid-save-state ui-grid-auto-resize ui-grid-resize-columns ui-grid-pinning ui-grid-expandable style="height:95%"></div>
|
||||
</md-card>
|
||||
</md-content>
|
||||
</div>
|
||||
@@ -0,0 +1,234 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* MODULE DESCRIPTION:
|
||||
*
|
||||
* TODO: Write description here.
|
||||
*/
|
||||
angular.module('portal.dashboard.scriptBank', ['ui.router'])
|
||||
.controller('ScriptBankCtrl', ScriptBankCtrlController);
|
||||
|
||||
function ScriptBankCtrlController($scope, cache, scriptStores, scriptProvider,
|
||||
accountStores, $mdDialog, uiGridConstants, portalUtils, $log, Triggers, Constants) {
|
||||
|
||||
$scope.confirmQuestionBox = true;
|
||||
|
||||
$scope.scripts = [];
|
||||
|
||||
$scope.userRole = '';
|
||||
|
||||
$scope.Constants = Constants;
|
||||
|
||||
$scope.mCache = cache.request([
|
||||
new accountStores.Account(),
|
||||
new scriptStores.Scripts()
|
||||
]).then(function(){
|
||||
$scope.acct = $scope.mCache.account.data;
|
||||
$scope.scripts = $scope.mCache.scripts.data.values;
|
||||
for (var i = 0; i < $scope.scripts.length; i++) {
|
||||
$scope.scripts[i].subGridOptions = {
|
||||
data: $scope.scripts[i].schedule,
|
||||
columnDefs: [
|
||||
{field: 'jobId', displayName: 'Job Id', width: '**'},
|
||||
{field: 'startDatetime', displayName: 'Start Date/Time', width: '*',
|
||||
cellTemplate: '<div class="ui-grid-cell-contents">{{grid.appScope.formatTimeSub(row.entity.startDatetime)}}</div>'},
|
||||
{field: 'endDatetime', displayName: 'End Date/Time', width: '*',
|
||||
cellTemplate: '<div class="ui-grid-cell-contents">{{grid.appScope.formatTimeSub(row.entity.endDatetime)}}</div>'},
|
||||
{field: 'frequency', displayName: 'Frequency', width: '*'},
|
||||
{field: 'maxExecutions', displayName: 'Max Executions', width: '*'},
|
||||
{field: 'currentExecutionCount', displayName: 'Current Count', width: '*'},
|
||||
{field: 'lastRun', displayName: 'Last Ran', width: '*',
|
||||
cellTemplate: '<div class="ui-grid-cell-contents">{{grid.appScope.formatTimeSub(row.entity.lastRun)}}</div>'},
|
||||
{field: 'executionStatus', displayName: 'Status', width: '*',
|
||||
cellTemplate: 'main/script-bank/cell-templates/script-sched-status.html'},
|
||||
{field: 'id', displayName: '', width: '100', enableColumnMenu: false, enableFiltering: false, enableHiding: false,
|
||||
cellTemplate: 'main/script-bank/cell-templates/script-sched-actions.html'},
|
||||
]
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
$scope.scriptGrid = {
|
||||
data: 'scripts',
|
||||
expandableRowTemplate:'<div ui-grid="row.entity.subGridOptions" style="height:150px;"></div>',
|
||||
expandableRowScope: {
|
||||
Constants : $scope.Constants,
|
||||
formatTimeSub : function(value) {
|
||||
if (value === null || value === undefined || value === 0) {
|
||||
return 'None';
|
||||
}
|
||||
return $scope.formatTime(value);
|
||||
},
|
||||
deleteSchedule: function(entity) {
|
||||
$scope.deleteSchedule(entity);
|
||||
},
|
||||
formatStatus: function(entity) {
|
||||
return $scope.formatScriptStatus(entity);
|
||||
},
|
||||
viewStatus: function(entity) {
|
||||
$scope.viewScriptStatus(entity);
|
||||
}
|
||||
},
|
||||
paginationPageSizes: [25, 50, 75, 100, 125, 150, 175, 200],
|
||||
paginationPageSize: 25,
|
||||
enableHorizontalScrollbar: uiGridConstants.scrollbars.NEVER,
|
||||
toggleModifierKeysToMultiSelect : true,
|
||||
enableRowHeaderSelection: true,
|
||||
enableColumnMenus: true,
|
||||
enableGridMenu: true,
|
||||
exporterMenuCsv: true,
|
||||
multiSelect: false,
|
||||
noUnselect: false,
|
||||
onRegisterApi: function (gridApi) {
|
||||
$scope.scriptGridApi = gridApi;
|
||||
},
|
||||
columnDefs: [
|
||||
{field: 'name', displayName: 'Name', width: '*'},
|
||||
{field: 'command', displayName: 'Command', width: '**' },
|
||||
{field: 'parameters', displayName: 'Parameters', width: '**',
|
||||
cellTemplate: '<div class="ui-grid-cell-contents">{{grid.appScope.formatParameters(row.entity.parameters)}}</div>'},
|
||||
{field: 'schedule', displayName: 'Schedule Count', width: '*',
|
||||
cellTemplate: '<div class="ui-grid-cell-contents">{{row.entity.schedule.length}}</div>'},
|
||||
{field: 'id', displayName: 'Actions', width: '125', enableColumnMenu: false, enableFiltering: false, enableHiding: false,
|
||||
cellTemplate: 'main/script-bank/cell-templates/script-actions.html'
|
||||
}
|
||||
],
|
||||
};
|
||||
|
||||
$scope.formatScriptStatus = function(entity) {
|
||||
if (entity.currentExecutionCount === null) {
|
||||
return 'Not Ran';
|
||||
}
|
||||
|
||||
if (entity.executionStatus !== 0) {
|
||||
return 'Failed';
|
||||
}
|
||||
|
||||
return 'Success';
|
||||
};
|
||||
|
||||
$scope.formatParameters = function(parameters) {
|
||||
var params = '';
|
||||
|
||||
for (var i = 0; i < parameters.length; i++) {
|
||||
params += parameters[i].parameter + ' ';
|
||||
}
|
||||
return params;
|
||||
};
|
||||
|
||||
$scope.formatTime = function(value) {
|
||||
return moment(value).format('MMM D, YYYY hh:mm:ss A');
|
||||
};
|
||||
|
||||
$scope.run = function(entity) {
|
||||
portalUtils.confirmBox('run', 'Run Script', ['Are you sure you want to manually run the script', entity.name],
|
||||
true, function(value) {
|
||||
if (value.confirm) {
|
||||
$scope.confirmQuestionBox = !value.checkbox;
|
||||
$scope.runScript(entity);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.runScript = function(entity) {
|
||||
scriptProvider.runScript(entity).then(function() {
|
||||
portalUtils.toast('Script scheduled to run', ['top', 'left'], 2000);
|
||||
}, function(err){
|
||||
portalUtils.toast('Unable to run script: ' + err.message, ['top', 'left'], 4000);
|
||||
new scriptStores.Scripts().refresh();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.deleteSchedule = function(entity) {
|
||||
portalUtils.confirmBox('deleteSched', 'Delete Schedule', ['Are you sure you want to delete the schedule', entity.jobId],
|
||||
false, function(value) {
|
||||
if (value.confirm) {
|
||||
$scope.deleteSched(entity);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.deleteSched = function(entity) {
|
||||
scriptProvider.deleteScriptSchedule(entity).then(function(){
|
||||
portalUtils.toast('Script schedule deleted successfully', ['top', 'left'], 2000);
|
||||
}, function(err){
|
||||
portalUtils.toast('Unable to delete script : ' + err.message, ['top', 'left'], 4000);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.delete = function(entity) {
|
||||
if ($scope.confirmQuestionBox) {
|
||||
portalUtils.confirmBox('deleteScript', 'Delete Script', ['Are you sure you want to delete the script', entity.name],
|
||||
true, function(value) {
|
||||
if (value.confirm) {
|
||||
$scope.confirmQuestionBox = !value.checkbox;
|
||||
$scope.deleteScript(entity);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$scope.deleteScript(entity);
|
||||
}
|
||||
};
|
||||
|
||||
$scope.deleteScript = function(entity) {
|
||||
scriptProvider.deleteScript(entity).then(function() {
|
||||
portalUtils.toast('Script deleted successfully', ['top', 'left'], 2000);
|
||||
},function(err){
|
||||
portalUtils.toast('Unable to delete script: ' + err.message, ['top', 'left'], 4000);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.edit = function(entity) {
|
||||
$mdDialog.show({
|
||||
templateUrl: 'common/partials/add-script/add-script.html',
|
||||
controller: 'AddScriptCtrl',
|
||||
escapeToClose: false,
|
||||
locals: {
|
||||
modalInstance: {
|
||||
header: 'Edit Script',
|
||||
script: entity
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.addScript = function() {
|
||||
$mdDialog.show({
|
||||
templateUrl: 'common/partials/add-script/add-script.html',
|
||||
controller: 'AddScriptCtrl',
|
||||
escapeToClose: false,
|
||||
locals: {
|
||||
modalInstance: {
|
||||
header: 'Add New Script',
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.viewScriptStatus = function(entity) {
|
||||
$mdDialog.show({
|
||||
templateUrl: 'common/partials/script-status/view-script-status.html',
|
||||
controller: 'ScriptStatusCtrl',
|
||||
escapeToClose: false,
|
||||
locals: {
|
||||
modalInstance: {
|
||||
jobId: entity.jobId,
|
||||
header: 'Script Status'
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.toggleFiltering = function() {
|
||||
$scope.scriptGrid.enableFiltering = !$scope.scriptGrid.enableFiltering;
|
||||
$scope.scriptGridApi.core.notifyDataChange( uiGridConstants.dataChange.COLUMN );
|
||||
};
|
||||
|
||||
$scope.$on('$destroy', function () {
|
||||
$scope.mCache.unlisten();
|
||||
});
|
||||
|
||||
} //end ScriptBankCtrlController function
|
||||
|
||||
})();
|
||||
Reference in new issue
Block a user