(feature: RuntimeFeatureDefinition)
| 238 | } |
| 239 | |
| 240 | private renderFeature(feature: RuntimeFeatureDefinition): string { |
| 241 | const enabled = isFeatureEnabled(feature.id); |
| 242 | const available = isFeatureAvailable(feature.id); |
| 243 | const effectiveSecrets = getEffectiveSecrets(feature); |
| 244 | const allStaged = !available && effectiveSecrets.every( |
| 245 | (k) => getSecretState(k).valid || (this.pendingSecrets.has(k) && this.validatedKeys.get(k) !== false) |
| 246 | ); |
| 247 | const pillClass = available ? 'ok' : allStaged ? 'staged' : 'warn'; |
| 248 | const pillLabel = available ? t('modals.runtimeConfig.status.ready') : allStaged ? t('modals.runtimeConfig.status.staged') : t('modals.runtimeConfig.status.needsKeys'); |
| 249 | const secrets = effectiveSecrets.map((key) => this.renderSecretRow(key)).join(''); |
| 250 | const desktop = isDesktopRuntime(); |
| 251 | const fallbackHtml = available || allStaged ? '' : `<p class="runtime-feature-fallback fallback">${escapeHtml(feature.fallback)}</p>`; |
| 252 | |
| 253 | return ` |
| 254 | <section class="runtime-feature ${available ? 'available' : allStaged ? 'staged' : 'degraded'}"> |
| 255 | <header class="runtime-feature-header"> |
| 256 | <label> |
| 257 | <input type="checkbox" data-toggle="${feature.id}" ${enabled ? 'checked' : ''} ${desktop ? '' : 'disabled'}> |
| 258 | <span>${escapeHtml(feature.name)}</span> |
| 259 | </label> |
| 260 | <span class="runtime-pill ${pillClass}">${pillLabel}</span> |
| 261 | </header> |
| 262 | <div class="runtime-secrets">${secrets}</div> |
| 263 | ${fallbackHtml} |
| 264 | </section> |
| 265 | `; |
| 266 | } |
| 267 | |
| 268 | private renderSecretRow(key: RuntimeSecretKey): string { |
| 269 | const state = getSecretState(key); |
no test coverage detected