mirror of
https://github.com/ZwareBear/awx.git
synced 2026-04-27 10:21:49 -05:00
Changes copy behavior to reload list rather than navigate to edit form. Shows toast message on successful copy.
This commit is contained in:
@@ -6,10 +6,10 @@
|
||||
|
||||
export default ['$scope', 'Rest', 'CredentialList', 'Prompt', 'ProcessErrors', 'GetBasePath',
|
||||
'Wait', '$state', '$filter', 'rbacUiControlService', 'Dataset', 'credentialType', 'i18n',
|
||||
'CredentialModel', 'CredentialsStrings',
|
||||
'CredentialModel', 'CredentialsStrings', 'ngToast',
|
||||
function($scope, Rest, CredentialList, Prompt,
|
||||
ProcessErrors, GetBasePath, Wait, $state, $filter, rbacUiControlService, Dataset,
|
||||
credentialType, i18n, Credential, CredentialsStrings) {
|
||||
credentialType, i18n, Credential, CredentialsStrings, ngToast) {
|
||||
|
||||
const credential = new Credential();
|
||||
|
||||
@@ -93,9 +93,21 @@ export default ['$scope', 'Rest', 'CredentialList', 'Prompt', 'ProcessErrors', '
|
||||
Wait('start');
|
||||
new Credential('get', credential.id)
|
||||
.then(model => model.copy())
|
||||
.then(({ id }) => {
|
||||
const params = { credential_id: id };
|
||||
$state.go('credentials.edit', params, { reload: true });
|
||||
.then((copiedCred) => {
|
||||
ngToast.success({
|
||||
content: `
|
||||
<div class="Toast-wrapper">
|
||||
<div class="Toast-icon">
|
||||
<i class="fa fa-check-circle Toast-successIcon"></i>
|
||||
</div>
|
||||
<div>
|
||||
${CredentialsStrings.get('SUCCESSFUL_CREATION', copiedCred.name)}
|
||||
</div>
|
||||
</div>`,
|
||||
dismissButton: false,
|
||||
dismissOnTimeout: true
|
||||
});
|
||||
$state.go('.', null, { reload: true });
|
||||
})
|
||||
.catch(({ data, status }) => {
|
||||
const params = { hdr: 'Error!', msg: `Call to copy failed. Return status: ${status}` };
|
||||
|
||||
Reference in New Issue
Block a user