case 4688 - user form: hide login fields for agent users; copy button for a new agent token; token box only once saved

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-01 19:51:56 -07:00
parent f7a661a712
commit 573722da39

View File

@@ -118,7 +118,10 @@
@change="fieldValueChanged('agent')"
></v-checkbox>
</v-col>
<v-col v-if="obj.agent && obj.id != 0" cols="12">
<v-col
v-if="obj.agent && obj.id != 0 && !formState.dirty"
cols="12"
>
<v-card outlined class="pa-3" data-cy="agentTokens">
<div class="text-subtitle-1">
{{ $sock.t("AgentTokens") }}
@@ -136,6 +139,15 @@
>
<code>{{ newAgentToken }}</code>
</div>
<v-btn
small
class="mt-2"
data-cy="copyAgentToken"
@click="copyAgentToken()"
>
<v-icon small left>$sockiCopy</v-icon>
{{ $sock.t("CopyToClipboard") }}
</v-btn>
</v-alert>
<v-simple-table v-if="agentTokens.length > 0" dense>
<tbody>
@@ -198,7 +210,13 @@
</v-row>
</v-card>
</v-col>
<v-col v-if="obj.allowLogin" cols="12" sm="6" lg="4" xl="3">
<v-col
v-if="obj.allowLogin && !obj.agent"
cols="12"
sm="6"
lg="4"
xl="3"
>
<v-text-field
id="username"
ref="login"
@@ -217,7 +235,13 @@
></v-text-field>
</v-col>
<v-col v-if="obj.allowLogin" cols="12" sm="6" lg="4" xl="3">
<v-col
v-if="obj.allowLogin && !obj.agent"
cols="12"
sm="6"
lg="4"
xl="3"
>
<v-text-field
id="password"
ref="password"
@@ -962,6 +986,13 @@ export default {
window.$gz.locale.getHour12()
);
},
copyAgentToken() {
window.$gz.util.copyToClipboard(this.newAgentToken);
window.$gz.eventBus.$emit(
"notify-success",
this.$sock.t("CopyToClipboard")
);
},
async getAgentTokens() {
const vm = this;
vm.newAgentToken = null;
@@ -1276,6 +1307,7 @@ async function fetchTranslatedText() {
"AgentTokenRevoke",
"AgentTokenRevoked",
"AgentTokenNone",
"CopyToClipboard",
"Vendor",
"User",
"UserSettings",