Merge branch 'poc/package-modules-v2' into poc/package-modules-move-libs-test

This commit is contained in:
Mads Rasmussen
2023-05-19 08:39:51 +02:00
2 changed files with 26 additions and 21 deletions

View File

@@ -1,22 +1,21 @@
import { UUITextStyles } from '@umbraco-ui/uui-css/lib';
import { css, html } from 'lit';
import { customElement, state } from 'lit/decorators.js';
import { UmbLitElement } from '@umbraco-cms/internal/lit-element';
import { ProfilingResource } from '@umbraco-cms/backoffice/backend-api';
import { tryExecuteAndNotify } from '@umbraco-cms/backoffice/resources';
import { UmbLitElement } from '@umbraco-cms/internal/lit-element';
@customElement('umb-dashboard-performance-profiling')
export class UmbDashboardPerformanceProfilingElement extends UmbLitElement {
@state()
private _profilingStatus?: boolean;
// TODO: Get this from the management api configuration when available
@state()
private _profilingPerformance = false;
private _isDebugMode = true;
constructor() {
super();
firstUpdated() {
this._getProfilingStatus();
this._profilingPerformance = localStorage.getItem('profilingPerformance') === 'true';
}
private async _getProfilingStatus() {
@@ -27,17 +26,23 @@ export class UmbDashboardPerformanceProfilingElement extends UmbLitElement {
}
}
private _changeProfilingPerformance() {
this._profilingPerformance = !this._profilingPerformance;
localStorage.setItem('profilingPerformance', this._profilingPerformance.toString());
private async _changeProfilingStatus() {
const { error } = await tryExecuteAndNotify(
this,
ProfilingResource.putProfilingStatus({ requestBody: { enabled: !this._profilingStatus } })
);
if (!error) {
this._profilingStatus = !this._profilingStatus;
}
}
private renderProfilingStatus() {
return this._profilingStatus
return this._isDebugMode
? html`
<p>
Umbraco currently runs in debug mode. This means you can use the built-in performance profiler to assess the
performance when rendering pages.
Umbraco is running in debug mode. This means you can use the built-in performance profiler
to assess performance when rendering pages.
</p>
<p>
If you want to activate the profiler for a specific page rendering, simply add
@@ -53,24 +58,24 @@ export class UmbDashboardPerformanceProfilingElement extends UmbLitElement {
<uui-toggle
label="Activate the profiler by default"
label-position="left"
.checked="${this._profilingPerformance}"
@change="${this._changeProfilingPerformance}"></uui-toggle>
.checked="${this._profilingStatus}"
@change="${this._changeProfilingStatus}"></uui-toggle>
<h4>Friendly reminder</h4>
<p>
You should never let a production site run in debug mode. Debug mode is turned off by setting
Umbraco:CMS:Hosting:Debug to false in appsettings.json, appsettings.{Environment}.json or via an environment
variable.
<strong>Umbraco:CMS:Hosting:Debug</strong> to <strong>false</strong> in appsettings.json,
appsettings.{Environment}.json or via an environment variable.
</p>
`
: html`
<p>
Umbraco currently does not run in debug mode, so you can't use the built-in profiler. This is how it should
Umbraco is not running in debug mode, so you can't use the built-in profiler. This is how it should
be for a production site.
</p>
<p>
Debug mode is turned on by setting <b>debug="true"</b> on the <b>&lt;compilation /&gt;</b> element in
web.config.
Debug mode is turned on by setting <strong>Umbraco:CMS:Hosting:Debug</strong> to <strong>true</strong> in
appsettings.json, appsettings.{Environment}.json or via an environment variable.
</p>
`;
}

View File

@@ -1,10 +1,10 @@
import { Meta, StoryObj } from '@storybook/web-components';
import './input-user-group.element';
import type { UmbUserGroupInputElement } from './user-group-input.element';
import './user-group-input.element';
const meta: Meta<UmbUserGroupInputElement> = {
title: 'Components/Inputs/User Group',
component: 'umb-input-user-group',
title: 'User Group/Components/User Group Input',
component: 'umb-user-group-input',
argTypes: {
// modalType: {
// control: 'inline-radio',