mirror of
https://github.com/ansible/awx.git
synced 2026-02-20 12:40:06 -03:30
Defined delete string in the base with the ability to pass the resource name in
This commit is contained in:
@@ -60,6 +60,10 @@ function BaseStringService (namespace) {
|
|||||||
this.CANCEL = t.s('CANCEL');
|
this.CANCEL = t.s('CANCEL');
|
||||||
this.SAVE = t.s('SAVE');
|
this.SAVE = t.s('SAVE');
|
||||||
this.OK = t.s('OK');
|
this.OK = t.s('OK');
|
||||||
|
this.deleteResource = {
|
||||||
|
USED_BY: resourceType => t.s('The {{ resourceType }} is currently being used by other resources.', { resourceType }),
|
||||||
|
CONFIRM: resourceType => t.s('Are you sure you want to delete this {{ resourceType }}?', { resourceType })
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This getter searches the extending class' namespace first for a match then falls back to
|
* This getter searches the extending class' namespace first for a match then falls back to
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ function CredentialTypesStrings (BaseString) {
|
|||||||
let ns = this.credential_types;
|
let ns = this.credential_types;
|
||||||
|
|
||||||
ns.deleteCredentialType = {
|
ns.deleteCredentialType = {
|
||||||
CONFIRM: t.s('Are you sure you want to delete this credential type?'),
|
|
||||||
CREDENTIAL_TYPE_IN_USE: t.s('This credential type is currently being used by one or more credentials. Credentials that use this credential type must be deleted before the credential type can be deleted.')
|
CREDENTIAL_TYPE_IN_USE: t.s('This credential type is currently being used by one or more credentials. Credentials that use this credential type must be deleted before the credential type can be deleted.')
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ export default ['$rootScope', '$scope', 'Wait', 'CredentialTypesList',
|
|||||||
credentialType.getDependentResourceCounts(id)
|
credentialType.getDependentResourceCounts(id)
|
||||||
.then((counts) => {
|
.then((counts) => {
|
||||||
let credentialTypeInUse = false;
|
let credentialTypeInUse = false;
|
||||||
let deleteModalBody = `<div class="Prompt-bodyQuery">${CredentialTypesStrings.get('deleteCredentialType.CONFIRM')}</div>`;
|
let deleteModalBody = `<div class="Prompt-bodyQuery">${CredentialTypesStrings.get('deleteResource.CONFIRM', 'credential type')}</div>`;
|
||||||
|
|
||||||
counts.forEach(countObj => {
|
counts.forEach(countObj => {
|
||||||
if(countObj.count && countObj.count > 0) {
|
if(countObj.count && countObj.count > 0) {
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ export default ['$scope', 'Rest', 'CredentialList', 'Prompt', 'ProcessErrors', '
|
|||||||
credential.getDependentResourceCounts(id)
|
credential.getDependentResourceCounts(id)
|
||||||
.then((counts) => {
|
.then((counts) => {
|
||||||
const invalidateRelatedLines = [];
|
const invalidateRelatedLines = [];
|
||||||
let deleteModalBody = `<div class="Prompt-bodyQuery">${CredentialsStrings.get('deleteCredential.CONFIRM')}</div>`;
|
let deleteModalBody = `<div class="Prompt-bodyQuery">${CredentialsStrings.get('deleteResource.CONFIRM', 'credential')}</div>`;
|
||||||
|
|
||||||
counts.forEach(countObj => {
|
counts.forEach(countObj => {
|
||||||
if(countObj.count && countObj.count > 0) {
|
if(countObj.count && countObj.count > 0) {
|
||||||
@@ -123,7 +123,7 @@ export default ['$scope', 'Rest', 'CredentialList', 'Prompt', 'ProcessErrors', '
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (invalidateRelatedLines && invalidateRelatedLines.length > 0) {
|
if (invalidateRelatedLines && invalidateRelatedLines.length > 0) {
|
||||||
deleteModalBody = `<div class="Prompt-bodyQuery">${CredentialsStrings.get('deleteCredential.CONFIRM')}</div>`;
|
deleteModalBody = `<div class="Prompt-bodyQuery">${CredentialsStrings.get('deleteResource.USED_BY', 'credential')} ${CredentialsStrings.get('deleteResource.CONFIRM', 'credential')}</div>`;
|
||||||
invalidateRelatedLines.forEach(invalidateRelatedLine => {
|
invalidateRelatedLines.forEach(invalidateRelatedLine => {
|
||||||
deleteModalBody += invalidateRelatedLine;
|
deleteModalBody += invalidateRelatedLine;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ function InventoriesList($scope,
|
|||||||
inventory.getDependentResourceCounts(id)
|
inventory.getDependentResourceCounts(id)
|
||||||
.then((counts) => {
|
.then((counts) => {
|
||||||
const invalidateRelatedLines = [];
|
const invalidateRelatedLines = [];
|
||||||
let deleteModalBody = `<div class="Prompt-bodyQuery">${InventoryHostsStrings.get('deleteInventory.CONFIRM')}</div>`;
|
let deleteModalBody = `<div class="Prompt-bodyQuery">${InventoryHostsStrings.get('deleteResource.CONFIRM', 'inventory')}</div>`;
|
||||||
|
|
||||||
counts.forEach(countObj => {
|
counts.forEach(countObj => {
|
||||||
if(countObj.count && countObj.count > 0) {
|
if(countObj.count && countObj.count > 0) {
|
||||||
@@ -110,7 +110,7 @@ function InventoriesList($scope,
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (invalidateRelatedLines && invalidateRelatedLines.length > 0) {
|
if (invalidateRelatedLines && invalidateRelatedLines.length > 0) {
|
||||||
deleteModalBody = `<div class="Prompt-bodyQuery">${InventoryHostsStrings.get('deleteInventory.CONFIRM')}</div>`;
|
deleteModalBody = `<div class="Prompt-bodyQuery">${InventoryHostsStrings.get('deleteResource.USED_BY', 'inventory')} ${InventoryHostsStrings.get('deleteResource.CONFIRM', 'inventory')}</div>`;
|
||||||
invalidateRelatedLines.forEach(invalidateRelatedLine => {
|
invalidateRelatedLines.forEach(invalidateRelatedLine => {
|
||||||
deleteModalBody += invalidateRelatedLine;
|
deleteModalBody += invalidateRelatedLine;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -143,7 +143,7 @@
|
|||||||
inventorySource.getDependentResourceCounts(inventory_source.id)
|
inventorySource.getDependentResourceCounts(inventory_source.id)
|
||||||
.then((counts) => {
|
.then((counts) => {
|
||||||
const invalidateRelatedLines = [];
|
const invalidateRelatedLines = [];
|
||||||
let deleteModalBody = `<div class="Prompt-bodyQuery">${InventoryHostsStrings.get('deleteSource.CONFIRM')}</div>`;
|
let deleteModalBody = `<div class="Prompt-bodyQuery">${InventoryHostsStrings.get('deleteResource.CONFIRM', 'inventory source')}</div>`;
|
||||||
|
|
||||||
counts.forEach(countObj => {
|
counts.forEach(countObj => {
|
||||||
if(countObj.count && countObj.count > 0) {
|
if(countObj.count && countObj.count > 0) {
|
||||||
@@ -152,7 +152,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (invalidateRelatedLines && invalidateRelatedLines.length > 0) {
|
if (invalidateRelatedLines && invalidateRelatedLines.length > 0) {
|
||||||
deleteModalBody = `<div class="Prompt-bodyQuery">${InventoryHostsStrings.get('deleteSource.CONFIRM')}</div>`;
|
deleteModalBody = `<div class="Prompt-bodyQuery">${InventoryHostsStrings.get('deleteResource.USED_BY', 'inventory source')} ${InventoryHostsStrings.get('deleteResource.CONFIRM', 'inventory source')}</div>`;
|
||||||
invalidateRelatedLines.forEach(invalidateRelatedLine => {
|
invalidateRelatedLines.forEach(invalidateRelatedLine => {
|
||||||
deleteModalBody += invalidateRelatedLine;
|
deleteModalBody += invalidateRelatedLine;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,14 +4,6 @@ function InventoryHostsStrings (BaseString) {
|
|||||||
let t = this.t;
|
let t = this.t;
|
||||||
let ns = this['inventory-hosts'];
|
let ns = this['inventory-hosts'];
|
||||||
|
|
||||||
ns.deleteInventory = {
|
|
||||||
CONFIRM: t.s('The inventory is currently being used by other resources. Are you sure you want to delete this inventory?')
|
|
||||||
};
|
|
||||||
|
|
||||||
ns.deleteSource = {
|
|
||||||
CONFIRM: t.s('The inventory source is currently being used by other resources. Are you sure you want to delete this inventory source?')
|
|
||||||
};
|
|
||||||
|
|
||||||
ns.deletegroup = {
|
ns.deletegroup = {
|
||||||
GROUP: count => t.p(count, 'group', 'groups'),
|
GROUP: count => t.p(count, 'group', 'groups'),
|
||||||
HOST: count => t.p(count, 'host', 'hosts'),
|
HOST: count => t.p(count, 'host', 'hosts'),
|
||||||
|
|||||||
@@ -1,12 +1,5 @@
|
|||||||
function InventoryScriptsStrings (BaseString) {
|
function InventoryScriptsStrings (BaseString) {
|
||||||
BaseString.call(this, 'inventory_scripts');
|
BaseString.call(this, 'inventory_scripts');
|
||||||
|
|
||||||
let t = this.t;
|
|
||||||
let ns = this.inventory_scripts;
|
|
||||||
|
|
||||||
ns.deleteInventoryScript = {
|
|
||||||
CONFIRM: t.s('The inventory script is currently being used by other resources. Are you sure you want to delete this inventory script?')
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
InventoryScriptsStrings.$inject = ['BaseStringService'];
|
InventoryScriptsStrings.$inject = ['BaseStringService'];
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ export default ['$rootScope', '$scope', 'Wait', 'InventoryScriptsList',
|
|||||||
inventoryScript.getDependentResourceCounts(id)
|
inventoryScript.getDependentResourceCounts(id)
|
||||||
.then((counts) => {
|
.then((counts) => {
|
||||||
const invalidateRelatedLines = [];
|
const invalidateRelatedLines = [];
|
||||||
let deleteModalBody = `<div class="Prompt-bodyQuery">${InventoryScriptsStrings.get('deleteInventoryScript.CONFIRM')}</div>`;
|
let deleteModalBody = `<div class="Prompt-bodyQuery">${InventoryScriptsStrings.get('deleteResource.CONFIRM', 'inventory script')}</div>`;
|
||||||
|
|
||||||
counts.forEach(countObj => {
|
counts.forEach(countObj => {
|
||||||
if(countObj.count && countObj.count > 0) {
|
if(countObj.count && countObj.count > 0) {
|
||||||
@@ -89,7 +89,7 @@ export default ['$rootScope', '$scope', 'Wait', 'InventoryScriptsList',
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (invalidateRelatedLines && invalidateRelatedLines.length > 0) {
|
if (invalidateRelatedLines && invalidateRelatedLines.length > 0) {
|
||||||
deleteModalBody = `<div class="Prompt-bodyQuery">${InventoryScriptsStrings.get('deleteInventoryScript.CONFIRM')}</div>`;
|
deleteModalBody = `<div class="Prompt-bodyQuery">${InventoryScriptsStrings.get('deleteResource.USED_BY', 'inventory script')} ${InventoryScriptsStrings.get('deleteResource.CONFIRM', 'inventory script')}</div>`;
|
||||||
invalidateRelatedLines.forEach(invalidateRelatedLine => {
|
invalidateRelatedLines.forEach(invalidateRelatedLine => {
|
||||||
deleteModalBody += invalidateRelatedLine;
|
deleteModalBody += invalidateRelatedLine;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ export default ['$scope', '$rootScope', '$log', 'Rest', 'Alert',
|
|||||||
project.getDependentResourceCounts(id)
|
project.getDependentResourceCounts(id)
|
||||||
.then((counts) => {
|
.then((counts) => {
|
||||||
const invalidateRelatedLines = [];
|
const invalidateRelatedLines = [];
|
||||||
let deleteModalBody = `<div class="Prompt-bodyQuery">${ProjectsStrings.get('deleteProject.CONFIRM')}</div>`;
|
let deleteModalBody = `<div class="Prompt-bodyQuery">${ProjectsStrings.get('deleteResource.CONFIRM', 'project')}</div>`;
|
||||||
|
|
||||||
counts.forEach(countObj => {
|
counts.forEach(countObj => {
|
||||||
if(countObj.count && countObj.count > 0) {
|
if(countObj.count && countObj.count > 0) {
|
||||||
@@ -215,7 +215,7 @@ export default ['$scope', '$rootScope', '$log', 'Rest', 'Alert',
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (invalidateRelatedLines && invalidateRelatedLines.length > 0) {
|
if (invalidateRelatedLines && invalidateRelatedLines.length > 0) {
|
||||||
deleteModalBody = `<div class="Prompt-bodyQuery">${ProjectsStrings.get('deleteProject.CONFIRM')}</div>`;
|
deleteModalBody = `<div class="Prompt-bodyQuery">${ProjectsStrings.get('deleteResource.USED_BY', 'project')} ${ProjectsStrings.get('deleteResource.CONFIRM', 'project')}</div>`;
|
||||||
invalidateRelatedLines.forEach(invalidateRelatedLine => {
|
invalidateRelatedLines.forEach(invalidateRelatedLine => {
|
||||||
deleteModalBody += invalidateRelatedLine;
|
deleteModalBody += invalidateRelatedLine;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,12 +1,5 @@
|
|||||||
function ProjectsStrings (BaseString) {
|
function ProjectsStrings (BaseString) {
|
||||||
BaseString.call(this, 'projects');
|
BaseString.call(this, 'projects');
|
||||||
|
|
||||||
let t = this.t;
|
|
||||||
let ns = this.projects;
|
|
||||||
|
|
||||||
ns.deleteProject = {
|
|
||||||
CONFIRM: t.s('The project is currently being used by other resources. Are you sure you want to delete this project?')
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectsStrings.$inject = ['BaseStringService'];
|
ProjectsStrings.$inject = ['BaseStringService'];
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ export default ['$scope', '$rootScope',
|
|||||||
Prompt({
|
Prompt({
|
||||||
hdr: i18n._('Delete'),
|
hdr: i18n._('Delete'),
|
||||||
resourceName: $filter('sanitize')(template.name),
|
resourceName: $filter('sanitize')(template.name),
|
||||||
body: TemplatesStrings.get('workflowJobTemplates.deleteWorkflowJobTemplate.CONFIRM'),
|
body: TemplatesStrings.get('deleteResource.CONFIRM', 'workflow job template'),
|
||||||
action: action,
|
action: action,
|
||||||
actionText: 'DELETE'
|
actionText: 'DELETE'
|
||||||
});
|
});
|
||||||
@@ -164,7 +164,7 @@ export default ['$scope', '$rootScope',
|
|||||||
jobTemplate.getDependentResourceCounts(template.id)
|
jobTemplate.getDependentResourceCounts(template.id)
|
||||||
.then((counts) => {
|
.then((counts) => {
|
||||||
const invalidateRelatedLines = [];
|
const invalidateRelatedLines = [];
|
||||||
let deleteModalBody = `<div class="Prompt-bodyQuery">${TemplatesStrings.get('jobTemplates.deleteJobTemplate.CONFIRM')}</div>`;
|
let deleteModalBody = `<div class="Prompt-bodyQuery">${TemplatesStrings.get('deleteResource.CONFIRM', 'job template')}</div>`;
|
||||||
|
|
||||||
counts.forEach(countObj => {
|
counts.forEach(countObj => {
|
||||||
if(countObj.count && countObj.count > 0) {
|
if(countObj.count && countObj.count > 0) {
|
||||||
@@ -173,7 +173,7 @@ export default ['$scope', '$rootScope',
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (invalidateRelatedLines && invalidateRelatedLines.length > 0) {
|
if (invalidateRelatedLines && invalidateRelatedLines.length > 0) {
|
||||||
deleteModalBody = `<div class="Prompt-bodyQuery">${TemplatesStrings.get('jobTemplates.deleteJobTemplate.CONFIRM')}</div>`;
|
deleteModalBody = `<div class="Prompt-bodyQuery">${TemplatesStrings.get('deleteResource.USED_BY', 'job template')} ${TemplatesStrings.get('deleteResource.CONFIRM', 'job template')}</div>`;
|
||||||
invalidateRelatedLines.forEach(invalidateRelatedLine => {
|
invalidateRelatedLines.forEach(invalidateRelatedLine => {
|
||||||
deleteModalBody += invalidateRelatedLine;
|
deleteModalBody += invalidateRelatedLine;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,20 +1,5 @@
|
|||||||
function TemplatesStrings (BaseString) {
|
function TemplatesStrings (BaseString) {
|
||||||
BaseString.call(this, 'templates');
|
BaseString.call(this, 'templates');
|
||||||
|
|
||||||
let t = this.t;
|
|
||||||
let ns = this.templates;
|
|
||||||
|
|
||||||
ns.jobTemplates = {
|
|
||||||
deleteJobTemplate: {
|
|
||||||
CONFIRM: t.s('The job template is currently being used by other resources. Are you sure you want to delete this job template?')
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ns.workflowJobTemplates = {
|
|
||||||
deleteWorkflowJobTemplate: {
|
|
||||||
CONFIRM: t.s('Are you sure you want to delete this workflow job template?')
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TemplatesStrings.$inject = ['BaseStringService'];
|
TemplatesStrings.$inject = ['BaseStringService'];
|
||||||
|
|||||||
Reference in New Issue
Block a user