MCPcopy Create free account
hub / github.com/MCSManager/MCSManager / handleChangeDir

Function handleChangeDir

frontend/src/hooks/useFileManager.ts:947–986  ·  view source on GitHub ↗
(dir: string)

Source from the content-addressed store, hash-verified

945 };
946
947 const handleChangeDir = async (dir: string) => {
948 if (!dir) return;
949
950 const oldPath = currentPath.value;
951 const oldBreadcrumbs = [...breadcrumbs];
952 const oldDisk = currentDisk.value;
953
954 spinning.value = true;
955 try {
956 updateBreadcrumbs(dir);
957
958 operationForm.value.name = "";
959 operationForm.value.current = 1;
960
961 await getFileList(true);
962
963 const thisTab = currentTabs.value.find((e) => e.key === activeTab.value);
964 if (thisTab) {
965 thisTab.path = dir;
966 thisTab.name = getLastNameFromPath(dir);
967 }
968 } catch (error: any) {
969 console.error("Path jump failed:", error);
970
971 breadcrumbs.length = 0;
972 oldBreadcrumbs.forEach((item) => breadcrumbs.push(item));
973 currentDisk.value = oldDisk;
974
975 await getFileList(false, oldPath).catch((err) =>
976 console.error("Failed to revert to old path after jump failure:", err)
977 );
978
979 const errorMsg = `${t("TXT_CODE_96281410")} ${
980 error.response?.data?.message || error.message || ""
981 }`;
982 return reportErrorMsg(errorMsg);
983 } finally {
984 spinning.value = false;
985 }
986 };
987
988 const handleTableChange = (e: { current: number; pageSize: number }) => {
989 selectedRowKeys.value = [];

Callers

nothing calls this directly

Calls 6

reportErrorMsgFunction · 0.90
updateBreadcrumbsFunction · 0.85
getFileListFunction · 0.85
getLastNameFromPathFunction · 0.85
errorMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected