From 7f022fc64c559bdc1079d1cb98bac6f7f9702fa7 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Wed, 18 Aug 2021 11:53:44 -0400 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A4=96=20upgrade=20help=20and=20?= =?UTF-8?q?alert=20icons=20to=20flight?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/addon/components/doc-link/index.hbs | 2 +- .../addon/components/error/message/index.js | 7 ++-- addons/core/index.js | 39 +++++++++++++++++++ .../rose/link-button/index.stories.mdx | 6 +-- .../components/rose/message/index.stories.mdx | 9 ++--- addons/rose/public/flight/alert-circle-16.svg | 7 ++++ addons/rose/public/flight/help-16.svg | 7 ++++ .../components/rose/card/link-test.js | 2 +- .../components/rose/link-button-test.js | 2 +- ui/admin/app/templates/scopes/index.hbs | 2 +- .../templates/scopes/scope/authenticate.hbs | 2 +- .../scopes/scope/authenticate/index.hbs | 2 +- .../templates/scopes/scope/authenticate.hbs | 2 +- .../scopes/scope/authenticate/index.hbs | 2 +- 14 files changed, 71 insertions(+), 20 deletions(-) create mode 100644 addons/rose/public/flight/alert-circle-16.svg create mode 100644 addons/rose/public/flight/help-16.svg diff --git a/addons/core/addon/components/doc-link/index.hbs b/addons/core/addon/components/doc-link/index.hbs index e654aac4a..c7b7e1a8e 100644 --- a/addons/core/addon/components/doc-link/index.hbs +++ b/addons/core/addon/components/doc-link/index.hbs @@ -4,5 +4,5 @@ target="_blank" rel="noreferrer noopener" title={{t "actions.get-topic-help"}}> - + diff --git a/addons/core/addon/components/error/message/index.js b/addons/core/addon/components/error/message/index.js index 22c587595..f121d7d7b 100644 --- a/addons/core/addon/components/error/message/index.js +++ b/addons/core/addon/components/error/message/index.js @@ -27,13 +27,12 @@ export default class ErrorMessageComponent extends MessageComponent { @computed('args.status') get icon() { switch (this.args.status) { + case '404': + return 'flight/help-16'; case '401': case '403': - return 'disabled'; - case '404': - return 'help-circle-outline'; default: - return 'alert-circle-outline'; + return 'flight/alert-circle-16'; } } diff --git a/addons/core/index.js b/addons/core/index.js index fa6be2662..f1a668631 100644 --- a/addons/core/index.js +++ b/addons/core/index.js @@ -1,4 +1,43 @@ 'use strict'; + +var path = require('path'); + module.exports = { name: require('./package').name, + + included(app) { + this._super.included.apply(this, arguments); + this.includePublic(app); + this.setupSVGO(app); + }, + + /** + * Finds the public folder and includes it into the ember-inline-svg addon. + */ + includePublic(app) { + const publicPath = path.resolve('public'); + const rosePublicPath = path.resolve('../rose/public'); + const dummyPublicPath = path.resolve('tests/dummy/public'); + + app.options.svg = app.options.svg || {}; + app.options.svg.paths = app.options.svg.paths || []; + + app.options.svg.paths.push(publicPath); + app.options.svg.paths.push(rosePublicPath); + if (this.isDevelopingAddon()) app.options.svg.paths.push(dummyPublicPath); + + this.addons.forEach((addon) => { + if (addon.name === 'ember-inline-svg') addon.included(app); + }); + }, + + /** + * Adjust SVG optimizer defaults (used by ember-inline-svg). + */ + setupSVGO(app) { + app.options.svg = app.options.svg || {}; + app.options.svg.optimize = app.options.svg.optimize || {}; + app.options.svg.optimize.plugins = app.options.svg.optimize.plugins || []; + app.options.svg.optimize.plugins.push({ removeViewBox: false }); + }, }; diff --git a/addons/rose/addon/components/rose/link-button/index.stories.mdx b/addons/rose/addon/components/rose/link-button/index.stories.mdx index e6c717d8a..f4e850bf9 100644 --- a/addons/rose/addon/components/rose/link-button/index.stories.mdx +++ b/addons/rose/addon/components/rose/link-button/index.stories.mdx @@ -68,7 +68,7 @@ Disabling link button is not supported as it is an action on form components onl Similar to `Rose::Button`, icon only link button is supported. ```html - + ``` @@ -92,11 +92,11 @@ Similar to `Rose::Button`, icon only link button is supported. 'iconOnly', { 'check-circle-outline': 'check-circle-outline', - 'help-circle-outline': 'help-circle-outline', + 'flight/help-16': 'flight/help-16', 'plus-circle-fill': 'plus-circle-fill', 'user-square-outline': 'user-square-outline', }, - 'help-circle-outline' + 'flight/help-16' ), }, }} diff --git a/addons/rose/addon/components/rose/message/index.stories.mdx b/addons/rose/addon/components/rose/message/index.stories.mdx index 89447aca1..c11095d2a 100644 --- a/addons/rose/addon/components/rose/message/index.stories.mdx +++ b/addons/rose/addon/components/rose/message/index.stories.mdx @@ -33,18 +33,17 @@ Title can be configured with optional icon and subtitle. icon: select( 'icon', { - 'alert-circle-outline': 'alert-circle-outline', - 'help-circle-outline': 'help-circle-outline', - 'disabled': 'disabled', + 'flight/alert-circle-16': 'flight/alert-circle-16', + 'flight/help-16': 'flight/help-16', }, - 'help-circle-outline' + 'flight/help-16' ), }, }} ```html - + You must be granted permissions to view this data. Ask your administrator if you think you should have access. diff --git a/addons/rose/public/flight/alert-circle-16.svg b/addons/rose/public/flight/alert-circle-16.svg new file mode 100644 index 000000000..55d000d4c --- /dev/null +++ b/addons/rose/public/flight/alert-circle-16.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/addons/rose/public/flight/help-16.svg b/addons/rose/public/flight/help-16.svg new file mode 100644 index 000000000..acaf4b376 --- /dev/null +++ b/addons/rose/public/flight/help-16.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/addons/rose/tests/integration/components/rose/card/link-test.js b/addons/rose/tests/integration/components/rose/card/link-test.js index af9003ef3..f4eb10074 100644 --- a/addons/rose/tests/integration/components/rose/card/link-test.js +++ b/addons/rose/tests/integration/components/rose/card/link-test.js @@ -42,7 +42,7 @@ module('Integration | Component | rose/card/link', function (hooks) { test('it renders with @icon', async function (assert) { await render( - hbs`` + hbs`` ); assert.ok(find('.rose-icon')); }); diff --git a/addons/rose/tests/integration/components/rose/link-button-test.js b/addons/rose/tests/integration/components/rose/link-button-test.js index ac2be94aa..243a4fbc5 100644 --- a/addons/rose/tests/integration/components/rose/link-button-test.js +++ b/addons/rose/tests/integration/components/rose/link-button-test.js @@ -51,7 +51,7 @@ module('Integration | Component | rose/link-button', function (hooks) { test('it supports only icon with @iconOnly', async function (assert) { await render( - hbs`` + hbs`` ); assert.ok(find('.rose-icon')); assert.ok(find('.has-icon-only')); diff --git a/ui/admin/app/templates/scopes/index.hbs b/ui/admin/app/templates/scopes/index.hbs index f4a0d7cfe..4ef9a35e2 100644 --- a/ui/admin/app/templates/scopes/index.hbs +++ b/ui/admin/app/templates/scopes/index.hbs @@ -8,7 +8,7 @@ diff --git a/ui/admin/app/templates/scopes/scope/authenticate.hbs b/ui/admin/app/templates/scopes/scope/authenticate.hbs index 847987db3..755b72578 100644 --- a/ui/admin/app/templates/scopes/scope/authenticate.hbs +++ b/ui/admin/app/templates/scopes/scope/authenticate.hbs @@ -79,7 +79,7 @@ diff --git a/ui/admin/app/templates/scopes/scope/authenticate/index.hbs b/ui/admin/app/templates/scopes/scope/authenticate/index.hbs index b8dbc824f..014f21a9a 100644 --- a/ui/admin/app/templates/scopes/scope/authenticate/index.hbs +++ b/ui/admin/app/templates/scopes/scope/authenticate/index.hbs @@ -2,7 +2,7 @@ diff --git a/ui/desktop/app/templates/scopes/scope/authenticate.hbs b/ui/desktop/app/templates/scopes/scope/authenticate.hbs index 0472b5fce..da49bb798 100644 --- a/ui/desktop/app/templates/scopes/scope/authenticate.hbs +++ b/ui/desktop/app/templates/scopes/scope/authenticate.hbs @@ -67,7 +67,7 @@ diff --git a/ui/desktop/app/templates/scopes/scope/authenticate/index.hbs b/ui/desktop/app/templates/scopes/scope/authenticate/index.hbs index b8dbc824f..014f21a9a 100644 --- a/ui/desktop/app/templates/scopes/scope/authenticate/index.hbs +++ b/ui/desktop/app/templates/scopes/scope/authenticate/index.hbs @@ -2,7 +2,7 @@