rename element to 'enable-provider'

This commit is contained in:
Jacob Overgaard
2024-03-26 14:50:41 +01:00
parent a78d0751da
commit f8c0f2cdfd
7 changed files with 33 additions and 36 deletions

View File

@@ -1,15 +1,15 @@
import type { UmbMfaProviderConfigurationElementProps } from '../../types.js';
import { UmbCurrentUserRepository } from '../../repository/index.js';
import type { UmbCurrentUserMfaProviderModalConfig } from './current-user-mfa-provider-modal.token.js';
import type { UmbCurrentUserMfaEnableProviderModalConfig } from './current-user-mfa-enable-provider-modal.token.js';
import type { ManifestMfaLoginProvider } from '@umbraco-cms/backoffice/extension-registry';
import { customElement, html } from '@umbraco-cms/backoffice/external/lit';
import { UmbModalBaseElement } from '@umbraco-cms/backoffice/modal';
import '../../components/mfa-provider-default.element.js';
@customElement('umb-current-user-mfa-provider-modal')
export class UmbCurrentUserMfaProviderModalElement extends UmbModalBaseElement<
UmbCurrentUserMfaProviderModalConfig,
@customElement('umb-current-user-mfa-enable-provider-modal')
export class UmbCurrentUserMfaEnableProviderModalElement extends UmbModalBaseElement<
UmbCurrentUserMfaEnableProviderModalConfig,
never
> {
#currentUserRepository = new UmbCurrentUserRepository(this);
@@ -48,10 +48,10 @@ export class UmbCurrentUserMfaProviderModalElement extends UmbModalBaseElement<
};
}
export default UmbCurrentUserMfaProviderModalElement;
export default UmbCurrentUserMfaEnableProviderModalElement;
declare global {
interface HTMLElementTagNameMap {
'umb-current-user-mfa-provider-modal': UmbCurrentUserMfaProviderModalElement;
'umb-current-user-mfa-enable-provider-modal': UmbCurrentUserMfaEnableProviderModalElement;
}
}

View File

@@ -1,11 +1,11 @@
import type { Meta, StoryObj } from '@storybook/web-components';
import type { UmbCurrentUserMfaProviderModalElement } from './current-user-mfa-provider-modal.element.js';
import type { UmbCurrentUserMfaEnableProviderModalElement } from './current-user-mfa-enable-provider-modal.element.js';
import { html } from '@umbraco-cms/backoffice/external/lit';
import { UmbServerExtensionRegistrator } from '@umbraco-cms/backoffice/extension-api';
import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import './current-user-mfa-provider-modal.element.js';
import './current-user-mfa-enable-provider-modal.element.js';
class UmbServerExtensionsHostElement extends UmbLitElement {
constructor() {
@@ -22,10 +22,9 @@ if (window.customElements.get('umb-server-extensions-host') === undefined) {
customElements.define('umb-server-extensions-host', UmbServerExtensionsHostElement);
}
const meta: Meta<UmbCurrentUserMfaProviderModalElement> = {
id: 'umb-current-user-mfa-provider-modal',
title: 'Current User/Modals/MFA Provider Modal',
component: 'umb-current-user-mfa-provider-modal',
const meta: Meta<UmbCurrentUserMfaEnableProviderModalElement> = {
title: 'Current User/MFA/Enable MFA Provider',
component: 'umb-current-user-mfa-enable-provider-modal',
decorators: [
(Story) =>
html`<umb-server-extensions-host style="width: 500px; height: 500px;">${Story()}</umb-server-extensions-host>`,
@@ -45,6 +44,6 @@ const meta: Meta<UmbCurrentUserMfaProviderModalElement> = {
export default meta;
type Story = StoryObj<UmbCurrentUserMfaProviderModalElement>;
type Story = StoryObj<UmbCurrentUserMfaEnableProviderModalElement>;
export const Overview: Story = {};

View File

@@ -0,0 +1,15 @@
import { UmbModalToken } from '@umbraco-cms/backoffice/modal';
export interface UmbCurrentUserMfaEnableProviderModalConfig {
providerName: string;
}
export const UMB_CURRENT_USER_MFA_ENABLE_PROVIDER_MODAL = new UmbModalToken<
UmbCurrentUserMfaEnableProviderModalConfig,
never
>('Umb.Modal.CurrentUserMfaProvider', {
modal: {
type: 'sidebar',
size: 'small',
},
});

View File

@@ -1,16 +0,0 @@
import type { UmbCurrentUserRepository } from '../../repository/index.js';
import { UmbModalToken } from '@umbraco-cms/backoffice/modal';
export interface UmbCurrentUserMfaProviderModalConfig {
providerName: string;
}
export const UMB_CURRENT_USER_MFA_PROVIDER_MODAL = new UmbModalToken<UmbCurrentUserMfaProviderModalConfig, never>(
'Umb.Modal.CurrentUserMfaProvider',
{
modal: {
type: 'sidebar',
size: 'small',
},
},
);

View File

@@ -1,4 +1,4 @@
import { UMB_CURRENT_USER_MFA_PROVIDER_MODAL } from '../current-user-mfa-provider/current-user-mfa-provider-modal.token.js';
import { UMB_CURRENT_USER_MFA_ENABLE_PROVIDER_MODAL } from '../current-user-mfa-enable-provider/current-user-mfa-enable-provider-modal.token.js';
import { UmbCurrentUserRepository } from '../../repository/index.js';
import type { UmbCurrentUserMfaProviderModel } from '../../types.js';
import { css, customElement, html, property, repeat, state, when } from '@umbraco-cms/backoffice/external/lit';
@@ -100,7 +100,7 @@ export class UmbCurrentUserMfaModalElement extends UmbLitElement {
// Open the provider modal
const modalManager = await this.getContext(UMB_MODAL_MANAGER_CONTEXT);
return await modalManager
.open(this, UMB_CURRENT_USER_MFA_PROVIDER_MODAL, {
.open(this, UMB_CURRENT_USER_MFA_ENABLE_PROVIDER_MODAL, {
data: { providerName: item.providerName },
})
.onSubmit()

View File

@@ -5,8 +5,7 @@ import { html } from '@umbraco-cms/backoffice/external/lit';
import './current-user-mfa-modal.element.js';
const meta: Meta<UmbCurrentUserMfaModalElement> = {
id: 'umb-current-user-mfa-modal',
title: 'Current User/Modals/MFA Modal',
title: 'Current User/MFA/Configure MFA Providers',
component: 'umb-current-user-mfa-modal',
decorators: [(Story) => html`<div style="width: 500px; height: 500px;">${Story()}</div>`],
parameters: {

View File

@@ -15,9 +15,9 @@ const modals: Array<ManifestModal> = [
},
{
type: 'modal',
alias: 'Umb.Modal.CurrentUserMfaProvider',
name: 'Current User MFA Provider Modal',
js: () => import('./current-user-mfa-provider/current-user-mfa-provider-modal.element.js'),
alias: 'Umb.Modal.CurrentUserMfaEnableProvider',
name: 'Current User MFA Enable Provider Modal',
js: () => import('./current-user-mfa-enable-provider/current-user-mfa-enable-provider-modal.element.js'),
},
];