Skip to content

Commit

Permalink
Admin UI: Make tiers overview look like the other overview pages (#827)
Browse files Browse the repository at this point in the history
* refactor: make tiers overview look like the other overview pages

* chore: remove unused translations

* chore: add translations cleaner package

* refactor: do not abuse ElevatedButton
  • Loading branch information
jkoenig134 authored Sep 2, 2024
1 parent be84239 commit 91c8dba
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 87 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ class _ClientsOverviewState extends State<ClientsOverview> {
),
),
DataCell(
ElevatedButton(
style: ButtonStyle(backgroundColor: WidgetStateProperty.all<Color>(Theme.of(context).colorScheme.primary)),
FilledButton(
onPressed: () => showChangeClientSecretDialog(context: context, clientId: client.clientId),
child: Text(
context.l10n.changeClientSecret,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ class TiersOverview extends StatefulWidget {
}

class _TiersOverviewState extends State<TiersOverview> {
List<TierOverview>? _tiers;

final double _boxWidth = 700;
List<TierOverview> _tiers = [];

@override
void initState() {
Expand All @@ -29,44 +27,15 @@ class _TiersOverviewState extends State<TiersOverview> {

@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(top: 20),
child: Column(
children: [
Container(
height: 100,
width: _boxWidth,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.primary,
boxShadow: const [
BoxShadow(
color: Colors.black26,
blurRadius: 4,
),
],
),
child: Padding(
padding: const EdgeInsets.only(left: 15, top: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
context.l10n.tiers,
style: TextStyle(color: Theme.of(context).colorScheme.onPrimary, fontSize: 30),
),
Text(
context.l10n.tiersOverview_title_description,
style: TextStyle(color: Theme.of(context).colorScheme.onPrimary, fontSize: 13),
),
],
),
),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: SizedBox(
width: _boxWidth,
child: Row(
return Scaffold(
appBar: AppBar(title: Text(context.l10n.tiersOverview_title)),
body: Card(
child: Padding(
padding: const EdgeInsets.all(8),
child: Column(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.end,
children: [
if (kIsDesktop)
Expand All @@ -75,46 +44,41 @@ class _TiersOverviewState extends State<TiersOverview> {
onPressed: _reloadTiers,
tooltip: context.l10n.reload,
),
Gaps.w8,
IconButton.filled(
icon: const Icon(Icons.add),
color: Theme.of(context).colorScheme.onPrimary,
onPressed: () => _showAddTierDialog(context: context),
),
],
),
),
),
if (_tiers == null)
const Center(child: CircularProgressIndicator())
else
Expanded(
child: Card(
child: SizedBox(
width: _boxWidth,
child: DataTable2(
isVerticalScrollBarVisible: true,
showCheckboxColumn: false,
empty: Text(context.l10n.tiersOverview_noTiersFound),
columns: [
DataColumn2(label: Text(context.l10n.name), size: ColumnSize.L),
DataColumn2(label: Text(context.l10n.numberOfIdentities), size: ColumnSize.L),
],
rows: _tiers!
.map(
(tier) => DataRow2(
onTap: () => context.go('/tiers/${tier.id}'),
cells: [
DataCell(Text(tier.name)),
DataCell(Text('${tier.numberOfIdentities}')),
],
),
)
.toList(),
),
Expanded(
child: DataTable2(
isVerticalScrollBarVisible: true,
showCheckboxColumn: false,
empty: Text(context.l10n.tiersOverview_noTiersFound),
columns: [
DataColumn2(label: Text(context.l10n.id), size: ColumnSize.L),
DataColumn2(label: Text(context.l10n.name), size: ColumnSize.L),
DataColumn2(label: Text(context.l10n.numberOfIdentities), size: ColumnSize.L),
],
rows: _tiers
.map(
(tier) => DataRow2(
onTap: () => context.go('/tiers/${tier.id}'),
cells: [
DataCell(Text(tier.id)),
DataCell(Text(tier.name)),
DataCell(Text('${tier.numberOfIdentities}')),
],
),
)
.toList(),
),
),
),
],
],
),
),
),
);
}
Expand Down
14 changes: 1 addition & 13 deletions Applications/AdminUi/apps/admin_ui/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"day": "Day",
"datawalletVersion": "Datawallet Version",
"defaultTier": "Default Tier",
"devices": "Devices",
"displayName": "Display Name",
"find": "Find",
"hour": "Hour",
Expand All @@ -50,7 +49,6 @@
"reload": "Reload",
"save": "Save",
"showAll": "Show all",
"searchTiers": "Search Tiers",
"settings": "Settings",
"source": "Source",
"system": "System",
Expand All @@ -62,7 +60,6 @@
"update": "Update",
"week": "Week",
"year": "Year",
"yes": "Yes",
"copyToClipboard_tooltip": "Copy to clipboard",
"copyToClipboard_success": "Successfully copied the '{entityName}' to clipboard.",
"@copiedToClipboard_success": {
Expand Down Expand Up @@ -107,17 +104,12 @@
"deletionProcessTable_approvalRemindersCell_noData": "No Data",
"deletionProcessTable_gracePeriodRemindersCell_reminder": "Reminder",
"deletionProcessTable_gracePeriodRemindersCell_noData": "No Data",
"deletionProcessDetails_title": "Deletion Process Details",
"deletionProcessDetails_deletionProcessID": "Deletion Process ID",
"deletionProcessDetails_status": "Status",
"deletionProcessDetails_status_waitingForApproval": "Waiting for Approval",
"deletionProcessDetails_status_approved": "Approved",
"deletionProcessDetails_status_cancelled": "Cancelled",
"deletionProcessDetails_status_rejected": "Rejected",
"deletionProcessDetails_status_deleting": "Deleting",
"deletionProcessDetails_auditLogs_title": "Deletion Process Audit Logs",
"deletionProcessDetails_auditLogs_title_description": "View deletion process audit logs for Identity",
"deletionProcessDetails_auditLogs_noData": "No deletion process audit logs found.",
"deletionProcessDetails_cancelDeletionProcess_title": "Cancel Deletion Process",
"deletionProcessDetails_cancelDeletionProcess_message": "Are you sure you want to cancel deletion process?",
"deletionProcessDetails_deletionProcessCancelledSuccessfully": "The deletion process was cancelled successfully.",
Expand All @@ -139,12 +131,9 @@
"deletionProcessAuditLogsTable_haveBeenDeleted": "have been deleted.",
"deletionProcessAuditLogs_title": "Identity deletion process audit logs",
"deletionProcessAuditLogs_inputHint": "Enter an identity address",
"deletionProcessAuditLogsDetails_title": "Deletion Process Audit Logs",
"deletionProcessAuditLogsDetails_title_description": "Identity",
"deletionProcessAuditLogsDetails_noDataFound": "No deletion process audit logs found.",
"identityDetails_card_identityClipboardMessage": "Identity address copied to clipboard.",
"identityDetails_card_publicKey": "Public Key",
"identityDetails_card_publicKey_tooltipMessage": "Copy public key",
"identityDetails_receivedMessages_title": "Received Messages",
"identityDetails_receivedMessages_subtitle": "View messages received by this identity.",
"identityDetails_noReceivedMessagesFound": "No received messages found.",
Expand Down Expand Up @@ -180,7 +169,6 @@
"identitiesDataTable_noIdentitiesFound": "No identities found.",
"identitiesDataTable_failedToLoadData": "Failed to load data.",
"identitiesDataTable_createdWithClient": "Created with Client",
"identitiesFilter_searchClients": "Search Clients",
"maxIdentities_title": "Update Max Identities",
"maxIdentities_error_message": "Error updating max identities",
"maxIdentities_success_message": "Max identities updated successfully.",
Expand All @@ -195,6 +183,6 @@
"tierDetails_quotaList_titleDescription": "View and assign quotas for this tier.",
"tierDetails_quotaList_titleDescription_readOnly": "View quotas for this tier. This tier is managed by the system and therefore read-only.",
"tierDetails_quotaList_noQuotaForTier": "No quotas added to this tier.",
"tiersOverview_title_description": "A list of existing tiers",
"tiersOverview_title": "A list of existing tiers",
"tiersOverview_noTiersFound": "No tiers found."
}
16 changes: 16 additions & 0 deletions Applications/AdminUi/apps/admin_ui/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "7.7.0"
glob:
dependency: transitive
description:
name: glob
sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63"
url: "https://pub.dev"
source: hosted
version: "2.1.2"
go_router:
dependency: "direct main"
description:
Expand Down Expand Up @@ -496,6 +504,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.7.2"
translations_cleaner:
dependency: "direct dev"
description:
name: translations_cleaner
sha256: "060f4a8cd782e271509719741dd3540fe81ddaad49bd79e1d8fc4598299a6b84"
url: "https://pub.dev"
source: hosted
version: "0.0.5"
typed_data:
dependency: transitive
description:
Expand Down
1 change: 1 addition & 0 deletions Applications/AdminUi/apps/admin_ui/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ dev_dependencies:
flutter_launcher_icons: ^0.13.1
flutter_test:
sdk: flutter
translations_cleaner: ^0.0.5
very_good_analysis: ^6.0.0

flutter:
Expand Down

0 comments on commit 91c8dba

Please sign in to comment.