Skip to content

Commit f207cfa

Browse files
authored
Merge branch 'main' into v14/bugfix/can-not-login-after-remove-ui-culture
2 parents c2ace22 + b9c62a6 commit f207cfa

File tree

17 files changed

+290
-23
lines changed

17 files changed

+290
-23
lines changed

src/apps/backoffice/backoffice.context.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
1010
import type { UmbExtensionManifestInitializer } from '@umbraco-cms/backoffice/extension-api';
1111
import { UMB_AUTH_CONTEXT } from '@umbraco-cms/backoffice/auth';
1212
import { UMB_CURRENT_USER_CONTEXT } from '@umbraco-cms/backoffice/current-user';
13+
import { UmbSysinfoRepository } from '@umbraco-cms/backoffice/sysinfo';
1314

1415
export class UmbBackofficeContext extends UmbContextBase<UmbBackofficeContext> {
1516
#activeSectionAlias = new UmbStringState(undefined);
@@ -76,6 +77,12 @@ export class UmbBackofficeContext extends UmbContextBase<UmbBackofficeContext> {
7677
public setActiveSectionAlias(alias: string) {
7778
this.#activeSectionAlias.setValue(alias);
7879
}
80+
81+
public async serverUpgradeCheck(): Promise<boolean> {
82+
const repository = new UmbSysinfoRepository(this);
83+
const check = await repository.serverUpgradeCheck();
84+
return !!check;
85+
}
7986
}
8087

8188
export const UMB_BACKOFFICE_CONTEXT = new UmbContextToken<UmbBackofficeContext>('UmbBackofficeContext');

src/apps/backoffice/components/backoffice-header-logo.element.ts

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { isCurrentUserAnAdmin } from '@umbraco-cms/backoffice/current-user';
21
import { UMB_BACKOFFICE_CONTEXT } from '../backoffice.context.js';
2+
import { isCurrentUserAnAdmin } from '@umbraco-cms/backoffice/current-user';
33
import { css, html, customElement, state } from '@umbraco-cms/backoffice/external/lit';
44
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
55
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
66
import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal';
7-
import { UMB_SYSINFO_MODAL } from '@umbraco-cms/backoffice/sysinfo';
7+
import { UMB_NEWVERSION_MODAL, UMB_SYSINFO_MODAL } from '@umbraco-cms/backoffice/sysinfo';
88

99
@customElement('umb-backoffice-header-logo')
1010
export class UmbBackofficeHeaderLogoElement extends UmbLitElement {
@@ -14,6 +14,11 @@ export class UmbBackofficeHeaderLogoElement extends UmbLitElement {
1414
@state()
1515
private _isUserAdmin = false;
1616

17+
@state()
18+
private _serverUpgradeCheck = false;
19+
20+
#backofficeContext?: typeof UMB_BACKOFFICE_CONTEXT.TYPE;
21+
1722
constructor() {
1823
super();
1924

@@ -26,13 +31,19 @@ export class UmbBackofficeHeaderLogoElement extends UmbLitElement {
2631
},
2732
'_observeVersion',
2833
);
34+
35+
this.#backofficeContext = context;
2936
});
3037

3138
this.#isAdmin();
3239
}
3340

3441
async #isAdmin() {
3542
this._isUserAdmin = await isCurrentUserAnAdmin(this);
43+
44+
if (this._isUserAdmin) {
45+
this._serverUpgradeCheck = this.#backofficeContext ? await this.#backofficeContext.serverUpgradeCheck() : false;
46+
}
3647
}
3748

