Analyse: Sperre im WOMS kenntlich machen
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0cec45d3da
commit
8ecf07fecd
3 files changed
+7
-2
No files matched your search
@@ -50,8 +50,9 @@ export default function AnalyseRow({ projectId }) {
|
|||||||
) : (
|
) : (
|
||||||
<span className="text-grey">Lädt …</span>
|
<span className="text-grey">Lädt …</span>
|
||||||
)}
|
)}
|
||||||
|
{status.hint && <span className="text-grey">({status.hint})</span>}
|
||||||
{status.canEnable && !mode && (
|
{status.canEnable && !mode && (
|
||||||
<button type="button" className="btn btn-sm" onClick={() => setMode('on')}>Einschalten</button>
|
<button type="button" className="btn btn-sm" onClick={() => setMode('on')}>{status.enableLabel || 'Einschalten'}</button>
|
||||||
)}
|
)}
|
||||||
{status.canDisable && !mode && (
|
{status.canDisable && !mode && (
|
||||||
<button type="button" className="btn btn-sm" onClick={() => setMode('off')}>Ausschalten</button>
|
<button type="button" className="btn btn-sm" onClick={() => setMode('off')}>Ausschalten</button>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export function analyseStatus(a) {
|
|||||||
const at = formatBerlinDate(a.activatedAt)
|
const at = formatBerlinDate(a.activatedAt)
|
||||||
return { text: at ? `An seit ${at}` : 'An', color: 'green', canEnable: false, canDisable: true }
|
return { text: at ? `An seit ${at}` : 'An', color: 'green', canEnable: false, canDisable: true }
|
||||||
}
|
}
|
||||||
if (a.state === 'disabled') return { text: 'Gesperrt', color: 'red', canEnable: Boolean(a.eligible), canDisable: false }
|
if (a.state === 'disabled') return { text: 'Gesperrt', hint: 'Vom Team gesperrt', enableLabel: 'Trotz Sperre einschalten', color: 'red', canEnable: Boolean(a.eligible), canDisable: false }
|
||||||
if (!a.eligible) {
|
if (!a.eligible) {
|
||||||
return { text: `Nicht verfügbar${a.reasonText ? `: ${a.reasonText}` : ''}`, color: 'grey', canEnable: false, canDisable: false }
|
return { text: `Nicht verfügbar${a.reasonText ? `: ${a.reasonText}` : ''}`, color: 'grey', canEnable: false, canDisable: false }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,10 @@ test('analyseStatus: aus und berechtigt => Einschalten moeglich', () => {
|
|||||||
test('analyseStatus: gesperrt', () => {
|
test('analyseStatus: gesperrt', () => {
|
||||||
const s = analyseStatus({ enabled: true, state: 'disabled', eligible: true })
|
const s = analyseStatus({ enabled: true, state: 'disabled', eligible: true })
|
||||||
assert.equal(s.text, 'Gesperrt')
|
assert.equal(s.text, 'Gesperrt')
|
||||||
|
assert.equal(s.canEnable, true)
|
||||||
|
assert.equal(s.enableLabel, 'Trotz Sperre einschalten')
|
||||||
|
assert.equal(s.hint, 'Vom Team gesperrt')
|
||||||
|
assert.equal(analyseStatus({ enabled: true, state: 'disabled', eligible: false }).canEnable, false)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('analyseStatus: nicht berechtigt => Grund, kein Button', () => {
|
test('analyseStatus: nicht berechtigt => Grund, kein Button', () => {
|
||||||
|
|||||||
Reference in new issue
Block a user