Move delete button from table to edit modal

- Delete button now appears in the edit modal footer (left side)
- Cleaner table layout with just Test and Edit buttons
- Delete button only shows when editing existing sources
This commit is contained in:
Mondo Diaz
2026-01-29 14:16:10 -06:00
parent 2c123d8d0f
commit a93bf84b83
3 changed files with 32 additions and 20 deletions

View File

@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Clicking red dot shows error details in a modal (#107) - Clicking red dot shows error details in a modal (#107)
- Source name column no longer wraps text for better table layout (#107) - Source name column no longer wraps text for better table layout (#107)
- Renamed "Cache Management" page to "Upstream Sources" (#107) - Renamed "Cache Management" page to "Upstream Sources" (#107)
- Moved Delete button from table row to edit modal for cleaner table layout (#107)
### Removed ### Removed
- Removed `is_public` field from upstream sources - all sources are now treated as internal/private (#107) - Removed `is_public` field from upstream sources - all sources are now treated as internal/private (#107)

View File

@@ -340,9 +340,14 @@
.form-actions { .form-actions {
display: flex; display: flex;
justify-content: flex-end; justify-content: space-between;
gap: 0.5rem; align-items: center;
margin-top: 1.5rem; margin-top: 1.5rem;
padding-top: 1rem; padding-top: 1rem;
border-top: 1px solid var(--border-color); border-top: 1px solid var(--border-color);
} }
.form-actions-right {
display: flex;
gap: 0.5rem;
}

View File

@@ -324,18 +324,9 @@ function AdminCachePage() {
Test Test
</button> </button>
{source.source !== 'env' && ( {source.source !== 'env' && (
<>
<button className="btn btn-sm" onClick={() => openEditForm(source)}> <button className="btn btn-sm" onClick={() => openEditForm(source)}>
Edit Edit
</button> </button>
<button
className="btn btn-sm btn-danger"
onClick={() => handleDelete(source)}
disabled={deletingId === source.id}
>
{deletingId === source.id ? 'Deleting...' : 'Delete'}
</button>
</>
)} )}
</td> </td>
</tr> </tr>
@@ -471,6 +462,20 @@ function AdminCachePage() {
)} )}
<div className="form-actions"> <div className="form-actions">
{editingSource && (
<button
type="button"
className="btn btn-danger"
onClick={() => {
handleDelete(editingSource);
setShowForm(false);
}}
disabled={deletingId === editingSource.id}
>
{deletingId === editingSource.id ? 'Deleting...' : 'Delete'}
</button>
)}
<div className="form-actions-right">
<button type="button" className="btn" onClick={() => setShowForm(false)}> <button type="button" className="btn" onClick={() => setShowForm(false)}>
Cancel Cancel
</button> </button>
@@ -478,6 +483,7 @@ function AdminCachePage() {
{isSaving ? 'Saving...' : editingSource ? 'Update' : 'Create'} {isSaving ? 'Saving...' : editingSource ? 'Update' : 'Create'}
</button> </button>
</div> </div>
</div>
</form> </form>
</div> </div>
</div> </div>