3849
override render() {
@@ -50,6 +61,14 @@ export class UmbBackofficeHeaderLogoElement extends UmbLitElement {
5061
height="82"
5162
loading="lazy" />
5263
<span>${this._version}</span>
64+
65+
${this._serverUpgradeCheck
66+
? html`<uui-button
67+
@click=${this.#openNewVersion}
68+
color="danger"
69+
label=${this.localize.term('general_newVersionAvailable')}></uui-button>`
70+
: ''}
71+
5372
<a href="https://umbraco.com" target="_blank" rel="noopener">Umbraco.com</a>
5473
5574
${this._isUserAdmin
@@ -72,6 +91,14 @@ export class UmbBackofficeHeaderLogoElement extends UmbLitElement {
7291
.catch(() => {});
7392
}
7493

94+
async #openNewVersion() {
95+
const modalManager = await this.getContext(UMB_MODAL_MANAGER_CONTEXT);
96+
modalManager
97+
.open(this, UMB_NEWVERSION_MODAL)
98+
.onSubmit()
99+
.catch(() => {});
100+
}
101+
75102
static override styles = [
76103
UmbTextStyles,
77104
css`

src/assets/lang/da-dk.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,7 @@ export default {
907907
lastUpdated: 'Last Updated',
908908
skipToMenu: 'Skip to menu',
909909
skipToContent: 'Skip to content',
910+
newVersionAvailable: 'Ny version tilgængelig',
910911
},
911912
colors: {
912913
blue: 'Blå',

src/assets/lang/de-de.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -879,6 +879,7 @@ export default {
879879
header: 'Kopf',
880880
systemField: 'System Feld',
881881
lastUpdated: 'Zuletzt geändert',
882+
newVersionAvailable: 'Neue Version verfügbar',
882883
},
883884
colors: {
884885
blue: 'Blau',

src/assets/lang/en-us.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -918,6 +918,7 @@ export default {
918918
skipToMenu: 'Skip to menu',
919919
skipToContent: 'Skip to content',
920920
restore: 'Restore',
921+
newVersionAvailable: 'New version available',
921922
},
922923
colors: {
923924
blue: 'Blue',

src/assets/lang/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,7 @@ export default {
934934
media: 'Media',
935935
revert: 'Revert',
936936
validate: 'Validate',
937+
newVersionAvailable: 'New version available',
937938
},
938939
colors: {
939940
blue: 'Blue',

src/external/backend-api/src/services.gen.ts

Lines changed: 16 additions & 1 deletion
Large diffs are not rendered by default.

src/external/backend-api/src/types.gen.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2149,6 +2149,7 @@ export type ServerConfigurationItemResponseModel = {
21492149

21502150
export type ServerConfigurationResponseModel = {
21512151
allowPasswordReset: boolean;
2152+
versionCheckPeriod: number;
21522153
};
21532154

21542155
export type ServerInformationResponseModel = {
@@ -2608,6 +2609,12 @@ export type UpdateWebhookRequestModel = {
26082609
events: Array<(string)>;
26092610
};
26102611

2612+
export type UpgradeCheckResponseModel = {
2613+
type: string;
2614+
comment: string;
2615+
url: string;
2616+
};
2617+
26112618
export type UpgradeSettingsResponseModel = {
26122619
currentState: string;
26132620
newState: string;
@@ -4667,6 +4674,8 @@ export type GetServerStatusResponse = ((ServerStatusResponseModel));
46674674

46684675
export type GetServerTroubleshootingResponse = ((ServerTroubleshootingResponseModel));
46694676

4677+
export type GetServerUpgradeCheckResponse = ((UpgradeCheckResponseModel));
4678+
46704679
export type GetItemStaticFileData = {
46714680
path?: Array<(string)>;
46724681
};

src/mocks/handlers/server.handlers.ts

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
const { rest } = window.MockServiceWorker;
22
import {
3-
type ServerStatusResponseModel,
4-
type ServerInformationResponseModel,
5-
type ServerTroubleshootingResponseModel,
63
RuntimeLevelModel,
74
RuntimeModeModel,
5+
type GetServerUpgradeCheckResponse,
6+
type GetServerTroubleshootingResponse,
7+
type GetServerInformationResponse,
8+
type GetServerConfigurationResponse,
9+
type GetServerStatusResponse,
810
} from '@umbraco-cms/backoffice/external/backend-api';
911
import { umbracoPath } from '@umbraco-cms/backoffice/utils';
1012

1113
export const serverRunningHandler = rest.get(umbracoPath('/server/status'), (_req, res, ctx) => {
1214
return res(
1315
// Respond with a 200 status code
1416
ctx.status(200),
15-
ctx.json<ServerStatusResponseModel>({
17+
ctx.json<GetServerStatusResponse>({
1618
serverStatus: RuntimeLevelModel.RUN,
1719
}),
1820
);
@@ -22,7 +24,7 @@ export const serverMustInstallHandler = rest.get(umbracoPath('/server/status'),
2224
return res(
2325
// Respond with a 200 status code
2426
ctx.status(200),
25-
ctx.json<ServerStatusResponseModel>({
27+
ctx.json<GetServerStatusResponse>({
2628
serverStatus: RuntimeLevelModel.INSTALL,
2729
}),
2830
);
@@ -32,20 +34,41 @@ export const serverMustUpgradeHandler = rest.get(umbracoPath('/server/status'),
3234
return res(
3335
// Respond with a 200 status code
3436
ctx.status(200),
35-
ctx.json<ServerStatusResponseModel>({
37+
ctx.json<GetServerStatusResponse>({
3638
serverStatus: RuntimeLevelModel.UPGRADE,
3739
}),
3840
);
3941
});
4042

4143
export const serverInformationHandlers = [
44+
rest.get(umbracoPath('/server/configuration'), (_req, res, ctx) => {
45+
return res(
46+
// Respond with a 200 status code
47+
ctx.status(200),
48+
ctx.json<GetServerConfigurationResponse>({
49+
allowPasswordReset: true,
50+
versionCheckPeriod: 7, // days
51+
}),
52+
);
53+
}),
54+
rest.get(umbracoPath('/server/upgrade-check'), (_req, res, ctx) => {
55+
return res(
56+
// Respond with a 200 status code
57+
ctx.status(200),
58+
ctx.json<GetServerUpgradeCheckResponse>({
59+
type: 'Minor',
60+
comment: "14.2.0.0 is released. Upgrade today - it's free!",
61+
url: 'https://our.umbraco.com/download/releases/1420',
62+
}),
63+
);
64+
}),
4265
rest.get(umbracoPath('/server/information'), (_req, res, ctx) => {
4366
return res(
4467
// Respond with a 200 status code
4568
ctx.status(200),
46-
ctx.json<ServerInformationResponseModel>({
47-
version: '14.0.0-preview004',
48-
assemblyVersion: '14.0.0-preview004',
69+
ctx.json<GetServerInformationResponse>({
70+
version: '14.0.0',
71+
assemblyVersion: '14.0.0',
4972
baseUtcOffset: '01:00:00',
5073
runtimeMode: RuntimeModeModel.BACKOFFICE_DEVELOPMENT,
5174
}),
@@ -55,7 +78,7 @@ export const serverInformationHandlers = [
5578
return res(
5679
// Respond with a 200 status code
5780
ctx.status(200),
58-
ctx.json<ServerTroubleshootingResponseModel>({
81+
ctx.json<GetServerTroubleshootingResponse>({
5982
items: [
6083
{ name: 'Umbraco base url', data: location.origin },
6184
{ name: 'Mocked server', data: 'true' },

src/packages/core/sorter/sorter.controller.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,14 @@ describe('UmbSorterController', () => {
148148
});
149149

150150
describe('enable', () => {
151-
it('sets all allowed items to draggable', () => {
152-
// [NL] I have experienced an issue with this test, it may need a little delay before testing for this. As the test relies on DOM.
151+
it('sets all allowed items to draggable', async () => {
153152
const items = element.getSortableItems();
154153
expect(items.length).to.equal(3);
154+
155+
await aTimeout(100);
156+
await element.updateComplete;
157+
158+
// Expect all items to be draggable
155159
items.forEach((item) => {
156160
expect(item.draggable).to.be.true;
157161
});

0 commit comments

Comments
 (0)