Skip to content

Commit

Permalink
fix(shell): 修复文件管理下在终端中打开连接失败问题 (#1164)
Browse files Browse the repository at this point in the history
**问题**

1.文件管理下终端打开时url中连接了登录节点名称而不是登录节点地址导致连接失败


![image](https://github.com/PKUHPC/SCOW/assets/43978285/9adcc915-ab4a-4db4-86dd-6e826f908e53)

2.通过SHELL导航使用终端功能时,终端页面标题显示的时登录节点的地址而不是登录节点的名称,也无法实现国际化显示


![image](https://github.com/PKUHPC/SCOW/assets/43978285/c3c7f6b8-049b-41c0-8b88-46a2565a4b7a)

![image](https://github.com/PKUHPC/SCOW/assets/43978285/51642845-a05b-4a87-81f0-4604d65be981)

此PR修复上面两个问题

**修复后**

1.在文件管理下的在终端打开时可以正常连接SHELL
2.终端页面标题栏可以正常显示登录节点名称并实现国际化


![image](https://github.com/PKUHPC/SCOW/assets/43978285/1a8e7d50-3230-490e-bbed-5a32f367e2be)

![image](https://github.com/PKUHPC/SCOW/assets/43978285/f48faaab-3713-4f1a-8fb8-16f011f5aa8d)

![image](https://github.com/PKUHPC/SCOW/assets/43978285/23d30ff8-283d-4688-a5dc-76ca79f3b0a3)
  • Loading branch information
piccaSun authored Mar 11, 2024
1 parent fa89bf6 commit 25f9caf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/swift-papayas-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@scow/portal-web": patch
---

修复文件管理下在终端中打开连接失败及终端不显示登录节点名称的问题
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export const FileManager: React.FC<Props> = ({ cluster, path, urlPrefix }) => {
const [showHiddenFile, setShowHiddenFile] = useState(false);

const { loginNodes } = useStore(LoginNodeStore);
const loginNode = loginNodes[cluster.id][0].name;
const loginNode = loginNodes[cluster.id][0].address;

const reload = async (signal?: AbortSignal) => {
setLoading(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ import { NextPage } from "next";
import dynamic from "next/dynamic";
import Router, { useRouter } from "next/router";
import { useRef } from "react";
import { useStore } from "simstate";
import { requireAuth } from "src/auth/requireAuth";
import { NotFoundPage } from "src/components/errorPages/NotFoundPage";
import { Localized, useI18n, useI18nTranslateToString } from "src/i18n";
import { LoginNodeStore } from "src/stores/LoginNodeStore";
import { publicConfig } from "src/utils/config";
import { Head } from "src/utils/head";
import { styled } from "styled-components";
Expand Down Expand Up @@ -83,6 +85,9 @@ export const ShellPage: NextPage = requireAuth(() => true)(({ userStore }) => {
const loginNode = router.query.loginNode as string;
const paths = router.query.path as (string[] | undefined);

const { loginNodes } = useStore(LoginNodeStore);
const currentLoginNodeName = loginNodes[cluster].find((x) => x.address === loginNode)?.name ?? loginNode;

const headerRef = useRef<HTMLDivElement>(null);

const clusterName =
Expand All @@ -97,7 +102,7 @@ export const ShellPage: NextPage = requireAuth(() => true)(({ userStore }) => {
<h2>
<Localized
id="pages.shell.loginNode.content"
args={[userStore.user.identityId, clusterName, loginNode]}
args={[userStore.user.identityId, clusterName, currentLoginNodeName]}
/>
</h2>
<Space wrap>
Expand All @@ -112,7 +117,6 @@ export const ShellPage: NextPage = requireAuth(() => true)(({ userStore }) => {
getPopupContainer={() => headerRef.current || document.body}
content={() => (
<div>
{/* {t("pages.shell.loginNode.popoverContent1")} */}
<p><b>{t("pages.shell.loginNode.popoverContent1")}</b>
<Text code>sopen</Text>{t("pages.shell.loginNode.popoverContent2")}
</p>
Expand Down

0 comments on commit 25f9caf

Please sign in to comment.