From 2773daedc675436aed059059a63f9f4de92a6cc4 Mon Sep 17 00:00:00 2001 From: John Cowen Date: Mon, 19 Oct 2020 17:31:01 +0100 Subject: [PATCH] ui: Move all our notification partials to components (#8968) --- .../consul/acl/notifications/index.hbs} | 21 ++++++++-------- .../lock-session/notifications/index.hbs | 7 ++++++ .../consul/nspace/notifications/index.hbs} | 15 ++++++----- .../consul/policy/notifications/index.hbs} | 15 ++++++----- .../consul/role/notifications/index.hbs} | 15 ++++++----- .../consul/service/notifications/index.hbs} | 5 ++-- .../consul/token/notifications/index.hbs} | 25 +++++++++---------- ui-v2/app/templates/dc/acls/edit.hbs | 10 +++++--- ui-v2/app/templates/dc/acls/index.hbs | 8 ++++-- ui-v2/app/templates/dc/acls/policies/edit.hbs | 7 +++++- .../app/templates/dc/acls/policies/index.hbs | 9 +++++-- ui-v2/app/templates/dc/acls/roles/edit.hbs | 7 +++++- ui-v2/app/templates/dc/acls/roles/index.hbs | 9 +++++-- ui-v2/app/templates/dc/acls/tokens/edit.hbs | 7 +++++- ui-v2/app/templates/dc/acls/tokens/index.hbs | 9 +++++-- .../app/templates/dc/nodes/-notifications.hbs | 12 --------- ui-v2/app/templates/dc/nodes/show.hbs | 6 +++-- ui-v2/app/templates/dc/nspaces/edit.hbs | 6 ++++- ui-v2/app/templates/dc/nspaces/index.hbs | 8 ++++-- ui-v2/app/templates/dc/services/index.hbs | 5 +++- ui-v2/app/templates/dc/services/instance.hbs | 5 +++- ui-v2/app/templates/dc/services/show.hbs | 5 +++- 22 files changed, 131 insertions(+), 85 deletions(-) rename ui-v2/app/{templates/dc/acls/-notifications.hbs => components/consul/acl/notifications/index.hbs} (60%) create mode 100644 ui-v2/app/components/consul/lock-session/notifications/index.hbs rename ui-v2/app/{templates/dc/nspaces/-notifications.hbs => components/consul/nspace/notifications/index.hbs} (65%) rename ui-v2/app/{templates/dc/acls/policies/-notifications.hbs => components/consul/policy/notifications/index.hbs} (63%) rename ui-v2/app/{templates/dc/acls/roles/-notifications.hbs => components/consul/role/notifications/index.hbs} (63%) rename ui-v2/app/{templates/dc/services/-notifications.hbs => components/consul/service/notifications/index.hbs} (62%) rename ui-v2/app/{templates/dc/acls/tokens/-notifications.hbs => components/consul/token/notifications/index.hbs} (56%) delete mode 100644 ui-v2/app/templates/dc/nodes/-notifications.hbs diff --git a/ui-v2/app/templates/dc/acls/-notifications.hbs b/ui-v2/app/components/consul/acl/notifications/index.hbs similarity index 60% rename from ui-v2/app/templates/dc/acls/-notifications.hbs rename to ui-v2/app/components/consul/acl/notifications/index.hbs index 1b577c6ef8..a82fd4ba68 100644 --- a/ui-v2/app/templates/dc/acls/-notifications.hbs +++ b/ui-v2/app/components/consul/acl/notifications/index.hbs @@ -1,32 +1,31 @@ -{{#if (eq type 'create')}} - {{#if (eq status 'success') }} +{{#if (eq @type 'create')}} + {{#if (eq @status 'success') }} Your ACL token has been added. {{else}} There was an error adding your ACL token. {{/if}} -{{else if (eq type 'update') }} - {{#if (eq status 'success') }} +{{else if (eq @type 'update') }} + {{#if (eq @status 'success') }} Your ACL token has been saved. {{else}} There was an error saving your ACL token. {{/if}} -{{ else if (eq type 'delete')}} - {{#if (eq status 'success') }} +{{ else if (eq @type 'delete')}} + {{#if (eq @status 'success') }} Your ACL token was deleted. {{else}} There was an error deleting your ACL token. {{/if}} -{{ else if (eq type 'use')}} - {{#if (eq status 'success') }} +{{ else if (eq @type 'use')}} + {{#if (eq @status 'success') }} Now using new ACL token. {{else}} There was an error using that ACL token. {{/if}} -{{ else if (eq type 'clone')}} - {{#if (eq status 'success') }} +{{ else if (eq @type 'clone')}} + {{#if (eq @status 'success') }} Your ACL token was cloned. {{else}} There was an error cloning your ACL token. {{/if}} {{/if}} - diff --git a/ui-v2/app/components/consul/lock-session/notifications/index.hbs b/ui-v2/app/components/consul/lock-session/notifications/index.hbs new file mode 100644 index 0000000000..52b97172c3 --- /dev/null +++ b/ui-v2/app/components/consul/lock-session/notifications/index.hbs @@ -0,0 +1,7 @@ +{{#if (eq @type 'delete')}} + {{#if (eq @status 'success') }} + The session was invalidated. + {{else}} + There was an error invalidating the session. + {{/if}} +{{/if}} \ No newline at end of file diff --git a/ui-v2/app/templates/dc/nspaces/-notifications.hbs b/ui-v2/app/components/consul/nspace/notifications/index.hbs similarity index 65% rename from ui-v2/app/templates/dc/nspaces/-notifications.hbs rename to ui-v2/app/components/consul/nspace/notifications/index.hbs index 498750c3d2..e5ae1deeb7 100644 --- a/ui-v2/app/templates/dc/nspaces/-notifications.hbs +++ b/ui-v2/app/components/consul/nspace/notifications/index.hbs @@ -1,25 +1,24 @@ -{{#if (eq type 'create')}} - {{#if (eq status 'success') }} +{{#if (eq @type 'create')}} + {{#if (eq @status 'success') }} Your namespace has been added. {{else}} There was an error adding your namespace. {{/if}} -{{else if (eq type 'update') }} - {{#if (eq status 'success') }} +{{else if (eq @type 'update') }} + {{#if (eq @status 'success') }} Your namespace has been saved. {{else}} There was an error saving your namespace. {{/if}} -{{ else if (eq type 'delete')}} - {{#if (eq status 'success') }} +{{ else if (eq @type 'delete')}} + {{#if (eq @status 'success') }} Your namespace has been marked for deletion. {{else}} There was an error deleting your namespace. {{/if}} {{/if}} -{{#let error.errors.firstObject as |error|}} +{{#let @error.errors.firstObject as |error|}} {{#if error.detail }}
{{concat '(' (if error.status (concat error.status ': ')) error.detail ')'}} {{/if}} {{/let}} - diff --git a/ui-v2/app/templates/dc/acls/policies/-notifications.hbs b/ui-v2/app/components/consul/policy/notifications/index.hbs similarity index 63% rename from ui-v2/app/templates/dc/acls/policies/-notifications.hbs rename to ui-v2/app/components/consul/policy/notifications/index.hbs index 64ae640e72..308096c94c 100644 --- a/ui-v2/app/templates/dc/acls/policies/-notifications.hbs +++ b/ui-v2/app/components/consul/policy/notifications/index.hbs @@ -1,25 +1,24 @@ -{{#if (eq type 'create')}} - {{#if (eq status 'success') }} +{{#if (eq @type 'create')}} + {{#if (eq @status 'success') }} Your policy has been added. {{else}} There was an error adding your policy. {{/if}} -{{else if (eq type 'update') }} - {{#if (eq status 'success') }} +{{else if (eq @type 'update') }} + {{#if (eq @status 'success') }} Your policy has been saved. {{else}} There was an error saving your policy. {{/if}} -{{ else if (eq type 'delete')}} - {{#if (eq status 'success') }} +{{ else if (eq @type 'delete')}} + {{#if (eq @status 'success') }} Your policy was deleted. {{else}} There was an error deleting your policy. {{/if}} {{/if}} -{{#let error.errors.firstObject as |error|}} +{{#let @error.errors.firstObject as |error|}} {{#if error.detail }}
{{concat '(' (if error.status (concat error.status ': ')) error.detail ')'}} {{/if}} {{/let}} - diff --git a/ui-v2/app/templates/dc/acls/roles/-notifications.hbs b/ui-v2/app/components/consul/role/notifications/index.hbs similarity index 63% rename from ui-v2/app/templates/dc/acls/roles/-notifications.hbs rename to ui-v2/app/components/consul/role/notifications/index.hbs index 15f44721fd..1f2ad9ba75 100644 --- a/ui-v2/app/templates/dc/acls/roles/-notifications.hbs +++ b/ui-v2/app/components/consul/role/notifications/index.hbs @@ -1,25 +1,24 @@ -{{#if (eq type 'create')}} - {{#if (eq status 'success') }} +{{#if (eq @type 'create')}} + {{#if (eq @status 'success') }} Your role has been added. {{else}} There was an error adding your role. {{/if}} -{{else if (eq type 'update') }} - {{#if (eq status 'success') }} +{{else if (eq @type 'update') }} + {{#if (eq @status 'success') }} Your role has been saved. {{else}} There was an error saving your role. {{/if}} -{{ else if (eq type 'delete')}} - {{#if (eq status 'success') }} +{{ else if (eq @type 'delete')}} + {{#if (eq @status 'success') }} Your role was deleted. {{else}} There was an error deleting your role. {{/if}} {{/if}} -{{#let error.errors.firstObject as |error|}} +{{#let @error.errors.firstObject as |error|}} {{#if error.detail }}
{{concat '(' (if error.status (concat error.status ': ')) error.detail ')'}} {{/if}} {{/let}} - diff --git a/ui-v2/app/templates/dc/services/-notifications.hbs b/ui-v2/app/components/consul/service/notifications/index.hbs similarity index 62% rename from ui-v2/app/templates/dc/services/-notifications.hbs rename to ui-v2/app/components/consul/service/notifications/index.hbs index 9dee0a3ec9..85679bb99b 100644 --- a/ui-v2/app/templates/dc/services/-notifications.hbs +++ b/ui-v2/app/components/consul/service/notifications/index.hbs @@ -1,7 +1,6 @@ -{{#if (eq type 'update')}} - {{#if (eq status 'warning') }} +{{#if (eq @type 'update')}} + {{#if (eq @status 'warning') }} This service has been deregistered and no longer exists in the catalog. {{else}} {{/if}} {{/if}} - diff --git a/ui-v2/app/templates/dc/acls/tokens/-notifications.hbs b/ui-v2/app/components/consul/token/notifications/index.hbs similarity index 56% rename from ui-v2/app/templates/dc/acls/tokens/-notifications.hbs rename to ui-v2/app/components/consul/token/notifications/index.hbs index 34a59cbafb..521f5ac367 100644 --- a/ui-v2/app/templates/dc/acls/tokens/-notifications.hbs +++ b/ui-v2/app/components/consul/token/notifications/index.hbs @@ -1,37 +1,36 @@ -{{#if (eq type 'create')}} - {{#if (eq status 'success') }} +{{#if (eq @type 'create')}} + {{#if (eq @status 'success') }} The token has been added. {{else}} There was an error adding the token. {{/if}} -{{else if (eq type 'update') }} - {{#if (eq status 'success') }} +{{else if (eq @type 'update') }} + {{#if (eq @status 'success') }} The token has been saved. {{else}} There was an error saving the token. {{/if}} -{{ else if (eq type 'delete')}} - {{#if (eq status 'success') }} +{{ else if (eq @type 'delete')}} + {{#if (eq @status 'success') }} The token was deleted. {{else}} There was an error deleting the token. {{/if}} -{{ else if (eq type 'clone')}} - {{#if (eq status 'success') }} - The token has been cloned as {{truncate subject.AccessorID 8 false}} +{{ else if (eq @type 'clone')}} + {{#if (eq @status 'success') }} + The token has been cloned as {{truncate @item.AccessorID 8 false}} {{else}} There was an error cloning the token. {{/if}} -{{ else if (eq type 'use')}} - {{#if (eq status 'success') }} +{{ else if (eq @type 'use')}} + {{#if (eq @status 'success') }} You are now using the new ACL token {{else}} There was an error using that ACL token. {{/if}} {{/if}} -{{#let error.errors.firstObject as |error|}} +{{#let @error.errors.firstObject as |error|}} {{#if error.detail }}
{{concat '(' (if error.status (concat error.status ': ')) error.detail ')'}} {{/if}} {{/let}} - diff --git a/ui-v2/app/templates/dc/acls/edit.hbs b/ui-v2/app/templates/dc/acls/edit.hbs index 2e93701036..b10cd72859 100644 --- a/ui-v2/app/templates/dc/acls/edit.hbs +++ b/ui-v2/app/templates/dc/acls/edit.hbs @@ -1,7 +1,11 @@ - - {{partial 'dc/acls/notifications'}} - + + +
  1. All Tokens
  2. diff --git a/ui-v2/app/templates/dc/acls/index.hbs b/ui-v2/app/templates/dc/acls/index.hbs index ddd7e96df1..59c9b192e5 100644 --- a/ui-v2/app/templates/dc/acls/index.hbs +++ b/ui-v2/app/templates/dc/acls/index.hbs @@ -8,8 +8,12 @@ as |filter| }} - - {{partial 'dc/acls/notifications'}} + +

    diff --git a/ui-v2/app/templates/dc/acls/policies/edit.hbs b/ui-v2/app/templates/dc/acls/policies/edit.hbs index 5184a111ba..c09685958b 100644 --- a/ui-v2/app/templates/dc/acls/policies/edit.hbs +++ b/ui-v2/app/templates/dc/acls/policies/edit.hbs @@ -12,7 +12,12 @@ @enabled={{isEnabled}} > - {{partial 'dc/acls/policies/notifications'}} +
      diff --git a/ui-v2/app/templates/dc/acls/policies/index.hbs b/ui-v2/app/templates/dc/acls/policies/index.hbs index 49813c0b16..c7821f9bcc 100644 --- a/ui-v2/app/templates/dc/acls/policies/index.hbs +++ b/ui-v2/app/templates/dc/acls/policies/index.hbs @@ -12,8 +12,13 @@ @authorized={{isAuthorized}} @enabled={{isEnabled}} > - - {{partial 'dc/acls/policies/notifications'}} + +

      diff --git a/ui-v2/app/templates/dc/acls/roles/edit.hbs b/ui-v2/app/templates/dc/acls/roles/edit.hbs index 6047cf4a60..a17f125004 100644 --- a/ui-v2/app/templates/dc/acls/roles/edit.hbs +++ b/ui-v2/app/templates/dc/acls/roles/edit.hbs @@ -12,7 +12,12 @@ @enabled={{isEnabled}} > - {{partial 'dc/acls/roles/notifications'}} +
        diff --git a/ui-v2/app/templates/dc/acls/roles/index.hbs b/ui-v2/app/templates/dc/acls/roles/index.hbs index 46d0a16983..70101bf678 100644 --- a/ui-v2/app/templates/dc/acls/roles/index.hbs +++ b/ui-v2/app/templates/dc/acls/roles/index.hbs @@ -9,8 +9,13 @@ @authorized={{isAuthorized}} @enabled={{isEnabled}} > - - {{partial 'dc/acls/roles/notifications'}} + +

        diff --git a/ui-v2/app/templates/dc/acls/tokens/edit.hbs b/ui-v2/app/templates/dc/acls/tokens/edit.hbs index 408d3c2e2a..09e5f1a950 100644 --- a/ui-v2/app/templates/dc/acls/tokens/edit.hbs +++ b/ui-v2/app/templates/dc/acls/tokens/edit.hbs @@ -12,7 +12,12 @@ @enabled={{isEnabled}} > - {{partial 'dc/acls/tokens/notifications'}} +
          diff --git a/ui-v2/app/templates/dc/acls/tokens/index.hbs b/ui-v2/app/templates/dc/acls/tokens/index.hbs index 8a251e4513..8a9b6e1626 100644 --- a/ui-v2/app/templates/dc/acls/tokens/index.hbs +++ b/ui-v2/app/templates/dc/acls/tokens/index.hbs @@ -12,8 +12,13 @@ @authorized={{isAuthorized}} @enabled={{isEnabled}} > - - {{partial 'dc/acls/tokens/notifications'}} + +

          diff --git a/ui-v2/app/templates/dc/nodes/-notifications.hbs b/ui-v2/app/templates/dc/nodes/-notifications.hbs deleted file mode 100644 index cbc36249f0..0000000000 --- a/ui-v2/app/templates/dc/nodes/-notifications.hbs +++ /dev/null @@ -1,12 +0,0 @@ -{{#if (eq type 'delete')}} - {{#if (eq status 'success') }} - The session was invalidated. - {{else}} - There was an error invalidating the session. - {{/if}} -{{else if (eq type 'update')}} - {{#if (eq status 'warning') }} - This node no longer exists in the catalog. - {{else}} - {{/if}} -{{/if}} diff --git a/ui-v2/app/templates/dc/nodes/show.hbs b/ui-v2/app/templates/dc/nodes/show.hbs index 146f84c44a..5f12fbc795 100644 --- a/ui-v2/app/templates/dc/nodes/show.hbs +++ b/ui-v2/app/templates/dc/nodes/show.hbs @@ -31,8 +31,10 @@ - {{!TODO: Move sessions to its own folder within nodes }} - {{partial 'dc/nodes/notifications'}} +
            diff --git a/ui-v2/app/templates/dc/nspaces/edit.hbs b/ui-v2/app/templates/dc/nspaces/edit.hbs index d19f889a74..72bdd234d0 100644 --- a/ui-v2/app/templates/dc/nspaces/edit.hbs +++ b/ui-v2/app/templates/dc/nspaces/edit.hbs @@ -5,7 +5,11 @@ {{/if}} - {{partial 'dc/nspaces/notifications'}} +
              diff --git a/ui-v2/app/templates/dc/nspaces/index.hbs b/ui-v2/app/templates/dc/nspaces/index.hbs index 4f4bd42773..cd3523bf33 100644 --- a/ui-v2/app/templates/dc/nspaces/index.hbs +++ b/ui-v2/app/templates/dc/nspaces/index.hbs @@ -2,8 +2,12 @@ {{#let (or sortBy "Name:asc") as |sort|}} - - {{partial 'dc/nspaces/notifications'}} + +

              diff --git a/ui-v2/app/templates/dc/services/index.hbs b/ui-v2/app/templates/dc/services/index.hbs index 19d044b9a3..b18eca890a 100644 --- a/ui-v2/app/templates/dc/services/index.hbs +++ b/ui-v2/app/templates/dc/services/index.hbs @@ -8,7 +8,10 @@ {{#let (or sortBy "Name:asc") as |sort|}} - {{partial 'dc/services/notifications'}} +

              diff --git a/ui-v2/app/templates/dc/services/instance.hbs b/ui-v2/app/templates/dc/services/instance.hbs index cd9a1ac931..aaa34c7463 100644 --- a/ui-v2/app/templates/dc/services/instance.hbs +++ b/ui-v2/app/templates/dc/services/instance.hbs @@ -4,7 +4,10 @@ - {{partial 'dc/services/notifications'}} +
                diff --git a/ui-v2/app/templates/dc/services/show.hbs b/ui-v2/app/templates/dc/services/show.hbs index 7692eaa0b5..e3c11aa323 100644 --- a/ui-v2/app/templates/dc/services/show.hbs +++ b/ui-v2/app/templates/dc/services/show.hbs @@ -7,7 +7,10 @@ {{title item.Service.Service}} - {{partial 'dc/services/notifications'}} +