mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-02-16 01:41:23 +01:00
fix statfile atom dependencies via formatRemoteUri (#1797)
This commit is contained in:
parent
a98242138d
commit
68cf3fd412
@ -4,7 +4,7 @@
|
|||||||
import { Button } from "@/app/element/button";
|
import { Button } from "@/app/element/button";
|
||||||
import { Input } from "@/app/element/input";
|
import { Input } from "@/app/element/input";
|
||||||
import { ContextMenuModel } from "@/app/store/contextmenu";
|
import { ContextMenuModel } from "@/app/store/contextmenu";
|
||||||
import { PLATFORM, atoms, createBlock, getApi } from "@/app/store/global";
|
import { PLATFORM, atoms, createBlock, getApi, globalStore } from "@/app/store/global";
|
||||||
import { RpcApi } from "@/app/store/wshclientapi";
|
import { RpcApi } from "@/app/store/wshclientapi";
|
||||||
import { TabRpcClient } from "@/app/store/wshrpcutil";
|
import { TabRpcClient } from "@/app/store/wshrpcutil";
|
||||||
import type { PreviewModel } from "@/app/view/preview/preview";
|
import type { PreviewModel } from "@/app/view/preview/preview";
|
||||||
@ -296,8 +296,8 @@ function DirectoryTable({
|
|||||||
console.log(`replacing ${fileName} with ${newName}: ${path}`);
|
console.log(`replacing ${fileName} with ${newName}: ${path}`);
|
||||||
fireAndForget(async () => {
|
fireAndForget(async () => {
|
||||||
await RpcApi.FileMoveCommand(TabRpcClient, {
|
await RpcApi.FileMoveCommand(TabRpcClient, {
|
||||||
srcuri: await model.formatRemoteUri(path),
|
srcuri: await model.formatRemoteUri(path, globalStore.get),
|
||||||
desturi: await model.formatRemoteUri(newPath),
|
desturi: await model.formatRemoteUri(newPath, globalStore.get),
|
||||||
opts: {
|
opts: {
|
||||||
recursive: true,
|
recursive: true,
|
||||||
},
|
},
|
||||||
@ -610,7 +610,7 @@ function TableBody({
|
|||||||
meta: {
|
meta: {
|
||||||
controller: "shell",
|
controller: "shell",
|
||||||
view: "term",
|
view: "term",
|
||||||
"cmd:cwd": await model.formatRemoteUri(finfo.path),
|
"cmd:cwd": await model.formatRemoteUri(finfo.path, globalStore.get),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
await createBlock(termBlockDef);
|
await createBlock(termBlockDef);
|
||||||
@ -627,7 +627,7 @@ function TableBody({
|
|||||||
fireAndForget(async () => {
|
fireAndForget(async () => {
|
||||||
await RpcApi.FileDeleteCommand(TabRpcClient, {
|
await RpcApi.FileDeleteCommand(TabRpcClient, {
|
||||||
info: {
|
info: {
|
||||||
path: await model.formatRemoteUri(finfo.path),
|
path: await model.formatRemoteUri(finfo.path, globalStore.get),
|
||||||
},
|
},
|
||||||
}).catch((e) => console.log(e));
|
}).catch((e) => console.log(e));
|
||||||
setRefreshVersion((current) => current + 1);
|
setRefreshVersion((current) => current + 1);
|
||||||
@ -726,7 +726,7 @@ function DirectoryPreview({ model }: DirectoryPreviewProps) {
|
|||||||
TabRpcClient,
|
TabRpcClient,
|
||||||
{
|
{
|
||||||
info: {
|
info: {
|
||||||
path: await model.formatRemoteUri(dirPath),
|
path: await model.formatRemoteUri(dirPath, globalStore.get),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
null
|
null
|
||||||
@ -825,7 +825,7 @@ function DirectoryPreview({ model }: DirectoryPreviewProps) {
|
|||||||
TabRpcClient,
|
TabRpcClient,
|
||||||
{
|
{
|
||||||
info: {
|
info: {
|
||||||
path: await model.formatRemoteUri(`${dirPath}/${newName}`),
|
path: await model.formatRemoteUri(`${dirPath}/${newName}`, globalStore.get),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
null
|
null
|
||||||
@ -844,7 +844,7 @@ function DirectoryPreview({ model }: DirectoryPreviewProps) {
|
|||||||
fireAndForget(async () => {
|
fireAndForget(async () => {
|
||||||
await RpcApi.FileMkdirCommand(TabRpcClient, {
|
await RpcApi.FileMkdirCommand(TabRpcClient, {
|
||||||
info: {
|
info: {
|
||||||
path: await model.formatRemoteUri(`${dirPath}/${newName}`),
|
path: await model.formatRemoteUri(`${dirPath}/${newName}`, globalStore.get),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
model.refreshCallback();
|
model.refreshCallback();
|
||||||
|
@ -371,7 +371,7 @@ export class PreviewModel implements ViewModel {
|
|||||||
}
|
}
|
||||||
const statFile = await RpcApi.FileInfoCommand(TabRpcClient, {
|
const statFile = await RpcApi.FileInfoCommand(TabRpcClient, {
|
||||||
info: {
|
info: {
|
||||||
path: await this.formatRemoteUri(fileName),
|
path: await this.formatRemoteUri(fileName, get),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log("stat file", statFile);
|
console.log("stat file", statFile);
|
||||||
@ -392,7 +392,7 @@ export class PreviewModel implements ViewModel {
|
|||||||
}
|
}
|
||||||
const file = await RpcApi.FileReadCommand(TabRpcClient, {
|
const file = await RpcApi.FileReadCommand(TabRpcClient, {
|
||||||
info: {
|
info: {
|
||||||
path: await this.formatRemoteUri(fileName),
|
path: await this.formatRemoteUri(fileName, get),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log("full file", file);
|
console.log("full file", file);
|
||||||
@ -604,7 +604,7 @@ export class PreviewModel implements ViewModel {
|
|||||||
try {
|
try {
|
||||||
await RpcApi.FileWriteCommand(TabRpcClient, {
|
await RpcApi.FileWriteCommand(TabRpcClient, {
|
||||||
info: {
|
info: {
|
||||||
path: await this.formatRemoteUri(filePath),
|
path: await this.formatRemoteUri(filePath, globalStore.get),
|
||||||
},
|
},
|
||||||
data64: stringToBase64(newFileContent),
|
data64: stringToBase64(newFileContent),
|
||||||
});
|
});
|
||||||
@ -780,7 +780,7 @@ export class PreviewModel implements ViewModel {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
async formatRemoteUri(path: string): Promise<string> {
|
async formatRemoteUri(path: string, get: Getter): Promise<string> {
|
||||||
const conn = (await globalStore.get(this.connection)) ?? "local";
|
const conn = (await globalStore.get(this.connection)) ?? "local";
|
||||||
return `wsh://${conn}/${path}`;
|
return `wsh://${conn}/${path}`;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user