mirror of https://github.com/halo-dev/halo
Refine UI
parent
dd2080c3ae
commit
c945a9443c
|
@ -7434,6 +7434,72 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"/apis/console.api.halo.run/v1alpha1/systemconfigs/{group}": {
|
||||
"get": {
|
||||
"description": "Get system config by group",
|
||||
"operationId": "getSystemConfigByGroup",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Group of the system config",
|
||||
"in": "path",
|
||||
"name": "group",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"content": {
|
||||
"*/*": {
|
||||
"schema": {
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"application/json": {}
|
||||
},
|
||||
"description": "default response"
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"SystemConfigV1alpha1Console"
|
||||
]
|
||||
},
|
||||
"put": {
|
||||
"description": "Update system config by group",
|
||||
"operationId": "updateSystemConfigByGroup",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Group of the system config",
|
||||
"in": "path",
|
||||
"name": "group",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"*/*": {
|
||||
"schema": {
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"204 NO_CONTENT": {
|
||||
"content": {},
|
||||
"description": "default response"
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"SystemConfigV1alpha1Console"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/apis/console.api.migration.halo.run/v1alpha1/backup-files": {
|
||||
"get": {
|
||||
"description": "Get backup files from backup root.",
|
||||
|
|
|
@ -3136,6 +3136,72 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"/apis/console.api.halo.run/v1alpha1/systemconfigs/{group}": {
|
||||
"get": {
|
||||
"description": "Get system config by group",
|
||||
"operationId": "getSystemConfigByGroup",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Group of the system config",
|
||||
"in": "path",
|
||||
"name": "group",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"content": {
|
||||
"*/*": {
|
||||
"schema": {
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"application/json": {}
|
||||
},
|
||||
"description": "default response"
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"SystemConfigV1alpha1Console"
|
||||
]
|
||||
},
|
||||
"put": {
|
||||
"description": "Update system config by group",
|
||||
"operationId": "updateSystemConfigByGroup",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Group of the system config",
|
||||
"in": "path",
|
||||
"name": "group",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"*/*": {
|
||||
"schema": {
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"204 NO_CONTENT": {
|
||||
"content": {},
|
||||
"description": "default response"
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"SystemConfigV1alpha1Console"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/apis/console.api.migration.halo.run/v1alpha1/backup-files": {
|
||||
"get": {
|
||||
"description": "Get backup files from backup root.",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script lang="ts" setup>
|
||||
import { usePermission } from "@/utils/permission";
|
||||
import type { Menu } from "@halo-dev/api-client";
|
||||
import { coreApiClient } from "@halo-dev/api-client";
|
||||
import { consoleApiClient, coreApiClient } from "@halo-dev/api-client";
|
||||
import {
|
||||
Dialog,
|
||||
Toast,
|
||||
|
@ -22,6 +22,10 @@ import { onMounted, ref } from "vue";
|
|||
import { useI18n } from "vue-i18n";
|
||||
import MenuEditingModal from "./MenuEditingModal.vue";
|
||||
|
||||
interface SystemMenuConfig {
|
||||
primary: string;
|
||||
}
|
||||
|
||||
const { currentUserHasPermission } = usePermission();
|
||||
const { t } = useI18n();
|
||||
|
||||
|
@ -65,10 +69,10 @@ const {
|
|||
}
|
||||
},
|
||||
refetchInterval(data) {
|
||||
const deletingMenus = data?.filter(
|
||||
const hasDeletingMenu = data?.some(
|
||||
(menu) => !!menu.metadata.deletionTimestamp
|
||||
);
|
||||
return deletingMenus?.length ? 1000 : false;
|
||||
return hasDeletingMenu ? 1000 : false;
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -138,35 +142,25 @@ onMounted(async () => {
|
|||
const { data: primaryMenuName, refetch: refetchPrimaryMenuName } = useQuery({
|
||||
queryKey: ["primary-menu-name"],
|
||||
queryFn: async () => {
|
||||
const { data } = await coreApiClient.configMap.getConfigMap({
|
||||
name: "system",
|
||||
});
|
||||
const { data } =
|
||||
await consoleApiClient.configMap.system.getSystemConfigByGroup({
|
||||
group: "menu",
|
||||
});
|
||||
|
||||
if (!data.data?.menu) {
|
||||
return "";
|
||||
}
|
||||
const { primary } = (data as SystemMenuConfig) || {};
|
||||
|
||||
const menuConfig = JSON.parse(data.data.menu);
|
||||
|
||||
return menuConfig.primary;
|
||||
return primary;
|
||||
},
|
||||
});
|
||||
|
||||
const handleSetPrimaryMenu = async (menu: Menu) => {
|
||||
const { data: systemConfigMap } = await coreApiClient.configMap.getConfigMap({
|
||||
name: "system",
|
||||
await consoleApiClient.configMap.system.updateSystemConfigByGroup({
|
||||
group: "menu",
|
||||
body: {
|
||||
primary: menu.metadata.name,
|
||||
},
|
||||
});
|
||||
|
||||
if (systemConfigMap.data) {
|
||||
const menuConfigToUpdate = JSON.parse(systemConfigMap.data?.menu || "{}");
|
||||
menuConfigToUpdate.primary = menu.metadata.name;
|
||||
systemConfigMap.data["menu"] = JSON.stringify(menuConfigToUpdate);
|
||||
|
||||
await coreApiClient.configMap.updateConfigMap({
|
||||
name: "system",
|
||||
configMap: systemConfigMap,
|
||||
});
|
||||
}
|
||||
await refetchPrimaryMenuName();
|
||||
|
||||
Toast.success(t("core.menu.operations.set_primary.toast_success"));
|
||||
|
|
|
@ -55,6 +55,7 @@ import {
|
|||
SnapshotV1alpha1Api,
|
||||
SnapshotV1alpha1UcApi,
|
||||
SubscriptionV1alpha1Api,
|
||||
SystemConfigV1alpha1ConsoleApi,
|
||||
SystemV1alpha1ConsoleApi,
|
||||
SystemV1alpha1PublicApi,
|
||||
TagV1alpha1Api,
|
||||
|
@ -320,6 +321,13 @@ function createConsoleApiClient(axiosInstance: AxiosInstance) {
|
|||
theme: {
|
||||
theme: new ThemeV1alpha1ConsoleApi(undefined, baseURL, axiosInstance),
|
||||
},
|
||||
configMap: {
|
||||
system: new SystemConfigV1alpha1ConsoleApi(
|
||||
undefined,
|
||||
baseURL,
|
||||
axiosInstance
|
||||
),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -448,6 +456,5 @@ export {
|
|||
createPublicApiClient,
|
||||
createUcApiClient,
|
||||
defaultPublicApiClient as publicApiClient,
|
||||
defaultUcApiClient as ucApiClient
|
||||
defaultUcApiClient as ucApiClient,
|
||||
};
|
||||
|
||||
|
|
|
@ -65,6 +65,7 @@ api/single-page-v1alpha1-public-api.ts
|
|||
api/snapshot-v1alpha1-api.ts
|
||||
api/snapshot-v1alpha1-uc-api.ts
|
||||
api/subscription-v1alpha1-api.ts
|
||||
api/system-config-v1alpha1-console-api.ts
|
||||
api/system-v1alpha1-console-api.ts
|
||||
api/system-v1alpha1-public-api.ts
|
||||
api/tag-v1alpha1-api.ts
|
||||
|
|
|
@ -77,6 +77,7 @@ export * from './api/single-page-v1alpha1-public-api';
|
|||
export * from './api/snapshot-v1alpha1-api';
|
||||
export * from './api/snapshot-v1alpha1-uc-api';
|
||||
export * from './api/subscription-v1alpha1-api';
|
||||
export * from './api/system-config-v1alpha1-console-api';
|
||||
export * from './api/system-v1alpha1-console-api';
|
||||
export * from './api/system-v1alpha1-public-api';
|
||||
export * from './api/tag-v1alpha1-api';
|
||||
|
|
|
@ -0,0 +1,246 @@
|
|||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Halo
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 2.20.0-SNAPSHOT
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
import type { Configuration } from '../configuration';
|
||||
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
|
||||
import globalAxios from 'axios';
|
||||
// Some imports not used depending on template conditions
|
||||
// @ts-ignore
|
||||
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';
|
||||
// @ts-ignore
|
||||
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base';
|
||||
/**
|
||||
* SystemConfigV1alpha1ConsoleApi - axios parameter creator
|
||||
* @export
|
||||
*/
|
||||
export const SystemConfigV1alpha1ConsoleApiAxiosParamCreator = function (configuration?: Configuration) {
|
||||
return {
|
||||
/**
|
||||
* Get system config by group
|
||||
* @param {string} group Group of the system config
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
getSystemConfigByGroup: async (group: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'group' is not null or undefined
|
||||
assertParamExists('getSystemConfigByGroup', 'group', group)
|
||||
const localVarPath = `/apis/console.api.halo.run/v1alpha1/systemconfigs/{group}`
|
||||
.replace(`{${"group"}}`, encodeURIComponent(String(group)));
|
||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||
let baseOptions;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
}
|
||||
|
||||
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
|
||||
const localVarHeaderParameter = {} as any;
|
||||
const localVarQueryParameter = {} as any;
|
||||
|
||||
// authentication basicAuth required
|
||||
// http basic authentication required
|
||||
setBasicAuthToObject(localVarRequestOptions, configuration)
|
||||
|
||||
// authentication bearerAuth required
|
||||
// http bearer authentication required
|
||||
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
||||
|
||||
|
||||
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
|
||||
return {
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
/**
|
||||
* Update system config by group
|
||||
* @param {string} group Group of the system config
|
||||
* @param {object} [body]
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
updateSystemConfigByGroup: async (group: string, body?: object, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'group' is not null or undefined
|
||||
assertParamExists('updateSystemConfigByGroup', 'group', group)
|
||||
const localVarPath = `/apis/console.api.halo.run/v1alpha1/systemconfigs/{group}`
|
||||
.replace(`{${"group"}}`, encodeURIComponent(String(group)));
|
||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
||||
let baseOptions;
|
||||
if (configuration) {
|
||||
baseOptions = configuration.baseOptions;
|
||||
}
|
||||
|
||||
const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options};
|
||||
const localVarHeaderParameter = {} as any;
|
||||
const localVarQueryParameter = {} as any;
|
||||
|
||||
// authentication basicAuth required
|
||||
// http basic authentication required
|
||||
setBasicAuthToObject(localVarRequestOptions, configuration)
|
||||
|
||||
// authentication bearerAuth required
|
||||
// http bearer authentication required
|
||||
await setBearerAuthToObject(localVarHeaderParameter, configuration)
|
||||
|
||||
|
||||
|
||||
localVarHeaderParameter['Content-Type'] = 'application/json';
|
||||
|
||||
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
||||
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||
localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration)
|
||||
|
||||
return {
|
||||
url: toPathString(localVarUrlObj),
|
||||
options: localVarRequestOptions,
|
||||
};
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* SystemConfigV1alpha1ConsoleApi - functional programming interface
|
||||
* @export
|
||||
*/
|
||||
export const SystemConfigV1alpha1ConsoleApiFp = function(configuration?: Configuration) {
|
||||
const localVarAxiosParamCreator = SystemConfigV1alpha1ConsoleApiAxiosParamCreator(configuration)
|
||||
return {
|
||||
/**
|
||||
* Get system config by group
|
||||
* @param {string} group Group of the system config
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async getSystemConfigByGroup(group: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<object>> {
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.getSystemConfigByGroup(group, options);
|
||||
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
||||
const localVarOperationServerBasePath = operationServerMap['SystemConfigV1alpha1ConsoleApi.getSystemConfigByGroup']?.[localVarOperationServerIndex]?.url;
|
||||
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
||||
},
|
||||
/**
|
||||
* Update system config by group
|
||||
* @param {string} group Group of the system config
|
||||
* @param {object} [body]
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async updateSystemConfigByGroup(group: string, body?: object, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.updateSystemConfigByGroup(group, body, options);
|
||||
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
||||
const localVarOperationServerBasePath = operationServerMap['SystemConfigV1alpha1ConsoleApi.updateSystemConfigByGroup']?.[localVarOperationServerIndex]?.url;
|
||||
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* SystemConfigV1alpha1ConsoleApi - factory interface
|
||||
* @export
|
||||
*/
|
||||
export const SystemConfigV1alpha1ConsoleApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
|
||||
const localVarFp = SystemConfigV1alpha1ConsoleApiFp(configuration)
|
||||
return {
|
||||
/**
|
||||
* Get system config by group
|
||||
* @param {SystemConfigV1alpha1ConsoleApiGetSystemConfigByGroupRequest} requestParameters Request parameters.
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
getSystemConfigByGroup(requestParameters: SystemConfigV1alpha1ConsoleApiGetSystemConfigByGroupRequest, options?: RawAxiosRequestConfig): AxiosPromise<object> {
|
||||
return localVarFp.getSystemConfigByGroup(requestParameters.group, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
* Update system config by group
|
||||
* @param {SystemConfigV1alpha1ConsoleApiUpdateSystemConfigByGroupRequest} requestParameters Request parameters.
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
updateSystemConfigByGroup(requestParameters: SystemConfigV1alpha1ConsoleApiUpdateSystemConfigByGroupRequest, options?: RawAxiosRequestConfig): AxiosPromise<void> {
|
||||
return localVarFp.updateSystemConfigByGroup(requestParameters.group, requestParameters.body, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Request parameters for getSystemConfigByGroup operation in SystemConfigV1alpha1ConsoleApi.
|
||||
* @export
|
||||
* @interface SystemConfigV1alpha1ConsoleApiGetSystemConfigByGroupRequest
|
||||
*/
|
||||
export interface SystemConfigV1alpha1ConsoleApiGetSystemConfigByGroupRequest {
|
||||
/**
|
||||
* Group of the system config
|
||||
* @type {string}
|
||||
* @memberof SystemConfigV1alpha1ConsoleApiGetSystemConfigByGroup
|
||||
*/
|
||||
readonly group: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Request parameters for updateSystemConfigByGroup operation in SystemConfigV1alpha1ConsoleApi.
|
||||
* @export
|
||||
* @interface SystemConfigV1alpha1ConsoleApiUpdateSystemConfigByGroupRequest
|
||||
*/
|
||||
export interface SystemConfigV1alpha1ConsoleApiUpdateSystemConfigByGroupRequest {
|
||||
/**
|
||||
* Group of the system config
|
||||
* @type {string}
|
||||
* @memberof SystemConfigV1alpha1ConsoleApiUpdateSystemConfigByGroup
|
||||
*/
|
||||
readonly group: string
|
||||
|
||||
/**
|
||||
*
|
||||
* @type {object}
|
||||
* @memberof SystemConfigV1alpha1ConsoleApiUpdateSystemConfigByGroup
|
||||
*/
|
||||
readonly body?: object
|
||||
}
|
||||
|
||||
/**
|
||||
* SystemConfigV1alpha1ConsoleApi - object-oriented interface
|
||||
* @export
|
||||
* @class SystemConfigV1alpha1ConsoleApi
|
||||
* @extends {BaseAPI}
|
||||
*/
|
||||
export class SystemConfigV1alpha1ConsoleApi extends BaseAPI {
|
||||
/**
|
||||
* Get system config by group
|
||||
* @param {SystemConfigV1alpha1ConsoleApiGetSystemConfigByGroupRequest} requestParameters Request parameters.
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof SystemConfigV1alpha1ConsoleApi
|
||||
*/
|
||||
public getSystemConfigByGroup(requestParameters: SystemConfigV1alpha1ConsoleApiGetSystemConfigByGroupRequest, options?: RawAxiosRequestConfig) {
|
||||
return SystemConfigV1alpha1ConsoleApiFp(this.configuration).getSystemConfigByGroup(requestParameters.group, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update system config by group
|
||||
* @param {SystemConfigV1alpha1ConsoleApiUpdateSystemConfigByGroupRequest} requestParameters Request parameters.
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof SystemConfigV1alpha1ConsoleApi
|
||||
*/
|
||||
public updateSystemConfigByGroup(requestParameters: SystemConfigV1alpha1ConsoleApiUpdateSystemConfigByGroupRequest, options?: RawAxiosRequestConfig) {
|
||||
return SystemConfigV1alpha1ConsoleApiFp(this.configuration).updateSystemConfigByGroup(requestParameters.group, requestParameters.body, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue