mirror of
https://github.com/louislam/dockge.git
synced 2024-11-30 22:24:03 +00:00
feat: dockge agent friendly name
Add the option to set a friendly name to a dockge remote agent. If the field is not used the `agent.url` will be displayed
This commit is contained in:
parent
4a9173f5dc
commit
c0fc76a0c8
5 changed files with 18 additions and 4 deletions
|
@ -76,12 +76,14 @@ export class AgentManager {
|
||||||
* @param url
|
* @param url
|
||||||
* @param username
|
* @param username
|
||||||
* @param password
|
* @param password
|
||||||
|
* @param friendlyname
|
||||||
*/
|
*/
|
||||||
async add(url : string, username : string, password : string) : Promise<Agent> {
|
async add(url : string, username : string, password : string, friendlyname : string) : Promise<Agent> {
|
||||||
let bean = R.dispense("agent") as Agent;
|
let bean = R.dispense("agent") as Agent;
|
||||||
bean.url = url;
|
bean.url = url;
|
||||||
bean.username = username;
|
bean.username = username;
|
||||||
bean.password = password;
|
bean.password = password;
|
||||||
|
bean.friendlyname = friendlyname;
|
||||||
await R.store(bean);
|
await R.store(bean);
|
||||||
return bean;
|
return bean;
|
||||||
}
|
}
|
||||||
|
@ -276,6 +278,7 @@ export class AgentManager {
|
||||||
url: "",
|
url: "",
|
||||||
username: "",
|
username: "",
|
||||||
endpoint: "",
|
endpoint: "",
|
||||||
|
friendlyname: "",
|
||||||
};
|
};
|
||||||
|
|
||||||
for (let endpoint in list) {
|
for (let endpoint in list) {
|
||||||
|
|
|
@ -7,6 +7,7 @@ export async function up(knex: Knex): Promise<void> {
|
||||||
table.string("url", 255).notNullable().unique();
|
table.string("url", 255).notNullable().unique();
|
||||||
table.string("username", 255).notNullable();
|
table.string("username", 255).notNullable();
|
||||||
table.string("password", 255).notNullable();
|
table.string("password", 255).notNullable();
|
||||||
|
table.string("friendlyname", 255);
|
||||||
table.boolean("active").notNullable().defaultTo(true);
|
table.boolean("active").notNullable().defaultTo(true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ export class Agent extends BeanModel {
|
||||||
url: this.url,
|
url: this.url,
|
||||||
username: this.username,
|
username: this.username,
|
||||||
endpoint: this.endpoint,
|
endpoint: this.endpoint,
|
||||||
|
friendlyname: this.friendlyname
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ export class ManageAgentSocketHandler extends SocketHandler {
|
||||||
let data = requestData as LooseObject;
|
let data = requestData as LooseObject;
|
||||||
let manager = socket.instanceManager;
|
let manager = socket.instanceManager;
|
||||||
await manager.test(data.url, data.username, data.password);
|
await manager.test(data.url, data.username, data.password);
|
||||||
await manager.add(data.url, data.username, data.password);
|
await manager.add(data.url, data.username, data.password, data.friendlyname);
|
||||||
|
|
||||||
// connect to the agent
|
// connect to the agent
|
||||||
manager.connect(data.url, data.username, data.password);
|
manager.connect(data.url, data.username, data.password);
|
||||||
|
|
|
@ -49,8 +49,11 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- Agent Display Name -->
|
<!-- Agent Display Name -->
|
||||||
<span v-if="endpoint === ''">{{ $t("currentEndpoint") }}</span>
|
<template v-if="$root.agentStatusList[endpoint]">
|
||||||
<a v-else :href="agent.url" target="_blank">{{ endpoint }}</a>
|
<span v-if="endpoint === '' && agent.friendlyname === ''" class="badge bg-secondary me-2">Controller</span>
|
||||||
|
<span v-else-if="agent.friendlyname === ''" :href="agent.url">{{ endpoint }}</span>
|
||||||
|
<span v-else :href="agent.url">{{ agent.friendlyname }}</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
<!-- Remove Button -->
|
<!-- Remove Button -->
|
||||||
<font-awesome-icon v-if="endpoint !== ''" class="ms-2 remove-agent" icon="trash" @click="showRemoveAgentDialog[agent.url] = !showRemoveAgentDialog[agent.url]" />
|
<font-awesome-icon v-if="endpoint !== ''" class="ms-2 remove-agent" icon="trash" @click="showRemoveAgentDialog[agent.url] = !showRemoveAgentDialog[agent.url]" />
|
||||||
|
@ -81,6 +84,11 @@
|
||||||
<input id="password" v-model="agent.password" type="password" class="form-control" required autocomplete="new-password">
|
<input id="password" v-model="agent.password" type="password" class="form-control" required autocomplete="new-password">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="friendlyname" class="form-label">{{ $t("Friendly Name") }}</label>
|
||||||
|
<input id="friendlyname" v-model="agent.friendlyname" type="text" class="form-control" optional>
|
||||||
|
</div>
|
||||||
|
|
||||||
<button type="submit" class="btn btn-primary" :disabled="connectingAgent">
|
<button type="submit" class="btn btn-primary" :disabled="connectingAgent">
|
||||||
<template v-if="connectingAgent">{{ $t("connecting") }}</template>
|
<template v-if="connectingAgent">{{ $t("connecting") }}</template>
|
||||||
<template v-else>{{ $t("connect") }}</template>
|
<template v-else>{{ $t("connect") }}</template>
|
||||||
|
@ -126,6 +134,7 @@ export default {
|
||||||
url: "http://",
|
url: "http://",
|
||||||
username: "",
|
username: "",
|
||||||
password: "",
|
password: "",
|
||||||
|
friendlyname: "",
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue