diff --git a/server/controllers/view.js b/server/controllers/view.js index baf6d4baaab..fb7729d0ac2 100644 --- a/server/controllers/view.js +++ b/server/controllers/view.js @@ -10,8 +10,6 @@ const { getK8sRuntime, getOAuthInfo, getClusterRole, - getSupportGpuList, - getInstallerSpec, getTheme, } = require('../services/session'); @@ -182,18 +180,16 @@ const renderView = async ctx => { const clusterRole = await getClusterRole(ctx); const ksConfig = await getKSConfig(ctx); - const [user, runtime, supportGpuType, installer, installedExtensions] = await Promise.all([ + const [user, runtime, installedExtensions] = await Promise.all([ getCurrentUser(ctx, clusterRole, ksConfig.multicluster), getK8sRuntime(ctx), - getSupportGpuList(ctx), - getInstallerSpec(ctx), getInstalledExtensions(ctx), ]); await renderIndex(ctx, { ksConfig: { ...ksConfig, - metrics_server: get(installer, 'metrics_server.enabled', false), + metrics_server: false, }, user, runtime, @@ -201,7 +197,7 @@ const renderView = async ctx => { installedExtensions, config: { ...clientConfig, - supportGpuType: [...supportGpuType, ...clientConfig.supportGpuType], + supportGpuType: [...clientConfig.supportGpuType], }, }); } catch (err) { @@ -214,24 +210,22 @@ const renderV3View = async ctx => { const clusterRole = await getClusterRole(ctx); const ksConfig = await getKSConfig(ctx); - const [user, runtime, supportGpuType, installer] = await Promise.all([ + const [user, runtime] = await Promise.all([ getCurrentUser(ctx, clusterRole, ksConfig.multicluster), getK8sRuntime(ctx), - getSupportGpuList(ctx), - getInstallerSpec(ctx), ]); await renderV3Index(ctx, { ksConfig: { ...ksConfig, - metrics_server: get(installer, 'metrics_server.enabled', false), + metrics_server: false, }, user, runtime, clusterRole, config: { ...clientConfig, - supportGpuType: [...supportGpuType, ...clientConfig.supportGpuType], + supportGpuType: [...clientConfig.supportGpuType], }, }); } catch (err) { diff --git a/server/services/session.js b/server/services/session.js index 23885137c9d..6695ca55351 100644 --- a/server/services/session.js +++ b/server/services/session.js @@ -404,32 +404,6 @@ const getClusterRole = async ctx => { return role; }; -const getSupportGpuList = async ctx => { - const token = ctx.cookies.get('token'); - let gpuKinds = []; - if (!token) { - return []; - } - try { - const list = await sendGatewayRequest({ - method: 'GET', - url: '/kapis/config.kubesphere.io/v1alpha2/configs/gpu/kinds', - token, - }); - if (Array.isArray(list)) { - const defaultGpu = list.filter(item => item.default).map(item => item.resourceName); - - const otherGpus = list.filter(item => !item.default).map(item => item.resourceName); - - gpuKinds = [...defaultGpu, ...otherGpus]; - } - } catch (error) { - console.error(error); - } - - return gpuKinds; -}; - const getOAuthInfo = async () => { let resp = []; try { @@ -511,27 +485,6 @@ const createUser = (params, token) => { }); }; -const getInstallerSpec = async ctx => { - const token = ctx.cookies.get('token'); - if (!token) { - return {}; - } - - try { - const result = await sendGatewayRequest({ - method: 'GET', - url: `/apis/installer.kubesphere.io/v1alpha1/clusterconfigurations?name=ks-installer`, - token, - }); - - return result.items[0].spec; - } catch (error) { - console.error(error); - } - - return {}; -}; - const getTheme = async () => { try { const theme = await sendGatewayRequest({ @@ -566,7 +519,5 @@ module.exports = { getK8sRuntime, createUser, getClusterRole, - getSupportGpuList, - getInstallerSpec, getTheme, };