Add viewed history, diagnostics, tag chips and SWF viewer
This commit is contained in:
@@ -15,6 +15,7 @@ class ProviderCheckScreen extends ConsumerWidget {
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final providers = ref.watch(providersControllerProvider);
|
||||
final health = ref.watch(providerHealthProvider);
|
||||
final diagnostics = ref.watch(providerDiagnosticsProvider).value ?? {};
|
||||
return AdaptiveScaffold(
|
||||
title: 'Provider Check',
|
||||
actions: [
|
||||
@@ -35,6 +36,7 @@ class ProviderCheckScreen extends ConsumerWidget {
|
||||
return ProviderHealthTile(
|
||||
config: item,
|
||||
health: health[item.id],
|
||||
diagnostics: diagnostics[item.id],
|
||||
onCheck: () => _checkOne(ref, item.id),
|
||||
);
|
||||
},
|
||||
|
||||
@@ -90,6 +90,9 @@ class _ProviderFormScreenState extends ConsumerState<ProviderFormScreen> {
|
||||
value: 'rule34', child: Text('rule34-compatible')),
|
||||
DropdownMenuItem(
|
||||
value: 'danbooru', child: Text('danbooru-compatible')),
|
||||
DropdownMenuItem(
|
||||
value: 'moebooru', child: Text('moebooru-compatible')),
|
||||
DropdownMenuItem(value: 'e621', child: Text('e621/e926')),
|
||||
DropdownMenuItem(value: 'custom', child: Text('custom')),
|
||||
],
|
||||
onChanged: (value) =>
|
||||
|
||||
@@ -38,3 +38,14 @@ class ProvidersController extends AsyncNotifier<List<ContentProviderConfig>> {
|
||||
|
||||
final providerHealthProvider =
|
||||
StateProvider<Map<String, ProviderHealth>>((ref) => {});
|
||||
|
||||
final providerDiagnosticsProvider =
|
||||
FutureProvider<Map<String, ProviderDiagnostics>>((ref) async {
|
||||
final result = await ref.watch(providerRepositoryProvider).getDiagnostics();
|
||||
if (result is Success<List<ProviderDiagnostics>>) {
|
||||
return {
|
||||
for (final item in result.data) item.providerId: item,
|
||||
};
|
||||
}
|
||||
return {};
|
||||
});
|
||||
|
||||
@@ -7,12 +7,14 @@ class ProviderHealthTile extends StatelessWidget {
|
||||
const ProviderHealthTile({
|
||||
required this.config,
|
||||
required this.health,
|
||||
required this.diagnostics,
|
||||
required this.onCheck,
|
||||
super.key,
|
||||
});
|
||||
|
||||
final ContentProviderConfig config;
|
||||
final ProviderHealth? health;
|
||||
final ProviderDiagnostics? diagnostics;
|
||||
final VoidCallback onCheck;
|
||||
|
||||
@override
|
||||
@@ -22,11 +24,19 @@ class ProviderHealthTile extends StatelessWidget {
|
||||
title: Text(config.name),
|
||||
subtitle: Text(
|
||||
[
|
||||
'${config.apiType} | ${config.enabled ? 'enabled' : 'disabled'} | priority ${config.priority}',
|
||||
if (health != null) 'Ping ${health!.pingMs} ms',
|
||||
if (health?.apiVersion != null) 'API ${health!.apiVersion}',
|
||||
if (health?.lastCheckedAt != null)
|
||||
'Checked ${health!.lastCheckedAt}',
|
||||
if (diagnostics != null)
|
||||
'Last search: ${diagnostics!.lastResultCount} posts at ${diagnostics!.lastSearchAt}',
|
||||
if (diagnostics?.lastErrorMessage != null)
|
||||
diagnostics!.lastErrorMessage!,
|
||||
if (health?.errorMessage != null) health!.errorMessage!,
|
||||
].join('\n'),
|
||||
maxLines: 7,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
leading: ProviderStatusBadge(health: health),
|
||||
trailing: IconButton(
|
||||
|
||||
Reference in New Issue
Block a user