mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-02-22 02:41:23 +01:00
updates for new webremote, fix bug in cwd computation
This commit is contained in:
parent
99cf937ffd
commit
394a2a9ab3
@ -62,15 +62,12 @@ function replaceHomePath(path : string, homeDir : string) : string {
|
||||
}
|
||||
|
||||
function getCwdStr(remote : RemoteType, state : FeStateType) : string {
|
||||
if ((state == null || state.cwd == null) && remote != null) {
|
||||
if (state == null || isBlank(state.cwd)) {
|
||||
return "~";
|
||||
}
|
||||
let cwd = "?";
|
||||
if (state && state.cwd) {
|
||||
cwd = state.cwd;
|
||||
}
|
||||
let cwd = state.cwd;
|
||||
if (remote && remote.remotevars.home) {
|
||||
cwd = replaceHomePath(cwd, remote.remotevars.cwd)
|
||||
cwd = replaceHomePath(cwd, remote.remotevars.home)
|
||||
}
|
||||
return cwd;
|
||||
}
|
||||
|
@ -966,7 +966,6 @@ class InfoRemoteEdit extends React.Component<{}, {}> {
|
||||
kwargs["autoinstall"] = (this.autoInstallBool.get() ? "1" : "0");
|
||||
kwargs["visual"] = "1";
|
||||
kwargs["submit"] = "1";
|
||||
console.log("submit remote", (isEditing ? redit.remoteid : cname), kwargs);
|
||||
mobx.action(() => {
|
||||
if (isEditing) {
|
||||
GlobalCommandRunner.editRemote(redit.remoteid, kwargs);
|
||||
|
@ -506,9 +506,12 @@ type WebLine = {
|
||||
};
|
||||
|
||||
type WebRemote = {
|
||||
remoteid : string,
|
||||
alias : string,
|
||||
canonicalname : string,
|
||||
name : string,
|
||||
homedir : string,
|
||||
isroot : boolean,
|
||||
};
|
||||
|
||||
type WebCmd = {
|
||||
|
@ -43,18 +43,13 @@ function replaceHomePath(path : string, homeDir : string) : string {
|
||||
return path;
|
||||
}
|
||||
|
||||
function getCwdStr(state : T.FeStateType) : string {
|
||||
let remote = null;
|
||||
if ((state == null || state.cwd == null) && remote != null) {
|
||||
function getCwdStr(remote : T.WebRemote, state : T.FeStateType) : string {
|
||||
if (state == null || isBlank(state.cwd)) {
|
||||
return "~";
|
||||
}
|
||||
let cwd = "?";
|
||||
if (state && state.cwd) {
|
||||
cwd = state.cwd;
|
||||
}
|
||||
// TODO fix
|
||||
if (remote && remote.remotevars.home) {
|
||||
cwd = replaceHomePath(cwd, remote.remotevars.cwd)
|
||||
let cwd = state.cwd;
|
||||
if (remote && remote.homedir) {
|
||||
cwd = replaceHomePath(cwd, remote.homedir)
|
||||
}
|
||||
return cwd;
|
||||
}
|
||||
@ -73,13 +68,8 @@ class Prompt extends React.Component<{remote : T.WebRemote, festate : T.FeStateT
|
||||
render() {
|
||||
let {remote, festate} = this.props;
|
||||
let remoteStr = getRemoteStr(remote);
|
||||
let cwd = getCwdStr(festate);
|
||||
let isRoot = false;
|
||||
// if (remote && remote.remotevars) {
|
||||
// if (remote.remotevars["sudo"] || remote.remotevars["bestuser"] == "root") {
|
||||
// isRoot = true;
|
||||
// }
|
||||
// }
|
||||
let cwd = getCwdStr(remote, festate);
|
||||
let isRoot = !!remote.isroot;
|
||||
let remoteColorClass = (isRoot ? "color-red" : "color-green");
|
||||
// if (remote && remote.remoteopts && remote.remoteopts.color) {
|
||||
// remoteColorClass = "color-" + remote.remoteopts.color;
|
||||
|
Loading…
Reference in New Issue
Block a user