Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix: Removes unused Published Status dashboard actions #17503

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,59 +1,27 @@
import type { UUIButtonState } from '@umbraco-cms/backoffice/external/uui';
import { css, html, customElement, state } from '@umbraco-cms/backoffice/external/lit';
import { css, customElement, html, state } from '@umbraco-cms/backoffice/external/lit';
import { tryExecuteAndNotify } from '@umbraco-cms/backoffice/resources';
import { umbConfirmModal } from '@umbraco-cms/backoffice/modal';
import { PublishedCacheService } from '@umbraco-cms/backoffice/external/backend-api';
import { tryExecuteAndNotify } from '@umbraco-cms/backoffice/resources';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
import type { UUIButtonState } from '@umbraco-cms/backoffice/external/uui';

@customElement('umb-dashboard-published-status')
export class UmbDashboardPublishedStatusElement extends UmbLitElement {
@state()
private _publishedStatusText = '';

@state()
private _buttonState: UUIButtonState = undefined;

@state()
private _buttonStateReload: UUIButtonState = undefined;

@state()
private _buttonStateRebuild: UUIButtonState = undefined;

@state()
private _buttonStateCollect: UUIButtonState = undefined;

override connectedCallback() {
super.connectedCallback();
this._getPublishedStatus();
}

// Refresh
private async _getPublishedStatus() {
const { data } = await tryExecuteAndNotify(this, PublishedCacheService.getPublishedCacheStatus());
if (data) {
this._publishedStatusText = data;
}
}

private async _onRefreshCacheHandler() {
this._buttonState = 'waiting';
await this._getPublishedStatus();
this._buttonState = 'success';
}

//Reload
private async _reloadMemoryCache() {
this._buttonStateReload = 'waiting';
this._buttonState = 'waiting';
const { error } = await tryExecuteAndNotify(this, PublishedCacheService.postPublishedCacheReload());
if (error) {
this._buttonStateReload = 'failed';
this._buttonState = 'failed';
} else {
this._buttonStateReload = 'success';
this._getPublishedStatus();
this._buttonState = 'success';
}
}
private async _onReloadCacheHandler() {
Expand Down Expand Up @@ -89,42 +57,8 @@ export class UmbDashboardPublishedStatusElement extends UmbLitElement {
this._rebuildDatabaseCache();
}

//Collect
private async _cacheCollect() {
this._buttonStateCollect = 'waiting';
const { error } = await tryExecuteAndNotify(this, PublishedCacheService.postPublishedCacheCollect());
if (error) {
this._buttonStateCollect = 'failed';
} else {
this._buttonStateCollect = 'success';
}
}

private async _onSnapshotCacheHandler() {
await umbConfirmModal(this, {
headline: 'Snapshot',
content: html` Trigger a NuCache snapshots collection.`,
color: 'danger',
confirmLabel: 'Continue',
});
this._cacheCollect();
}

override render() {
return html`
<uui-box headline="Published Cache Status">
<p>${this._publishedStatusText}</p>
<uui-button
.state=${this._buttonState}
type="button"
look="primary"
color="danger"
label="Refresh Status"
@click=${this._onRefreshCacheHandler}>
Refresh Status
</uui-button>
</uui-box>

<uui-box headline="Memory Cache">
<p>
This button lets you reload the in-memory cache, by entirely reloading it from the database cache (but it does
Expand Down Expand Up @@ -159,22 +93,6 @@ export class UmbDashboardPublishedStatusElement extends UmbLitElement {
Rebuild Database Cache
</uui-button>
</uui-box>

<uui-box headline="Internal Cache">
<p>
This button lets you trigger a NuCache snapshots collection (after running a fullCLR GC). Unless you know what
that means, you probably do not need to use it.
</p>
<uui-button
type="button"
look="primary"
color="danger"
label="Snapshot Internal Cache"
@click=${this._onSnapshotCacheHandler}
.state=${this._buttonStateCollect}>
Snapshot Internal Cache
</uui-button>
</uui-box>
`;
}

Expand Down
Loading