feat: add handler for troubleshooting
This commit is contained in:
@@ -72,7 +72,7 @@ const handlers = [
|
|||||||
...userGroupsHandlers,
|
...userGroupsHandlers,
|
||||||
...userHandlers,
|
...userHandlers,
|
||||||
...documentBlueprintHandlers,
|
...documentBlueprintHandlers,
|
||||||
serverHandlers.serverInformationHandler,
|
...serverHandlers.serverInformationHandlers,
|
||||||
];
|
];
|
||||||
|
|
||||||
switch (import.meta.env.VITE_UMBRACO_INSTALL_STATUS) {
|
switch (import.meta.env.VITE_UMBRACO_INSTALL_STATUS) {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import { handlers as configHandlers } from './handlers/config.handlers.js';
|
|||||||
|
|
||||||
export const handlers = [
|
export const handlers = [
|
||||||
serverHandlers.serverRunningHandler,
|
serverHandlers.serverRunningHandler,
|
||||||
serverHandlers.serverInformationHandler,
|
...serverHandlers.serverInformationHandlers,
|
||||||
...manifestsHandlers.manifestEmptyHandlers,
|
...manifestsHandlers.manifestEmptyHandlers,
|
||||||
...installHandlers,
|
...installHandlers,
|
||||||
...upgradeHandlers,
|
...upgradeHandlers,
|
||||||
|
|||||||
@@ -3,7 +3,11 @@ import type {
|
|||||||
ServerStatusResponseModel,
|
ServerStatusResponseModel,
|
||||||
ServerInformationResponseModel,
|
ServerInformationResponseModel,
|
||||||
} from '@umbraco-cms/backoffice/external/backend-api';
|
} from '@umbraco-cms/backoffice/external/backend-api';
|
||||||
import { RuntimeLevelModel, RuntimeModeModel } from '@umbraco-cms/backoffice/external/backend-api';
|
import {
|
||||||
|
RuntimeLevelModel,
|
||||||
|
RuntimeModeModel,
|
||||||
|
ServerTroubleshootingResponseModel,
|
||||||
|
} from '@umbraco-cms/backoffice/external/backend-api';
|
||||||
import { umbracoPath } from '@umbraco-cms/backoffice/utils';
|
import { umbracoPath } from '@umbraco-cms/backoffice/utils';
|
||||||
|
|
||||||
export const serverRunningHandler = rest.get(umbracoPath('/server/status'), (_req, res, ctx) => {
|
export const serverRunningHandler = rest.get(umbracoPath('/server/status'), (_req, res, ctx) => {
|
||||||
@@ -36,15 +40,30 @@ export const serverMustUpgradeHandler = rest.get(umbracoPath('/server/status'),
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
export const serverInformationHandler = rest.get(umbracoPath('/server/information'), (_req, res, ctx) => {
|
export const serverInformationHandlers = [
|
||||||
return res(
|
rest.get(umbracoPath('/server/information'), (_req, res, ctx) => {
|
||||||
// Respond with a 200 status code
|
return res(
|
||||||
ctx.status(200),
|
// Respond with a 200 status code
|
||||||
ctx.json<ServerInformationResponseModel>({
|
ctx.status(200),
|
||||||
version: '14.0.0-preview004',
|
ctx.json<ServerInformationResponseModel>({
|
||||||
assemblyVersion: '14.0.0-preview004',
|
version: '14.0.0-preview004',
|
||||||
baseUtcOffset: '01:00:00',
|
assemblyVersion: '14.0.0-preview004',
|
||||||
runtimeMode: RuntimeModeModel.BACKOFFICE_DEVELOPMENT,
|
baseUtcOffset: '01:00:00',
|
||||||
}),
|
runtimeMode: RuntimeModeModel.BACKOFFICE_DEVELOPMENT,
|
||||||
);
|
}),
|
||||||
});
|
);
|
||||||
|
}),
|
||||||
|
rest.get(umbracoPath('/server/troubleshooting'), (_req, res, ctx) => {
|
||||||
|
return res(
|
||||||
|
// Respond with a 200 status code
|
||||||
|
ctx.status(200),
|
||||||
|
ctx.json<ServerTroubleshootingResponseModel>({
|
||||||
|
items: [
|
||||||
|
{ name: 'Umbraco base url', data: location.origin },
|
||||||
|
{ name: 'Mocked server', data: 'true' },
|
||||||
|
{ name: 'Umbraco version', data: '14.0.0-preview004' },
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user