mirror of
https://github.com/ansible/awx.git
synced 2026-03-11 06:29:31 -02:30
Update delete modals and fixed unit test failures
This commit is contained in:
@@ -33,7 +33,10 @@
|
|||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<div class="Modal-content modal-content">
|
<div class="Modal-content modal-content">
|
||||||
<div class="Modal-header">
|
<div class="Modal-header">
|
||||||
<div class="Modal-title" ng-bind="promptHeader" id="prompt-header"></div>
|
<div class="Modal-title" id="prompt-header">
|
||||||
|
<span ng-bind="promptHeader"></span>
|
||||||
|
<span class="Modal-titleResourceName" ng-bind="promptResourceName"></span>
|
||||||
|
</div>
|
||||||
<div class="Modal-exitHolder">
|
<div class="Modal-exitHolder">
|
||||||
<button class="close Modal-exit" data-target="#prompt-modal" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times-circle"></i></button>
|
<button class="close Modal-exit" data-target="#prompt-modal" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times-circle"></i></button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ export default ['$scope', 'Rest', 'CredentialList', 'Prompt', 'ProcessErrors', '
|
|||||||
|
|
||||||
counts.forEach(countObj => {
|
counts.forEach(countObj => {
|
||||||
if(countObj.count && countObj.count > 0) {
|
if(countObj.count && countObj.count > 0) {
|
||||||
invalidateRelatedLines.push(`<div>${countObj.label} <span class="badge List-titleBadge">${countObj.count}</span></div>`);
|
invalidateRelatedLines.push(`<div><span class="Prompt-warningResourceTitle">${countObj.label}</span><span class="badge List-titleBadge">${countObj.count}</span></div>`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -130,7 +130,8 @@ export default ['$scope', 'Rest', 'CredentialList', 'Prompt', 'ProcessErrors', '
|
|||||||
}
|
}
|
||||||
|
|
||||||
Prompt({
|
Prompt({
|
||||||
hdr: i18n._('Delete') + ' ' + $filter('sanitize')(name),
|
hdr: i18n._('Delete'),
|
||||||
|
resourceName: $filter('sanitize')(name),
|
||||||
body: deleteModalBody,
|
body: deleteModalBody,
|
||||||
action: action,
|
action: action,
|
||||||
actionText: 'DELETE'
|
actionText: 'DELETE'
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ function InventoriesList($scope,
|
|||||||
|
|
||||||
counts.forEach(countObj => {
|
counts.forEach(countObj => {
|
||||||
if(countObj.count && countObj.count > 0) {
|
if(countObj.count && countObj.count > 0) {
|
||||||
invalidateRelatedLines.push(`<div>${countObj.label} <span class="badge List-titleBadge">${countObj.count}</span></div>`);
|
invalidateRelatedLines.push(`<div><span class="Prompt-warningResourceTitle">${countObj.label}</span><span class="badge List-titleBadge">${countObj.count}</span></div>`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -117,7 +117,8 @@ function InventoriesList($scope,
|
|||||||
deleteModalBody += '<div class="Prompt-bodyNote"><span class="Prompt-bodyNote--emphasis">Note:</span> ' + i18n._('The inventory will be in a pending status until the final delete is processed.') + '</div>';
|
deleteModalBody += '<div class="Prompt-bodyNote"><span class="Prompt-bodyNote--emphasis">Note:</span> ' + i18n._('The inventory will be in a pending status until the final delete is processed.') + '</div>';
|
||||||
|
|
||||||
Prompt({
|
Prompt({
|
||||||
hdr: i18n._('Delete') + ' ' + $filter('sanitize')(name),
|
hdr: i18n._('Delete'),
|
||||||
|
resourceName: $filter('sanitize')(name),
|
||||||
body: deleteModalBody,
|
body: deleteModalBody,
|
||||||
action: action,
|
action: action,
|
||||||
actionText: 'DELETE'
|
actionText: 'DELETE'
|
||||||
|
|||||||
@@ -147,7 +147,7 @@
|
|||||||
|
|
||||||
counts.forEach(countObj => {
|
counts.forEach(countObj => {
|
||||||
if(countObj.count && countObj.count > 0) {
|
if(countObj.count && countObj.count > 0) {
|
||||||
invalidateRelatedLines.push(`<div>${countObj.label} <span class="badge List-titleBadge">${countObj.count}</span></div>`);
|
invalidateRelatedLines.push(`<div><span class="Prompt-warningResourceTitle">${countObj.label}</span><span class="badge List-titleBadge">${countObj.count}</span></div>`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -159,7 +159,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
Prompt({
|
Prompt({
|
||||||
hdr: i18n._('Delete Source') + ' ' + $filter('sanitize')(inventory_source.name),
|
hdr: i18n._('Delete Source'),
|
||||||
|
resourceName: $filter('sanitize')(inventory_source.name),
|
||||||
body: deleteModalBody,
|
body: deleteModalBody,
|
||||||
action: action,
|
action: action,
|
||||||
actionText: 'DELETE'
|
actionText: 'DELETE'
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ export default ['$rootScope', '$scope', 'Wait', 'InventoryScriptsList',
|
|||||||
|
|
||||||
counts.forEach(countObj => {
|
counts.forEach(countObj => {
|
||||||
if(countObj.count && countObj.count > 0) {
|
if(countObj.count && countObj.count > 0) {
|
||||||
invalidateRelatedLines.push(`<div>${countObj.label} <span class="badge List-titleBadge">${countObj.count}</span></div>`);
|
invalidateRelatedLines.push(`<div><span class="Prompt-warningResourceTitle">${countObj.label}</span><span class="badge List-titleBadge">${countObj.count}</span></div>`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -96,7 +96,8 @@ export default ['$rootScope', '$scope', 'Wait', 'InventoryScriptsList',
|
|||||||
}
|
}
|
||||||
|
|
||||||
Prompt({
|
Prompt({
|
||||||
hdr: i18n._('Delete') + ' ' + $filter('sanitize')(name),
|
hdr: i18n._('Delete'),
|
||||||
|
resourceName: $filter('sanitize')(name),
|
||||||
body: deleteModalBody,
|
body: deleteModalBody,
|
||||||
action: action,
|
action: action,
|
||||||
actionText: 'DELETE'
|
actionText: 'DELETE'
|
||||||
|
|||||||
@@ -91,11 +91,9 @@ function ($q, Prompt, $filter, Wait, Rest, $state, ProcessErrors, InitiatePlaybo
|
|||||||
deleteJob: function(job) {
|
deleteJob: function(job) {
|
||||||
Prompt({
|
Prompt({
|
||||||
hdr: i18n._("Delete Job"),
|
hdr: i18n._("Delete Job"),
|
||||||
|
resourceName: `#${job.id} ` + $filter('sanitize')(job.name),
|
||||||
body: `<div class='Prompt-bodyQuery'>
|
body: `<div class='Prompt-bodyQuery'>
|
||||||
${i18n._("Are you sure you want to delete the job below?")}
|
${i18n._("Are you sure you want to delete this job?")}
|
||||||
</div>
|
|
||||||
<div class='Prompt-bodyTarget'>
|
|
||||||
#${job.id} ${$filter('sanitize')(job.name)}
|
|
||||||
</div>`,
|
</div>`,
|
||||||
action: function() {
|
action: function() {
|
||||||
Wait('start');
|
Wait('start');
|
||||||
@@ -140,11 +138,9 @@ function ($q, Prompt, $filter, Wait, Rest, $state, ProcessErrors, InitiatePlaybo
|
|||||||
|
|
||||||
Prompt({
|
Prompt({
|
||||||
hdr: i18n._('Cancel Job'),
|
hdr: i18n._('Cancel Job'),
|
||||||
|
resourceName: `#${job.id} ` + $filter('sanitize')(job.name),
|
||||||
body: `<div class='Prompt-bodyQuery' translate>
|
body: `<div class='Prompt-bodyQuery' translate>
|
||||||
${i18n._("Are you sure you want to cancel the job below?")}
|
${i18n._("Are you sure you want to cancel this job?")}
|
||||||
</div>
|
|
||||||
<div class='Prompt-bodyTarget'>
|
|
||||||
#${job.id} ${$filter('sanitize')(job.name)}
|
|
||||||
</div>`,
|
</div>`,
|
||||||
action: function() {
|
action: function() {
|
||||||
Wait('start');
|
Wait('start');
|
||||||
|
|||||||
@@ -106,10 +106,11 @@
|
|||||||
scope.removeCancelJob();
|
scope.removeCancelJob();
|
||||||
}
|
}
|
||||||
scope.removeCancelJob = scope.$on('CancelJob', function() {
|
scope.removeCancelJob = scope.$on('CancelJob', function() {
|
||||||
var cancelBody = "<div class=\"Prompt-bodyQuery\">" + i18n._("Submit the request to cancel?") + "</div>";
|
var cancelBody = "<div class=\"Prompt-bodyQuery\">" + i18n._("Are you sure you want to submit the request to cancel this job?") + "</div>";
|
||||||
var deleteBody = "<div class=\"Prompt-bodyQuery\">" + i18n._("Are you sure you want to delete the job below?") + "</div><div class=\"Prompt-bodyTarget\" translate>#" + id + " " + $filter('sanitize')(job.name) + "</div>";
|
var deleteBody = "<div class=\"Prompt-bodyQuery\">" + i18n._("Are you sure you want to delete this job?") + "</div>";
|
||||||
Prompt({
|
Prompt({
|
||||||
hdr: hdr,
|
hdr: hdr,
|
||||||
|
resourceName: `#${job.id} ` + $filter('sanitize')(job.name),
|
||||||
body: (action_label === 'cancel' || job.status === 'new') ? cancelBody : deleteBody,
|
body: (action_label === 'cancel' || job.status === 'new') ? cancelBody : deleteBody,
|
||||||
action: action,
|
action: action,
|
||||||
actionText: (action_label === 'cancel' || job.status === 'new') ? i18n._("OK") : i18n._("DELETE")
|
actionText: (action_label === 'cancel' || job.status === 'new') ? i18n._("OK") : i18n._("DELETE")
|
||||||
|
|||||||
@@ -193,10 +193,11 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
var bodyHtml = '<div class="Prompt-bodyQuery">' + i18n._('Are you sure you want to delete the notification template below?') + '</div><div class="Prompt-bodyTarget">' + $filter('sanitize')(name) + '</div>';
|
|
||||||
Prompt({
|
Prompt({
|
||||||
hdr: i18n._('Delete'),
|
hdr: i18n._('Delete'),
|
||||||
body: bodyHtml,
|
resourceName: $filter('sanitize')(name),
|
||||||
|
body: '<div class="Prompt-bodyQuery">' + i18n._('Are you sure you want to delete this notification template?') + '</div>',
|
||||||
action: action,
|
action: action,
|
||||||
actionText: i18n._('DELETE')
|
actionText: i18n._('DELETE')
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -169,7 +169,8 @@ export default ['$stateParams', '$scope', '$rootScope',
|
|||||||
|
|
||||||
Prompt({
|
Prompt({
|
||||||
hdr: i18n._('Delete'),
|
hdr: i18n._('Delete'),
|
||||||
body: '<div class="Prompt-bodyQuery">' + i18n._('Are you sure you want to delete the organization below? This makes everything in this organization unavailable.') + '</div><div class="Prompt-bodyTarget">' + $filter('sanitize')(name) + '</div>',
|
resourceName: $filter('sanitize')(name),
|
||||||
|
body: '<div class="Prompt-bodyQuery">' + i18n._('Are you sure you want to delete this organization? This makes everything in this organization unavailable.') + '</div>',
|
||||||
action: action,
|
action: action,
|
||||||
actionText: i18n._('DELETE')
|
actionText: i18n._('DELETE')
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ export default ['$scope', '$rootScope', '$log', 'Rest', 'Alert',
|
|||||||
|
|
||||||
counts.forEach(countObj => {
|
counts.forEach(countObj => {
|
||||||
if(countObj.count && countObj.count > 0) {
|
if(countObj.count && countObj.count > 0) {
|
||||||
invalidateRelatedLines.push(`<div>${countObj.label} <span class="badge List-titleBadge">${countObj.count}</span></div>`);
|
invalidateRelatedLines.push(`<div><span class="Prompt-warningResourceTitle">${countObj.label}</span><span class="badge List-titleBadge">${countObj.count}</span></div>`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -222,7 +222,8 @@ export default ['$scope', '$rootScope', '$log', 'Rest', 'Alert',
|
|||||||
}
|
}
|
||||||
|
|
||||||
Prompt({
|
Prompt({
|
||||||
hdr: i18n._('Delete') + ' ' + $filter('sanitize')(name),
|
hdr: i18n._('Delete'),
|
||||||
|
resourceName: $filter('sanitize')(name),
|
||||||
body: deleteModalBody,
|
body: deleteModalBody,
|
||||||
action: action,
|
action: action,
|
||||||
actionText: 'DELETE'
|
actionText: 'DELETE'
|
||||||
|
|||||||
@@ -54,7 +54,8 @@ export default
|
|||||||
|
|
||||||
Prompt({
|
Prompt({
|
||||||
hdr: hdr,
|
hdr: hdr,
|
||||||
body: '<div class="Prompt-bodyQuery">Are you sure you want to delete the schedule below?</div><div class="Prompt-bodyTarget">' + $filter('sanitize')(schedule.name) + '</div>',
|
resourceName: $filter('sanitize')(schedule.name),
|
||||||
|
body: '<div class="Prompt-bodyQuery">Are you sure you want to delete this schedule?</div>',
|
||||||
action: action,
|
action: action,
|
||||||
actionText: 'DELETE',
|
actionText: 'DELETE',
|
||||||
backdrop: false
|
backdrop: false
|
||||||
|
|||||||
@@ -123,3 +123,7 @@
|
|||||||
.Modal-footerButton + .Modal-footerButton {
|
.Modal-footerButton + .Modal-footerButton {
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.Modal-titleResourceName {
|
||||||
|
color: @default-err;
|
||||||
|
}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ angular.module('PromptDialog', ['Utilities'])
|
|||||||
scope = dialog.scope(), cls, local_backdrop;
|
scope = dialog.scope(), cls, local_backdrop;
|
||||||
|
|
||||||
scope.promptHeader = params.hdr;
|
scope.promptHeader = params.hdr;
|
||||||
|
scope.promptResourceName = params.resourceName;
|
||||||
scope.promptBody = params.body;
|
scope.promptBody = params.body;
|
||||||
scope.promptAction = params.action;
|
scope.promptAction = params.action;
|
||||||
scope.promptActionText = (params.actionText === null || params.actionText === undefined || params.actionText === '') ? 'YES' : params.actionText;
|
scope.promptActionText = (params.actionText === null || params.actionText === undefined || params.actionText === '') ? 'YES' : params.actionText;
|
||||||
|
|||||||
@@ -23,3 +23,7 @@
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.Prompt-warningResourceTitle {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|||||||
@@ -6,9 +6,9 @@
|
|||||||
|
|
||||||
export default ['$scope', 'Rest', 'TeamList', 'Prompt',
|
export default ['$scope', 'Rest', 'TeamList', 'Prompt',
|
||||||
'ProcessErrors', 'GetBasePath', 'Wait', '$state', '$filter',
|
'ProcessErrors', 'GetBasePath', 'Wait', '$state', '$filter',
|
||||||
'rbacUiControlService', 'Dataset',
|
'rbacUiControlService', 'Dataset', 'i18n',
|
||||||
function($scope, Rest, TeamList, Prompt, ProcessErrors,
|
function($scope, Rest, TeamList, Prompt, ProcessErrors,
|
||||||
GetBasePath, Wait, $state, $filter, rbacUiControlService, Dataset) {
|
GetBasePath, Wait, $state, $filter, rbacUiControlService, Dataset, i18n) {
|
||||||
|
|
||||||
var list = TeamList,
|
var list = TeamList,
|
||||||
defaultUrl = GetBasePath('teams');
|
defaultUrl = GetBasePath('teams');
|
||||||
@@ -77,7 +77,8 @@ export default ['$scope', 'Rest', 'TeamList', 'Prompt',
|
|||||||
|
|
||||||
Prompt({
|
Prompt({
|
||||||
hdr: 'Delete',
|
hdr: 'Delete',
|
||||||
body: '<div class="Prompt-bodyQuery">Are you sure you want to delete the team below?</div><div class="Prompt-bodyTarget">' + $filter('sanitize')(name) + '</div>',
|
resourceName: $filter('sanitize')(name),
|
||||||
|
body: '<div class="Prompt-bodyQuery">' + i18n._('Are you sure you want to delete this team?') + '</div>',
|
||||||
action: action,
|
action: action,
|
||||||
actionText: 'DELETE'
|
actionText: 'DELETE'
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -150,31 +150,44 @@ export default ['$scope', '$rootScope',
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
jobTemplate.getDependentResourceCounts(template.id)
|
if(template.type && (template.type === 'Workflow Job Template' || template.type === 'workflow_job_template')) {
|
||||||
.then((counts) => {
|
Prompt({
|
||||||
const invalidateRelatedLines = [];
|
hdr: i18n._('Delete'),
|
||||||
let deleteModalBody = `<div class="Prompt-bodyQuery">${TemplatesStrings.get('jobTemplates.deleteJobTemplate.CONFIRM')}</div>`;
|
resourceName: $filter('sanitize')(template.name),
|
||||||
|
body: TemplatesStrings.get('workflowJobTemplates.deleteWorkflowJobTemplate.CONFIRM'),
|
||||||
counts.forEach(countObj => {
|
action: action,
|
||||||
if(countObj.count && countObj.count > 0) {
|
actionText: 'DELETE'
|
||||||
invalidateRelatedLines.push(`<div>${countObj.label} <span class="badge List-titleBadge">${countObj.count}</span></div>`);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (invalidateRelatedLines && invalidateRelatedLines.length > 0) {
|
|
||||||
deleteModalBody = `<div class="Prompt-bodyQuery">${TemplatesStrings.get('jobTemplates.deleteJobTemplate.CONFIRM')} ${TemplatesStrings.get('jobTemplates.deleteJobTemplate.INVALIDATE')}</div>`;
|
|
||||||
invalidateRelatedLines.forEach(invalidateRelatedLine => {
|
|
||||||
deleteModalBody += invalidateRelatedLine;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Prompt({
|
|
||||||
hdr: i18n._('Delete') + ' ' + $filter('sanitize')(template.name),
|
|
||||||
body: deleteModalBody,
|
|
||||||
action: action,
|
|
||||||
actionText: 'DELETE'
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
else if(template.type && (template.type === 'Job Template' || template.type === 'job_template')) {
|
||||||
|
|
||||||
|
jobTemplate.getDependentResourceCounts(template.id)
|
||||||
|
.then((counts) => {
|
||||||
|
const invalidateRelatedLines = [];
|
||||||
|
let deleteModalBody = `<div class="Prompt-bodyQuery">${TemplatesStrings.get('jobTemplates.deleteJobTemplate.CONFIRM')}</div>`;
|
||||||
|
|
||||||
|
counts.forEach(countObj => {
|
||||||
|
if(countObj.count && countObj.count > 0) {
|
||||||
|
invalidateRelatedLines.push(`<div><span class="Prompt-warningResourceTitle">${countObj.label}</span><span class="badge List-titleBadge">${countObj.count}</span></div>`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (invalidateRelatedLines && invalidateRelatedLines.length > 0) {
|
||||||
|
deleteModalBody = `<div class="Prompt-bodyQuery">${TemplatesStrings.get('jobTemplates.deleteJobTemplate.CONFIRM')} ${TemplatesStrings.get('jobTemplates.deleteJobTemplate.INVALIDATE')}</div>`;
|
||||||
|
invalidateRelatedLines.forEach(invalidateRelatedLine => {
|
||||||
|
deleteModalBody += invalidateRelatedLine;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Prompt({
|
||||||
|
hdr: i18n._('Delete'),
|
||||||
|
resourceName: $filter('sanitize')(template.name),
|
||||||
|
body: deleteModalBody,
|
||||||
|
action: action,
|
||||||
|
actionText: 'DELETE'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Alert('Error: Unable to delete template', 'Template parameter is missing');
|
Alert('Error: Unable to delete template', 'Template parameter is missing');
|
||||||
|
|||||||
@@ -10,6 +10,12 @@ function TemplatesStrings (BaseString) {
|
|||||||
INVALIDATE: t.s('Doing so will invalidate the following:')
|
INVALIDATE: t.s('Doing so will invalidate the following:')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ns.workflowJobTemplates = {
|
||||||
|
deleteWorkflowJobTemplate: {
|
||||||
|
CONFIRM: t.s('Are you sure you want to delete this workflow job template?')
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
TemplatesStrings.$inject = ['BaseStringService'];
|
TemplatesStrings.$inject = ['BaseStringService'];
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
<div id="workflow-modal-dialog" style="display: none;">
|
<div id="workflow-modal-dialog" style="display: none;">
|
||||||
<div class="WorkflowMaker-deleteOverlay" ng-show="deleteOverlayVisible">
|
<div class="WorkflowMaker-deleteOverlay" ng-show="deleteOverlayVisible">
|
||||||
|
<div class="modal-dialog">
|
||||||
<div class="Modal-content modal-content">
|
<div class="Modal-content modal-content">
|
||||||
<div class="Modal-header">
|
<div class="Modal-header">
|
||||||
<div class="Modal-title">REMOVE</div>
|
<div class="Modal-title">
|
||||||
|
<span>DELETE</span>
|
||||||
|
<span class="Modal-titleResourceName" ng-bind="nodeToBeDeleted.unifiedJobTemplate.name"></span>
|
||||||
|
</div>
|
||||||
<div class="Modal-exitHolder">
|
<div class="Modal-exitHolder">
|
||||||
<button class="close Modal-exit" ng-click="cancelDeleteNode()">
|
<button class="close Modal-exit" ng-click="cancelDeleteNode()">
|
||||||
<i class="fa fa-times-circle"></i>
|
<i class="fa fa-times-circle"></i>
|
||||||
@@ -10,14 +14,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="Modal-body ng-binding">
|
<div class="Modal-body ng-binding">
|
||||||
<div class="Prompt-bodyQuery">Are you sure you want to remove the template below?</div>
|
<div class="Prompt-bodyQuery">Are you sure you want to delete this workflow node?</div>
|
||||||
<div class="Prompt-bodyTarget">{{nodeToBeDeleted.unifiedJobTemplate.name}}</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="Modal-footer">
|
<div class="Modal-footer">
|
||||||
<button ng-click="cancelDeleteNode()" class="btn Modal-defaultButton Modal-footerButton">CANCEL</a>
|
<button ng-click="cancelDeleteNode()" class="btn Modal-defaultButton Modal-footerButton">CANCEL</a>
|
||||||
<button ng-click="confirmDeleteNode()" class="btn Modal-footerButton ng-binding Modal-errorButton">DELETE</a>
|
<button ng-click="confirmDeleteNode()" class="btn Modal-footerButton ng-binding Modal-errorButton">DELETE</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="WorkflowMaker-header">
|
<div class="WorkflowMaker-header">
|
||||||
<div class="WorkflowMaker-title">
|
<div class="WorkflowMaker-title">
|
||||||
|
|||||||
@@ -87,7 +87,8 @@ export default ['$scope', '$rootScope', 'Rest', 'UserList', 'Prompt',
|
|||||||
|
|
||||||
Prompt({
|
Prompt({
|
||||||
hdr: i18n._('Delete'),
|
hdr: i18n._('Delete'),
|
||||||
body: '<div class="Prompt-bodyQuery">' + i18n._('Are you sure you want to delete the user below?') + '</div><div class="Prompt-bodyTarget">' + $filter('sanitize')(name) + '</div>',
|
resourceName: $filter('sanitize')(name),
|
||||||
|
body: '<div class="Prompt-bodyQuery">' + i18n._('Are you sure you want to delete this user?') + '</div>',
|
||||||
action: action,
|
action: action,
|
||||||
actionText: i18n._('DELETE')
|
actionText: i18n._('DELETE')
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -35,11 +35,9 @@ export default ['$q', 'Prompt', '$filter', 'Wait', 'Rest', '$state', 'ProcessErr
|
|||||||
deleteJob: function(workflow) {
|
deleteJob: function(workflow) {
|
||||||
Prompt({
|
Prompt({
|
||||||
hdr: 'Delete Job',
|
hdr: 'Delete Job',
|
||||||
|
resourceName: `#${workflow.id} ` + $filter('sanitize')(workflow.name),
|
||||||
body: `<div class='Prompt-bodyQuery'>
|
body: `<div class='Prompt-bodyQuery'>
|
||||||
Are you sure you want to delete the workflow below?
|
Are you sure you want to delete this workflow?
|
||||||
</div>
|
|
||||||
<div class='Prompt-bodyTarget'>
|
|
||||||
#${workflow.id} ${$filter('sanitize')(workflow.name)}
|
|
||||||
</div>`,
|
</div>`,
|
||||||
action: function() {
|
action: function() {
|
||||||
Wait('start');
|
Wait('start');
|
||||||
@@ -84,11 +82,9 @@ export default ['$q', 'Prompt', '$filter', 'Wait', 'Rest', '$state', 'ProcessErr
|
|||||||
|
|
||||||
Prompt({
|
Prompt({
|
||||||
hdr: 'Cancel Workflow',
|
hdr: 'Cancel Workflow',
|
||||||
|
resourceName: `#${workflow.id} ${$filter('sanitize')(workflow.name)}`,
|
||||||
body: `<div class='Prompt-bodyQuery'>
|
body: `<div class='Prompt-bodyQuery'>
|
||||||
Are you sure you want to cancel the workflow below?
|
Are you sure you want to cancel this workflow job?
|
||||||
</div>
|
|
||||||
<div class='Prompt-bodyTarget'>
|
|
||||||
#${workflow.id} ${$filter('sanitize')(workflow.name)}
|
|
||||||
</div>`,
|
</div>`,
|
||||||
action: function() {
|
action: function() {
|
||||||
Wait('start');
|
Wait('start');
|
||||||
|
|||||||
@@ -14,8 +14,10 @@ describe('Controller: TemplatesList', () => {
|
|||||||
canAddDeferred,
|
canAddDeferred,
|
||||||
q,
|
q,
|
||||||
TemplatesService,
|
TemplatesService,
|
||||||
|
JobTemplateModel,
|
||||||
deleteWorkflowJobTemplateDeferred,
|
deleteWorkflowJobTemplateDeferred,
|
||||||
deleteJobTemplateDeferred,
|
deleteJobTemplateDeferred,
|
||||||
|
jobTemplateGetDepDeferred,
|
||||||
Dataset;
|
Dataset;
|
||||||
|
|
||||||
beforeEach(angular.mock.module('awApp'));
|
beforeEach(angular.mock.module('awApp'));
|
||||||
@@ -31,6 +33,14 @@ describe('Controller: TemplatesList', () => {
|
|||||||
id: 1
|
id: 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// JobTemplateModel = {
|
||||||
|
// prototype: {
|
||||||
|
// getDependentResourceCounts: function(){
|
||||||
|
// return angular.noop;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
|
||||||
rbacUiControlService = {
|
rbacUiControlService = {
|
||||||
canAdd: function(){
|
canAdd: function(){
|
||||||
return angular.noop;
|
return angular.noop;
|
||||||
@@ -78,11 +88,26 @@ describe('Controller: TemplatesList', () => {
|
|||||||
canAddDeferred = q.defer();
|
canAddDeferred = q.defer();
|
||||||
deleteWorkflowJobTemplateDeferred = q.defer();
|
deleteWorkflowJobTemplateDeferred = q.defer();
|
||||||
deleteJobTemplateDeferred = q.defer();
|
deleteJobTemplateDeferred = q.defer();
|
||||||
|
jobTemplateGetDepDeferred = q.defer();
|
||||||
|
|
||||||
rbacUiControlService.canAdd = jasmine.createSpy('canAdd').and.returnValue(canAddDeferred.promise);
|
rbacUiControlService.canAdd = jasmine.createSpy('canAdd').and.returnValue(canAddDeferred.promise);
|
||||||
|
|
||||||
TemplatesService.deleteWorkflowJobTemplate = jasmine.createSpy('deleteWorkflowJobTemplate').and.returnValue(deleteWorkflowJobTemplateDeferred.promise);
|
TemplatesService.deleteWorkflowJobTemplate = jasmine.createSpy('deleteWorkflowJobTemplate').and.returnValue(deleteWorkflowJobTemplateDeferred.promise);
|
||||||
TemplatesService.deleteJobTemplate = jasmine.createSpy('deleteJobTemplate').and.returnValue(deleteJobTemplateDeferred.promise);
|
TemplatesService.deleteJobTemplate = jasmine.createSpy('deleteJobTemplate').and.returnValue(deleteJobTemplateDeferred.promise);
|
||||||
|
JobTemplateModel = function () {
|
||||||
|
this.getDependentResourceCounts = function() {
|
||||||
|
return jobTemplateGetDepDeferred.promise;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// JobTemplateModel.prototype.getDependentResourceCounts = jasmine.createSpy()
|
||||||
|
// spyOn(JobTemplateModel, 'getDependentResourceCounts').andCallThrough();
|
||||||
|
|
||||||
|
// JobTemplateModel.prototype.constructor = jasmine.createSpy('constructor').andPassThrough;
|
||||||
|
// JobTemplateModel.prototype.getDependentResourceCounts = jasmine.createSpy('getDependentResourceCounts').and.returnValue(jobTemplateGetDepDeferred.promise);
|
||||||
|
// spyOn(JobTemplate.prototype, "getDependentResourceCounts").and.returnValue(jobTemplateGetDepDeferred.promise);
|
||||||
|
// var mockGetDependentResourceCounts = jasmine.createStub(JobTemplate, ["getDependentResourceCounts"]);
|
||||||
|
// mockGetDependentResourceCounts.method.and.returnValue(jobTemplateGetDepDeferred.promise);
|
||||||
|
|
||||||
TemplatesListController = $controller('TemplatesListController', {
|
TemplatesListController = $controller('TemplatesListController', {
|
||||||
$scope: scope,
|
$scope: scope,
|
||||||
@@ -94,8 +119,11 @@ describe('Controller: TemplatesList', () => {
|
|||||||
InitiatePlaybookRun: InitiatePlaybookRun,
|
InitiatePlaybookRun: InitiatePlaybookRun,
|
||||||
rbacUiControlService: rbacUiControlService,
|
rbacUiControlService: rbacUiControlService,
|
||||||
TemplatesService: TemplatesService,
|
TemplatesService: TemplatesService,
|
||||||
|
JobTemplateModel: JobTemplateModel,
|
||||||
Dataset: Dataset
|
Dataset: Dataset
|
||||||
});
|
});
|
||||||
|
|
||||||
|
rootScope.$apply();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('scope.editJobTemplate()', () => {
|
describe('scope.editJobTemplate()', () => {
|
||||||
@@ -155,6 +183,8 @@ describe('Controller: TemplatesList', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
scope.deleteJobTemplate(testTemplate);
|
scope.deleteJobTemplate(testTemplate);
|
||||||
|
jobTemplateGetDepDeferred.resolve([]);
|
||||||
|
rootScope.$apply();
|
||||||
expect(Prompt).toHaveBeenCalled();
|
expect(Prompt).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -169,6 +199,8 @@ describe('Controller: TemplatesList', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
scope.deleteJobTemplate(testTemplate);
|
scope.deleteJobTemplate(testTemplate);
|
||||||
|
jobTemplateGetDepDeferred.resolve([]);
|
||||||
|
rootScope.$apply();
|
||||||
expect(TemplatesService.deleteWorkflowJobTemplate).toHaveBeenCalled();
|
expect(TemplatesService.deleteWorkflowJobTemplate).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -183,6 +215,8 @@ describe('Controller: TemplatesList', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
scope.deleteJobTemplate(testTemplate);
|
scope.deleteJobTemplate(testTemplate);
|
||||||
|
jobTemplateGetDepDeferred.resolve([]);
|
||||||
|
rootScope.$apply();
|
||||||
expect(TemplatesService.deleteJobTemplate).toHaveBeenCalled();
|
expect(TemplatesService.deleteJobTemplate).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user