🚨 Fix warnings (#953)

This commit is contained in:
Manuel
2023-05-20 15:33:14 +02:00
committed by GitHub
parent d615f49f47
commit e63321f5ad
2 changed files with 7 additions and 10 deletions

View File

@@ -14,20 +14,18 @@ import axios from 'axios';
import Dockerode from 'dockerode';
import { useTranslation } from 'next-i18next';
import { useState } from 'react';
import { TFunction } from 'react-i18next';
import { v4 as uuidv4 } from 'uuid';
import { useConfigContext } from '../../config/provider';
import { openContextModalGeneric } from '../../tools/mantineModalManagerExtensions';
import { MatchingImages, ServiceType, tryMatchPort } from '../../tools/types';
import { AppType } from '../../types/app';
let t: TFunction<'modules/docker', undefined>;
function sendDockerCommand(
action: string,
containerId: string,
containerName: string,
reload: () => void
reload: () => void,
t: (key: string) => string,
) {
showNotification({
id: containerId,
@@ -68,7 +66,7 @@ export interface ContainerActionBarProps {
}
export default function ContainerActionBar({ selected, reload }: ContainerActionBarProps) {
t = useTranslation('modules/docker').t;
const { t } = useTranslation('modules/docker');
const [isLoading, setisLoading] = useState(false);
const { name: configName, config } = useConfigContext();
const getLowestWrapper = () => config?.wrappers.sort((a, b) => a.position - b.position)[0];
@@ -96,7 +94,7 @@ export default function ContainerActionBar({ selected, reload }: ContainerAction
onClick={() =>
Promise.all(
selected.map((container) =>
sendDockerCommand('restart', container.Id, container.Names[0].substring(1), reload)
sendDockerCommand('restart', container.Id, container.Names[0].substring(1), reload, t)
)
)
}
@@ -112,7 +110,7 @@ export default function ContainerActionBar({ selected, reload }: ContainerAction
onClick={() =>
Promise.all(
selected.map((container) =>
sendDockerCommand('stop', container.Id, container.Names[0].substring(1), reload)
sendDockerCommand('stop', container.Id, container.Names[0].substring(1), reload, t)
)
)
}
@@ -128,7 +126,7 @@ export default function ContainerActionBar({ selected, reload }: ContainerAction
onClick={() =>
Promise.all(
selected.map((container) =>
sendDockerCommand('start', container.Id, container.Names[0].substring(1), reload)
sendDockerCommand('start', container.Id, container.Names[0].substring(1), reload, t)
)
)
}
@@ -147,7 +145,7 @@ export default function ContainerActionBar({ selected, reload }: ContainerAction
onClick={() =>
Promise.all(
selected.map((container) =>
sendDockerCommand('remove', container.Id, container.Names[0].substring(1), reload)
sendDockerCommand('remove', container.Id, container.Names[0].substring(1), reload, t)
)
)
}