mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-14 09:25:47 +01:00
✏️ Fix locales, button order and add reload state
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
// https://www.i18next.com/overview/configuration-options#logging
|
// https://www.i18next.com/overview/configuration-options#logging
|
||||||
debug: process.env.NODE_ENV === 'development',
|
|
||||||
i18n: {
|
i18n: {
|
||||||
defaultLocale: 'en',
|
defaultLocale: 'en',
|
||||||
locales: ['en', 'de', 'es', 'fr', 'it', 'ja', 'nl', 'ru', 'sv', 'zh'],
|
locales: ['en', 'de', 'es', 'fr', 'it', 'ja', 'nl', 'ru', 'sv', 'zh'],
|
||||||
|
|||||||
@@ -11,7 +11,8 @@
|
|||||||
"name": "Name",
|
"name": "Name",
|
||||||
"image": "Image",
|
"image": "Image",
|
||||||
"ports": "Ports",
|
"ports": "Ports",
|
||||||
"state": "State"
|
"state": "State",
|
||||||
|
"addToHomarr": "Add to homarr"
|
||||||
},
|
},
|
||||||
"body": {
|
"body": {
|
||||||
"portCollapse": "{{ports}} more"
|
"portCollapse": "{{ports}} more"
|
||||||
@@ -37,9 +38,8 @@
|
|||||||
"start": {
|
"start": {
|
||||||
"title": "Start"
|
"title": "Start"
|
||||||
},
|
},
|
||||||
"refreshData": "Refresh data",
|
"refreshData": {
|
||||||
"addToHomarr": {
|
"title": "Refresh data"
|
||||||
"title": "Add to Homarr"
|
|
||||||
},
|
},
|
||||||
"remove": {
|
"remove": {
|
||||||
"title": "Remove"
|
"title": "Remove"
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import Dockerode from 'dockerode';
|
import Dockerode from 'dockerode';
|
||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
|
import { useState } from 'react';
|
||||||
import { TFunction } from 'react-i18next';
|
import { TFunction } from 'react-i18next';
|
||||||
|
|
||||||
let t: TFunction<'modules/docker', undefined>;
|
let t: TFunction<'modules/docker', undefined>;
|
||||||
@@ -61,9 +62,25 @@ export interface ContainerActionBarProps {
|
|||||||
|
|
||||||
export default function ContainerActionBar({ selected, reload }: ContainerActionBarProps) {
|
export default function ContainerActionBar({ selected, reload }: ContainerActionBarProps) {
|
||||||
t = useTranslation('modules/docker').t;
|
t = useTranslation('modules/docker').t;
|
||||||
|
const [isLoading, setisLoading] = useState(false);
|
||||||
return (
|
return (
|
||||||
<Group>
|
<Group>
|
||||||
|
<Button
|
||||||
|
leftIcon={<IconRefresh />}
|
||||||
|
onClick={() => {
|
||||||
|
setisLoading(true);
|
||||||
|
setTimeout(() => {
|
||||||
|
reload();
|
||||||
|
setisLoading(false);
|
||||||
|
}, 750);
|
||||||
|
}}
|
||||||
|
variant="light"
|
||||||
|
color="violet"
|
||||||
|
loading={isLoading}
|
||||||
|
radius="md"
|
||||||
|
>
|
||||||
|
{t('actionBar.refreshData.title')}
|
||||||
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
leftIcon={<IconRotateClockwise />}
|
leftIcon={<IconRotateClockwise />}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
@@ -112,9 +129,6 @@ export default function ContainerActionBar({ selected, reload }: ContainerAction
|
|||||||
>
|
>
|
||||||
{t('actionBar.start.title')}
|
{t('actionBar.start.title')}
|
||||||
</Button>
|
</Button>
|
||||||
<Button leftIcon={<IconRefresh />} onClick={() => reload()} variant="light" color="violet" radius="md">
|
|
||||||
{t('actionBar.refreshData.title')}
|
|
||||||
</Button>
|
|
||||||
<Button
|
<Button
|
||||||
leftIcon={<IconTrash />}
|
leftIcon={<IconTrash />}
|
||||||
color="red"
|
color="red"
|
||||||
|
|||||||
@@ -1,4 +1,14 @@
|
|||||||
import { Table, Checkbox, Group, Badge, createStyles, ScrollArea, TextInput, Modal, ActionIcon, Tooltip } from '@mantine/core';
|
import {
|
||||||
|
Table,
|
||||||
|
Checkbox,
|
||||||
|
Group,
|
||||||
|
Badge,
|
||||||
|
createStyles,
|
||||||
|
ScrollArea,
|
||||||
|
TextInput,
|
||||||
|
Modal,
|
||||||
|
ActionIcon,
|
||||||
|
} from '@mantine/core';
|
||||||
import { IconPlus, IconSearch } from '@tabler/icons';
|
import { IconPlus, IconSearch } from '@tabler/icons';
|
||||||
import Dockerode from 'dockerode';
|
import Dockerode from 'dockerode';
|
||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
@@ -71,9 +81,7 @@ export default function DockerTable({
|
|||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
<td>{element.Names[0].replace('/', '')}</td>
|
<td>{element.Names[0].replace('/', '')}</td>
|
||||||
<td>
|
<td>{element.Image}</td>
|
||||||
{element.Image}
|
|
||||||
</td>
|
|
||||||
<td>
|
<td>
|
||||||
<Group>
|
<Group>
|
||||||
{element.Ports.sort((a, b) => a.PrivatePort - b.PrivatePort)
|
{element.Ports.sort((a, b) => a.PrivatePort - b.PrivatePort)
|
||||||
@@ -99,21 +107,17 @@ export default function DockerTable({
|
|||||||
<ContainerState state={element.State} />
|
<ContainerState state={element.State} />
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<Group>
|
<ActionIcon
|
||||||
<Tooltip label={t('table.body.action.addToHomarr')}>
|
color="indigo"
|
||||||
<ActionIcon
|
variant="light"
|
||||||
color="indigo"
|
radius="md"
|
||||||
variant="light"
|
onClick={() => {
|
||||||
radius="md"
|
setRowSelected(element);
|
||||||
onClick={() => {
|
setOpened(true);
|
||||||
setRowSelected(element);
|
}}
|
||||||
setOpened(true);
|
>
|
||||||
}}
|
<IconPlus />
|
||||||
>
|
</ActionIcon>
|
||||||
<IconPlus />
|
|
||||||
</ActionIcon>
|
|
||||||
</Tooltip>
|
|
||||||
</Group>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
);
|
);
|
||||||
@@ -158,7 +162,7 @@ export default function DockerTable({
|
|||||||
<th>{t('table.header.image')}</th>
|
<th>{t('table.header.image')}</th>
|
||||||
<th>{t('table.header.ports')}</th>
|
<th>{t('table.header.ports')}</th>
|
||||||
<th>{t('table.header.state')}</th>
|
<th>{t('table.header.state')}</th>
|
||||||
<th>{t('table.header.action')}</th>
|
<th>{t('table.header.addToHomarr')}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>{rows}</tbody>
|
<tbody>{rows}</tbody>
|
||||||
|
|||||||
Reference in New Issue
Block a user