UI: Glimmerize InfoTable, PageHeader, UpgradePage, NamespaceReminder, PageHeaderLevel Left,Right,Top (#19572)

This commit is contained in:
Kianna
2023-03-17 08:13:54 -07:00
committed by GitHub
parent f15715f6d0
commit f509ef6274
17 changed files with 64 additions and 111 deletions

View File

@@ -6,12 +6,12 @@
<thead class="has-text-weight-semibold"> <thead class="has-text-weight-semibold">
<tr> <tr>
<th scope="col"> <th scope="col">
{{this.header}} {{@header}}
</th> </th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{{#each this.items as |item|}} {{#each @items as |item|}}
<tr> <tr>
<td> <td>
<InfoTableRow @value={{item}} /> <InfoTableRow @value={{item}} />

View File

@@ -3,8 +3,7 @@
* SPDX-License-Identifier: MPL-2.0 * SPDX-License-Identifier: MPL-2.0
*/ */
import Component from '@ember/component'; import Component from '@glimmer/component';
import layout from '../templates/components/info-table';
/** /**
* @module InfoTable * @module InfoTable
@@ -23,10 +22,8 @@ import layout from '../templates/components/info-table';
* @param {Array} items=null - An array of strings which will be used as the InfoTableRow value. * @param {Array} items=null - An array of strings which will be used as the InfoTableRow value.
*/ */
export default Component.extend({ export default class InfoTable extends Component {
layout, get title() {
tagName: '', return this.args.title || 'Info Table';
title: 'Info Table', }
header: null, }
items: null,
});

View File

@@ -6,7 +6,7 @@
{{else}} {{else}}
<p class="namespace-reminder"> <p class="namespace-reminder">
This This
{{this.noun}} {{@noun}}
will be will be
{{this.modeVerb}} {{this.modeVerb}}
in the in the

View File

@@ -3,24 +3,24 @@
* SPDX-License-Identifier: MPL-2.0 * SPDX-License-Identifier: MPL-2.0
*/ */
import Component from '@glimmer/component';
import { inject as service } from '@ember/service'; import { inject as service } from '@ember/service';
import { not } from '@ember/object/computed';
import Component from '@ember/component';
import { computed } from '@ember/object';
import layout from '../templates/components/namespace-reminder';
export default Component.extend({ export default class NamespaceReminder extends Component {
layout, @service namespace;
namespace: service(),
showMessage: not('namespace.inRootNamespace'), get showMessage() {
//public API return !this.namespace.inRootNamespace;
noun: null, }
mode: 'edit',
modeVerb: computed('mode', function () { get mode() {
const mode = this.mode; return this.args.mode || 'edit';
if (!mode) { }
get modeVerb() {
if (!this.mode) {
return ''; return '';
} }
return mode.endsWith('e') ? `${mode}d` : `${mode}ed`; return this.mode.endsWith('e') ? `${this.mode}d` : `${this.mode}ed`;
}), }
}); }

View File

@@ -1,10 +0,0 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import Component from '@ember/component';
export default Component.extend({
tagName: '',
});

View File

@@ -1,10 +0,0 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import Component from '@ember/component';
export default Component.extend({
tagName: '',
});

View File

@@ -0,0 +1,3 @@
<div>
{{yield}}
</div>

View File

@@ -1,10 +0,0 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import Component from '@ember/component';
export default Component.extend({
tagName: '',
});

View File

@@ -0,0 +1,15 @@
<header class="page-header">
{{#if this.hasLevel}}
{{yield (hash top=(component "page-header-level"))}}
<div class="level">
<div class="level-left">
{{yield (hash levelLeft=(component "page-header-level"))}}
</div>
<div class="level-right field is-grouped">
{{yield (hash levelRight=(component "page-header-level"))}}
</div>
</div>
{{else}}
{{yield (hash top=(component "page-header-level"))}}
{{/if}}
</header>

View File

@@ -3,11 +3,10 @@
* SPDX-License-Identifier: MPL-2.0 * SPDX-License-Identifier: MPL-2.0
*/ */
import Component from '@ember/component'; import Component from '@glimmer/component';
import layout from '../templates/components/page-header';
export default Component.extend({ export default class PageHeader extends Component {
layout, get hasLevel() {
tagName: '', return this.args.hasLevel === undefined ? true : this.args.hasLevel;
hasLevel: true, }
}); }

View File

@@ -3,16 +3,17 @@
* SPDX-License-Identifier: MPL-2.0 * SPDX-License-Identifier: MPL-2.0
*/ */
import Component from '@ember/component'; import Component from '@glimmer/component';
import { computed } from '@ember/object';
import layout from '../templates/components/upgrade-page';
export default Component.extend({ export default class UpgradePage extends Component {
layout, get minimumEdition() {
title: 'Vault Enterprise', return this.args.minimumEdition || 'Vault Enterprise';
featureName: computed('title', function () { }
const title = this.title; get title() {
return title === 'Vault Enterprise' ? 'this feature' : title; return this.args.title || 'Vault Enterprise';
}), }
minimumEdition: 'Vault Enterprise',
}); get featureName() {
return this.title === 'Vault Enterprise' ? 'this feature' : this.title;
}
}

View File

@@ -1,15 +0,0 @@
<header class="page-header">
{{#if this.hasLevel}}
{{yield (hash top=(component "page-header-top"))}}
<div class="level">
<div class="level-left">
{{yield (hash levelLeft=(component "page-header-level-left"))}}
</div>
<div class="level-right field is-grouped">
{{yield (hash levelRight=(component "page-header-level-right"))}}
</div>
</div>
{{else}}
{{yield (hash top=(component "page-header-top"))}}
{{/if}}
</header>

View File

@@ -1,6 +0,0 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
export { default } from 'core/components/page-header-level-left';

View File

@@ -1,6 +0,0 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
export { default } from 'core/components/page-header-level-right';

View File

@@ -0,0 +1 @@
export { default } from 'core/components/page-header-level';

View File

@@ -1,6 +0,0 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
export { default } from 'core/components/page-header-top';