05/06 Phase 2: updated and added new files
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
{% extends "admin/layouts/base.html" %}
|
||||
{% block title %}Set Override — {{ tenant.name }}{% endblock %}
|
||||
{% block content %}
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-6">
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-header"><h5 class="mb-0">Set Setting Override — {{ tenant.name }}</h5></div>
|
||||
<div class="card-body">
|
||||
{% if error %}<div class="alert alert-danger py-2">{{ error }}</div>{% endif %}
|
||||
<form method="POST" novalidate>
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Setting Key</label>
|
||||
<input type="text" class="form-control font-monospace" name="setting_key"
|
||||
placeholder="e.g. feature_marketing or business_hours" required>
|
||||
<div class="form-text">Alphanumeric, underscores, dots. Use <code>feature_FLAG</code> to force-enable/disable a plan feature.</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Value</label>
|
||||
<input type="text" class="form-control" name="setting_value" required>
|
||||
<div class="form-text">For feature flags: <code>true</code> or <code>false</code></div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Note <small class="text-muted">(optional)</small></label>
|
||||
<input type="text" class="form-control" name="note" placeholder="Reason for override">
|
||||
</div>
|
||||
<div class="d-flex gap-2">
|
||||
<button type="submit" class="btn btn-warning">Set Override</button>
|
||||
<a href="{{ url_for('settings_override.tenant_overrides', tenant_id=tenant.id) }}"
|
||||
class="btn btn-outline-secondary">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,66 @@
|
||||
{% extends "admin/layouts/base.html" %}
|
||||
{% block title %}Settings Overrides — {{ tenant.name }}{% endblock %}
|
||||
{% block content %}
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h4 class="fw-bold mb-0">Overrides — {{ tenant.name }}</h4>
|
||||
<a href="{{ url_for('settings_override.set_override', tenant_id=tenant.id) }}" class="btn btn-warning btn-sm">
|
||||
<i class="bi bi-plus-lg me-1"></i>Set Override
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{% if active %}
|
||||
<div class="card shadow-sm mb-4 border-warning">
|
||||
<div class="card-header bg-warning-subtle fw-semibold">Active Overrides</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm mb-0">
|
||||
<thead><tr><th>Key</th><th>Value</th><th>Set by</th><th>Set at</th><th>Note</th><th></th></tr></thead>
|
||||
<tbody>
|
||||
{% for ov in active %}
|
||||
<tr>
|
||||
<td><code>{{ ov.setting_key }}</code></td>
|
||||
<td>{{ ov.setting_value }}</td>
|
||||
<td class="small">{{ ov.admin.name if ov.admin else ov.overridden_by }}</td>
|
||||
<td class="small text-muted">{{ ov.overridden_at.strftime('%Y-%m-%d %H:%M') }}</td>
|
||||
<td class="small text-muted">{{ ov.note or '—' }}</td>
|
||||
<td>
|
||||
<form method="POST" action="{{ url_for('settings_override.lift_override', override_id=ov.id) }}"
|
||||
onsubmit="return confirm('Lift this override?')">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||
<button class="btn btn-outline-warning btn-sm">Lift</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="alert alert-light">No active overrides for this tenant.</div>
|
||||
{% endif %}
|
||||
|
||||
{% if history %}
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-header fw-semibold text-muted">Override History</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm mb-0">
|
||||
<thead><tr><th>Key</th><th>Value</th><th>Set at</th><th>Lifted at</th></tr></thead>
|
||||
<tbody>
|
||||
{% for ov in history %}
|
||||
<tr class="text-muted">
|
||||
<td><code>{{ ov.setting_key }}</code></td>
|
||||
<td>{{ ov.setting_value }}</td>
|
||||
<td class="small">{{ ov.overridden_at.strftime('%Y-%m-%d %H:%M') }}</td>
|
||||
<td class="small">{{ ov.lifted_at.strftime('%Y-%m-%d %H:%M') if ov.lifted_at else '—' }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<a href="{{ url_for('tenants.detail', tenant_id=tenant.id) }}" class="btn btn-outline-secondary btn-sm mt-3">
|
||||
<i class="bi bi-arrow-left me-1"></i>Back to Tenant
|
||||
</a>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user