From d97b7674c728d49ea2bae3b22060bc5e4406635e Mon Sep 17 00:00:00 2001 From: "Ronald A. Richardson" Date: Fri, 30 Aug 2024 14:02:26 +0800 Subject: [PATCH] small improvements to ux --- addon/routes/application.js | 16 ++++++++++++++++ addon/templates/application.hbs | 10 +++++----- app/routes/application.js | 1 + package.json | 4 ++-- pnpm-lock.yaml | 20 ++++++++++---------- tests/unit/routes/application-test.js | 11 +++++++++++ 6 files changed, 45 insertions(+), 17 deletions(-) create mode 100644 addon/routes/application.js create mode 100644 app/routes/application.js create mode 100644 tests/unit/routes/application-test.js diff --git a/addon/routes/application.js b/addon/routes/application.js new file mode 100644 index 0000000..a682549 --- /dev/null +++ b/addon/routes/application.js @@ -0,0 +1,16 @@ +import Route from '@ember/routing/route'; +import { inject as service } from '@ember/service'; + +export default class ApplicationRoute extends Route { + @service notifications; + @service hostRouter; + @service abilities; + @service intl; + + beforeModel() { + if (this.abilities.cannot('developers see extension')) { + this.notifications.warning(this.intl.t('common.unauthorized-access')); + return this.hostRouter.transitionTo('console'); + } + } +} diff --git a/addon/templates/application.hbs b/addon/templates/application.hbs index 5136572..c35e643 100644 --- a/addon/templates/application.hbs +++ b/addon/templates/application.hbs @@ -1,11 +1,11 @@ {{t "developers.application.sidebar.items.home"}} - {{t "developers.application.sidebar.items.api-keys"}} - {{t "developers.application.sidebar.items.webhooks"}} - {{t "developers.application.sidebar.items.websockets"}} - {{t "developers.application.sidebar.items.logs"}} - {{t "developers.application.sidebar.items.events"}} + {{t "developers.application.sidebar.items.api-keys"}} + {{t "developers.application.sidebar.items.webhooks"}} + {{t "developers.application.sidebar.items.websockets"}} + {{t "developers.application.sidebar.items.logs"}} + {{t "developers.application.sidebar.items.events"}} diff --git a/app/routes/application.js b/app/routes/application.js new file mode 100644 index 0000000..b29d73c --- /dev/null +++ b/app/routes/application.js @@ -0,0 +1 @@ +export { default } from '@fleetbase/dev-engine/routes/application'; diff --git a/package.json b/package.json index 04dc980..5aee157 100644 --- a/package.json +++ b/package.json @@ -42,8 +42,8 @@ }, "dependencies": { "@babel/core": "^7.23.2", - "@fleetbase/ember-core": "^0.2.16", - "@fleetbase/ember-ui": "^0.2.22", + "@fleetbase/ember-core": "^0.2.17", + "@fleetbase/ember-ui": "^0.2.24", "@fortawesome/ember-fontawesome": "^2.0.0", "@fortawesome/fontawesome-svg-core": "6.4.0", "@fortawesome/free-brands-svg-icons": "6.4.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 15750ee..2986256 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,11 +12,11 @@ importers: specifier: ^7.23.2 version: 7.25.2 '@fleetbase/ember-core': - specifier: ^0.2.16 - version: 0.2.16(@ember/string@3.1.1)(@ember/test-helpers@3.3.1(@babel/core@7.25.2)(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.93.0))(webpack@5.93.0))(ember-resolver@11.0.1(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.93.0)))(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.93.0))(webpack@5.93.0) + specifier: ^0.2.17 + version: 0.2.17(@ember/string@3.1.1)(@ember/test-helpers@3.3.1(@babel/core@7.25.2)(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.93.0))(webpack@5.93.0))(ember-resolver@11.0.1(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.93.0)))(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.93.0))(webpack@5.93.0) '@fleetbase/ember-ui': - specifier: ^0.2.22 - version: 0.2.22(@ember/test-helpers@3.3.1(@babel/core@7.25.2)(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.93.0))(webpack@5.93.0))(@glimmer/component@1.1.2(@babel/core@7.25.2))(@glimmer/tracking@1.1.2)(ember-resolver@11.0.1(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.93.0)))(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.93.0))(postcss@8.4.41)(rollup@2.79.1)(tracked-built-ins@3.3.0)(webpack@5.93.0) + specifier: ^0.2.24 + version: 0.2.24(@ember/test-helpers@3.3.1(@babel/core@7.25.2)(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.93.0))(webpack@5.93.0))(@glimmer/component@1.1.2(@babel/core@7.25.2))(@glimmer/tracking@1.1.2)(ember-resolver@11.0.1(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.93.0)))(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.93.0))(postcss@8.4.41)(rollup@2.79.1)(tracked-built-ins@3.3.0)(webpack@5.93.0) '@fortawesome/ember-fontawesome': specifier: ^2.0.0 version: 2.0.0(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.93.0))(rollup@2.79.1)(webpack@5.93.0) @@ -1325,12 +1325,12 @@ packages: peerDependencies: ember-source: '>= 4.0.0' - '@fleetbase/ember-core@0.2.16': - resolution: {integrity: sha512-9IrOvmh5C3ZLuQB8WX5BHtGBiMqrTNArsxQ7AGK/unHwwcXKHSKBMqxI4ZjqzBLIp5x/G3Y/ext/qJywiBaxRg==} + '@fleetbase/ember-core@0.2.17': + resolution: {integrity: sha512-4xtkBYDOmLUD2kIFl90Rg+G4BS7BdTXB2jf654VzsWxtV6vhjiFOeMBn/BErT8wnx0Re/7jdcQ3sdrJjBf1gBg==} engines: {node: '>= 18'} - '@fleetbase/ember-ui@0.2.22': - resolution: {integrity: sha512-uPsd0lluupjZ0YoknH0aJ7Pfhmfqd3+y1K8w/Q2K+VAA6rCLQ+VQQrugsbikH0jP4OnoiGKQWFyexQVGNZm1ew==} + '@fleetbase/ember-ui@0.2.24': + resolution: {integrity: sha512-EAPdgz3SDgLVqEn165lfdamS7xI3rszVO6P1EwLgLdzpOFleI6rzVX4WfhGhB/CXJTtjVlr74RSbV0gPDMp/tQ==} engines: {node: '>= 18'} '@fleetbase/intl-lint@0.0.1': @@ -9667,7 +9667,7 @@ snapshots: transitivePeerDependencies: - supports-color - '@fleetbase/ember-core@0.2.16(@ember/string@3.1.1)(@ember/test-helpers@3.3.1(@babel/core@7.25.2)(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.93.0))(webpack@5.93.0))(ember-resolver@11.0.1(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.93.0)))(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.93.0))(webpack@5.93.0)': + '@fleetbase/ember-core@0.2.17(@ember/string@3.1.1)(@ember/test-helpers@3.3.1(@babel/core@7.25.2)(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.93.0))(webpack@5.93.0))(ember-resolver@11.0.1(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.93.0)))(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.93.0))(webpack@5.93.0)': dependencies: '@babel/core': 7.25.2 compress-json: 3.1.0 @@ -9700,7 +9700,7 @@ snapshots: - utf-8-validate - webpack - '@fleetbase/ember-ui@0.2.22(@ember/test-helpers@3.3.1(@babel/core@7.25.2)(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.93.0))(webpack@5.93.0))(@glimmer/component@1.1.2(@babel/core@7.25.2))(@glimmer/tracking@1.1.2)(ember-resolver@11.0.1(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.93.0)))(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.93.0))(postcss@8.4.41)(rollup@2.79.1)(tracked-built-ins@3.3.0)(webpack@5.93.0)': + '@fleetbase/ember-ui@0.2.24(@ember/test-helpers@3.3.1(@babel/core@7.25.2)(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.93.0))(webpack@5.93.0))(@glimmer/component@1.1.2(@babel/core@7.25.2))(@glimmer/tracking@1.1.2)(ember-resolver@11.0.1(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.93.0)))(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.93.0))(postcss@8.4.41)(rollup@2.79.1)(tracked-built-ins@3.3.0)(webpack@5.93.0)': dependencies: '@babel/core': 7.25.2 '@ember/render-modifiers': 2.1.0(@babel/core@7.25.2)(ember-source@5.4.1(@babel/core@7.25.2)(@glimmer/component@1.1.2(@babel/core@7.25.2))(rsvp@4.8.5)(webpack@5.93.0)) diff --git a/tests/unit/routes/application-test.js b/tests/unit/routes/application-test.js new file mode 100644 index 0000000..a9593fd --- /dev/null +++ b/tests/unit/routes/application-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'dummy/tests/helpers'; + +module('Unit | Route | application', function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + let route = this.owner.lookup('route:application'); + assert.ok(route); + }); +});