improve delete-key flow
Some checks failed
Build Docker and Deploy / Build Docker Container (push) Failing after 1m15s
Build Docker and Deploy / Run Unit-Tests (push) Failing after 2m57s
Build Docker and Deploy / Deploy to Server (push) Has been skipped

This commit is contained in:
Mike Schwörer 2025-05-03 23:00:12 +02:00
parent 1d2f4f70c8
commit 9db49a4164
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
3 changed files with 10 additions and 3 deletions

View File

@ -79,7 +79,7 @@ class _KeyTokenListPageState extends State<KeyTokenListPage> {
child: PagedListView<int, KeyToken>(
pagingController: _pagingController,
builderDelegate: PagedChildBuilderDelegate<KeyToken>(
itemBuilder: (context, item, index) => KeyTokenListItem(item: item),
itemBuilder: (context, item, index) => KeyTokenListItem(item: item, needsReload: _fullRefresh),
),
),
),
@ -107,4 +107,9 @@ class _KeyTokenListPageState extends State<KeyTokenListPage> {
builder: (context) => KeyTokenCreatedModal(keytoken: token, tokenValue: tokValue),
);
}
void _fullRefresh() {
ApplicationLog.debug('KeytokenListPage::fullRefresh');
_pagingController.refresh();
}
}

View File

@ -17,10 +17,12 @@ enum KeyTokenListItemMode {
class KeyTokenListItem extends StatelessWidget {
const KeyTokenListItem({
required this.item,
required this.needsReload,
super.key,
});
final KeyToken item;
final void Function()? needsReload;
@override
Widget build(BuildContext context) {
@ -32,7 +34,7 @@ class KeyTokenListItem extends StatelessWidget {
color: Theme.of(context).cardTheme.color,
child: InkWell(
onTap: () {
Navi.push(context, () => KeyTokenViewPage(keytokenID: item.keytokenID, preloadedData: item, needsReload: null));
Navi.push(context, () => KeyTokenViewPage(keytokenID: item.keytokenID, preloadedData: item, needsReload: needsReload));
},
child: Padding(
padding: const EdgeInsets.all(8),

View File

@ -535,7 +535,7 @@ class _KeyTokenViewPageState extends State<KeyTokenViewPage> {
}
try {
final r = await UIDialogs.showConfirmDialog(context, 'Really (permanently) delete this Key?', okText: 'Unsubscribe', cancelText: 'Cancel');
final r = await UIDialogs.showConfirmDialog(context, 'Really (permanently) delete this Key?', okText: 'Delete', cancelText: 'Cancel');
if (!r) return;
await APIClient.deleteKeyToken(acc, keytokenPreview!.keytokenID);