-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### 问题 因初始化时无法通过token或auth鉴权,导致系统初始化时的可用集群查询结果为空 ![image](https://github.com/PKUHPC/SCOW/assets/43978285/8b5fa308-6044-4622-9e81-15e055d7fa01) ### 修改 在管理系统的web端原有获取集群配置信息接口以外增加返回简单集群信息的web接口 `getSimpleClustersInfoFromConfigFiles` 返回信息仅包含 `clusterId, displayName,` 及用于优先级排序的 `priority` 在`getSimpleClustersInfoFromConfigFiles` 及获取当前集群在线信息接口中` getClustersRuntimeInfo` 增加是否已初始化判断,未初始化时允许所有人获取简单集群在线信息 ### 修改后 系统初始化时获取集群信息正常,各操作正常,初始化完成后登录正常 ![集群停用初始化](https://github.com/PKUHPC/SCOW/assets/43978285/3149453e-f0b0-495b-8c40-8edf391211ed) <img width="677" alt="faa3afca5e2e2cc4219edc077f2ef6f" src="https://github.com/PKUHPC/SCOW/assets/43978285/59f8b8a9-222d-492f-bb33-89bdc404d54e">
- Loading branch information
Showing
12 changed files
with
155 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
"@scow/mis-web": patch | ||
"@scow/config": patch | ||
"@scow/lib-ssh": patch | ||
"@scow/lib-web": patch | ||
--- | ||
|
||
修复系统初始化时因无法通过鉴权可用集群为空的问题 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/** | ||
* Copyright (c) 2022 Peking University and Peking University Institute for Computing and Digital Economy | ||
* SCOW is licensed under Mulan PSL v2. | ||
* You can use this software according to the terms and conditions of the Mulan PSL v2. | ||
* You may obtain a copy of Mulan PSL v2 at: | ||
* http://license.coscl.org.cn/MulanPSL2 | ||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, | ||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, | ||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. | ||
* See the Mulan PSL v2 for more details. | ||
*/ | ||
|
||
/** | ||
* Copyright (c) 2022 Peking University and Peking University Institute for Computing and Digital Economy | ||
* SCOW is licensed under Mulan PSL v2. | ||
* You can use this software according to the terms and conditions of the Mulan PSL v2. | ||
* You may obtain a copy of Mulan PSL v2 at: | ||
* http://license.coscl.org.cn/MulanPSL2 | ||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, | ||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, | ||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. | ||
* See the Mulan PSL v2 for more details. | ||
*/ | ||
|
||
import { typeboxRouteSchema } from "@ddadaal/next-typed-api-routes-runtime"; | ||
import { getClusterConfigFiles } from "src/server/clusterConfig"; | ||
import { ClusterConfigSchema, SimpleClusterSchema } from "@scow/config/build/cluster"; | ||
import { route } from "src/utils/route"; | ||
import { Type } from "@sinclair/typebox"; | ||
import { queryIfInitialized } from "src/utils/init"; | ||
import { authenticate } from "src/auth/server"; | ||
|
||
export const GetSimpleClustersInfoFromConfigFilesSchema = typeboxRouteSchema({ | ||
method: "GET", | ||
|
||
responses: { | ||
|
||
200: Type.Object({ | ||
clustersInfo: Type.Record(Type.String(), SimpleClusterSchema) }), | ||
}, | ||
}); | ||
|
||
const auth = authenticate(() => true); | ||
export default route(GetSimpleClustersInfoFromConfigFilesSchema, | ||
async (req, res) => { | ||
|
||
// if not initialized, every one can getSimpleClusterInfo which includes clusterId, displayedName and priority | ||
if (await queryIfInitialized()) { | ||
const info = await auth(req, res); | ||
if (!info) { return; } | ||
} | ||
|
||
const clustersFullInfo: Record<string, ClusterConfigSchema> = await getClusterConfigFiles(); | ||
|
||
const clustersInfo: Record<string, SimpleClusterSchema> = {}; | ||
|
||
Object.keys(clustersFullInfo).forEach(key => { | ||
clustersInfo[key] = { | ||
clusterId: key, | ||
displayName: clustersFullInfo[key].displayName, | ||
priority: clustersFullInfo[key].priority, | ||
}; | ||
}); | ||
|
||
return { | ||
200: { clustersInfo }, | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters