feat: add handler for troubleshooting
This commit is contained in:
@@ -72,7 +72,7 @@ const handlers = [
|
||||
...userGroupsHandlers,
|
||||
...userHandlers,
|
||||
...documentBlueprintHandlers,
|
||||
serverHandlers.serverInformationHandler,
|
||||
...serverHandlers.serverInformationHandlers,
|
||||
];
|
||||
|
||||
switch (import.meta.env.VITE_UMBRACO_INSTALL_STATUS) {
|
||||
|
||||
@@ -18,7 +18,7 @@ import { handlers as configHandlers } from './handlers/config.handlers.js';
|
||||
|
||||
export const handlers = [
|
||||
serverHandlers.serverRunningHandler,
|
||||
serverHandlers.serverInformationHandler,
|
||||
...serverHandlers.serverInformationHandlers,
|
||||
...manifestsHandlers.manifestEmptyHandlers,
|
||||
...installHandlers,
|
||||
...upgradeHandlers,
|
||||
|
||||
@@ -3,7 +3,11 @@ import type {
|
||||
ServerStatusResponseModel,
|
||||
ServerInformationResponseModel,
|
||||
} 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';
|
||||
|
||||
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) => {
|
||||
return res(
|
||||
// Respond with a 200 status code
|
||||
ctx.status(200),
|
||||
ctx.json<ServerInformationResponseModel>({
|
||||
version: '14.0.0-preview004',
|
||||
assemblyVersion: '14.0.0-preview004',
|
||||
baseUtcOffset: '01:00:00',
|
||||
runtimeMode: RuntimeModeModel.BACKOFFICE_DEVELOPMENT,
|
||||
}),
|
||||
);
|
||||
});
|
||||
export const serverInformationHandlers = [
|
||||
rest.get(umbracoPath('/server/information'), (_req, res, ctx) => {
|
||||
return res(
|
||||
// Respond with a 200 status code
|
||||
ctx.status(200),
|
||||
ctx.json<ServerInformationResponseModel>({
|
||||
version: '14.0.0-preview004',
|
||||
assemblyVersion: '14.0.0-preview004',
|
||||
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