From d0eb41e03b84fa0dabd69bb7ea269c423969b986 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Thu, 3 Jun 2021 17:08:40 -0400 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20add=20icons=20and=20clea?= =?UTF-8?q?n=20up=20state=20change=20language?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/api/addon/classes/auth-method.js | 15 -------- addons/api/addon/models/auth-method.js | 21 +++++++++++ addons/api/app/classes/auth-method.js | 1 - .../tests/unit/classes/auth-method-test.js | 22 ------------ addons/core/translations/actions/en-us.yaml | 1 + addons/core/translations/resources/en-us.yaml | 1 - addons/core/translations/states/en-us.yaml | 9 ++--- addons/rose/package.json | 2 +- .../scopes/scope/auth-methods/auth-method.js | 4 +-- .../auth-methods/auth-method/-actions.hbs | 15 ++++---- yarn.lock | 35 +++++-------------- 11 files changed, 45 insertions(+), 81 deletions(-) delete mode 100644 addons/api/addon/classes/auth-method.js delete mode 100644 addons/api/app/classes/auth-method.js delete mode 100644 addons/api/tests/unit/classes/auth-method-test.js diff --git a/addons/api/addon/classes/auth-method.js b/addons/api/addon/classes/auth-method.js deleted file mode 100644 index 799afb353..000000000 --- a/addons/api/addon/classes/auth-method.js +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Empty auth method definition - */ -export class AuthMethod {} - -/** - * Simple OIDC auth method definition to contain possible oidc states. - * @property states {[string]} states - */ -export class AuthMethodOIDC extends AuthMethod { - /** - * Possible auth-method statuses - */ - static states = ['inactive', 'active-private', 'active-public']; -} diff --git a/addons/api/addon/models/auth-method.js b/addons/api/addon/models/auth-method.js index 09b801e0a..8e6c4f198 100644 --- a/addons/api/addon/models/auth-method.js +++ b/addons/api/addon/models/auth-method.js @@ -75,6 +75,27 @@ export default class AuthMethodModel extends GeneratedAuthMethodModel { return this.type === 'oidc'; } + /** + * @type {boolean} + */ + get isInactive() { + return this.attributes.state === 'inactive'; + } + + /** + * @type {boolean} + */ + get isPrivate() { + return this.attributes.state === 'active-private'; + } + + /** + * @type {boolean} + */ + get isPublic() { + return this.attributes.state === 'active-public'; + } + // =methods /** diff --git a/addons/api/app/classes/auth-method.js b/addons/api/app/classes/auth-method.js deleted file mode 100644 index 5cdd5e1b1..000000000 --- a/addons/api/app/classes/auth-method.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'api/classes/auth-method'; diff --git a/addons/api/tests/unit/classes/auth-method-test.js b/addons/api/tests/unit/classes/auth-method-test.js deleted file mode 100644 index d2fb5d8c6..000000000 --- a/addons/api/tests/unit/classes/auth-method-test.js +++ /dev/null @@ -1,22 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; -import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; -import { AuthMethod, AuthMethodOIDC } from 'api/classes/auth-method'; - -module('Unit | Class | auth method', function (hooks) { - setupTest(hooks); - setupMirage(hooks); - - test('it exists', function (assert) { - assert.ok(AuthMethod); - assert.ok(AuthMethodOIDC); - }); - - test('oidc auth method lists states', function (assert) { - assert.deepEqual(AuthMethodOIDC.states, [ - 'inactive', - 'active-private', - 'active-public', - ]); - }); -}); diff --git a/addons/core/translations/actions/en-us.yaml b/addons/core/translations/actions/en-us.yaml index eccbad6eb..2c501df04 100644 --- a/addons/core/translations/actions/en-us.yaml +++ b/addons/core/translations/actions/en-us.yaml @@ -31,3 +31,4 @@ set-password: Set Password change-password: Change Password edit-form: Edit Form change-origin: Change Origin URL +change-state: Change State diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index 0c0eedb57..8ab5152ac 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -45,7 +45,6 @@ auth-method: delete: Delete Auth Method make-primary: Make Primary remove-as-primary: Remove as Primary - status: Status notifications: make-primary-success: Auth method successfully elected to primary. remove-as-primary-success: Auth method successfully removed as primary. diff --git a/addons/core/translations/states/en-us.yaml b/addons/core/translations/states/en-us.yaml index 23a92c6cf..aca77b801 100644 --- a/addons/core/translations/states/en-us.yaml +++ b/addons/core/translations/states/en-us.yaml @@ -8,9 +8,6 @@ connection: success: description: "Local proxy address ({protocol}): {address}:{port}" primary: Primary -auth-method: - oidc: - states: - inactive: Inactive - active-private: Active Private - active-public: Active Public +inactive: Inactive +active-private: Private +active-public: Public diff --git a/addons/rose/package.json b/addons/rose/package.json index aa389d5a0..2226f0281 100644 --- a/addons/rose/package.json +++ b/addons/rose/package.json @@ -43,7 +43,7 @@ "@ember/test-helpers": "^2.1.4", "@glimmer/component": "^1.0.3", "@glimmer/tracking": "^1.0.3", - "@hashicorp/structure-icons": "^1.8.1", + "@hashicorp/structure-icons": "^1.9.0-0", "@storybook/addon-actions": "^6.0.26", "@storybook/addon-docs": "^6.0.26", "@storybook/addon-knobs": "^6.0.26", diff --git a/ui/admin/app/controllers/scopes/scope/auth-methods/auth-method.js b/ui/admin/app/controllers/scopes/scope/auth-methods/auth-method.js index a095f6d40..1aa269744 100644 --- a/ui/admin/app/controllers/scopes/scope/auth-methods/auth-method.js +++ b/ui/admin/app/controllers/scopes/scope/auth-methods/auth-method.js @@ -1,5 +1,5 @@ import Controller from '@ember/controller'; -import { AuthMethodOIDC } from 'api/classes/auth-method'; +import { options } from 'api/models/auth-method'; export default class ScopesScopeAuthMethodsAuthMethodController extends Controller { // =attributes @@ -17,6 +17,6 @@ export default class ScopesScopeAuthMethodsAuthMethodController extends Controll * @type {[string]} */ get oidcStates() { - return AuthMethodOIDC.states; + return options.oidc.state; } } diff --git a/ui/admin/app/templates/scopes/scope/auth-methods/auth-method/-actions.hbs b/ui/admin/app/templates/scopes/scope/auth-methods/auth-method/-actions.hbs index 0a7476f53..612a5e408 100644 --- a/ui/admin/app/templates/scopes/scope/auth-methods/auth-method/-actions.hbs +++ b/ui/admin/app/templates/scopes/scope/auth-methods/auth-method/-actions.hbs @@ -1,14 +1,15 @@ {{#if @model.isOIDC}} - + diff --git a/yarn.lock b/yarn.lock index 5ec5ecb54..f2e14d85f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2023,10 +2023,10 @@ resolved "https://registry.yarnpkg.com/@handlebars/parser/-/parser-1.1.0.tgz#d6dbc7574774b238114582410e8fee0dc3532bdf" integrity sha512-rR7tJoSwJ2eooOpYGxGGW95sLq6GXUaS1UtWvN7pei6n2/okYvCGld9vsUTvkl2migxbkszsycwtMf/GEc1k1A== -"@hashicorp/structure-icons@^1.8.1": - version "1.8.1" - resolved "https://registry.yarnpkg.com/@hashicorp/structure-icons/-/structure-icons-1.8.1.tgz#d29945df2b41dcb317b141e51a26bd4be796a164" - integrity sha512-XFYdCIshmaR3Igc8eWpOZ2Gr3IR/0TogXZ4PQ9bz1E9cLzF3njBcs3tCpJUOwRwe/wMI5YTlL/sOGvcZ77AB/Q== +"@hashicorp/structure-icons@^1.9.0-0": + version "1.9.0-0" + resolved "https://registry.yarnpkg.com/@hashicorp/structure-icons/-/structure-icons-1.9.0-0.tgz#7bd2f4a61d2dd81247090d2cfb86f1f89d4ea22a" + integrity sha512-khvUS/zThfR6pLW4hGVRpcGY2Ta5azeS/Vzb9iCfr3A8OhSZFdnrlkqjYknpBg4RwrQDBpWTzZhe/Z35Ne4Wxg== "@iarna/cli@^1.2.0": version "1.2.0" @@ -7560,7 +7560,7 @@ debug@~4.1.0: dependencies: ms "^2.1.1" -debuglog@*, debuglog@^1.0.1: +debuglog@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492" integrity sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI= @@ -12369,7 +12369,7 @@ import-lazy@^4.0.0: resolved "https://registry.yarnpkg.com/import-lazy/-/import-lazy-4.0.0.tgz#e8eb627483a0a43da3c03f3e35548be5cb0cc153" integrity sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw== -imurmurhash@*, imurmurhash@^0.1.4: +imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= @@ -14067,11 +14067,6 @@ lodash._baseflatten@^3.0.0: lodash.isarguments "^3.0.0" lodash.isarray "^3.0.0" -lodash._baseindexof@*: - version "3.1.0" - resolved "https://registry.yarnpkg.com/lodash._baseindexof/-/lodash._baseindexof-3.1.0.tgz#fe52b53a1c6761e42618d654e4a25789ed61822c" - integrity sha1-/lK1OhxnYeQmGNZU5KJXie1hgiw= - lodash._baseuniq@~4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz#0ebb44e456814af7905c6212fa2c9b2d51b841e8" @@ -14080,16 +14075,11 @@ lodash._baseuniq@~4.6.0: lodash._createset "~4.0.0" lodash._root "~3.0.0" -lodash._bindcallback@*, lodash._bindcallback@^3.0.0: +lodash._bindcallback@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz#e531c27644cf8b57a99e17ed95b35c748789392e" integrity sha1-5THCdkTPi1epnhftlbNcdIeJOS4= -lodash._cacheindexof@*: - version "3.0.2" - resolved "https://registry.yarnpkg.com/lodash._cacheindexof/-/lodash._cacheindexof-3.0.2.tgz#3dc69ac82498d2ee5e3ce56091bafd2adc7bde92" - integrity sha1-PcaayCSY0u5ePOVgkbr9Ktx73pI= - lodash._createassigner@^3.0.0: version "3.1.1" resolved "https://registry.yarnpkg.com/lodash._createassigner/-/lodash._createassigner-3.1.1.tgz#838a5bae2fdaca63ac22dee8e19fa4e6d6970b11" @@ -14099,19 +14089,12 @@ lodash._createassigner@^3.0.0: lodash._isiterateecall "^3.0.0" lodash.restparam "^3.0.0" -lodash._createcache@*: - version "3.1.2" - resolved "https://registry.yarnpkg.com/lodash._createcache/-/lodash._createcache-3.1.2.tgz#56d6a064017625e79ebca6b8018e17440bdcf093" - integrity sha1-VtagZAF2JeeevKa4AY4XRAvc8JM= - dependencies: - lodash._getnative "^3.0.0" - lodash._createset@~4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26" integrity sha1-D0ZZ+7CddRlPqeK4imZE02PJ/iY= -lodash._getnative@*, lodash._getnative@^3.0.0: +lodash._getnative@^3.0.0: version "3.9.1" resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" integrity sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U= @@ -14329,7 +14312,7 @@ lodash.pick@^4.4.0: resolved "https://registry.yarnpkg.com/lodash.pick/-/lodash.pick-4.4.0.tgz#52f05610fff9ded422611441ed1fc123a03001b3" integrity sha1-UvBWEP/53tQiYRRB7R/BI6AwAbM= -lodash.restparam@*, lodash.restparam@^3.0.0: +lodash.restparam@^3.0.0: version "3.6.1" resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805" integrity sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=