format using prettier

This commit is contained in:
Jacob Overgaard
2022-05-19 15:39:42 +02:00
parent bef07224dd
commit 9db0033672
6 changed files with 70 additions and 58 deletions

View File

@@ -5,7 +5,7 @@ import { paths } from '../../schemas/generated-schema';
const fetcher = Fetcher.for<paths>();
fetcher.configure({
baseUrl: '/umbraco/backoffice'
baseUrl: '/umbraco/backoffice',
});
export const getInitStatus = fetcher.path('/init').method('get').create();
@@ -14,4 +14,4 @@ export const postUserLogin = fetcher.path('/user/login').method('post').create()
export const postUserLogout = fetcher.path('/user/logout').method('post').create();
export const getUserSections = fetcher.path('/user/sections').method('get').create();
export const getInstall = fetcher.path('/install').method('get').create();
export const postInstall = fetcher.path('/install').method('post').create();
export const postInstall = fetcher.path('/install').method('post').create();

View File

@@ -48,7 +48,9 @@ export class UmbLogin extends LitElement {
await postUserLogin({ username, password, persist });
this._loggingIn = false;
// TODO: Change to redirect when router has been added.
this.dispatchEvent(new CustomEvent('login', { bubbles: true, composed: true, detail: { username, password, persist } }));
this.dispatchEvent(
new CustomEvent('login', { bubbles: true, composed: true, detail: { username, password, persist } })
);
} catch (error) {
console.log(error);
this._loggingIn = false;

View File

@@ -80,28 +80,28 @@ export class UmbBackofficeHeader extends LitElement {
{
type: 'section',
alias: 'Umb.Section.Content',
name: 'Content'
name: 'Content',
},
{
type: 'section',
alias: 'Umb.Section.Media',
name: 'Media'
name: 'Media',
},
{
type: 'section',
alias: 'Umb.Section.Members',
name: 'Members'
name: 'Members',
},
{
type: 'section',
alias: 'Umb.Section.Settings',
name: 'Settings'
name: 'Settings',
},
{
type: 'section',
alias: 'Umb.Section.Packages',
name: 'Packages'
}
name: 'Packages',
},
];
@state()
@@ -148,29 +148,36 @@ export class UmbBackofficeHeader extends LitElement {
const { data } = await getUserSections({});
this._availableSections = data.sections;
this._visibleSections = this._sections.filter(section => this._availableSections.includes(section.alias)).map(section => section.name);
this._visibleSections = this._sections
.filter((section) => this._availableSections.includes(section.alias))
.map((section) => section.name);
this._activeSection = this._visibleSections?.[0];
}
private _renderExtraSections() {
return when(this._extraSections.length > 0, () => html`
<uui-tab id="moreTab" @click="${this._handleTabClick}">
<uui-popover .open=${this._open} placement="bottom-start" @close="${() => (this._open = false)}">
<uui-button slot="trigger" look="primary" label="More" @click="${this._handleMore}" compact>
<uui-symbol-more></uui-symbol-more>
</uui-button>
return when(
this._extraSections.length > 0,
() => html`
<uui-tab id="moreTab" @click="${this._handleTabClick}">
<uui-popover .open=${this._open} placement="bottom-start" @close="${() => (this._open = false)}">
<uui-button slot="trigger" look="primary" label="More" @click="${this._handleMore}" compact>
<uui-symbol-more></uui-symbol-more>
</uui-button>
<div slot="popover" id="dropdown">
${this._extraSections.map((section) => html`
<uui-menu-item
?active="${this._activeSection === section}"
label="${section}"
@click-label="${this._handleLabelClick}"></uui-menu-item>
`)}
</div>
</uui-popover>
</uui-tab>
`);
<div slot="popover" id="dropdown">
${this._extraSections.map(
(section) => html`
<uui-menu-item
?active="${this._activeSection === section}"
label="${section}"
@click-label="${this._handleLabelClick}"></uui-menu-item>
`
)}
</div>
</uui-popover>
</uui-tab>
`
);
}
render() {
@@ -182,12 +189,14 @@ export class UmbBackofficeHeader extends LitElement {
<div id="sections">
<uui-tab-group id="tabs">
${this._visibleSections.map((section) => html`
<uui-tab
?active="${this._activeSection === section}"
label="${section}"
@click="${this._handleTabClick}"></uui-tab>
`)}
${this._visibleSections.map(
(section) => html`
<uui-tab
?active="${this._activeSection === section}"
label="${section}"
@click="${this._handleTabClick}"></uui-tab>
`
)}
${this._renderExtraSections()}
</uui-tab-group>
</div>

View File

@@ -55,8 +55,8 @@ export class UmbInstallerUser extends LitElement {
connectionString: '',
databaseProviderMetadataId: '1',
integratedAuth: false,
providerName: 'SQLite'
}
providerName: 'SQLite',
},
});
// TODO: Change to redirect when router has been added.

