fix connection note
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
3e321327a4
commit
89071a4fdb
@ -1098,14 +1098,13 @@ showSetOSAccount(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
showAuditDialog(SessionID sessionId, dialogManager) async {
|
showAuditDialog(FFI ffi) async {
|
||||||
final controller = TextEditingController();
|
final controller = TextEditingController(text: ffi.auditNote);
|
||||||
dialogManager.show((setState, close, context) {
|
ffi.dialogManager.show((setState, close, context) {
|
||||||
submit() {
|
submit() {
|
||||||
var text = controller.text.trim();
|
var text = controller.text;
|
||||||
if (text != '') {
|
bind.sessionSendNote(sessionId: ffi.sessionId, note: text);
|
||||||
bind.sessionSendNote(sessionId: sessionId, note: text);
|
ffi.auditNote = text;
|
||||||
}
|
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ List<TTextMenu> toolbarControls(BuildContext context, String id, FFI ffi) {
|
|||||||
v.add(
|
v.add(
|
||||||
TTextMenu(
|
TTextMenu(
|
||||||
child: Text(translate('Note')),
|
child: Text(translate('Note')),
|
||||||
onPressed: () => showAuditDialog(sessionId, ffi.dialogManager)),
|
onPressed: () => showAuditDialog(ffi)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// divider
|
// divider
|
||||||
|
@ -1575,6 +1575,7 @@ class FFI {
|
|||||||
var version = '';
|
var version = '';
|
||||||
var connType = ConnType.defaultConn;
|
var connType = ConnType.defaultConn;
|
||||||
var closed = false;
|
var closed = false;
|
||||||
|
var auditNote = '';
|
||||||
|
|
||||||
/// dialogManager use late to ensure init after main page binding [globalKey]
|
/// dialogManager use late to ensure init after main page binding [globalKey]
|
||||||
late final dialogManager = OverlayDialogManager();
|
late final dialogManager = OverlayDialogManager();
|
||||||
@ -1624,6 +1625,7 @@ class FFI {
|
|||||||
String? password,
|
String? password,
|
||||||
bool? forceRelay}) {
|
bool? forceRelay}) {
|
||||||
closed = false;
|
closed = false;
|
||||||
|
auditNote = '';
|
||||||
assert(!(isFileTransfer && isPortForward), 'more than one connect type');
|
assert(!(isFileTransfer && isPortForward), 'more than one connect type');
|
||||||
if (isFileTransfer) {
|
if (isFileTransfer) {
|
||||||
connType = ConnType.fileTransfer;
|
connType = ConnType.fileTransfer;
|
||||||
|
@ -342,8 +342,8 @@ class Header: Reactor.Component {
|
|||||||
<textarea .outline-focus spellcheck="false" name="text" novalue="input note here" style="overflow: scroll-indicator; width:*; height: 140px; font-size: 1.2em; padding: 0.5em;">{self.conn_note}</textarea>
|
<textarea .outline-focus spellcheck="false" name="text" novalue="input note here" style="overflow: scroll-indicator; width:*; height: 140px; font-size: 1.2em; padding: 0.5em;">{self.conn_note}</textarea>
|
||||||
</div>, "", function(res=null) {
|
</div>, "", function(res=null) {
|
||||||
if (!res) return;
|
if (!res) return;
|
||||||
if (!res.text) return;
|
if (res.text == null || res.text == undefined) return;
|
||||||
self.conn_note = res.text;
|
self.conn_note = res.text ?? "";
|
||||||
handler.send_note(res.text);
|
handler.send_note(res.text);
|
||||||
}, 280);
|
}, 280);
|
||||||
}
|
}
|
||||||
|
@ -1348,6 +1348,6 @@ async fn start_one_port_forward<T: InvokeUiSession>(
|
|||||||
|
|
||||||
#[tokio::main(flavor = "current_thread")]
|
#[tokio::main(flavor = "current_thread")]
|
||||||
async fn send_note(url: String, id: String, conn_id: i32, note: String) {
|
async fn send_note(url: String, id: String, conn_id: i32, note: String) {
|
||||||
let body = serde_json::json!({ "id": id, "Id": conn_id, "note": note });
|
let body = serde_json::json!({ "id": id, "conn_id": conn_id, "note": note });
|
||||||
allow_err!(crate::post_request(url, body.to_string(), "").await);
|
allow_err!(crate::post_request(url, body.to_string(), "").await);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user