Skip to content

Commit

Permalink
fix(portal-web): 修复选择模板进行提交作业时没有正确获取模板数据的问题 (#1286)
Browse files Browse the repository at this point in the history
**问题原因**

集群停用issue中修改query中的集群时不小心把useStore放在了if下,导致无法正确渲染 


**修复后**

使用在线集群的模板数据提交作业时可以正确渲染各模板中保存的值
同时确认了mis-web/portal-web中没有其他使用在线集群的useStore时出现没有放在顶层的问题

![image](https://github.com/PKUHPC/SCOW/assets/43978285/83931b11-0d32-4e93-affb-c363df9d82c2)
  • Loading branch information
piccaSun authored Jun 10, 2024
1 parent eacda16 commit 9709d45
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/light-cycles-fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@scow/portal-web": patch
---

修复选择模板来提交作业时没有获取到正确的模板数据的问题
7 changes: 3 additions & 4 deletions apps/portal-web/src/pages/jobs/submit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,14 @@ export const SubmitJobPage: NextPage<Props> = requireAuth(() => true)(
const query = useQuerystring();

const cluster = queryToString(query.cluster);
const { currentClusters } = useStore(ClusterInfoStore);
const clusterObj = currentClusters.find((x) => x.id === cluster);

const jobTemplateId = queryToString(query.jobTemplateId);

const { data, isLoading } = useAsync({
promiseFn: useCallback(async () => {
if (cluster && jobTemplateId) {

const { currentClusters } = useStore(ClusterInfoStore);

const clusterObj = currentClusters.find((x) => x.id === cluster);
if (!clusterObj) { return undefined; }
return api.getJobTemplate({ query: { cluster, id: jobTemplateId } })
.then(({ template }) => ({
Expand Down

0 comments on commit 9709d45

Please sign in to comment.