From b2aa10fd40771be17fbb271b98303c20e742cf2a Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Wed, 19 Aug 2020 16:37:44 -0400 Subject: [PATCH] chore: Add Manage>delete dropdown to host-catalog & host-set --- .../scopes/scope/projects/project/host-catalogs.js | 10 ++++++---- .../projects/project/host-catalogs/host-catalog.js | 8 +++++++- .../host-catalogs/host-catalog/host-sets/host-set.js | 8 +++++++- .../project/host-catalogs/host-catalog/-actions.hbs | 9 +++++++++ .../host-catalogs/host-catalog/host-sets/-actions.hbs | 9 +++++++++ .../host-catalog/host-sets/host-set/index.hbs | 8 -------- ui/core/translations/en-us.yaml | 1 + 7 files changed, 39 insertions(+), 14 deletions(-) create mode 100644 ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/-actions.hbs create mode 100644 ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/-actions.hbs diff --git a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs.js b/ui/core/app/routes/scopes/scope/projects/project/host-catalogs.js index de945f71c..8ef0f103d 100644 --- a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs.js +++ b/ui/core/app/routes/scopes/scope/projects/project/host-catalogs.js @@ -6,6 +6,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsRoute extends Route { // =services + @service intl; @service notify; // =methods @@ -40,11 +41,13 @@ export default class ScopesScopeProjectsProjectHostCatalogsRoute extends Route { */ @action async save(hostCatalog) { + const { isNew } = hostCatalog; try { await hostCatalog.save(); this.refresh(); - // TODO: replace with translated strings - this.notify.success('Save succeeded.'); + this.notify.success( + this.intl.t(isNew ? 'notify.create-success' : 'notify.save-success') + ); this.transitionTo('scopes.scope.projects.project.host-catalogs.host-catalog', hostCatalog); } catch (error) { // TODO: replace with translated strings @@ -61,9 +64,8 @@ export default class ScopesScopeProjectsProjectHostCatalogsRoute extends Route { try { await project.destroyRecord(); this.refresh(); + this.notify.success(this.intl.t('notify.delete-success')); this.transitionTo('scopes.scope.projects.project.host-catalogs'); - // TODO: replace with translated strings - this.notify.success('Deleted host catalog succesfully.'); } catch (error) { // TODO: replace with translated strings this.notify.error(error.message, { closeAfter: null }); diff --git a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog.js b/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog.js index 00d0b148d..00768575f 100644 --- a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog.js +++ b/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog.js @@ -18,7 +18,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogRoute exte } /** - * Renders the host-catalog specific templates for header and navigation page sections. + * Renders the host-catalog specific templates for header, navigation, and actions page sections. * @override * @param {object} controller * @param {object} model @@ -37,5 +37,11 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogRoute exte outlet: 'navigation', model: model }); + + this.render('scopes/scope/projects/project/host-catalogs/host-catalog/-actions', { + into: 'scopes/scope/projects/project/host-catalogs/host-catalog', + outlet: 'actions', + model: model + }); } } diff --git a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set.js b/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set.js index 7211982fb..66c552c4d 100644 --- a/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set.js +++ b/ui/core/app/routes/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set.js @@ -18,7 +18,7 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo } /** - * Renders the host-set specific templates for header and navigation page sections. + * Renders the host-set specific templates for header, navigation, and action page sections. * @override * @param {object} controller * @param {object} model @@ -37,5 +37,11 @@ export default class ScopesScopeProjectsProjectHostCatalogsHostCatalogHostSetsHo outlet: 'navigation', model: model }); + + this.render('scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/-actions', { + into: 'scopes/scope/projects/project/host-catalogs/host-catalog', + outlet: 'actions', + model: model + }); } } diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/-actions.hbs b/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/-actions.hbs new file mode 100644 index 000000000..b905f8d7d --- /dev/null +++ b/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/-actions.hbs @@ -0,0 +1,9 @@ + + + {{t 'actions.delete-host-catalog'}} + + \ No newline at end of file diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/-actions.hbs b/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/-actions.hbs new file mode 100644 index 000000000..9497cdee3 --- /dev/null +++ b/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/-actions.hbs @@ -0,0 +1,9 @@ + + + {{t 'actions.delete-host-set'}} + + \ No newline at end of file diff --git a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/index.hbs b/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/index.hbs index 4ea8678d7..ac0b64897 100644 --- a/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/index.hbs +++ b/ui/core/app/templates/scopes/scope/projects/project/host-catalogs/host-catalog/host-sets/host-set/index.hbs @@ -3,11 +3,3 @@ @submit={{route-action "save" @model}} @cancel={{route-action "cancel" @model}} /> - - - {{t 'actions.delete'}} - diff --git a/ui/core/translations/en-us.yaml b/ui/core/translations/en-us.yaml index c8b35c17b..b274633f8 100644 --- a/ui/core/translations/en-us.yaml +++ b/ui/core/translations/en-us.yaml @@ -14,6 +14,7 @@ actions: delete-role: Delete role delete-project: Delete project delete-host-catalog: Delete host catalog + delete-host-set: Delete host set auth: titles: no-scopes: No Scopes Available