diff --git a/addons/rose/.template-lintrc.js b/addons/rose/.template-lintrc.js index 37b21ecca..0cfbd1f3b 100644 --- a/addons/rose/.template-lintrc.js +++ b/addons/rose/.template-lintrc.js @@ -10,11 +10,7 @@ module.exports = { extends: ['recommended', 'ember-template-lint-plugin-prettier:recommended'], overrides: [ { - files: [ - 'addon/components/rose/anonymous/index.hbs', - 'addon/components/rose/table/row/cell/index.hbs', - 'addon/components/rose/anonymous/index.hbs', - ], + files: ['addon/components/rose/anonymous/index.hbs'], rules: { 'no-yield-only': false, }, diff --git a/addons/rose/addon/components/rose/table/index.hbs b/addons/rose/addon/components/rose/table/index.hbs deleted file mode 100644 index 7b3729acd..000000000 --- a/addons/rose/addon/components/rose/table/index.hbs +++ /dev/null @@ -1,27 +0,0 @@ -{{! - Copyright (c) HashiCorp, Inc. - SPDX-License-Identifier: BUSL-1.1 -}} - - - {{#if @caption}} - - {{/if}} - - {{yield - (hash - header=(component - 'rose/table/section' tagName='thead' classNames='rose-table-header' - ) - body=(component - 'rose/table/section' tagName='tbody' classNames='rose-table-body' - ) - footer=(component - 'rose/table/section' tagName='tfoot' classNames='rose-table-footer' - ) - ) - }} -
{{@caption}}
\ No newline at end of file diff --git a/addons/rose/addon/components/rose/table/row/cell/index.hbs b/addons/rose/addon/components/rose/table/row/cell/index.hbs deleted file mode 100644 index 8709fc4b8..000000000 --- a/addons/rose/addon/components/rose/table/row/cell/index.hbs +++ /dev/null @@ -1,6 +0,0 @@ -{{! - Copyright (c) HashiCorp, Inc. - SPDX-License-Identifier: BUSL-1.1 -}} - -{{yield}} \ No newline at end of file diff --git a/addons/rose/addon/components/rose/table/row/cell/index.js b/addons/rose/addon/components/rose/table/row/cell/index.js deleted file mode 100644 index c9d2f35f3..000000000 --- a/addons/rose/addon/components/rose/table/row/cell/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) HashiCorp, Inc. - * SPDX-License-Identifier: BUSL-1.1 - */ - -import Component from '@ember/component'; -import layout from './index'; -import { computed } from '@ember/object'; - -export default Component.extend({ - layout, - tagName: 'td', - classNameBindings: ['cellTypeStyle', 'cellShrink', 'cellAlignmentStyle'], - cellTypeStyle: computed(function () { - return this.tagName.match('th') - ? `rose-table-header-cell` - : 'rose-table-cell'; - }), - cellShrink: computed(function () { - if (this.shrink) { - return 'rose-table-cell-shrink'; - } - }), - cellAlignmentStyle: computed(function () { - if (this.alignRight) { - return 'align-right'; - } - - if (this.alignCenter) { - return 'align-center'; - } - }), -}); diff --git a/addons/rose/addon/components/rose/table/row/index.hbs b/addons/rose/addon/components/rose/table/row/index.hbs deleted file mode 100644 index d5427c002..000000000 --- a/addons/rose/addon/components/rose/table/row/index.hbs +++ /dev/null @@ -1,18 +0,0 @@ -{{! - Copyright (c) HashiCorp, Inc. - SPDX-License-Identifier: BUSL-1.1 -}} - - - {{yield - (hash - cell=(component 'rose/table/row/cell') - headerCell=(component 'rose/table/row/cell' tagName='th') - ) - }} - \ No newline at end of file diff --git a/addons/rose/addon/components/rose/table/row/index.js b/addons/rose/addon/components/rose/table/row/index.js deleted file mode 100644 index e3b8e5934..000000000 --- a/addons/rose/addon/components/rose/table/row/index.js +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) HashiCorp, Inc. - * SPDX-License-Identifier: BUSL-1.1 - */ - -import Component from '@ember/component'; -import layout from './index'; - -/** - * A table row component that uses tr table element and - * configures a table cell element. - */ -export default Component.extend({ - layout, - tagName: '', -}); diff --git a/addons/rose/addon/components/rose/table/section/index.hbs b/addons/rose/addon/components/rose/table/section/index.hbs deleted file mode 100644 index f5b5318c1..000000000 --- a/addons/rose/addon/components/rose/table/section/index.hbs +++ /dev/null @@ -1,6 +0,0 @@ -{{! - Copyright (c) HashiCorp, Inc. - SPDX-License-Identifier: BUSL-1.1 -}} - -{{yield (hash row=(component 'rose/table/row'))}} \ No newline at end of file diff --git a/addons/rose/addon/components/rose/table/section/index.js b/addons/rose/addon/components/rose/table/section/index.js deleted file mode 100644 index 5deef75b0..000000000 --- a/addons/rose/addon/components/rose/table/section/index.js +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) HashiCorp, Inc. - * SPDX-License-Identifier: BUSL-1.1 - */ - -import Component from '@ember/component'; -import layout from './index'; - -/** - * A table section component that configures a row component. - * Section can be: thead, tbody, or tfoot table elements. - */ -export default Component.extend({ - layout, - tagName: '', -}); diff --git a/addons/rose/app/components/rose/notification.js b/addons/rose/app/components/rose/notification.js deleted file mode 100644 index 61de3f245..000000000 --- a/addons/rose/app/components/rose/notification.js +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Copyright (c) HashiCorp, Inc. - * SPDX-License-Identifier: BUSL-1.1 - */ - -export { default } from 'rose/components/rose/notification'; diff --git a/addons/rose/app/components/rose/table.js b/addons/rose/app/components/rose/table.js deleted file mode 100644 index c9a89893b..000000000 --- a/addons/rose/app/components/rose/table.js +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Copyright (c) HashiCorp, Inc. - * SPDX-License-Identifier: BUSL-1.1 - */ - -export { default } from 'rose/components/rose/table'; diff --git a/addons/rose/app/components/rose/table/row.js b/addons/rose/app/components/rose/table/row.js deleted file mode 100644 index 85687342c..000000000 --- a/addons/rose/app/components/rose/table/row.js +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Copyright (c) HashiCorp, Inc. - * SPDX-License-Identifier: BUSL-1.1 - */ - -export { default } from 'rose/components/rose/table/row'; diff --git a/addons/rose/app/components/rose/table/row/cell.js b/addons/rose/app/components/rose/table/row/cell.js deleted file mode 100644 index d437a26a1..000000000 --- a/addons/rose/app/components/rose/table/row/cell.js +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Copyright (c) HashiCorp, Inc. - * SPDX-License-Identifier: BUSL-1.1 - */ - -export { default } from 'rose/components/rose/table/row/cell'; diff --git a/addons/rose/app/components/rose/table/section.js b/addons/rose/app/components/rose/table/section.js deleted file mode 100644 index ad07f158f..000000000 --- a/addons/rose/app/components/rose/table/section.js +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Copyright (c) HashiCorp, Inc. - * SPDX-License-Identifier: BUSL-1.1 - */ - -export { default } from 'rose/components/rose/table/section'; diff --git a/addons/rose/app/styles/rose/components/_index.scss b/addons/rose/app/styles/rose/components/_index.scss index bdbe24095..65b2aead8 100644 --- a/addons/rose/app/styles/rose/components/_index.scss +++ b/addons/rose/app/styles/rose/components/_index.scss @@ -17,7 +17,6 @@ @import 'page-header'; @import 'separator'; @import 'nav'; -@import 'table'; @import 'message'; @import 'toolbar'; @import 'code-editor'; diff --git a/addons/rose/app/styles/rose/components/table/_index.scss b/addons/rose/app/styles/rose/components/table/_index.scss deleted file mode 100644 index 595c64a7c..000000000 --- a/addons/rose/app/styles/rose/components/table/_index.scss +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Copyright (c) HashiCorp, Inc. - * SPDX-License-Identifier: BUSL-1.1 - */ - -@import 'table'; diff --git a/addons/rose/app/styles/rose/components/table/_table.scss b/addons/rose/app/styles/rose/components/table/_table.scss deleted file mode 100644 index 64d5eee52..000000000 --- a/addons/rose/app/styles/rose/components/table/_table.scss +++ /dev/null @@ -1,120 +0,0 @@ -/** - * Copyright (c) HashiCorp, Inc. - * SPDX-License-Identifier: BUSL-1.1 - */ - -@use '../../variables/sizing'; -@use '../../utilities/type'; -@use 'sass:math'; - -.rose-table { - @include type.type(s, normal); - - width: 100%; - - .rose-table-row { - border-bottom: sizing.rems(xxxxs) solid var(--ui-gray-subtler-3); - text-align: left; - - &:last-child { - border-bottom: 0; - } - } - - // This styles are add to stop the input to apply extra margin (default on forms) - .rose-form-input, - .rose-form-input-field, - .hds-form-select, - [class^='hds-form-field'], - [class^='hds-form-field']:not(:first-child) { - margin: 0; - width: 100%; - } - - // Fix margin issue with textarea elements inside tables - textarea { - display: block; - } - - .rose-table-cell, - .rose-table-header-cell { - vertical-align: text-top; - - &.align-right { - text-align: right; - } - - &.align-center { - text-align: center; - } - } - - .rose-table-header-cell { - @include type.type(s, semibold); - } - - .rose-table-header .rose-table-header-cell { - color: var(--ui-gray); - } - - .rose-table-header, - .rose-table-footer { - .rose-table-cell, - .rose-table-header-cell { - padding: sizing.rems(s); - } - } - - .rose-table-body { - .rose-table-cell, - .rose-table-header-cell { - padding: sizing.rems(m) sizing.rems(s); - } - } - - .rose-table-cell-shrink { - width: 1%; - white-space: nowrap; - } - - [class*='rose-button'] { - margin-bottom: 0; - } - - &.rose-table-condensed { - .rose-table-cell, - .rose-table-header-cell { - @include type.type(s); - - $line-height: math.div(36, 14); - - line-height: $line-height; - padding: sizing.rems(xxs) + sizing.rems(xxxxs) sizing.rems(s); - - &:first-child { - padding-left: 0; - } - } - - .rose-table-header { - border-bottom: sizing.rems(xxxxs) solid var(--ui-gray-subtler-3); - - .rose-table-header-cell { - $line-height: math.div(16, 14); - - line-height: $line-height; - padding: sizing.rems(xs) sizing.rems(s); - - &:first-child { - padding-left: 0; - } - } - } - } - - .rose-table-row-visually-hidden { - position: absolute; - top: -9999rem; - left: -9999rem; - } -} diff --git a/addons/rose/tests/integration/components/rose/table-test.js b/addons/rose/tests/integration/components/rose/table-test.js deleted file mode 100644 index e3dae9612..000000000 --- a/addons/rose/tests/integration/components/rose/table-test.js +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright (c) HashiCorp, Inc. - * SPDX-License-Identifier: BUSL-1.1 - */ - -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'ember-qunit'; -import { render, find } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; - -module('Integration | Component | rose/table', function (hooks) { - setupRenderingTest(hooks); - - test('it renders', async function (assert) { - await render(hbs``); - assert.ok(find('table')); - assert.ok(find('.rose-table')); - }); - - test('it renders with attributes', async function (assert) { - await render(hbs``); - assert.ok(find('#table')); - }); - - test('it renders with caption', async function (assert) { - await render(hbs``); - assert.ok(find('caption')); - assert.strictEqual(find('caption').textContent.trim(), 'table caption'); - }); - - test('it renders with header', async function (assert) { - await render(hbs` - - `); - assert.ok(find('thead')); - }); - - test('it renders with body', async function (assert) { - await render(hbs` - - `); - assert.ok(find('tbody')); - }); - - test('it renders with footer', async function (assert) { - await render(hbs` - - `); - assert.ok(find('tfoot')); - }); - - test('it supports a style class', async function (assert) { - await render(hbs``); - assert.ok(find('.rose-table-condensed')); - }); -}); diff --git a/addons/rose/tests/integration/components/rose/table/row-test.js b/addons/rose/tests/integration/components/rose/table/row-test.js deleted file mode 100644 index bc06375fd..000000000 --- a/addons/rose/tests/integration/components/rose/table/row-test.js +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright (c) HashiCorp, Inc. - * SPDX-License-Identifier: BUSL-1.1 - */ - -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'ember-qunit'; -import { render, find } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; - -module('Integration | Component | rose/table/row', function (hooks) { - setupRenderingTest(hooks); - - test('it renders', async function (assert) { - assert.expect(2); - await render(hbs``); - assert.ok(find('tr')); - assert.ok(find('.rose-table-row')); - }); - - test('it renders with attributes', async function (assert) { - assert.expect(1); - await render(hbs``); - assert.ok(find('#row')); - }); - - test('it renders a cell', async function (assert) { - assert.expect(2); - await render(hbs` - - `); - assert.ok(find('td')); - assert.ok(find('.rose-table-cell')); - }); - - test('it renders a header cell', async function (assert) { - assert.expect(2); - await render(hbs` - - `); - assert.ok(find('th')); - assert.ok(find('.rose-table-header-cell')); - }); - - test('it can be hidden', async function (assert) { - assert.expect(1); - await render(hbs``); - assert.ok(find('.rose-table-row-visually-hidden')); - }); -}); diff --git a/addons/rose/tests/integration/components/rose/table/row/cell-test.js b/addons/rose/tests/integration/components/rose/table/row/cell-test.js deleted file mode 100644 index 74ce45cbd..000000000 --- a/addons/rose/tests/integration/components/rose/table/row/cell-test.js +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Copyright (c) HashiCorp, Inc. - * SPDX-License-Identifier: BUSL-1.1 - */ - -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'ember-qunit'; -import { render, find } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; - -module('Integration | Component | rose/table/row/cell', function (hooks) { - setupRenderingTest(hooks); - - test('it renders', async function (assert) { - assert.expect(2); - await render(hbs` - content - `); - assert.ok(find('td')); - assert.strictEqual(find('.rose-table-cell').textContent.trim(), 'content'); - }); - - test('it renders with attributes', async function (assert) { - assert.expect(1); - await render(hbs``); - assert.ok(find('#cell')); - }); - - test('it renders as header cell', async function (assert) { - assert.expect(4); - await render(hbs``); - assert.ok(find('th')); - assert.ok(find('.rose-table-header-cell')); - assert.notOk(find('td')); - assert.notOk(find('.rose-table-cell')); - }); - - test('it adds shrink style class', async function (assert) { - assert.expect(1); - await render(hbs``); - assert.ok(find('.rose-table-cell-shrink')); - }); - - test('it does not add expand style class in default cells', async function (assert) { - assert.expect(1); - await render(hbs``); - assert.notOk(find('.rose-table-cell-shrink')); - }); - - test('it renders with align center in a header cell', async function (assert) { - assert.expect(2); - await render( - hbs``, - ); - assert.ok(find('.rose-table-header-cell')); - assert.ok(find('.align-center')); - }); - - test('it renders with align center in a body', async function (assert) { - assert.expect(2); - await render(hbs``); - assert.ok(find('.rose-table-cell')); - assert.ok(find('.align-center')); - }); - - test('it renders with align right in a header cell', async function (assert) { - assert.expect(2); - await render( - hbs``, - ); - assert.ok(find('.rose-table-header-cell')); - assert.ok(find('.align-right')); - }); - - test('it renders with align right', async function (assert) { - assert.expect(2); - await render(hbs``); - assert.ok(find('.rose-table-cell')); - assert.ok(find('.align-right')); - }); -}); diff --git a/addons/rose/tests/integration/components/rose/table/section-test.js b/addons/rose/tests/integration/components/rose/table/section-test.js deleted file mode 100644 index ccad4cfd6..000000000 --- a/addons/rose/tests/integration/components/rose/table/section-test.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) HashiCorp, Inc. - * SPDX-License-Identifier: BUSL-1.1 - */ - -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'ember-qunit'; -import { render, find } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; - -module('Integration | Component | rose/table/section', function (hooks) { - setupRenderingTest(hooks); - - test('it renders', async function (assert) { - await render(hbs``); - assert.ok(find('tag')); - assert.ok(find('.tag-class')); - }); - - test('it renders with attributes', async function (assert) { - await render(hbs``); - assert.ok(find('#section')); - }); - - test('it renders a row', async function (assert) { - await render(hbs` - - `); - assert.ok(find('tr')); - assert.ok(find('.rose-table-row')); - }); -}); diff --git a/ui/admin/app/styles/app.scss b/ui/admin/app/styles/app.scss index 97022c9d0..2c98efe9d 100644 --- a/ui/admin/app/styles/app.scss +++ b/ui/admin/app/styles/app.scss @@ -88,38 +88,6 @@ } } } - - .rose-form-fieldset { - .rose-table { - .rose-form-label { - left: -9999px; - position: absolute; - top: -9999px; - } - } - } -} - -.rose-table { - p { - margin-bottom: 0; - } - - .rose-table-header-cell { - p { - color: var(--ui-gray-subtler-1); - font-weight: normal; - } - } - - .rose-form-checkbox { - margin-bottom: 0; - - .rose-form-checkbox-label-text { - color: var(--stark); - text-decoration: underline; - } - } } .rose-header { diff --git a/ui/admin/tests/acceptance/accounts/read-test.js b/ui/admin/tests/acceptance/accounts/read-test.js index a52afbeae..73ed838f9 100644 --- a/ui/admin/tests/acceptance/accounts/read-test.js +++ b/ui/admin/tests/acceptance/accounts/read-test.js @@ -53,7 +53,7 @@ module('Acceptance | accounts | read', function (hooks) { test('can navigate to an account form', async function (assert) { await visit(urls.accounts); - await click(commonSelectors.TABLE_FIRST_ROW_RESOURCE_LINK); + await click(commonSelectors.TABLE_RESOURCE_LINK(urls.account)); await a11yAudit(); assert.strictEqual(currentURL(), urls.account); @@ -64,10 +64,12 @@ module('Acceptance | accounts | read', function (hooks) { instances.account.authorized_actions.filter((item) => item !== 'read'); await visit(urls.accounts); - assert.dom(commonSelectors.TABLE_FIRST_ROW_RESOURCE_LINK).doesNotExist(); + assert + .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.account)) + .doesNotExist(); }); - test('user can navigate to account and incorrect url autocorrects', async function (assert) { + test('user can navigate to account and incorrect url auto-corrects', async function (assert) { const authMethod = this.server.create('auth-method', { scope: instances.scopes.org, }); diff --git a/ui/admin/tests/acceptance/credential-library/read-test.js b/ui/admin/tests/acceptance/credential-library/read-test.js index dc421c002..82bb2e4a9 100644 --- a/ui/admin/tests/acceptance/credential-library/read-test.js +++ b/ui/admin/tests/acceptance/credential-library/read-test.js @@ -10,6 +10,7 @@ import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; import a11yAudit from 'ember-a11y-testing/test-support/audit'; import { authenticateSession } from 'ember-simple-auth/test-support'; import { TYPE_CREDENTIAL_LIBRARY_VAULT_SSH_CERTIFICATE } from 'api/models/credential-library'; +import * as commonSelectors from 'admin/tests/helpers/selectors'; module('Acceptance | credential-libraries | read', function (hooks) { setupApplicationTest(hooks); @@ -33,6 +34,7 @@ module('Acceptance | credential-libraries | read', function (hooks) { credentialLibraries: null, newCredentialLibrary: null, unknownCredentialLibrary: null, + vaultSshCredentialLibrary: null, }; hooks.beforeEach(function () { @@ -68,8 +70,10 @@ module('Acceptance | credential-libraries | read', function (hooks) { test('can navigate to resource', async function (assert) { await visit(urls.credentialLibraries); - await click('.hds-table .hds-table__tbody .hds-table__tr a'); + + await click(commonSelectors.TABLE_RESOURCE_LINK(urls.credentialLibrary)); await a11yAudit(); + assert.strictEqual(currentURL(), urls.credentialLibrary); }); @@ -79,7 +83,10 @@ module('Acceptance | credential-libraries | read', function (hooks) { (item) => item !== 'read', ); await visit(urls.credentialLibraries); - assert.notOk(find('main tbody .rose-table-header-cell a')); + + assert + .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.credentialLibrary)) + .doesNotExist(); }); test('cannot navigate to vault ssh cert form when feature is not enabled', async function (assert) { @@ -88,13 +95,17 @@ module('Acceptance | credential-libraries | read', function (hooks) { credentialStore: instances.credentialStore, type: TYPE_CREDENTIAL_LIBRARY_VAULT_SSH_CERTIFICATE, }); - await visit( - `${urls.credentialLibraries}/${instances.credentialLibrary.id}`, - ); + urls.vaultSshCredentialLibrary = `${urls.credentialLibraries}/${instances.credentialLibrary.id}`; await visit(urls.credentialLibraries); const featuresService = this.owner.lookup('service:features'); + assert.false(featuresService.isEnabled('ssh-target')); - assert.dom('.rose-table-body tr:nth-of-type(2) a').doesNotExist(); + assert + .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.credentialLibrary)) + .isVisible(); + assert + .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.vaultSshCredentialLibrary)) + .doesNotExist(); }); test('visiting an unknown credential library displays 404 message', async function (assert) { @@ -103,7 +114,7 @@ module('Acceptance | credential-libraries | read', function (hooks) { assert.ok(find('.rose-message-subtitle').textContent.trim(), 'Error 404'); }); - test('users can navigate to credential library and incorrect url autocorrects', async function (assert) { + test('users can navigate to credential library and incorrect url auto-corrects', async function (assert) { const credentialStore = this.server.create('credential-store', { scope: instances.scopes.project, }); diff --git a/ui/admin/tests/acceptance/credential-store/credentials/read-test.js b/ui/admin/tests/acceptance/credential-store/credentials/read-test.js index 857db25c2..ecfafc63e 100644 --- a/ui/admin/tests/acceptance/credential-store/credentials/read-test.js +++ b/ui/admin/tests/acceptance/credential-store/credentials/read-test.js @@ -9,6 +9,7 @@ import { setupApplicationTest } from 'admin/tests/helpers'; import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; import a11yAudit from 'ember-a11y-testing/test-support/audit'; import { authenticateSession } from 'ember-simple-auth/test-support'; +import * as commonSelectors from 'admin/tests/helpers/selectors'; module('Acceptance | credential-stores | credentials | read', function (hooks) { setupApplicationTest(hooks); @@ -117,7 +118,13 @@ module('Acceptance | credential-stores | credentials | read', function (hooks) { (item) => item != 'read', ); await visit(urls.credentials); - assert.dom('.rose-table-body tr:first-child a').doesNotExist(); + + assert + .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.usernameKeyPairCredential)) + .isVisible(); + assert + .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.usernamePasswordCredential)) + .doesNotExist(); }); test('cannot navigate to a username & key pair credential form without proper authorization', async function (assert) { @@ -126,7 +133,13 @@ module('Acceptance | credential-stores | credentials | read', function (hooks) { (item) => item != 'read', ); await visit(urls.credentials); - assert.dom('.rose-table-body tr:nth-child(2) a').doesNotExist(); + + assert + .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.usernamePasswordCredential)) + .isVisible(); + assert + .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.usernameKeyPairCredential)) + .doesNotExist(); }); test('cannot navigate to a JSON credential form without proper authorization', async function (assert) { @@ -135,13 +148,25 @@ module('Acceptance | credential-stores | credentials | read', function (hooks) { (item) => item != 'read', ); await visit(urls.credentials); - assert.dom('.rose-table-body tr:nth-child(3) a').doesNotExist(); + + assert + .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.usernamePasswordCredential)) + .isVisible(); + assert + .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.jsonCredential)) + .doesNotExist(); }); test('cannot navigate to a JSON credential form when feature not enabled', async function (assert) { await visit(urls.credentials); + assert.false(featuresService.isEnabled('json-credentials')); - assert.dom('.rose-table-body tr:nth-child(3) a').doesNotExist(); + assert + .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.usernamePasswordCredential)) + .isVisible(); + assert + .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.jsonCredential)) + .doesNotExist(); }); test('visiting an unknown credential displays 404 message', async function (assert) { @@ -159,7 +184,7 @@ module('Acceptance | credential-stores | credentials | read', function (hooks) { ); }); - test('users can navigate to credential and incorrect url autocorrects', async function (assert) { + test('users can navigate to credential and incorrect url auto-corrects', async function (assert) { const credentialStore = this.server.create('credential-store', { scope: instances.scopes.project, }); diff --git a/ui/admin/tests/acceptance/credential-store/read-test.js b/ui/admin/tests/acceptance/credential-store/read-test.js index 684998873..0d471bdd1 100644 --- a/ui/admin/tests/acceptance/credential-store/read-test.js +++ b/ui/admin/tests/acceptance/credential-store/read-test.js @@ -10,6 +10,7 @@ import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; import { setupIndexedDb } from 'api/test-support/helpers/indexed-db'; import a11yAudit from 'ember-a11y-testing/test-support/audit'; import { authenticateSession } from 'ember-simple-auth/test-support'; +import * as commonSelectors from 'admin/tests/helpers/selectors'; module('Acceptance | credential-stores | read', function (hooks) { setupApplicationTest(hooks); @@ -101,8 +102,12 @@ module('Acceptance | credential-stores | read', function (hooks) { await click(`[href="${urls.credentialStores}"]`); - assert.dom('.rose-table-body tr:first-child a').doesNotExist(); - assert.dom(`[href="${urls.vaultCredentialStore}"]`).exists(); + assert + .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.vaultCredentialStore)) + .isVisible(); + assert + .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.staticCredentialStore)) + .doesNotExist(); }); test('cannot navigate to a vault credential store form without proper authorization', async function (assert) { @@ -115,8 +120,12 @@ module('Acceptance | credential-stores | read', function (hooks) { await click(`[href="${urls.credentialStores}"]`); - assert.dom('.rose-table-body tr:nth-child(2) a').doesNotExist(); - assert.dom(`[href="${urls.staticCredentialStore}"]`).exists(); + assert + .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.staticCredentialStore)) + .isVisible(); + assert + .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.vaultCredentialStore)) + .doesNotExist(); }); test('visiting an unknown credential store displays 404 message', async function (assert) { @@ -138,7 +147,7 @@ module('Acceptance | credential-stores | read', function (hooks) { .exists(); }); - test('users can navigate to credential store and incorrect url autocorrects', async function (assert) { + test('users can navigate to credential store and incorrect url auto-corrects', async function (assert) { const projectScope = this.server.create('scope', { type: 'project', scope: { id: instances.scopes.org.id, type: 'org' }, diff --git a/ui/admin/tests/acceptance/groups/read-test.js b/ui/admin/tests/acceptance/groups/read-test.js index ea4d0b04f..56524d3f3 100644 --- a/ui/admin/tests/acceptance/groups/read-test.js +++ b/ui/admin/tests/acceptance/groups/read-test.js @@ -7,6 +7,7 @@ import { module, test } from 'qunit'; import { visit, currentURL } from '@ember/test-helpers'; import { setupApplicationTest } from 'admin/tests/helpers'; import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; +import { setupIndexedDb } from 'api/test-support/helpers/indexed-db'; import a11yAudit from 'ember-a11y-testing/test-support/audit'; import { authenticateSession } from 'ember-simple-auth/test-support'; import * as commonSelectors from 'admin/tests/helpers/selectors'; @@ -14,6 +15,7 @@ import * as commonSelectors from 'admin/tests/helpers/selectors'; module('Acceptance | groups | read', function (hooks) { setupApplicationTest(hooks); setupMirage(hooks); + setupIndexedDb(hooks); const instances = { scopes: { @@ -54,12 +56,12 @@ module('Acceptance | groups | read', function (hooks) { test('cannot navigate to a group form without proper authorization', async function (assert) { instances.group.authorized_actions = instances.group.authorized_actions.filter((item) => item !== 'read'); - await visit(urls.group); + await visit(urls.groups); - assert.dom(commonSelectors.TABLE_FIRST_ROW_RESOURCE_LINK).doesNotExist(); + assert.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.group)).doesNotExist(); }); - test('users can navigate to group and incorrect url autocorrects', async function (assert) { + test('users can navigate to group and incorrect url auto-corrects', async function (assert) { const orgScope = this.server.create('scope', { type: 'org', scope: { id: 'global', type: 'global' }, diff --git a/ui/admin/tests/acceptance/host-catalogs/host-sets/read-test.js b/ui/admin/tests/acceptance/host-catalogs/host-sets/read-test.js index 74c0ab3e0..73eae6ac2 100644 --- a/ui/admin/tests/acceptance/host-catalogs/host-sets/read-test.js +++ b/ui/admin/tests/acceptance/host-catalogs/host-sets/read-test.js @@ -9,6 +9,7 @@ import { setupApplicationTest } from 'admin/tests/helpers'; import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; import a11yAudit from 'ember-a11y-testing/test-support/audit'; import { authenticateSession } from 'ember-simple-auth/test-support'; +import * as commonSelectors from 'admin/tests/helpers/selectors'; module('Acceptance | host-catalogs | host-sets | read', function (hooks) { setupApplicationTest(hooks); @@ -84,7 +85,9 @@ module('Acceptance | host-catalogs | host-sets | read', function (hooks) { await click(`[href="${urls.hostSets}"]`); - assert.dom('.rose-table-body tr:first-child a').doesNotExist(); + assert + .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.hostSet)) + .doesNotExist(); }); test('visiting an unknown host set displays 404 message', async function (assert) { @@ -106,7 +109,7 @@ module('Acceptance | host-catalogs | host-sets | read', function (hooks) { .exists(); }); - test('users can navigate to host set and incorrect url autocorrects', async function (assert) { + test('users can navigate to host set and incorrect url auto-corrects', async function (assert) { const hostCatalog = this.server.create('host-catalog', { scope: instances.scopes.project, type: 'static', diff --git a/ui/admin/tests/acceptance/host-catalogs/hosts/read-test.js b/ui/admin/tests/acceptance/host-catalogs/hosts/read-test.js index 91f4b448b..16ee14445 100644 --- a/ui/admin/tests/acceptance/host-catalogs/hosts/read-test.js +++ b/ui/admin/tests/acceptance/host-catalogs/hosts/read-test.js @@ -85,7 +85,7 @@ module('Acceptance | host-catalogs | hosts | read', function (hooks) { await click(commonSelectors.HREF(urls.hosts)); - assert.dom(commonSelectors.TABLE_FIRST_ROW_RESOURCE_LINK).doesNotExist(); + assert.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.host)).doesNotExist(); }); test('visiting an unknown host displays 404 message', async function (assert) { diff --git a/ui/admin/tests/acceptance/host-catalogs/list-test.js b/ui/admin/tests/acceptance/host-catalogs/list-test.js index 91db168fe..e03917791 100644 --- a/ui/admin/tests/acceptance/host-catalogs/list-test.js +++ b/ui/admin/tests/acceptance/host-catalogs/list-test.js @@ -15,6 +15,7 @@ import { TYPE_HOST_CATALOG_PLUGIN_AWS, TYPE_HOST_CATALOG_PLUGIN_AZURE, } from 'api/models/host-catalog'; +import * as commonSelectors from 'admin/tests/helpers/selectors'; module('Acceptance | host-catalogs | list', function (hooks) { setupApplicationTest(hooks); @@ -35,6 +36,8 @@ module('Acceptance | host-catalogs | list', function (hooks) { orgScope: null, projectScope: null, hostCatalogs: null, + awsHostCatalog: null, + azureHostCatalog: null, staticHostCatalog: null, }; @@ -138,7 +141,10 @@ module('Acceptance | host-catalogs | list', function (hooks) { await click(`[href="${urls.hostCatalogs}"]`); - assert.dom('.rose-table-body tr:first-child a').doesNotExist(); + assert.dom('.hds-application-state__body-text').isVisible(); + assert + .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.staticHostCatalog)) + .doesNotExist(); }); test('user can navigate to index with only list action', async function (assert) { diff --git a/ui/admin/tests/acceptance/host-catalogs/read-test.js b/ui/admin/tests/acceptance/host-catalogs/read-test.js index f8a2611ca..401746bae 100644 --- a/ui/admin/tests/acceptance/host-catalogs/read-test.js +++ b/ui/admin/tests/acceptance/host-catalogs/read-test.js @@ -10,6 +10,7 @@ import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; import a11yAudit from 'ember-a11y-testing/test-support/audit'; import { authenticateSession } from 'ember-simple-auth/test-support'; import { setupIndexedDb } from 'api/test-support/helpers/indexed-db'; +import * as commonSelectors from 'admin/tests/helpers/selectors'; module('Acceptance | host-catalogs | read', function (hooks) { setupApplicationTest(hooks); @@ -78,7 +79,9 @@ module('Acceptance | host-catalogs | read', function (hooks) { await click(`[href="${urls.hostCatalogs}"]`); - assert.dom('.rose-table-body tr:first-child a').doesNotExist(); + assert + .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.hostCatalog)) + .doesNotExist(); }); test('visiting an unknown host catalog displays 404 message', async function (assert) { diff --git a/ui/admin/tests/acceptance/storage-buckets/read-test.js b/ui/admin/tests/acceptance/storage-buckets/read-test.js index 985732dc6..0b1b7f081 100644 --- a/ui/admin/tests/acceptance/storage-buckets/read-test.js +++ b/ui/admin/tests/acceptance/storage-buckets/read-test.js @@ -71,7 +71,9 @@ module('Acceptance | storage-buckets | read', function (hooks) { await click(commonSelectors.HREF(urls.storageBuckets)); - assert.dom(commonSelectors.TABLE_FIRST_ROW_RESOURCE_LINK).doesNotExist(); + assert + .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.storageBucket)) + .doesNotExist(); }); test('visiting an unknown storage bucket displays 404 message', async function (assert) { @@ -83,7 +85,7 @@ module('Acceptance | storage-buckets | read', function (hooks) { .hasText(commonSelectors.RESOURCE_NOT_FOUND_VALUE); }); - test('users can navigate to storage bucket and incorrect url autocorrects', async function (assert) { + test('users can navigate to storage bucket and incorrect url auto-corrects', async function (assert) { const incorrectUrl = `/scopes/${instances.scopes.org.id}/storage-buckets/${instances.storageBucket.id}`; await visit(incorrectUrl); diff --git a/ui/admin/tests/acceptance/targets/host-sources-test.js b/ui/admin/tests/acceptance/targets/host-sources-test.js index 2c31e2a24..6d57bedfb 100644 --- a/ui/admin/tests/acceptance/targets/host-sources-test.js +++ b/ui/admin/tests/acceptance/targets/host-sources-test.js @@ -10,6 +10,7 @@ import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; import a11yAudit from 'ember-a11y-testing/test-support/audit'; import { Response } from 'miragejs'; import { authenticateSession } from 'ember-simple-auth/test-support'; +import * as commonSelectors from 'admin/tests/helpers/selectors'; module('Acceptance | targets | host-sources', function (hooks) { setupApplicationTest(hooks); @@ -80,9 +81,10 @@ module('Acceptance | targets | host-sources', function (hooks) { urls.targetHostSources = `${urls.target}/host-sources`; urls.targetAddHostSources = `${urls.target}/add-host-sources`; urls.hostSet = `${urls.projectScope}/host-catalogs/${instances.hostCatalog.id}/host-sets/${instances.hostCatalog.hostSetIds[0]}`; - // Generate resource counter - getTargetHostSetCount = () => - this.server.schema.targets.first().hostSets.models.length; + urls.unknownHostSet = + // Generate resource counter + getTargetHostSetCount = () => + this.server.schema.targets.first().hostSets.models.length; authenticateSession({ username: 'admin' }); }); @@ -114,7 +116,13 @@ module('Acceptance | targets | host-sources', function (hooks) { await click(`[href="${urls.targetHostSources}"]`); - assert.dom('.rose-table-body tr:first-child a').doesNotExist(); + assert + .dom( + commonSelectors.TABLE_RESOURCE_LINK( + instances.hostCatalogPlugin.hostSets[0], + ), + ) + .doesNotExist(); }); test('can remove a host set', async function (assert) { diff --git a/ui/admin/tests/acceptance/targets/read-test.js b/ui/admin/tests/acceptance/targets/read-test.js index 6d9d9193e..916a2a5c8 100644 --- a/ui/admin/tests/acceptance/targets/read-test.js +++ b/ui/admin/tests/acceptance/targets/read-test.js @@ -11,6 +11,7 @@ import { setupIndexedDb } from 'api/test-support/helpers/indexed-db'; import a11yAudit from 'ember-a11y-testing/test-support/audit'; import { authenticateSession } from 'ember-simple-auth/test-support'; import { TYPE_TARGET_TCP, TYPE_TARGET_SSH } from 'api/models/target'; +import * as commonSelectors from 'admin/tests/helpers/selectors'; module('Acceptance | targets | read', function (hooks) { setupApplicationTest(hooks); @@ -120,8 +121,10 @@ module('Acceptance | targets | read', function (hooks) { await click(`[href="${urls.targets}"]`); - assert.dom('.rose-table-body tr:first-child a').doesNotExist(); - assert.dom(`[href="${urls.tcpTarget}"]`).exists(); + assert.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.tcpTarget)).isVisible(); + assert + .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.sshTarget)) + .doesNotExist(); }); test('cannot navigate to a tcp target form without proper authorization', async function (assert) { @@ -132,8 +135,10 @@ module('Acceptance | targets | read', function (hooks) { await click(`[href="${urls.targets}"]`); - assert.dom('.rose-table-body tr:nth-child(2) a').doesNotExist(); - assert.dom(`[href="${urls.sshTarget}"]`).exists(); + assert.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.sshTarget)).isVisible(); + assert + .dom(commonSelectors.TABLE_RESOURCE_LINK(urls.tcpTarget)) + .doesNotExist(); }); test('visiting an unknown target displays 404 message', async function (assert) { @@ -155,7 +160,7 @@ module('Acceptance | targets | read', function (hooks) { .exists(); }); - test('users can navigate to target and incorrect url autocorrects', async function (assert) { + test('users can navigate to target and incorrect url auto-corrects', async function (assert) { const incorrectUrl = `/scopes/${instances.scopes.org.id}/targets/${instances.sshTarget.id}`; await visit(incorrectUrl); diff --git a/ui/admin/tests/acceptance/targets/workers-test.js b/ui/admin/tests/acceptance/targets/workers-test.js index ea6ce13a2..ea7e12c42 100644 --- a/ui/admin/tests/acceptance/targets/workers-test.js +++ b/ui/admin/tests/acceptance/targets/workers-test.js @@ -218,7 +218,10 @@ module('Acceptance | targets | workers', function (hooks) { await click(CANCEL_BUTTON_SELECTOR); assert.strictEqual(currentURL(), urls.targetWorkers); - assert.notEqual(instances.target.inress_worker_filter, ingressWorkerFilter); + assert.notEqual( + instances.target.ingress_worker_filter, + ingressWorkerFilter, + ); assert .dom(CODE_BLOCK_SELECTOR('ingress')) .hasText(instances.target.ingress_worker_filter); diff --git a/ui/admin/tests/acceptance/users/list-test.js b/ui/admin/tests/acceptance/users/list-test.js index 38d0d2f13..ea786e457 100644 --- a/ui/admin/tests/acceptance/users/list-test.js +++ b/ui/admin/tests/acceptance/users/list-test.js @@ -9,6 +9,7 @@ import { setupApplicationTest } from 'admin/tests/helpers'; import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; import { setupIndexedDb } from 'api/test-support/helpers/indexed-db'; import { authenticateSession } from 'ember-simple-auth/test-support'; +import * as commonSelectors from 'admin/tests/helpers/selectors'; module('Acceptance | users | list', function (hooks) { setupApplicationTest(hooks); @@ -110,7 +111,8 @@ module('Acceptance | users | list', function (hooks) { await click(`[href="${urls.users}"]`); - assert.dom(`.rose-table [href="${urls.user1}"]`).doesNotExist(); + assert.dom('.hds-application-state__body-text').isVisible(); + assert.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.user1)).doesNotExist(); }); test('user can navigate to users tab with only list action', async function (assert) { diff --git a/ui/admin/tests/acceptance/users/read-test.js b/ui/admin/tests/acceptance/users/read-test.js index 92460e6c8..1c8b08f9a 100644 --- a/ui/admin/tests/acceptance/users/read-test.js +++ b/ui/admin/tests/acceptance/users/read-test.js @@ -10,6 +10,7 @@ import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; import { setupIndexedDb } from 'api/test-support/helpers/indexed-db'; import a11yAudit from 'ember-a11y-testing/test-support/audit'; import { authenticateSession } from 'ember-simple-auth/test-support'; +import * as commonSelectors from 'admin/tests/helpers/selectors'; module('Acceptance | users | read', function (hooks) { setupApplicationTest(hooks); @@ -71,7 +72,7 @@ module('Acceptance | users | read', function (hooks) { await click(`[href="${urls.users}"]`); - assert.dom(`.rose-table [href="${urls.user}"]`).doesNotExist(); + assert.dom(commonSelectors.TABLE_RESOURCE_LINK(urls.user)).doesNotExist(); }); test('users can link to docs page for users', async function (assert) { @@ -86,7 +87,7 @@ module('Acceptance | users | read', function (hooks) { .exists(); }); - test('users can navigate to user and incorrect url autocorrects', async function (assert) { + test('users can navigate to user and incorrect url auto-corrects', async function (assert) { const incorrectUrl = `/scopes/global/users/${instances.user.id}`; await visit(incorrectUrl); diff --git a/ui/admin/tests/helpers/selectors.js b/ui/admin/tests/helpers/selectors.js index 65423c6bf..4df37650d 100644 --- a/ui/admin/tests/helpers/selectors.js +++ b/ui/admin/tests/helpers/selectors.js @@ -14,7 +14,7 @@ export const FIELD_NAME_ERROR = '[data-test-error-message-name]'; export const FIELD_DESCRIPTION = '[name=description]'; export const FIELD_DESCRIPTION_VALUE = 'description'; -export const TABLE_FIRST_ROW_RESOURCE_LINK = 'tbody tr:first-child a'; +export const TABLE_RESOURCE_LINK = (url) => `tbody [href="${url}"]`; export const RESOURCE_NOT_FOUND_SUBTITLE = '.rose-message-subtitle'; export const RESOURCE_NOT_FOUND_VALUE = 'Error 404'; diff --git a/ui/desktop/app/styles/app.scss b/ui/desktop/app/styles/app.scss index dadfe07e6..8ae7b56c0 100644 --- a/ui/desktop/app/styles/app.scss +++ b/ui/desktop/app/styles/app.scss @@ -124,21 +124,6 @@ } } -.rose-table { - p { - margin-bottom: 0; - } - - .rose-form-checkbox { - margin-bottom: 0; - - .rose-form-checkbox-label-text { - color: var(--stark); - text-decoration: underline; - } - } -} - .rose-header { -webkit-app-region: drag; min-height: sizing.rems(l) * 2;