diff --git a/src/Umbraco.Web.UI.Client/src/packages/settings/dashboards/performance-profiling/dashboard-performance-profiling.element.ts b/src/Umbraco.Web.UI.Client/src/packages/settings/dashboards/performance-profiling/dashboard-performance-profiling.element.ts index 836316ac25..09958709c3 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/settings/dashboards/performance-profiling/dashboard-performance-profiling.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/settings/dashboards/performance-profiling/dashboard-performance-profiling.element.ts @@ -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`
- 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.
If you want to activate the profiler for a specific page rendering, simply add
@@ -53,24 +58,24 @@ export class UmbDashboardPerformanceProfilingElement extends UmbLitElement {
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. + Umbraco:CMS:Hosting:Debug to false in appsettings.json, + appsettings.{Environment}.json or via an environment variable.
` : html`- 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.
- Debug mode is turned on by setting debug="true" on the <compilation /> element in - web.config. + Debug mode is turned on by setting Umbraco:CMS:Hosting:Debug to true in + appsettings.json, appsettings.{Environment}.json or via an environment variable.
`; } diff --git a/src/Umbraco.Web.UI.Client/src/packages/users/user-groups/components/input-user-group/user-group-input.stories.ts b/src/Umbraco.Web.UI.Client/src/packages/users/user-groups/components/input-user-group/user-group-input.stories.ts index 16c93e313c..7183422f23 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/users/user-groups/components/input-user-group/user-group-input.stories.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/users/user-groups/components/input-user-group/user-group-input.stories.ts @@ -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