gui: group session/agent params in new session dialog; add agent alias field
This commit is contained in:
parent
374349622e
commit
1b67305ef7
32
gui/main.qml
32
gui/main.qml
|
|
@ -351,6 +351,9 @@ ApplicationWindow {
|
||||||
spacing: 16
|
spacing: 16
|
||||||
Layout.margins: 16
|
Layout.margins: 16
|
||||||
|
|
||||||
|
// --- Session ---
|
||||||
|
Label { text: "Session"; font.bold: true; font.pointSize: theme.fontSize > 0 ? theme.fontSize + 1 : Qt.application.font.pointSize + 1 }
|
||||||
|
|
||||||
// Directory
|
// Directory
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
@ -415,10 +418,24 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Agent
|
// Remote
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Label { text: "Agent:"; Layout.preferredWidth: 80 }
|
Label { text: "Remote:"; Layout.preferredWidth: 80 }
|
||||||
|
TextField {
|
||||||
|
id: remoteField
|
||||||
|
Layout.fillWidth: true
|
||||||
|
placeholderText: "user@host:port"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Agent ---
|
||||||
|
Label { text: "Agent"; font.bold: true; font.pointSize: theme.fontSize > 0 ? theme.fontSize + 1 : Qt.application.font.pointSize + 1 }
|
||||||
|
|
||||||
|
// Agent profile
|
||||||
|
RowLayout {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Label { text: "Profile:"; Layout.preferredWidth: 80 }
|
||||||
ComboBox {
|
ComboBox {
|
||||||
id: agentCombo
|
id: agentCombo
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
@ -428,14 +445,14 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remote
|
// Agent Name
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Label { text: "Remote:"; Layout.preferredWidth: 80 }
|
Label { text: "Alias:"; Layout.preferredWidth: 80 }
|
||||||
TextField {
|
TextField {
|
||||||
id: remoteField
|
id: agentAliasField
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
placeholderText: "user@host:port"
|
placeholderText: "(auto-generated)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -477,8 +494,9 @@ ApplicationWindow {
|
||||||
var model = modelCombo.currentIndex >= 0 ? modelCombo.currentText.trim() : ""
|
var model = modelCombo.currentIndex >= 0 ? modelCombo.currentText.trim() : ""
|
||||||
var agent = agentCombo.currentText
|
var agent = agentCombo.currentText
|
||||||
var remote = remoteField.text.trim()
|
var remote = remoteField.text.trim()
|
||||||
|
var agentAlias = agentAliasField.text.trim()
|
||||||
|
|
||||||
var ok = ollie.createSession(cwd, name, backend, model, agent, remote)
|
var ok = ollie.createSession(cwd, name, backend, model, agent, remote, agentAlias)
|
||||||
if (ok) {
|
if (ok) {
|
||||||
ollie.refreshSessions()
|
ollie.refreshSessions()
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -264,7 +264,7 @@ QStringList Ollie9pClient::getAvailableModels(const QString &backend) const
|
||||||
return it.value().toStringList();
|
return it.value().toStringList();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Ollie9pClient::createSession(const QString &cwd, const QString &name, const QString &backend, const QString &model, const QString &agent, const QString &remote)
|
bool Ollie9pClient::createSession(const QString &cwd, const QString &name, const QString &backend, const QString &model, const QString &agent, const QString &remote, const QString &agentAlias)
|
||||||
{
|
{
|
||||||
if (cwd.isEmpty()) return false;
|
if (cwd.isEmpty()) return false;
|
||||||
|
|
||||||
|
|
@ -275,6 +275,7 @@ bool Ollie9pClient::createSession(const QString &cwd, const QString &name, const
|
||||||
if (!model.isEmpty()) args << "model=" + model;
|
if (!model.isEmpty()) args << "model=" + model;
|
||||||
if (!agent.isEmpty()) args << "agent=" + agent;
|
if (!agent.isEmpty()) args << "agent=" + agent;
|
||||||
if (!remote.isEmpty()) args << "remote=" + remote;
|
if (!remote.isEmpty()) args << "remote=" + remote;
|
||||||
|
if (!agentAlias.isEmpty()) args << "agent_alias=" + agentAlias;
|
||||||
|
|
||||||
QProcess proc;
|
QProcess proc;
|
||||||
QStringList fullArgs = {"-a", serverAddr(), "write", "session/new"};
|
QStringList fullArgs = {"-a", serverAddr(), "write", "session/new"};
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ public:
|
||||||
Q_INVOKABLE void loadRootBackends();
|
Q_INVOKABLE void loadRootBackends();
|
||||||
Q_INVOKABLE void loadRootAgents();
|
Q_INVOKABLE void loadRootAgents();
|
||||||
Q_INVOKABLE QStringList getAvailableModels(const QString &backend) const;
|
Q_INVOKABLE QStringList getAvailableModels(const QString &backend) const;
|
||||||
Q_INVOKABLE bool createSession(const QString &cwd, const QString &name, const QString &backend, const QString &model, const QString &agent, const QString &remote);
|
Q_INVOKABLE bool createSession(const QString &cwd, const QString &name, const QString &backend, const QString &model, const QString &agent, const QString &remote, const QString &agentAlias);
|
||||||
Q_INVOKABLE bool renameSession(const QString &sessionId, const QString &newName);
|
Q_INVOKABLE bool renameSession(const QString &sessionId, const QString &newName);
|
||||||
Q_INVOKABLE bool renameAgent(const QString &sessionId, const QString &agentId, const QString &newName);
|
Q_INVOKABLE bool renameAgent(const QString &sessionId, const QString &agentId, const QString &newName);
|
||||||
|
|
||||||
|
|
|
||||||
Reference in New Issue