From ef018aac59b50d2bfce46e679b64f662c823e36f Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Tue, 25 Jan 2022 10:18:10 -0500 Subject: [PATCH] =?UTF-8?q?refactor:=20=F0=9F=92=A1=20remove=20renderTempl?= =?UTF-8?q?ate=20usage=20from=20creds=20resources?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../credential-store/actions/index.hbs} | 0 .../credential-store/header/index.hbs} | 0 .../credential-store/nav/index.hbs} | 0 .../credential-library.js | 13 ++ .../scopes/scope/credential-stores/new.js | 18 ++ .../credential-stores/credential-store.js | 23 -- .../credential-store/credential-libraries.js | 2 +- .../credential-library.js | 32 --- .../credential-libraries/new.js | 27 --- .../credential-stores/credential-store.hbs | 23 +- .../credential-library/-actions.hbs | 15 -- .../credential-library/-header.hbs | 12 - .../credential-library/-navigation.hbs | 7 - .../credential-library/index.hbs | 62 ++++- .../credential-libraries/index.hbs | 216 ++++++++++-------- .../credential-libraries/new.hbs | 25 +- .../credential-libraries/new/-header.hbs | 3 - .../credential-store/index.hbs | 31 ++- 18 files changed, 257 insertions(+), 252 deletions(-) rename ui/admin/app/{templates/scopes/scope/credential-stores/credential-store/-actions.hbs => components/credential-stores/credential-store/actions/index.hbs} (100%) rename ui/admin/app/{templates/scopes/scope/credential-stores/credential-store/-header.hbs => components/credential-stores/credential-store/header/index.hbs} (100%) rename ui/admin/app/{templates/scopes/scope/credential-stores/credential-store/-navigation.hbs => components/credential-stores/credential-store/nav/index.hbs} (100%) create mode 100644 ui/admin/app/controllers/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library.js create mode 100644 ui/admin/app/controllers/scopes/scope/credential-stores/new.js delete mode 100644 ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/-actions.hbs delete mode 100644 ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/-header.hbs delete mode 100644 ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/-navigation.hbs delete mode 100644 ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/new/-header.hbs diff --git a/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/-actions.hbs b/ui/admin/app/components/credential-stores/credential-store/actions/index.hbs similarity index 100% rename from ui/admin/app/templates/scopes/scope/credential-stores/credential-store/-actions.hbs rename to ui/admin/app/components/credential-stores/credential-store/actions/index.hbs diff --git a/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/-header.hbs b/ui/admin/app/components/credential-stores/credential-store/header/index.hbs similarity index 100% rename from ui/admin/app/templates/scopes/scope/credential-stores/credential-store/-header.hbs rename to ui/admin/app/components/credential-stores/credential-store/header/index.hbs diff --git a/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/-navigation.hbs b/ui/admin/app/components/credential-stores/credential-store/nav/index.hbs similarity index 100% rename from ui/admin/app/templates/scopes/scope/credential-stores/credential-store/-navigation.hbs rename to ui/admin/app/components/credential-stores/credential-store/nav/index.hbs diff --git a/ui/admin/app/controllers/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library.js b/ui/admin/app/controllers/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library.js new file mode 100644 index 000000000..ec222f462 --- /dev/null +++ b/ui/admin/app/controllers/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library.js @@ -0,0 +1,13 @@ +import Controller from '@ember/controller'; + +export default class ScopesScopeCredentialStoresCredentialStoreCredentialLibrariesCredentialLibraryController extends Controller { + // =attributes + + /** + * A model breadcrumb + * @type {string} + */ + get breadCrumb() { + return this.model.displayName; + } +} diff --git a/ui/admin/app/controllers/scopes/scope/credential-stores/new.js b/ui/admin/app/controllers/scopes/scope/credential-stores/new.js new file mode 100644 index 000000000..3f50abb13 --- /dev/null +++ b/ui/admin/app/controllers/scopes/scope/credential-stores/new.js @@ -0,0 +1,18 @@ +import Controller from '@ember/controller'; +import { inject as service } from '@ember/service'; + +export default class ScopesScopeCredentialStoresNewController extends Controller { + // =services + + @service intl; + + // =attributes + + /** + * Breadcrumb for new route + * @type {string} + */ + get breadCrumb() { + return this.intl.t('titles.new'); + } +} diff --git a/ui/admin/app/routes/scopes/scope/credential-stores/credential-store.js b/ui/admin/app/routes/scopes/scope/credential-stores/credential-store.js index 046b8a01c..e995f11b0 100644 --- a/ui/admin/app/routes/scopes/scope/credential-stores/credential-store.js +++ b/ui/admin/app/routes/scopes/scope/credential-stores/credential-store.js @@ -8,27 +8,4 @@ export default class ScopesScopeCredentialStoresCredentialStoreRoute extends Rou async model({ credential_store_id }) { return this.store.findRecord('credential-store', credential_store_id); } - - /** - * Render credential store header, navigation and actions page sections. - * @override - */ - renderTemplate() { - super.renderTemplate(...arguments); - - this.render('scopes/scope/credential-stores/credential-store/-header', { - into: 'scopes/scope/credential-stores/credential-store', - outlet: 'header', - }); - - this.render('scopes/scope/credential-stores/credential-store/-navigation', { - into: 'scopes/scope/credential-stores/credential-store', - outlet: 'navigation', - }); - - this.render('scopes/scope/credential-stores/credential-store/-actions', { - into: 'scopes/scope/credential-stores/credential-store', - outlet: 'actions', - }); - } } diff --git a/ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries.js b/ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries.js index a8f8db78a..09eec86c6 100644 --- a/ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries.js +++ b/ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries.js @@ -81,7 +81,7 @@ export default class ScopesScopeCredentialStoresCredentialStoreCredentialLibrari @confirm('questions.delete-confirm') @notifyError(({ message }) => message, { catch: true }) @notifySuccess('notifications.delete-success') - async delete(credentialLibrary) { + async deleteCredentialLibrary(credentialLibrary) { await credentialLibrary.destroyRecord(); await this.router.replaceWith( 'scopes.scope.credential-stores.credential-store.credential-libraries' diff --git a/ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library.js b/ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library.js index 45f5953fb..00b935f23 100644 --- a/ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library.js +++ b/ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library.js @@ -14,36 +14,4 @@ export default class ScopesScopeCredentialStoresCredentialStoreCredentialLibrari reload: true, }); } - - /** - * Renders the credential library specific templates for header, navigation, and action page sections. - * @override - */ - renderTemplate() { - super.renderTemplate(...arguments); - - this.render( - 'scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/-header', - { - into: 'scopes/scope/credential-stores/credential-store', - outlet: 'header', - } - ); - - this.render( - 'scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/-navigation', - { - into: 'scopes/scope/credential-stores/credential-store', - outlet: 'navigation', - } - ); - - this.render( - 'scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/-actions', - { - into: 'scopes/scope/credential-stores/credential-store', - outlet: 'actions', - } - ); - } } diff --git a/ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries/new.js b/ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries/new.js index c9ccc770c..d6c3db15b 100644 --- a/ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries/new.js +++ b/ui/admin/app/routes/scopes/scope/credential-stores/credential-store/credential-libraries/new.js @@ -16,31 +16,4 @@ export default class ScopesScopeCredentialStoresCredentialStoreCredentialLibrari credential_store_id, }); } - - /** - * Renders new credential library specific templates for header, navigation, - * and action page sections. - * @override - */ - renderTemplate() { - super.renderTemplate(...arguments); - - this.render( - 'scopes/scope/credential-stores/credential-store/credential-libraries/new/-header', - { - into: 'scopes/scope/credential-stores/credential-store', - outlet: 'header', - } - ); - - this.render('_empty', { - into: 'scopes/scope/credential-stores/credential-store', - outlet: 'navigation', - }); - - this.render('_empty', { - into: 'scopes/scope/credential-stores/credential-store', - outlet: 'actions', - }); - } } diff --git a/ui/admin/app/templates/scopes/scope/credential-stores/credential-store.hbs b/ui/admin/app/templates/scopes/scope/credential-stores/credential-store.hbs index efc46641a..7d32ecb0d 100644 --- a/ui/admin/app/templates/scopes/scope/credential-stores/credential-store.hbs +++ b/ui/admin/app/templates/scopes/scope/credential-stores/credential-store.hbs @@ -1,24 +1,3 @@ {{page-title @model.displayName}} - - - - - - - - {{outlet 'header'}} - - - - {{outlet 'navigation'}} - - - - {{outlet 'actions'}} - - - - {{outlet}} - - \ No newline at end of file +{{outlet}} \ No newline at end of file diff --git a/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/-actions.hbs b/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/-actions.hbs deleted file mode 100644 index 4399f847b..000000000 --- a/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/-actions.hbs +++ /dev/null @@ -1,15 +0,0 @@ -{{#if (can 'delete model' @model)}} - - - {{t 'resources.credential-library.actions.delete'}} - - -{{/if}} \ No newline at end of file diff --git a/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/-header.hbs b/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/-header.hbs deleted file mode 100644 index 229448ada..000000000 --- a/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/-header.hbs +++ /dev/null @@ -1,12 +0,0 @@ -

- {{t 'resources.credential-library.title'}} - -

-

{{t 'resources.credential-library.description'}}

- - {{@model.id}} - \ No newline at end of file diff --git a/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/-navigation.hbs b/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/-navigation.hbs deleted file mode 100644 index d5bb5cf63..000000000 --- a/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/-navigation.hbs +++ /dev/null @@ -1,7 +0,0 @@ - - - {{t 'titles.details'}} - - \ No newline at end of file diff --git a/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/index.hbs b/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/index.hbs index 648221a43..fe4f7069e 100644 --- a/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/index.hbs +++ b/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/credential-library/index.hbs @@ -1,5 +1,57 @@ - \ No newline at end of file + + + + + + + +

+ {{t 'resources.credential-library.title'}} + +

+

{{t 'resources.credential-library.description'}}

+ + {{@model.id}} + +
+ + + + + {{t 'titles.details'}} + + + + + + {{#if (can 'delete model' @model)}} + + + {{t 'resources.credential-library.actions.delete'}} + + + {{/if}} + + + + + +
\ No newline at end of file diff --git a/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/index.hbs b/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/index.hbs index 8f1b0ba98..d231ca381 100644 --- a/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/index.hbs +++ b/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/index.hbs @@ -1,102 +1,128 @@ -{{#if @model}} + - - - - {{t 'form.name.label'}} - {{t 'form.type.label'}} - {{t 'form.id.label'}} - - - - {{#each @model as |credentialLibrary|}} - - - {{#if (can 'read model' credentialLibrary)}} - - {{credentialLibrary.displayName}} - - {{else}} - {{credentialLibrary.displayName}} - {{/if}} -

{{credentialLibrary.description}}

-
- - {{t - (concat - 'resources.credential-library.types.' credentialLibrary.type - ) - }} - - - - {{credentialLibrary.id}} - - -
- {{/each}} -
-
+ + + -{{else}} + + + - - - - {{#if - (can - 'list collection' - this.credentialStore - collection='credential-libraries' - ) - }} - {{! can list (at least): show default welcome message}} - {{t 'resources.credential-library.description'}} + + + - {{else if (can - 'create collection' - this.credentialStore - collection='credential-libraries' - )}} - {{! can create (only): show create-but-not-list welcome message}} - {{t - 'descriptions.create-but-not-list' - resource=(t 'resources.credential-library.title_plural') - }} - {{else}} - {{! can neither list nor create }} - {{t - 'descriptions.neither-list-nor-create' - resource=(t 'resources.credential-library.title_plural') - }} - {{/if}} + + + - - {{#if - (can - 'create collection' - this.credentialStore - collection='credential-libraries' - ) - }} - + {{#if @model}} + + + + + {{t 'form.name.label'}} + {{t 'form.type.label'}} + {{t 'form.id.label'}} + + + + {{#each @model as |credentialLibrary|}} + + + {{#if (can 'read model' credentialLibrary)}} + + {{credentialLibrary.displayName}} + + {{else}} + {{credentialLibrary.displayName}} + {{/if}} +

{{credentialLibrary.description}}

+
+ + {{t + (concat + 'resources.credential-library.types.' + credentialLibrary.type + ) + }} + + + + {{credentialLibrary.id}} + + +
+ {{/each}} +
+
+ + {{else}} + + + - - {{t 'titles.new'}} -
- {{/if}} -
-
+ + {{#if + (can + 'list collection' + this.credentialStore + collection='credential-libraries' + ) + }} + {{! can list (at least): show default welcome message}} + {{t 'resources.credential-library.description'}} -{{/if}} \ No newline at end of file + {{else if (can + 'create collection' + this.credentialStore + collection='credential-libraries' + )}} + {{! can create (only): show create-but-not-list welcome message}} + {{t + 'descriptions.create-but-not-list' + resource=(t 'resources.credential-library.title_plural') + }} + {{else}} + {{! can neither list nor create }} + {{t + 'descriptions.neither-list-nor-create' + resource=(t 'resources.credential-library.title_plural') + }} + {{/if}} + + + {{#if + (can + 'create collection' + this.credentialStore + collection='credential-libraries' + ) + }} + + + {{t 'titles.new'}} + + {{/if}} + + + + {{/if}} + +
\ No newline at end of file diff --git a/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/new.hbs b/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/new.hbs index 5d03e5b9f..818471682 100644 --- a/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/new.hbs +++ b/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/new.hbs @@ -1,7 +1,22 @@ {{page-title (t 'titles.new')}} - \ No newline at end of file + + + + + + + +

+ {{t 'titles.new'}} +

+
+ + + + +
\ No newline at end of file diff --git a/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/new/-header.hbs b/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/new/-header.hbs deleted file mode 100644 index 51755b136..000000000 --- a/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/credential-libraries/new/-header.hbs +++ /dev/null @@ -1,3 +0,0 @@ -

- {{t 'titles.new'}} -

\ No newline at end of file diff --git a/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/index.hbs b/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/index.hbs index aaa14a18c..78a8548a2 100644 --- a/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/index.hbs +++ b/ui/admin/app/templates/scopes/scope/credential-stores/credential-store/index.hbs @@ -1,5 +1,26 @@ - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file