mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-11 16:05:47 +01:00
🚨 Fix warnings (#953)
This commit is contained in:
@@ -14,20 +14,18 @@ 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 { useState } from 'react';
|
||||||
import { TFunction } from 'react-i18next';
|
|
||||||
import { v4 as uuidv4 } from 'uuid';
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
import { useConfigContext } from '../../config/provider';
|
import { useConfigContext } from '../../config/provider';
|
||||||
import { openContextModalGeneric } from '../../tools/mantineModalManagerExtensions';
|
import { openContextModalGeneric } from '../../tools/mantineModalManagerExtensions';
|
||||||
import { MatchingImages, ServiceType, tryMatchPort } from '../../tools/types';
|
import { MatchingImages, ServiceType, tryMatchPort } from '../../tools/types';
|
||||||
import { AppType } from '../../types/app';
|
import { AppType } from '../../types/app';
|
||||||
|
|
||||||
let t: TFunction<'modules/docker', undefined>;
|
|
||||||
|
|
||||||
function sendDockerCommand(
|
function sendDockerCommand(
|
||||||
action: string,
|
action: string,
|
||||||
containerId: string,
|
containerId: string,
|
||||||
containerName: string,
|
containerName: string,
|
||||||
reload: () => void
|
reload: () => void,
|
||||||
|
t: (key: string) => string,
|
||||||
) {
|
) {
|
||||||
showNotification({
|
showNotification({
|
||||||
id: containerId,
|
id: containerId,
|
||||||
@@ -68,7 +66,7 @@ export interface ContainerActionBarProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function ContainerActionBar({ selected, reload }: ContainerActionBarProps) {
|
export default function ContainerActionBar({ selected, reload }: ContainerActionBarProps) {
|
||||||
t = useTranslation('modules/docker').t;
|
const { t } = useTranslation('modules/docker');
|
||||||
const [isLoading, setisLoading] = useState(false);
|
const [isLoading, setisLoading] = useState(false);
|
||||||
const { name: configName, config } = useConfigContext();
|
const { name: configName, config } = useConfigContext();
|
||||||
const getLowestWrapper = () => config?.wrappers.sort((a, b) => a.position - b.position)[0];
|
const getLowestWrapper = () => config?.wrappers.sort((a, b) => a.position - b.position)[0];
|
||||||
@@ -96,7 +94,7 @@ export default function ContainerActionBar({ selected, reload }: ContainerAction
|
|||||||
onClick={() =>
|
onClick={() =>
|
||||||
Promise.all(
|
Promise.all(
|
||||||
selected.map((container) =>
|
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={() =>
|
onClick={() =>
|
||||||
Promise.all(
|
Promise.all(
|
||||||
selected.map((container) =>
|
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={() =>
|
onClick={() =>
|
||||||
Promise.all(
|
Promise.all(
|
||||||
selected.map((container) =>
|
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={() =>
|
onClick={() =>
|
||||||
Promise.all(
|
Promise.all(
|
||||||
selected.map((container) =>
|
selected.map((container) =>
|
||||||
sendDockerCommand('remove', container.Id, container.Names[0].substring(1), reload)
|
sendDockerCommand('remove', container.Id, container.Names[0].substring(1), reload, t)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import { NextApiRequest, NextApiResponse } from 'next';
|
|||||||
import { getConfig } from '../../../../tools/config/getConfig';
|
import { getConfig } from '../../../../tools/config/getConfig';
|
||||||
|
|
||||||
import { MediaRequest } from '../../../../widgets/media-requests/media-request-types';
|
import { MediaRequest } from '../../../../widgets/media-requests/media-request-types';
|
||||||
import { ConfigAppType } from '../../../../types/app';
|
|
||||||
import { MediaRequestListWidget } from '../../../../widgets/media-requests/MediaRequestListTile';
|
import { MediaRequestListWidget } from '../../../../widgets/media-requests/MediaRequestListTile';
|
||||||
|
|
||||||
const Get = async (request: NextApiRequest, response: NextApiResponse) => {
|
const Get = async (request: NextApiRequest, response: NextApiResponse) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user