mirror of
https://github.com/wavetermdev/backup.git
synced 2026-08-05 13:57:07 -07:00
update sharename
This commit is contained in:
+12
-1
@@ -263,6 +263,17 @@ class Screen {
|
||||
return (this.shareMode.get() == "web") && (this.webShareOpts.get() != null);
|
||||
}
|
||||
|
||||
getShareName() : string {
|
||||
if (!this.isWebShared()) {
|
||||
return null;
|
||||
}
|
||||
let opts = this.webShareOpts.get();
|
||||
if (opts == null) {
|
||||
return null;
|
||||
}
|
||||
return opts.sharename;
|
||||
}
|
||||
|
||||
getWebShareUrl() : string {
|
||||
let viewKey : string = null;
|
||||
if (this.webShareOpts.get() != null) {
|
||||
@@ -3464,7 +3475,7 @@ class CommandRunner {
|
||||
GlobalModel.submitCommand("screen", "set", null, {"focus": focusVal, "nohist": "1"}, false);
|
||||
}
|
||||
|
||||
screenSetSettings(screenId : string, settings : {tabcolor? : string, name? : string}, interactive : boolean) : Promise<CommandRtnType> {
|
||||
screenSetSettings(screenId : string, settings : {tabcolor? : string, name? : string, sharename? : string}, interactive : boolean) : Promise<CommandRtnType> {
|
||||
let kwargs = Object.assign({}, settings);
|
||||
kwargs["nohist"] = "1";
|
||||
kwargs["screen"] = screenId;
|
||||
|
||||
+4
-15
@@ -34,17 +34,6 @@ function getRemoteTitle(remote : RemoteType) {
|
||||
return remote.remotecanonicalname;
|
||||
}
|
||||
|
||||
function isStrEq(s1 : string, s2 : string) {
|
||||
if (util.isBlank(s1) && util.isBlank(s2)) {
|
||||
return true;
|
||||
}
|
||||
return s1 == s2;
|
||||
}
|
||||
|
||||
function isBoolEq(b1 : boolean, b2 : boolean) {
|
||||
return (!!b1) == (!!b2);
|
||||
}
|
||||
|
||||
@mobxReact.observer
|
||||
class AuthModeDropdown extends React.Component<{tempVal : OV<string>}, {}> {
|
||||
active : OV<boolean> = mobx.observable.box(false, {name: "AuthModeDropdown-active"});
|
||||
@@ -491,7 +480,7 @@ class EditRemoteSettings extends React.Component<{model : RemotesModalModel, rem
|
||||
let {remote, remoteEdit} = this.props;
|
||||
let authMode = this.tempAuthMode.get();
|
||||
let kwargs : Record<string, string> = {};
|
||||
if (!isStrEq(this.tempKeyFile.get(), remoteEdit.keystr)) {
|
||||
if (!util.isStrEq(this.tempKeyFile.get(), remoteEdit.keystr)) {
|
||||
if (authMode == "key" || authMode == "key+password") {
|
||||
kwargs["key"] = this.tempKeyFile.get();
|
||||
}
|
||||
@@ -509,13 +498,13 @@ class EditRemoteSettings extends React.Component<{model : RemotesModalModel, rem
|
||||
kwargs["password"] = ""
|
||||
}
|
||||
}
|
||||
if (!isStrEq(this.tempAlias.get(), remote.remotealias)) {
|
||||
if (!util.isStrEq(this.tempAlias.get(), remote.remotealias)) {
|
||||
kwargs["alias"] = this.tempAlias.get();
|
||||
}
|
||||
if (!isStrEq(this.tempConnectMode.get(), remote.connectmode)) {
|
||||
if (!util.isStrEq(this.tempConnectMode.get(), remote.connectmode)) {
|
||||
kwargs["connectmode"] = this.tempConnectMode.get();
|
||||
}
|
||||
if (!isBoolEq(this.tempAutoInstall.get(), remote.autoinstall)) {
|
||||
if (!util.isBoolEq(this.tempAutoInstall.get(), remote.autoinstall)) {
|
||||
kwargs["autoinstall"] = (this.tempAutoInstall.get() ? "1" : "0");
|
||||
}
|
||||
if (Object.keys(kwargs).length == 0) {
|
||||
|
||||
+28
-2
@@ -135,14 +135,27 @@ class ScreenSettingsModal extends React.Component<{sessionId : string, screenId
|
||||
if (screen == null) {
|
||||
return;
|
||||
}
|
||||
console.log("inline update name", val);
|
||||
if (val == screen.name.get()) {
|
||||
if (util.isStrEq(val, screen.name.get())) {
|
||||
return;
|
||||
}
|
||||
let prtn = GlobalCommandRunner.screenSetSettings(this.props.screenId, {name: val}, false);
|
||||
commandRtnHandler(prtn, this.errorMessage);
|
||||
}
|
||||
|
||||
@boundMethod
|
||||
inlineUpdateShareName(val : string) : void {
|
||||
let {sessionId, screenId} = this.props;
|
||||
let screen = GlobalModel.getScreenById(sessionId, screenId);
|
||||
if (screen == null) {
|
||||
return;
|
||||
}
|
||||
if (util.isStrEq(val, screen.getShareName())) {
|
||||
return;
|
||||
}
|
||||
let prtn = GlobalCommandRunner.screenSetSettings(this.props.screenId, {sharename: val}, false);
|
||||
commandRtnHandler(prtn, this.errorMessage);
|
||||
}
|
||||
|
||||
@boundMethod
|
||||
setErrorMessage(msg : string) : void {
|
||||
mobx.action(() => {
|
||||
@@ -253,6 +266,19 @@ class ScreenSettingsModal extends React.Component<{sessionId : string, screenId
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="settings-field sub-field">
|
||||
<div className="settings-label">
|
||||
Share Name
|
||||
</div>
|
||||
<div className="settings-input">
|
||||
<div className="settings-input">
|
||||
<InlineSettingsTextEdit placeholder="name"
|
||||
text={util.isBlank(screen.getShareName()) ? "(none)" : screen.getShareName()}
|
||||
value={screen.getShareName() ?? ""}
|
||||
onChange={this.inlineUpdateShareName} maxLength={150} showIcon={true}/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</If>
|
||||
<SettingsError errorMessage={this.errorMessage}/>
|
||||
</div>
|
||||
|
||||
+12
-1
@@ -333,4 +333,15 @@ function makeExternLink(url : string) : string {
|
||||
return "https://extern?" + encodeURIComponent(url);
|
||||
}
|
||||
|
||||
export {handleJsonFetchResponse, base64ToArray, genMergeData, genMergeDataMap, genMergeSimpleData, parseEnv0, boundInt, isModKeyPress, incObs, isBlank, loadFonts, getTodayStr, getYesterdayStr, getDateStr, sortAndFilterRemotes, makeExternLink};
|
||||
function isStrEq(s1 : string, s2 : string) {
|
||||
if (isBlank(s1) && isBlank(s2)) {
|
||||
return true;
|
||||
}
|
||||
return s1 == s2;
|
||||
}
|
||||
|
||||
function isBoolEq(b1 : boolean, b2 : boolean) {
|
||||
return (!!b1) == (!!b2);
|
||||
}
|
||||
|
||||
export {handleJsonFetchResponse, base64ToArray, genMergeData, genMergeDataMap, genMergeSimpleData, parseEnv0, boundInt, isModKeyPress, incObs, isBlank, loadFonts, getTodayStr, getYesterdayStr, getDateStr, sortAndFilterRemotes, makeExternLink, isStrEq, isBoolEq};
|
||||
|
||||
Reference in New Issue
Block a user