feat: 🎸 settings page (#2395)

* feat: 🎸 settings page
This commit is contained in:
Dharini Jeeva authored and Zhihe Li committed 2024-09-24 11:58:24 -04:00
1 parent fac7d2b128
commit a97f66e011
11 files changed
+189

No files matched your search

@@ -0,0 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import Controller from '@ember/controller';
export default class ScopesScopeProjectsSettingsIndexController extends Controller {}
+3
View File
@@ -26,6 +26,9 @@ Router.map(function () {
this.route('sessions', function () {
this.route('session', { path: ':session_id' }, function () {});
});
this.route('settings', function () {
this.route('setting', function () {});
});
});
});
});
@@ -0,0 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsSettingsRoute extends Route {}
@@ -0,0 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import Route from '@ember/routing/route';
export default class ScopesScopeProjectsSettingsIndexRoute extends Route {}
@@ -15,6 +15,10 @@
<Rose::Icon @name='flight-icons/svg/entry-point-16' @size='medium' />
{{t 'resources.session.title_plural'}}
</nav.link>
<nav.link @route='scopes.scope.projects.settings'>
<Rose::Icon @name='flight-icons/svg/settings-16' @size='medium' />
{{t 'titles.settings'}}
</nav.link>
</Rose::Nav::Sidebar>
</sidebarLayout.sidebar>
@@ -0,0 +1,14 @@
{{!
Copyright (c) HashiCorp, Inc.
SPDX-License-Identifier: BUSL-1.1
}}
<Rose::Layout::Page as |page|>
<page.header>
<h2>
{{t 'titles.settings'}}
{{! TODO: Add a link to the settings documentation }}
{{! <DocLink @doc='setting' @iconSize='large' /> }}
</h2>
</page.header>
</Rose::Layout::Page>
@@ -0,0 +1,6 @@
{{!
Copyright (c) HashiCorp, Inc.
SPDX-License-Identifier: BUSL-1.1
}}
{{outlet}}
@@ -0,0 +1,84 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import { module, test } from 'qunit';
import { currentURL, click, visit } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { authenticateSession } from 'ember-simple-auth/test-support';
import WindowMockIPC from '../../../helpers/window-mock-ipc';
module('Acceptance | projects | settings | index', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
authMethods: {
global: null,
},
target: null,
target2: null,
session: null,
};
const urls = {
scopes: {
global: null,
org: null,
},
authenticate: {
global: null,
methods: {
global: null,
},
},
projects: null,
targets: null,
settings: null,
};
const setDefaultClusterUrl = (test) => {
const windowOrigin = window.location.origin;
const clusterUrl = test.owner.lookup('service:clusterUrl');
clusterUrl.rendererClusterUrl = windowOrigin;
};
hooks.beforeEach(function () {
authenticateSession();
// Generate scopes
instances.scopes.global = this.server.create('scope', {
id: 'global',
name: 'Global',
});
const globalScope = { id: 'global', type: 'global' };
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: globalScope,
});
const orgScope = { id: instances.scopes.org.id, type: 'org' };
instances.scopes.project = this.server.create('scope', {
type: 'project',
scope: orgScope,
});
urls.scopes.org = `/scopes/${instances.scopes.org.id}`;
urls.scopes.global = `/scopes/${instances.scopes.global.id}`;
urls.projects = `${urls.scopes.org}/projects`;
urls.settings = `${urls.projects}/settings`;
this.owner.register('service:browser/window', WindowMockIPC);
setDefaultClusterUrl(this);
});
test('can navigate to the settings page', async function (assert) {
await visit(urls.projects);
await click(`[href="${urls.settings}"]`);
assert.strictEqual(currentURL(), urls.settings);
});
});
@@ -0,0 +1,22 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module(
'Unit | Controller | scopes/scope/projects/settings/index',
function (hooks) {
setupTest(hooks);
// TODO: Replace this with your real tests.
test('it exists', function (assert) {
let controller = this.owner.lookup(
'controller:scopes/scope/projects/settings/index',
);
assert.ok(controller);
});
},
);
@@ -0,0 +1,16 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Route | scopes/scope/projects/settings', function (hooks) {
setupTest(hooks);
test('it exists', function (assert) {
let route = this.owner.lookup('route:scopes/scope/projects/settings');
assert.ok(route);
});
});
@@ -0,0 +1,16 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Route | scopes/scope/projects/settings/index', function (hooks) {
setupTest(hooks);
test('it exists', function (assert) {
let route = this.owner.lookup('route:scopes/scope/projects/settings/index');
assert.ok(route);
});
});