mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-23 17:26:35 +00:00
fix: Do not hide period selector from the memory usage page
This commit is contained in:
parent
4246b50a24
commit
51b6e0ab41
|
@ -144,7 +144,8 @@
|
||||||
"unsupported": "You can't view resource usage charts without the server provider token.",
|
"unsupported": "You can't view resource usage charts without the server provider token.",
|
||||||
"system": "System",
|
"system": "System",
|
||||||
"ssh_users": "SSH users",
|
"ssh_users": "SSH users",
|
||||||
"ram_usage": "Average usage: {average}. Maximum: {max}."
|
"ram_usage": "Average usage: {average}. Maximum: {max}.",
|
||||||
|
"failed_to_load_memory_metrics": "Couldn't load memory usage data. This might be a connection issue, or there is not enough data yet."
|
||||||
},
|
},
|
||||||
"server": {
|
"server": {
|
||||||
"card_title": "Server",
|
"card_title": "Server",
|
||||||
|
|
|
@ -33,39 +33,43 @@ class _MemoryUsageByServiceContents extends StatelessWidget {
|
||||||
final Period period = cubit.state.period;
|
final Period period = cubit.state.period;
|
||||||
final MetricsState state = cubit.state;
|
final MetricsState state = cubit.state;
|
||||||
|
|
||||||
|
final List<Widget> children = [];
|
||||||
|
|
||||||
if (state is MetricsUnsupported ||
|
if (state is MetricsUnsupported ||
|
||||||
(state is MetricsLoaded && state.memoryMetrics == null)) {
|
(state is MetricsLoaded && state.memoryMetrics == null)) {
|
||||||
return BrandHeroScreen(
|
children.addAll([
|
||||||
heroTitle: 'resource_chart.memory'.tr(),
|
|
||||||
children: [
|
|
||||||
Center(
|
Center(
|
||||||
child: Center(
|
child: Center(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 32.0),
|
||||||
child: EmptyPagePlaceholder(
|
child: EmptyPagePlaceholder(
|
||||||
title: 'basis.error'.tr(),
|
title: 'basis.error'.tr(),
|
||||||
|
description:
|
||||||
|
'resource_chart.failed_to_load_memory_metrics'.tr(),
|
||||||
iconData: Icons.error_outline_outlined,
|
iconData: Icons.error_outline_outlined,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
);
|
]);
|
||||||
}
|
}
|
||||||
if (state is MetricsLoading) {
|
if (state is MetricsLoading) {
|
||||||
return BrandHeroScreen(
|
children.addAll([
|
||||||
heroTitle: 'resource_chart.memory'.tr(),
|
const Center(
|
||||||
children: const [
|
child: Padding(
|
||||||
Center(
|
padding: EdgeInsets.symmetric(vertical: 32.0),
|
||||||
child: CircularProgressIndicator(),
|
child: CircularProgressIndicator(),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (state is MetricsLoaded && state.memoryMetrics != null) {
|
||||||
final averageUsageByServices =
|
final averageUsageByServices =
|
||||||
(state as MetricsLoaded).memoryMetrics!.averageMetricsByService;
|
state.memoryMetrics!.averageMetricsByService;
|
||||||
final maxUsageByServices = state.memoryMetrics!.maxMetricsByService;
|
final maxUsageByServices = state.memoryMetrics!.maxMetricsByService;
|
||||||
|
|
||||||
// For each service, gather average and max usages
|
// For each service, gather average and max usages
|
||||||
final List<Widget> children = [];
|
|
||||||
for (final slice in averageUsageByServices.keys.sorted()) {
|
for (final slice in averageUsageByServices.keys.sorted()) {
|
||||||
final DiskSize averageUsage =
|
final DiskSize averageUsage =
|
||||||
DiskSize(byte: averageUsageByServices[slice]?.toInt() ?? 0);
|
DiskSize(byte: averageUsageByServices[slice]?.toInt() ?? 0);
|
||||||
|
@ -120,6 +124,7 @@ class _MemoryUsageByServiceContents extends StatelessWidget {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return BrandHeroScreen(
|
return BrandHeroScreen(
|
||||||
heroTitle: 'resource_chart.memory'.tr(),
|
heroTitle: 'resource_chart.memory'.tr(),
|
||||||
|
|
|
@ -32,10 +32,12 @@ class _BasicEnumConfigItemState extends State<BasicEnumConfigItem> {
|
||||||
DropdownMenuItem<String>(
|
DropdownMenuItem<String>(
|
||||||
value: widget.configItem.value,
|
value: widget.configItem.value,
|
||||||
enabled: false,
|
enabled: false,
|
||||||
child: Text(widget.configItem.value,
|
child: Text(
|
||||||
|
widget.configItem.value,
|
||||||
style: Theme.of(context).textTheme.titleMedium!.copyWith(
|
style: Theme.of(context).textTheme.titleMedium!.copyWith(
|
||||||
color: Theme.of(context).colorScheme.error.withOpacity(0.7),
|
color: Theme.of(context).colorScheme.error.withOpacity(0.7),
|
||||||
)),
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue