Skip to content

Commit babdbfb

Browse files
feat: detect and visually indicate disabled identification methods
Add detection of disabled identification methods in Signer component: - Load identify_methods from state and check if method is enabled - Add visual styling (reduced opacity, overlay) for disabled signers - Add tooltip explaining why signer cannot be used - Prevent click action when method is disabled - Keep actions menu functional for delete/edit operations This provides clear visual feedback when a signer's identification method has been disabled by the administrator. Signed-off-by: Vitor Mattos <[email protected]>
1 parent abf6dd5 commit babdbfb

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

src/Components/Signers/Signer.vue

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
:counter-type="counterType"
1010
:force-display-actions="true"
1111
:class="signerClass"
12+
:title="disabledTooltip"
1213
@click="signerClickAction">
1314
<template #icon>
1415
<NcAvatar :size="44" :display-name="signer.displayName" />
@@ -89,6 +90,7 @@ export default {
8990
data() {
9091
return {
9192
canRequestSign: loadState('libresign', 'can_request_sign', false),
93+
methods: loadState('libresign', 'identify_methods', []),
9294
}
9395
},
9496
computed: {
@@ -114,9 +116,32 @@ export default {
114116
counterType() {
115117
return this.counterNumber !== null ? 'highlighted' : undefined
116118
},
119+
isMethodDisabled() {
120+
if (!this.signer.identifyMethods?.length) {
121+
return false
122+
}
123+
const signerMethod = this.signer.identifyMethods[0].method
124+
const methodConfig = this.methods.find(m => m.name === signerMethod)
125+
return !methodConfig?.enabled
126+
},
127+
disabledMethodLabel() {
128+
if (!this.signer.identifyMethods?.length) {
129+
return ''
130+
}
131+
const signerMethod = this.signer.identifyMethods[0].method
132+
const methodConfig = this.methods.find(m => m.name === signerMethod)
133+
return methodConfig?.friendly_name || signerMethod
134+
},
135+
disabledTooltip() {
136+
if (this.isMethodDisabled) {
137+
return this.t('libresign', 'This signer cannot be used because the identification method "{method}" has been disabled by the administrator.', { method: this.disabledMethodLabel })
138+
}
139+
return ''
140+
},
117141
signerClass() {
118142
return {
119143
'signer-signed': this.signer.signed,
144+
'signer-method-disabled': this.isMethodDisabled,
120145
}
121146
},
122147
showDragHandle() {
@@ -173,6 +198,9 @@ export default {
173198
if (this.signer.signed) {
174199
return
175200
}
201+
if (this.isMethodDisabled) {
202+
return
203+
}
176204
emit(this.event, this.signer)
177205
},
178206
closeActions() {
@@ -220,4 +248,33 @@ export default {
220248
cursor: not-allowed;
221249
opacity: 0.3;
222250
}
251+
252+
.signer-method-disabled {
253+
opacity: 0.6;
254+
255+
:deep(.list-item__wrapper) {
256+
cursor: not-allowed !important;
257+
}
258+
259+
:deep(.list-item-content__wrapper) {
260+
position: relative;
261+
262+
&::after {
263+
content: '';
264+
position: absolute;
265+
top: 0;
266+
left: 0;
267+
right: 0;
268+
bottom: 0;
269+
background-color: var(--color-background-dark);
270+
opacity: 0.2;
271+
pointer-events: none;
272+
}
273+
}
274+
275+
:deep(.list-item-content__actions) {
276+
opacity: 1;
277+
pointer-events: auto;
278+
}
279+
}
223280
</style>

0 commit comments

Comments
 (0)