gui: add remote field to new session dialog
Allow specifying a remote target (e.g. user@host) when creating a session from the GUI. Empty means local execution. The value is passed through to the D-Bus CreateSession method's remote parameter.
This commit is contained in:
parent
17f9d30aaa
commit
5dfdd2bd31
|
|
@ -190,6 +190,7 @@ ApplicationWindow {
|
||||||
|
|
||||||
function openNewSessionDialog() {
|
function openNewSessionDialog() {
|
||||||
nameInput.text = ""
|
nameInput.text = ""
|
||||||
|
remoteInput.text = ""
|
||||||
newSessionDialog.backendModel = dbus.listBackends()
|
newSessionDialog.backendModel = dbus.listBackends()
|
||||||
newSessionDialog.agentModel = dbus.listAgents()
|
newSessionDialog.agentModel = dbus.listAgents()
|
||||||
newSessionDialog.cwdField.text = dbus.activeCwd || ""
|
newSessionDialog.cwdField.text = dbus.activeCwd || ""
|
||||||
|
|
@ -224,7 +225,8 @@ ApplicationWindow {
|
||||||
var model = modelSelect.editText.trim() || modelSelect.currentText
|
var model = modelSelect.editText.trim() || modelSelect.currentText
|
||||||
var agent = agentSelect.currentText
|
var agent = agentSelect.currentText
|
||||||
var name = nameInput.text.trim()
|
var name = nameInput.text.trim()
|
||||||
dbus.createSession(cwd, backend, model, name, agent)
|
var remote = remoteInput.text.trim()
|
||||||
|
dbus.createSession(cwd, backend, model, name, agent, remote)
|
||||||
}
|
}
|
||||||
|
|
||||||
GridLayout {
|
GridLayout {
|
||||||
|
|
@ -284,6 +286,13 @@ ApplicationWindow {
|
||||||
editable: true
|
editable: true
|
||||||
editText: ""
|
editText: ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Label { text: "Remote:" }
|
||||||
|
TextField {
|
||||||
|
id: remoteInput
|
||||||
|
Layout.fillWidth: true
|
||||||
|
placeholderText: "user@host (empty = local)"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -279,12 +279,12 @@ QStringList OllieDBusClient::listAgents()
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
QString OllieDBusClient::createSession(const QString &cwd, const QString &backend, const QString &model, const QString &name, const QString &agent)
|
QString OllieDBusClient::createSession(const QString &cwd, const QString &backend, const QString &model, const QString &name, const QString &agent, const QString &remote)
|
||||||
{
|
{
|
||||||
QString dir = cwd.isEmpty() ? QDir::homePath() : cwd;
|
QString dir = cwd.isEmpty() ? QDir::homePath() : cwd;
|
||||||
QString agentName = agent.isEmpty() ? QString("default") : agent;
|
QString agentName = agent.isEmpty() ? QString("default") : agent;
|
||||||
auto *watcher = new QDBusPendingCallWatcher(
|
auto *watcher = new QDBusPendingCallWatcher(
|
||||||
m_iface->asyncCall("CreateSession", dir, backend, model, agentName, QString(), QString()),
|
m_iface->asyncCall("CreateSession", dir, backend, model, agentName, QString(), remote),
|
||||||
this);
|
this);
|
||||||
connect(watcher, &QDBusPendingCallWatcher::finished, this, [this, name](QDBusPendingCallWatcher *w) {
|
connect(watcher, &QDBusPendingCallWatcher::finished, this, [this, name](QDBusPendingCallWatcher *w) {
|
||||||
QDBusPendingReply<QString> reply = *w;
|
QDBusPendingReply<QString> reply = *w;
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ public:
|
||||||
|
|
||||||
Q_INVOKABLE void refreshSessions();
|
Q_INVOKABLE void refreshSessions();
|
||||||
Q_INVOKABLE void fetchChat();
|
Q_INVOKABLE void fetchChat();
|
||||||
Q_INVOKABLE QString createSession(const QString &cwd, const QString &backend = QString(), const QString &model = QString(), const QString &name = QString(), const QString &agent = QString());
|
Q_INVOKABLE QString createSession(const QString &cwd, const QString &backend = QString(), const QString &model = QString(), const QString &name = QString(), const QString &agent = QString(), const QString &remote = QString());
|
||||||
Q_INVOKABLE QStringList listAgents();
|
Q_INVOKABLE QStringList listAgents();
|
||||||
Q_INVOKABLE void createSessionWithDialog();
|
Q_INVOKABLE void createSessionWithDialog();
|
||||||
Q_INVOKABLE bool killSession(const QString &sessionId);
|
Q_INVOKABLE bool killSession(const QString &sessionId);
|
||||||
|
|
|
||||||
Reference in New Issue