View File

@@ -1,4 +1,4 @@
import { setupWorker } from 'msw';
import { handlers } from './handlers';
export const worker = setupWorker(...handlers);
export const worker = setupWorker(...handlers);

View File

@@ -9,7 +9,7 @@ export const handlers = [
ctx.status(200),
ctx.json({
installed: import.meta.env.VITE_UMBRACO_INSTALL_STATUS !== 'false',
} as components['schemas']['InitResponse']),
} as components['schemas']['InitResponse'])
);
}),
@@ -18,8 +18,8 @@ export const handlers = [
// Respond with a 200 status code
ctx.status(200),
ctx.json({
version: '13.0.0'
} as components['schemas']['VersionResponse']),
version: '13.0.0',
} as components['schemas']['VersionResponse'])
);
}),
@@ -58,8 +58,8 @@ export const handlers = [
ctx.status(200),
ctx.json({
username: 'admin',
role: 'administrator'
} as components['schemas']['UserResponse']),
role: 'administrator',
} as components['schemas']['UserResponse'])
);
}),
@@ -67,8 +67,8 @@ export const handlers = [
return res(
ctx.status(200),
ctx.json({
sections: ['Umb.Section.Content', 'Umb.Section.Media', 'Umb.Section.Settings']
} as components['schemas']['AllowedSectionsResponse']),
sections: ['Umb.Section.Content', 'Umb.Section.Media', 'Umb.Section.Settings'],
} as components['schemas']['AllowedSectionsResponse'])
);
}),
@@ -87,26 +87,27 @@ export const handlers = [
consentLevels: [
{
level: 'Minimal',
description: 'We will only send an anonymized site ID to let us know that the site exists.'
description: 'We will only send an anonymized site ID to let us know that the site exists.',
},
{
level: 'Basic',
description: 'We will send an anonymized site ID, umbraco version, and packages installed'
description: 'We will send an anonymized site ID, umbraco version, and packages installed',
},
{
level: 'Detailed',
description: 'We will send:\n <br>- Anonymized site ID, umbraco version, and packages installed.\n <br>- Number of: Root nodes, Content nodes, Macros, Media, Document Types, Templates, Languages, Domains, User Group, Users, Members, and Property Editors in use.\n <br>- System information: Webserver, server OS, server framework, server OS language, and database provider.\n <br>- Configuration settings: Modelsbuilder mode, if custom Umbraco path exists, ASP environment, and if you are in debug mode.\n <br>\n <br><i>We might change what we send on the Detailed level in the future. If so, it will be listed above.\n <br>By choosing \'Detailed\' you agree to current and future anonymized information being collected.</i>'
}
description:
"We will send:\n <br>- Anonymized site ID, umbraco version, and packages installed.\n <br>- Number of: Root nodes, Content nodes, Macros, Media, Document Types, Templates, Languages, Domains, User Group, Users, Members, and Property Editors in use.\n <br>- System information: Webserver, server OS, server framework, server OS language, and database provider.\n <br>- Configuration settings: Modelsbuilder mode, if custom Umbraco path exists, ASP environment, and if you are in debug mode.\n <br>\n <br><i>We might change what we send on the Detailed level in the future. If so, it will be listed above.\n <br>By choosing 'Detailed' you agree to current and future anonymized information being collected.</i>",
},
],
quickInstallSettings: {
displayName: 'SQLite',
defaultDatabaseName: 'Umbraco',
}
},
},
view: 'user',
name: 'User',
description: '',
serverOrder: 20
serverOrder: 20,
},
{
model: {
@@ -123,7 +124,7 @@ export const handlers = [
serverPlaceholder: null,
requiresCredentials: false,
supportsIntegratedAuthentication: false,
requiresConnectionTest: false
requiresConnectionTest: false,
},
{
id: '2',
@@ -137,7 +138,7 @@ export const handlers = [
serverPlaceholder: '(local)\\SQLEXPRESS',
requiresCredentials: true,
supportsIntegratedAuthentication: true,
requiresConnectionTest: true
requiresConnectionTest: true,
},
{
id: '42c0eafd-1650-4bdb-8cf6-d226e8941698',
@@ -151,23 +152,23 @@ export const handlers = [
serverPlaceholder: null,
requiresCredentials: false,
supportsIntegratedAuthentication: false,
requiresConnectionTest: true
}
]
requiresConnectionTest: true,
},
],
},
view: 'database',
name: 'Database',
description: '',
serverOrder: 10
serverOrder: 10,
},
{
name: 'UmbracoVersion',
view: '',
model: null,
description: 'Installation is complete! Get ready to be redirected to your new CMS.',
serverOrder: 50
}
]
serverOrder: 50,
},
],
} as components['schemas']['UmbracoInstaller'])
);
}),