feat(docker-widget): replace footer timestamp text with compact refresh button (#6307)
This commit is contained in:
1 parent
8e8c29979f
commit
807e5eb2a9
3 files changed
+24
-5
No files matched your search
@@ -5205,6 +5205,9 @@
|
|||||||
"title": "Containers",
|
"title": "Containers",
|
||||||
"table": {
|
"table": {
|
||||||
"updated": "Updated {when}",
|
"updated": "Updated {when}",
|
||||||
|
"refresh": {
|
||||||
|
"lastUpdated": "Last refresh {when}"
|
||||||
|
},
|
||||||
"search": "Seach {count} containers",
|
"search": "Seach {count} containers",
|
||||||
"selected": "{selectCount} of {totalCount} containers selected",
|
"selected": "{selectCount} of {totalCount} containers selected",
|
||||||
"footer": "Total {count} containers",
|
"footer": "Total {count} containers",
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import { ActionIcon, Avatar, Badge, Center, Group, Stack, Text, Tooltip } from "@mantine/core";
|
import { ActionIcon, Avatar, Badge, Center, Group, Stack, Text, Tooltip } from "@mantine/core";
|
||||||
import type { IconProps } from "@tabler/icons-react";
|
import type { IconProps } from "@tabler/icons-react";
|
||||||
import { IconBrandDocker, IconPlayerPlay, IconPlayerStop, IconRotateClockwise } from "@tabler/icons-react";
|
import { IconBrandDocker, IconPlayerPlay, IconPlayerStop, IconRefresh, IconRotateClockwise } from "@tabler/icons-react";
|
||||||
import type { MRT_ColumnDef, MRT_VisibilityState } from "mantine-react-table";
|
import type { MRT_ColumnDef, MRT_VisibilityState } from "mantine-react-table";
|
||||||
import { MantineReactTable } from "mantine-react-table";
|
import { MantineReactTable } from "mantine-react-table";
|
||||||
|
|
||||||
@@ -184,7 +184,11 @@ export default function DockerWidget({ options, width, isEditMode }: WidgetCompo
|
|||||||
const t = useScopedI18n("docker");
|
const t = useScopedI18n("docker");
|
||||||
const isTiny = width <= 256;
|
const isTiny = width <= 256;
|
||||||
|
|
||||||
const { data } = clientApi.docker.getContainers.useQuery(undefined, {
|
const {
|
||||||
|
data,
|
||||||
|
refetch,
|
||||||
|
isFetching,
|
||||||
|
} = clientApi.docker.getContainers.useQuery(undefined, {
|
||||||
refetchInterval: 30_000,
|
refetchInterval: 30_000,
|
||||||
});
|
});
|
||||||
const containers = data?.containers ?? [];
|
const containers = data?.containers ?? [];
|
||||||
@@ -300,9 +304,20 @@ export default function DockerWidget({ options, width, isEditMode }: WidgetCompo
|
|||||||
{t("table.totalMemory", { memory: formatBytes(totals.memory) })}
|
{t("table.totalMemory", { memory: formatBytes(totals.memory) })}
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
<Text size="sm" style={{ whiteSpace: "nowrap" }}>
|
<Tooltip
|
||||||
{t("table.updated", { when: relativeTime })}
|
label={t("table.refresh.lastUpdated", { when: relativeTime })}
|
||||||
</Text>
|
>
|
||||||
|
<ActionIcon
|
||||||
|
size="sm"
|
||||||
|
variant="transparent"
|
||||||
|
c="var(--mantine-color-text)"
|
||||||
|
loading={isFetching}
|
||||||
|
onClick={() => void refetch()}
|
||||||
|
aria-label={t("table.refresh.lastUpdated", { when: relativeTime })}
|
||||||
|
>
|
||||||
|
<IconRefresh style={actionIconIconStyle} />
|
||||||
|
</ActionIcon>
|
||||||
|
</Tooltip>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ const columnTranslationKeyMap = {
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("dockerContainers", {
|
export const { definition, componentLoader } = createWidgetDefinition("dockerContainers", {
|
||||||
icon: IconBrandDocker,
|
icon: IconBrandDocker,
|
||||||
|
queryKey: [["docker", "getContainers"]],
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from((factory) => ({
|
return optionsBuilder.from((factory) => ({
|
||||||
columns: factory.multiSelect({
|
columns: factory.multiSelect({
|
||||||
|
|||||||
Reference in new issue
Block a user