-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UI: chroot namespace listener #23942
Changes from all commits
9e4f598
46bdcd7
7c3b83a
d9f01dc
61e3f18
69cf55d
c5ff114
fbf8016
cc092b5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:bug | ||
ui: fix broken GUI when accessing from listener with chroot_namespace defined | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,7 @@ export default class VersionService extends Service { | |
@task | ||
*getVersion() { | ||
if (this.version) return; | ||
const response = yield this.store.adapterFor('cluster').health(); | ||
const response = yield this.store.adapterFor('cluster').sealStatus(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Getting version from this endpoint instead since it's available in non-root namespace. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will probably be updated again to a UI-specific endpoint in the near future, but this will do for now. |
||
this.version = response.version; | ||
return; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{{! | ||
Copyright (c) HashiCorp, Inc. | ||
SPDX-License-Identifier: BUSL-1.1 | ||
~}} | ||
|
||
<div class="is-flex-grow-1 is-flex-v-centered"> | ||
<div class="empty-state-content"> | ||
<div class="is-flex-v-centered has-bottom-margin-xxl"> | ||
<div class="brand-icon-large"> | ||
<Icon @name="vault" @size="24" @stretched={{true}} /> | ||
</div> | ||
</div> | ||
<div class="is-flex-center"> | ||
<div class="error-icon"> | ||
<Icon @name="help" @size="24" class="has-text-grey" @stretched={{true}} /> | ||
</div> | ||
<div class="has-left-margin-s"> | ||
<h1 class="is-size-4 has-text-semibold has-text-grey has-line-height-1"> | ||
{{#if (eq this.model.httpStatus 403)}} | ||
Not authorized | ||
{{else if (eq this.model.httpStatus 404)}} | ||
Page not found | ||
{{else}} | ||
Error | ||
{{/if}} | ||
</h1> | ||
<p class="has-text-grey is-size-8">Error {{this.model.httpStatus}}</p> | ||
</div> | ||
</div> | ||
|
||
<p class="has-text-grey has-top-margin-m has-bottom-padding-l has-border-bottom-light" data-test-error-description> | ||
{{this.model.message}} | ||
{{join ". " this.model.errors}} | ||
</p> | ||
|
||
<div class="is-flex-between has-top-margin-s"> | ||
<ExternalLink @href="/" @sameTab={{true}} class="is-no-underline is-flex-center has-text-semibold"> | ||
<Chevron @direction="left" /> | ||
Go home | ||
</ExternalLink> | ||
<DocLink @path="/vault/api-docs#http-status-codes"> | ||
Learn more | ||
</DocLink> | ||
</div> | ||
</div> | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* Copyright (c) HashiCorp, Inc. | ||
* SPDX-License-Identifier: BUSL-1.1 | ||
*/ | ||
|
||
import { Response } from 'miragejs'; | ||
|
||
/* | ||
These are mocked responses to mimic what we get from the server | ||
when within a chrooted listener (assuming the namespace exists) | ||
*/ | ||
export default function (server) { | ||
server.get('sys/health', () => new Response(400, {}, { errors: ['unsupported path'] })); | ||
server.get('sys/replication/status', () => new Response(400, {}, { errors: ['unsupported path'] })); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* Copyright (c) HashiCorp, Inc. | ||
* SPDX-License-Identifier: BUSL-1.1 | ||
*/ | ||
|
||
import { module, test } from 'qunit'; | ||
import { setupApplicationTest } from 'ember-qunit'; | ||
import { currentRouteName } from '@ember/test-helpers'; | ||
import authPage from 'vault/tests/pages/auth'; | ||
import { setupMirage } from 'ember-cli-mirage/test-support'; | ||
import ENV from 'vault/config/environment'; | ||
|
||
module('Acceptance | chroot-namespace enterprise ui', function (hooks) { | ||
setupApplicationTest(hooks); | ||
setupMirage(hooks); | ||
|
||
hooks.before(function () { | ||
ENV['ember-cli-mirage'].handler = 'chrootNamespace'; | ||
}); | ||
hooks.after(function () { | ||
ENV['ember-cli-mirage'].handler = null; | ||
}); | ||
|
||
test('it should render normally when chroot namespace exists', async function (assert) { | ||
await authPage.login(); | ||
assert.strictEqual(currentRouteName(), 'vault.cluster.dashboard', 'goes to dashboard page'); | ||
assert.dom('[data-test-badge-namespace]').includesText('root', 'Shows root namespace badge'); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,10 +49,11 @@ module('Acceptance | landing page dashboard', function (hooks) { | |
await visit('/vault/dashboard'); | ||
const version = this.owner.lookup('service:version'); | ||
const versionName = version.version; | ||
const versionNameEnd = version.isEnterprise ? versionName.indexOf('+') : versionName.length; | ||
assert | ||
.dom(SELECTORS.cardHeader('Vault version')) | ||
.hasText(`Vault v${versionName.slice(0, versionNameEnd)} root`); | ||
const versionText = version.isEnterprise | ||
? `Vault v${versionName.slice(0, versionName.indexOf('+'))} root` | ||
: `Vault v${versionName}`; | ||
|
||
assert.dom(SELECTORS.cardHeader('Vault version')).hasText(versionText); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated this test because the root namespace badge shouldn't show in community version |
||
}); | ||
|
||
module('secrets engines card', function (hooks) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clusterName isn't used anywhere, so removed it from the model. The other values are also available on
seal-status
which will be available in a chroot scenario, so I moved those below to that section