diff --git a/src/components/cc-addon-admin/cc-addon-admin.js b/src/components/cc-addon-admin/cc-addon-admin.js index 9fb413da5..b61354a04 100644 --- a/src/components/cc-addon-admin/cc-addon-admin.js +++ b/src/components/cc-addon-admin/cc-addon-admin.js @@ -102,10 +102,12 @@ export class CcAddonAdmin extends LitElement { render() { return html` -
${i18n('cc-addon-admin.admin')}
+
${i18n('cc-addon-admin.admin')}
${this.state.type === 'error' - ? html` ` + ? html` + + ` : ''} ${this.state.type !== 'error' ? this._renderContent(this.state) : ''}
@@ -125,7 +127,7 @@ export class CcAddonAdmin extends LitElement { const shouldShowVmText = !this.noDangerZoneVmText; return html` - +
${i18n('cc-addon-admin.heading.name')}
@@ -148,7 +150,7 @@ export class CcAddonAdmin extends LitElement {
- +
${i18n('cc-addon-admin.heading.tags')}
${i18n('cc-addon-admin.tags-description')}
@@ -172,7 +174,7 @@ export class CcAddonAdmin extends LitElement {
- +
${i18n('cc-addon-admin.danger-zone')}

${i18n('cc-addon-admin.delete-disclaimer')}

diff --git a/src/components/cc-addon-backups/cc-addon-backups.js b/src/components/cc-addon-backups/cc-addon-backups.js index 446f897a2..ddd0f5f58 100644 --- a/src/components/cc-addon-backups/cc-addon-backups.js +++ b/src/components/cc-addon-backups/cc-addon-backups.js @@ -253,10 +253,15 @@ export class CcAddonBackups extends LitElement { render() { return html` -
${i18n('cc-addon-backups.title')}
- +
${i18n('cc-addon-backups.title')}
${this.state.type === 'error' - ? html` ` + ? html` + + ` : ''} ${this.state.type === 'loading' ? this._renderLoading(this.state) : ''} ${this.state.type === 'loaded' ? this._renderLoaded(this.state) : ''} @@ -271,10 +276,10 @@ export class CcAddonBackups extends LitElement { */ _renderLoading(state) { return html` -
+
${fakeString(150)}
- ${this._renderBackups(state)} + ${this._renderBackups(state, false)} `; } @@ -285,12 +290,13 @@ export class CcAddonBackups extends LitElement { */ _renderLoaded(state) { const hasData = state.backups.length > 0; + const isBlurred = this._overlayType === 'restore' || this._overlayType === 'delete'; return html` -
${this._getDescription(state.providerId)}
+
${this._getDescription(state.providerId)}
- ${!hasData ? html`
${i18n('cc-addon-backups.empty')}
` : ''} - ${hasData ? this._renderBackups(state) : ''} + ${!hasData ? html`
${i18n('cc-addon-backups.empty')}
` : ''} + ${hasData ? this._renderBackups(state, isBlurred) : ''} ${this._overlayType === 'restore' ? this._renderRestoreOverlay(state.providerId, state.passwordForCommand) : ''} ${this._overlayType === 'delete' ? this._renderDeleteOverlay(state.providerId, state.passwordForCommand) : ''} `; @@ -298,15 +304,16 @@ export class CcAddonBackups extends LitElement { /** * @param {AddonBackupsStateLoaded | AddonBackupsStateLoading} state + * @param {boolean} isBlurred * @private */ - _renderBackups(state) { + _renderBackups(state, isBlurred) { const skeleton = state.type === 'loading'; const areBtnsDisabled = state.type === 'loading' || this._overlayType != null; const data = state.type === 'loaded' ? state : SKELETON_BACKUPS; return html` -
+
${data.backups.map( (backup) => html`
@@ -352,12 +359,11 @@ export class CcAddonBackups extends LitElement { _renderRestoreOverlay(providerId, passwordForCommand) { return html` -
- -
${i18n('cc-addon-backups.restore', this._selectedBackup)}
+ +
${i18n('cc-addon-backups.restore', this._selectedBackup)}
+
${i18n('cc-addon-backups.close-btn')} +
+ + ${this._displaySectionWithService(providerId) + ? html` + +
${this._getRestoreWithServiceTitle(providerId)}
+
${this._getRestoreWithServiceDescription(providerId, this._selectedBackup.url)}
+
+ ` + : ''} - ${this._displaySectionWithService(providerId) + +
${i18n('cc-addon-backups.restore.manual.title')}
+
${this._getManualRestoreDescription(providerId)}
+ ${this._selectedBackup.restoreCommand != null ? html` - -
${this._getRestoreWithServiceTitle(providerId)}
-
${this._getRestoreWithServiceDescription(providerId, this._selectedBackup.url)}
-
+ +
${i18n('cc-addon-backups.command-password')}
+ ` : ''} - - -
${i18n('cc-addon-backups.restore.manual.title')}
-
${this._getManualRestoreDescription(providerId)}
- ${this._selectedBackup.restoreCommand != null - ? html` - -
${i18n('cc-addon-backups.command-password')}
- - ` - : ''} -
-
-
+ + `; } @@ -399,12 +405,11 @@ export class CcAddonBackups extends LitElement { */ _renderDeleteOverlay(providerId, passwordForCommand) { return html` -
- -
${i18n('cc-addon-backups.delete', this._selectedBackup)}
+ +
${i18n('cc-addon-backups.delete', this._selectedBackup)}
+
${i18n('cc-addon-backups.close-btn')} +
+ + ${this._displaySectionWithService(providerId) + ? html` + +
${i18n('cc-addon-backups.delete.with-service.title.es-addon')}
+
+ ${i18n('cc-addon-backups.delete.with-service.description.es-addon', { + href: this._selectedBackup.url, + })} +
+
+ ` + : ''} - ${this._displaySectionWithService(providerId) - ? html` - -
${i18n('cc-addon-backups.delete.with-service.title.es-addon')}
-
- ${i18n('cc-addon-backups.delete.with-service.description.es-addon', { - href: this._selectedBackup.url, - })} -
-
- ` - : ''} - - -
${i18n('cc-addon-backups.delete.manual.title')}
-
${this._getManualDeleteDescription(providerId)}
- -
${i18n('cc-addon-backups.command-password')}
- -
-
-
+ +
${i18n('cc-addon-backups.delete.manual.title')}
+
${this._getManualDeleteDescription(providerId)}
+ +
${i18n('cc-addon-backups.command-password')}
+ +
+ `; } @@ -445,8 +450,7 @@ export class CcAddonBackups extends LitElement { // language=CSS css` :host { - display: grid; - grid-gap: 1em; + display: block; line-height: 1.5; } @@ -489,15 +493,22 @@ export class CcAddonBackups extends LitElement { .overlay { box-shadow: 0 0 1em rgb(0 0 0 / 40%); - margin: 2em; + left: 50%; max-width: 50em; + padding-inline: 0; position: fixed; + transform: translateX(-50%); + width: 90%; } .overlay-close-btn { --cc-icon-size: 1.4em; } + .blurred { + filter: blur(5px); + } + .cc-link, cc-button[link] { margin-right: 0.5em; @@ -507,6 +518,11 @@ export class CcAddonBackups extends LitElement { cc-input-text { --cc-input-font-family: var(--cc-ff-monospace, monospace); } + + .empty-msg { + color: var(--cc-color-text-weak); + font-style: italic; + } `, ]; } diff --git a/src/components/cc-addon-credentials/cc-addon-credentials.js b/src/components/cc-addon-credentials/cc-addon-credentials.js index 4c96fbe31..c81d5d1d9 100644 --- a/src/components/cc-addon-credentials/cc-addon-credentials.js +++ b/src/components/cc-addon-credentials/cc-addon-credentials.js @@ -1,5 +1,6 @@ import { css, html, LitElement } from 'lit'; import { ifDefined } from 'lit/directives/if-defined.js'; +import { dispatchCustomEvent } from '../../lib/events.js'; import { skeletonStyles } from '../../styles/skeleton.js'; import { i18n } from '../../translations/translation.js'; import '../cc-block/cc-block.js'; @@ -8,7 +9,7 @@ import '../cc-notice/cc-notice.js'; /** * @typedef {import('./cc-addon-credentials.types.js').Credential} Credential - * @typedef {import('../common.types.js').ToggleStateType} ToggleStateType + * @typedef {import('../cc-block/cc-block.types.js').BlockToggleState} BlockToggleState * @typedef {import('./cc-addon-credentials.types.js').AddonType} AddonType */ @@ -20,6 +21,8 @@ import '../cc-notice/cc-notice.js'; * * When the `value` of a credential is nullish, a skeleton UI pattern is displayed (loading hint). * * @cssdisplay block + * + * @fires {CustomEvent<'open'|'close'>} cc-addon-credentials:toggle-change - Fires toggle state whenever it changes. */ export class CcAddonCredentials extends LitElement { static get properties() { @@ -28,7 +31,7 @@ export class CcAddonCredentials extends LitElement { error: { type: Boolean }, image: { type: String }, name: { type: String }, - toggleState: { type: Boolean, attribute: 'toggle-state' }, + toggle: { type: String }, type: { type: String }, }; } @@ -48,8 +51,8 @@ export class CcAddonCredentials extends LitElement { /** @type {string|null} Sets the display name of the add-on. */ this.name = null; - /** @type {ToggleStateType} Sets the toggle state of the inner block. */ - this.toggleState = 'off'; + /** @type {BlockToggleState} Sets the toggle state of the inner block. */ + this.toggle = 'off'; /** @type {AddonType} Sets the type of the add-on. */ this.type = null; @@ -89,18 +92,28 @@ export class CcAddonCredentials extends LitElement { } } + /** @param {CustomEvent<'open'|'close'>} event */ + _onToggleChange({ detail: value }) { + this.toggle = value; + dispatchCustomEvent(this, 'toggle-change', this.toggle); + } + render() { return html` - -
${i18n('cc-addon-credentials.title', { name: this.name })}
+ +
${i18n('cc-addon-credentials.title', { name: this.name })}
${!this.error ? html` -
${this._getDescription(this.type)}
+
${this._getDescription(this.type)}
${this.credentials != null ? html` -
+
${this.credentials.map( ({ type, secret, value }) => html` ` + ? html` + + ` : ''} `; diff --git a/src/components/cc-addon-credentials/cc-addon-credentials.stories.js b/src/components/cc-addon-credentials/cc-addon-credentials.stories.js index 86ab1c5d0..59f9cff6f 100644 --- a/src/components/cc-addon-credentials/cc-addon-credentials.stories.js +++ b/src/components/cc-addon-credentials/cc-addon-credentials.stories.js @@ -58,7 +58,7 @@ export const dataLoadedWithKibana = makeStory(conf, { type: 'kibana', name: 'Kibana', image: 'https://assets.clever-cloud.com/logos/elasticsearch-kibana.svg', - toggleState: 'close', + toggle: 'close', credentials: [ { type: 'host', value: 'my-host.services.clever-cloud.com', secret: false }, { type: 'user', value: 'my-super-user', secret: false }, @@ -73,7 +73,7 @@ export const dataLoadedWithApm = makeStory(conf, { { type: 'apm', name: 'APM', - toggleState: 'close', + toggle: 'close', image: 'https://assets.clever-cloud.com/logos/elasticsearch-apm.svg', credentials: [ { type: 'user', value: 'my-super-user', secret: false }, @@ -89,7 +89,7 @@ export const dataLoadedWithPulsar = makeStory(conf, { { type: 'pulsar', name: 'Pulsar', - toggleState: 'open', + toggle: 'open', image: 'https://assets.clever-cloud.com/logos/pulsar.svg', credentials: [ { type: 'url', value: 'pulsar+ssl://url:port', secret: false }, @@ -104,7 +104,7 @@ export const dataLoadedWithMateriaKv = makeStory(conf, { { type: 'materia-kv', name: 'Materia KV', - toggleState: 'off', + toggle: 'off', image: 'https://assets.clever-cloud.com/logos/materia-db-kv.png', credentials: [ { type: 'host', value: 'example.com', secret: false }, diff --git a/src/components/cc-addon-features/cc-addon-features.js b/src/components/cc-addon-features/cc-addon-features.js index 52826b4d8..823315c81 100644 --- a/src/components/cc-addon-features/cc-addon-features.js +++ b/src/components/cc-addon-features/cc-addon-features.js @@ -133,16 +133,22 @@ export class CcAddonFeatures extends LitElement { return html` -
${i18n('cc-addon-features.title')}
+
${i18n('cc-addon-features.title')}
-
${i18n('cc-addon-features.details')}
+
${i18n('cc-addon-features.details')}
${this.state.type === 'error' - ? html` ` + ? html` + + ` : ''} ${isLoadedOrLoading ? html` -
+
${features.map( (feature) => html`
diff --git a/src/components/cc-addon-linked-apps/cc-addon-linked-apps.js b/src/components/cc-addon-linked-apps/cc-addon-linked-apps.js index 3395dcc26..cc95af994 100644 --- a/src/components/cc-addon-linked-apps/cc-addon-linked-apps.js +++ b/src/components/cc-addon-linked-apps/cc-addon-linked-apps.js @@ -49,8 +49,8 @@ export class CcAddonLinkedApps extends LitElement { */ _getEmptyContent() { return html` -
${i18n('cc-addon-linked-apps.details')}
-
${i18n('cc-addon-linked-apps.no-linked-applications')}
+
${i18n('cc-addon-linked-apps.details')}
+
${i18n('cc-addon-linked-apps.no-linked-applications')}
`; } @@ -59,7 +59,9 @@ export class CcAddonLinkedApps extends LitElement { * @private */ _getErrorContent() { - return html` `; + return html` + + `; } /** @@ -89,11 +91,11 @@ export class CcAddonLinkedApps extends LitElement { } const content = html` -
${i18n('cc-addon-linked-apps.details')}
+
${i18n('cc-addon-linked-apps.details')}
${linkedApps.map( (linkedApp) => html` -
+