make linter happy
This commit is contained in:
@@ -83,11 +83,11 @@ const AdminMenu = props => {
|
||||
setEtkeRoutesEnabled(true);
|
||||
}
|
||||
}, []);
|
||||
const [serverProcess, setServerProcess] = useStore<ServerProcessResponse>("serverProcess", {
|
||||
const [serverProcess, _setServerProcess] = useStore<ServerProcessResponse>("serverProcess", {
|
||||
command: "",
|
||||
locked_at: "",
|
||||
});
|
||||
const [serverStatus, setServerStatus] = useStore<ServerStatusResponse>("serverStatus", {
|
||||
const [serverStatus, _setServerStatus] = useStore<ServerStatusResponse>("serverStatus", {
|
||||
success: false,
|
||||
ok: false,
|
||||
host: "",
|
||||
@@ -124,6 +124,7 @@ const AdminMenu = props => {
|
||||
{menu &&
|
||||
menu.map((item, index) => {
|
||||
const { url, icon, label } = item;
|
||||
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
||||
const IconComponent = Icons[icon] as React.ComponentType<any> | undefined;
|
||||
|
||||
return (
|
||||
|
||||
@@ -7,10 +7,8 @@ import {
|
||||
SimpleForm,
|
||||
BooleanInput,
|
||||
useTranslate,
|
||||
RaRecord,
|
||||
useNotify,
|
||||
useRedirect,
|
||||
useDelete,
|
||||
NotificationType,
|
||||
useDeleteMany,
|
||||
Identifier,
|
||||
@@ -51,7 +49,7 @@ const DeleteRoomButton: React.FC<DeleteRoomButtonProps> = props => {
|
||||
unselectAll();
|
||||
redirect("/rooms");
|
||||
},
|
||||
onError: error => notify("resources.rooms.action.erase.failure", { type: "error" as NotificationType }),
|
||||
onError: _error => notify("resources.rooms.action.erase.failure", { type: "error" as NotificationType }),
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
@@ -7,10 +7,8 @@ import {
|
||||
SimpleForm,
|
||||
BooleanInput,
|
||||
useTranslate,
|
||||
RaRecord,
|
||||
useNotify,
|
||||
useRedirect,
|
||||
useDelete,
|
||||
NotificationType,
|
||||
useDeleteMany,
|
||||
Identifier,
|
||||
@@ -57,7 +55,7 @@ const DeleteUserButton: React.FC<DeleteUserButtonProps> = props => {
|
||||
unselectAll();
|
||||
redirect("/users");
|
||||
},
|
||||
onError: error => notify("ra.notification.data_provider_error", { type: "error" as NotificationType }),
|
||||
onError: _error => notify("ra.notification.data_provider_error", { type: "error" as NotificationType }),
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
@@ -74,7 +74,7 @@ export const ExperimentalFeaturesList = () => {
|
||||
const updateFeature = async (feature_name: string, feature_value: boolean) => {
|
||||
const updatedFeatures = { ...features, [feature_name]: feature_value } as ExperimentalFeaturesModel;
|
||||
setFeatures(updatedFeatures);
|
||||
const response = await dataProvider.updateFeatures(record.id, updatedFeatures);
|
||||
await dataProvider.updateFeatures(record.id, updatedFeatures);
|
||||
notify("ra.notification.updated", {
|
||||
messageArgs: { smart_count: 1 },
|
||||
type: "success",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Avatar, Box, Link, Typography } from "@mui/material";
|
||||
import { Avatar, Box, Link } from "@mui/material";
|
||||
import { useTheme } from "@mui/material/styles";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Stack, Typography } from "@mui/material";
|
||||
import { TextField } from "@mui/material";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useDataProvider, useNotify, useRecordContext, useTranslate } from "react-admin";
|
||||
import { useDataProvider, useRecordContext, useTranslate } from "react-admin";
|
||||
import { useFormContext } from "react-hook-form";
|
||||
|
||||
const RateLimitRow = ({
|
||||
@@ -10,8 +10,8 @@ const RateLimitRow = ({
|
||||
updateRateLimit,
|
||||
}: {
|
||||
limit: string;
|
||||
value: any;
|
||||
updateRateLimit: (limit: string, value: any) => void;
|
||||
value: object;
|
||||
updateRateLimit: (limit: string, value: integer | null) => void;
|
||||
}) => {
|
||||
const translate = useTranslate();
|
||||
|
||||
@@ -53,8 +53,6 @@ const RateLimitRow = ({
|
||||
};
|
||||
|
||||
const UserRateLimits = () => {
|
||||
const translate = useTranslate();
|
||||
const notify = useNotify();
|
||||
const record = useRecordContext();
|
||||
const form = useFormContext();
|
||||
const dataProvider = useDataProvider();
|
||||
@@ -78,7 +76,7 @@ const UserRateLimits = () => {
|
||||
fetchRateLimits();
|
||||
}, []);
|
||||
|
||||
const updateRateLimit = async (limit: string, value: any) => {
|
||||
const updateRateLimit = async (limit: string, value: integer | null) => {
|
||||
const updatedRateLimits = { ...rateLimits, [limit]: value };
|
||||
setRateLimits(updatedRateLimits);
|
||||
form.setValue(`rates.${limit}`, value, { shouldDirty: true });
|
||||
|
||||
@@ -5,7 +5,7 @@ import { ServerProcessResponse } from "../../synapse/dataProvider";
|
||||
import { getTimeSince } from "../../utils/date";
|
||||
|
||||
const CurrentlyRunningCommand = () => {
|
||||
const [serverProcess, setServerProcess] = useStore<ServerProcessResponse>("serverProcess", {
|
||||
const [serverProcess, _setServerProcess] = useStore<ServerProcessResponse>("serverProcess", {
|
||||
command: "",
|
||||
locked_at: "",
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import RestoreIcon from "@mui/icons-material/Restore";
|
||||
import ScheduleIcon from "@mui/icons-material/Schedule";
|
||||
import { Box, Typography, Link, Divider } from "@mui/material";
|
||||
import { Box, Typography, Link } from "@mui/material";
|
||||
import { Stack } from "@mui/material";
|
||||
|
||||
import CurrentlyRunningCommand from "./CurrentlyRunningCommand";
|
||||
|
||||
@@ -23,6 +23,7 @@ import { ServerCommand, ServerProcessResponse } from "../../synapse/dataProvider
|
||||
import { Icons } from "../../utils/icons";
|
||||
|
||||
const renderIcon = (icon: string) => {
|
||||
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
||||
const IconComponent = Icons[icon] as React.ComponentType<any> | undefined;
|
||||
return IconComponent ? <IconComponent sx={{ verticalAlign: "middle", mr: 1 }} /> : null;
|
||||
};
|
||||
@@ -80,6 +81,7 @@ const ServerCommandsPanel = () => {
|
||||
// Update server process status
|
||||
await updateServerProcessStatus(serverCommands[command]);
|
||||
} catch (error) {
|
||||
console.error("Error running command:", error);
|
||||
setCommandIsRunning(false);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -33,7 +33,7 @@ const useServerNotifications = () => {
|
||||
notifications: [],
|
||||
success: false,
|
||||
});
|
||||
const [serverProcess, setServerProcess] = useStore<ServerProcessResponse>("serverProcess", {
|
||||
const [serverProcess, _setServerProcess] = useStore<ServerProcessResponse>("serverProcess", {
|
||||
command: "",
|
||||
locked_at: "",
|
||||
});
|
||||
|
||||
@@ -59,11 +59,11 @@ const useServerStatus = () => {
|
||||
host: "",
|
||||
results: [],
|
||||
});
|
||||
const [serverProcess, setServerProcess] = useStore<ServerProcessResponse>("serverProcess", {
|
||||
const [serverProcess, _setServerProcess] = useStore<ServerProcessResponse>("serverProcess", {
|
||||
command: "",
|
||||
locked_at: "",
|
||||
});
|
||||
const { command, locked_at } = serverProcess;
|
||||
const { command } = serverProcess;
|
||||
const { etkeccAdmin } = useAppContext();
|
||||
const dataProvider = useDataProvider();
|
||||
const isOkay = serverStatus.ok;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import CheckIcon from "@mui/icons-material/Check";
|
||||
import CloseIcon from "@mui/icons-material/Close";
|
||||
import EngineeringIcon from "@mui/icons-material/Engineering";
|
||||
import { Alert, Box, Stack, Typography, Paper, Link, Chip, Divider, Tooltip, ChipProps } from "@mui/material";
|
||||
import { Box, Stack, Typography, Paper, Link, Chip, Divider, ChipProps } from "@mui/material";
|
||||
import { useStore } from "ra-core";
|
||||
|
||||
import CurrentlyRunningCommand from "./CurrentlyRunningCommand";
|
||||
import { ServerProcessResponse, ServerStatusComponent, ServerStatusResponse } from "../../synapse/dataProvider";
|
||||
import { getTimeSince } from "../../utils/date";
|
||||
|
||||
const StatusChip = ({
|
||||
isOkay,
|
||||
@@ -40,17 +39,17 @@ const ServerComponentText = ({ text }: { text: string }) => {
|
||||
};
|
||||
|
||||
const ServerStatusPage = () => {
|
||||
const [serverStatus, setServerStatus] = useStore<ServerStatusResponse>("serverStatus", {
|
||||
const [serverStatus, _setServerStatus] = useStore<ServerStatusResponse>("serverStatus", {
|
||||
ok: false,
|
||||
success: false,
|
||||
host: "",
|
||||
results: [],
|
||||
});
|
||||
const [serverProcess, setServerProcess] = useStore<ServerProcessResponse>("serverProcess", {
|
||||
const [serverProcess, _setServerProcess] = useStore<ServerProcessResponse>("serverProcess", {
|
||||
command: "",
|
||||
locked_at: "",
|
||||
});
|
||||
const { command, locked_at } = serverProcess;
|
||||
const { command } = serverProcess;
|
||||
const successCheck = serverStatus.success;
|
||||
const isOkay = serverStatus.ok;
|
||||
const host = serverStatus.host;
|
||||
@@ -104,7 +103,7 @@ const ServerStatusPage = () => {
|
||||
</Typography>
|
||||
|
||||
<Stack spacing={2} direction="row">
|
||||
{Object.keys(groupedResults).map((category, idx) => (
|
||||
{Object.keys(groupedResults).map((category, _idx) => (
|
||||
<Box key={`category_${category}`} sx={{ flex: 1 }}>
|
||||
<Typography variant="h5" mb={1}>
|
||||
{category}
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
const transformCommandsToChoices = (commands: Record<string, any>) => {
|
||||
return Object.entries(commands).map(([key, value]) => ({
|
||||
id: key,
|
||||
name: value.name,
|
||||
description: value.description,
|
||||
}));
|
||||
};
|
||||
|
||||
const ScheduledCommandCreate = () => {
|
||||
const commandChoices = transformCommandsToChoices(serverCommands);
|
||||
|
||||
return (
|
||||
<SimpleForm>
|
||||
<SelectInput
|
||||
source="command"
|
||||
choices={commandChoices}
|
||||
optionText={choice => `${choice.name} - ${choice.description}`}
|
||||
/>
|
||||
</SimpleForm>
|
||||
);
|
||||
};
|
||||
@@ -22,6 +22,7 @@ import { RecurringCommand } from "../../../../../synapse/dataProvider";
|
||||
import { useServerCommands } from "../../../hooks/useServerCommands";
|
||||
import { useRecurringCommands } from "../../hooks/useRecurringCommands";
|
||||
|
||||
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
||||
const transformCommandsToChoices = (commands: Record<string, any>) => {
|
||||
return Object.entries(commands).map(([key, value]) => ({
|
||||
id: key,
|
||||
@@ -111,13 +112,11 @@ const RecurringCommandEdit = () => {
|
||||
delete submissionData.args;
|
||||
}
|
||||
|
||||
let result;
|
||||
|
||||
if (isCreating) {
|
||||
result = await dataProvider.createRecurringCommand(etkeccAdmin, submissionData);
|
||||
await dataProvider.createRecurringCommand(etkeccAdmin, submissionData);
|
||||
notify("recurring_commands.action.create_success", { type: "success" });
|
||||
} else {
|
||||
result = await dataProvider.updateRecurringCommand(etkeccAdmin, {
|
||||
await dataProvider.updateRecurringCommand(etkeccAdmin, {
|
||||
...submissionData,
|
||||
id: id,
|
||||
});
|
||||
@@ -129,6 +128,7 @@ const RecurringCommandEdit = () => {
|
||||
|
||||
navigate("/server_actions");
|
||||
} catch (error) {
|
||||
console.error("Error saving recurring command:", error);
|
||||
notify("recurring_commands.action.update_failure", { type: "error" });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -21,7 +21,7 @@ const ListActions = () => {
|
||||
};
|
||||
|
||||
const RecurringCommandsList = () => {
|
||||
const { data, isLoading, error } = useRecurringCommands();
|
||||
const { data, isLoading } = useRecurringCommands();
|
||||
|
||||
const listContext = useList({
|
||||
resource: "recurring",
|
||||
@@ -40,6 +40,7 @@ const RecurringCommandsList = () => {
|
||||
<Paper>
|
||||
<Datagrid
|
||||
bulkActionButtons={false}
|
||||
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
||||
rowClick={(id: Identifier, resource: string, record: any) => {
|
||||
if (!record) {
|
||||
return "";
|
||||
|
||||
@@ -11,7 +11,6 @@ import {
|
||||
useDataProvider,
|
||||
Loading,
|
||||
Button,
|
||||
BooleanInput,
|
||||
SelectInput,
|
||||
} from "react-admin";
|
||||
import { useWatch } from "react-hook-form";
|
||||
@@ -23,6 +22,7 @@ import { ScheduledCommand } from "../../../../../synapse/dataProvider";
|
||||
import { useServerCommands } from "../../../hooks/useServerCommands";
|
||||
import { useScheduledCommands } from "../../hooks/useScheduledCommands";
|
||||
|
||||
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
||||
const transformCommandsToChoices = (commands: Record<string, any>) => {
|
||||
return Object.entries(commands).map(([key, value]) => ({
|
||||
id: key,
|
||||
@@ -50,7 +50,7 @@ const ScheduledCommandEdit = () => {
|
||||
const isCreating = typeof id === "undefined";
|
||||
const [loading, setLoading] = useState(!isCreating);
|
||||
const { data: scheduledCommands, isLoading: isLoadingList } = useScheduledCommands();
|
||||
const { serverCommands, isLoading: isLoadingServerCommands } = useServerCommands();
|
||||
const { serverCommands } = useServerCommands();
|
||||
const pageTitle = isCreating ? "Create Scheduled Command" : "Edit Scheduled Command";
|
||||
|
||||
const commandChoices = transformCommandsToChoices(serverCommands);
|
||||
@@ -67,15 +67,12 @@ const ScheduledCommandEdit = () => {
|
||||
|
||||
const handleSubmit = async data => {
|
||||
try {
|
||||
let result;
|
||||
|
||||
data.scheduled_at = new Date(data.scheduled_at).toISOString();
|
||||
|
||||
if (isCreating) {
|
||||
result = await dataProvider.createScheduledCommand(etkeccAdmin, data);
|
||||
await dataProvider.createScheduledCommand(etkeccAdmin, data);
|
||||
notify("scheduled_commands.action.create_success", { type: "success" });
|
||||
} else {
|
||||
result = await dataProvider.updateScheduledCommand(etkeccAdmin, {
|
||||
await dataProvider.updateScheduledCommand(etkeccAdmin, {
|
||||
...data,
|
||||
id: id,
|
||||
});
|
||||
@@ -84,6 +81,7 @@ const ScheduledCommandEdit = () => {
|
||||
|
||||
navigate("/server_actions");
|
||||
} catch (error) {
|
||||
console.log("Error saving scheduled command:", error);
|
||||
notify("scheduled_commands.action.update_failure", { type: "error" });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -4,8 +4,6 @@ import { useState, useEffect } from "react";
|
||||
import {
|
||||
Loading,
|
||||
Button,
|
||||
useDataProvider,
|
||||
useNotify,
|
||||
SimpleShowLayout,
|
||||
TextField,
|
||||
BooleanField,
|
||||
@@ -15,7 +13,6 @@ import {
|
||||
import { useParams, useNavigate } from "react-router-dom";
|
||||
|
||||
import ScheduledDeleteButton from "./ScheduledDeleteButton";
|
||||
import { useAppContext } from "../../../../../Context";
|
||||
import { ScheduledCommand } from "../../../../../synapse/dataProvider";
|
||||
import { useScheduledCommands } from "../../hooks/useScheduledCommands";
|
||||
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
import AddIcon from "@mui/icons-material/Add";
|
||||
import { Paper } from "@mui/material";
|
||||
import { Loading, Button, useNotify, useRefresh, useCreatePath, useRecordContext } from "react-admin";
|
||||
import { Loading, Button } from "react-admin";
|
||||
import { ResourceContextProvider, useList } from "react-admin";
|
||||
import { ListContextProvider, TextField } from "react-admin";
|
||||
import { Datagrid } from "react-admin";
|
||||
import { BooleanField, DateField, TopToolbar } from "react-admin";
|
||||
import { useDataProvider } from "react-admin";
|
||||
import { Identifier } from "react-admin";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
|
||||
import { useAppContext } from "../../../../../Context";
|
||||
import { DATE_FORMAT } from "../../../../../utils/date";
|
||||
import { useScheduledCommands } from "../../hooks/useScheduledCommands";
|
||||
const ListActions = () => {
|
||||
@@ -27,7 +25,7 @@ const ListActions = () => {
|
||||
};
|
||||
|
||||
const ScheduledCommandsList = () => {
|
||||
const { data, isLoading, error } = useScheduledCommands();
|
||||
const { data, isLoading } = useScheduledCommands();
|
||||
|
||||
const listContext = useList({
|
||||
resource: "scheduled",
|
||||
@@ -46,6 +44,7 @@ const ScheduledCommandsList = () => {
|
||||
<Paper>
|
||||
<Datagrid
|
||||
bulkActionButtons={false}
|
||||
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
||||
rowClick={(id: Identifier, resource: string, record: any) => {
|
||||
if (!record) {
|
||||
return "";
|
||||
|
||||
@@ -7,16 +7,7 @@ import DownloadingIcon from "@mui/icons-material/Downloading";
|
||||
import FileOpenIcon from "@mui/icons-material/FileOpen";
|
||||
import LockIcon from "@mui/icons-material/Lock";
|
||||
import LockOpenIcon from "@mui/icons-material/LockOpen";
|
||||
import {
|
||||
Grid2 as Grid,
|
||||
Box,
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogContentText,
|
||||
DialogTitle,
|
||||
Tooltip,
|
||||
Link,
|
||||
} from "@mui/material";
|
||||
import { Box, Dialog, DialogContent, DialogContentText, DialogTitle, Tooltip } from "@mui/material";
|
||||
import { alpha, useTheme } from "@mui/material/styles";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import { get } from "lodash";
|
||||
@@ -149,7 +140,6 @@ const PurgeRemoteMediaDialog = ({ open, onClose, onSubmit }) => {
|
||||
};
|
||||
|
||||
export const PurgeRemoteMediaButton = (props: ButtonProps) => {
|
||||
const theme = useTheme();
|
||||
const [open, setOpen] = useState(false);
|
||||
const notify = useNotify();
|
||||
const dataProvider = useDataProvider<SynapseDataProvider>();
|
||||
|
||||
@@ -3,7 +3,7 @@ import { CardContent, CardHeader, Container } from "@mui/material";
|
||||
import { useTranslate } from "ra-core";
|
||||
import { ChangeEventHandler } from "react";
|
||||
|
||||
import { ParsedStats, Progress } from "./types";
|
||||
import { ImportResult, ParsedStats, Progress } from "./types";
|
||||
|
||||
const TranslatableOption = ({ value, text }: { value: string; text: string }) => {
|
||||
const translate = useTranslate();
|
||||
@@ -18,7 +18,7 @@ const ConflictModeCard = ({
|
||||
progress,
|
||||
}: {
|
||||
stats: ParsedStats | null;
|
||||
importResults: any;
|
||||
importResults: ImportResult | null;
|
||||
onConflictModeChanged: ChangeEventHandler<HTMLSelectElement>;
|
||||
conflictMode: string;
|
||||
progress: Progress;
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Checkbox } from "@mui/material";
|
||||
import { useTranslate } from "ra-core";
|
||||
import { ChangeEventHandler } from "react";
|
||||
|
||||
import { ParsedStats, Progress } from "./types";
|
||||
import { ImportResult, ParsedStats, Progress } from "./types";
|
||||
|
||||
const StatsCard = ({
|
||||
stats,
|
||||
@@ -18,7 +18,7 @@ const StatsCard = ({
|
||||
}: {
|
||||
stats: ParsedStats | null;
|
||||
progress: Progress;
|
||||
importResults: any;
|
||||
importResults: ImportResult | null;
|
||||
useridMode: string;
|
||||
passwordMode: boolean;
|
||||
onUseridModeChanged: ChangeEventHandler<HTMLSelectElement>;
|
||||
|
||||
@@ -2,14 +2,14 @@ import { CardHeader, CardContent, Container, Link, Stack, Typography, Paper } fr
|
||||
import { useTranslate } from "ra-core";
|
||||
import { ChangeEventHandler } from "react";
|
||||
|
||||
import { Progress } from "./types";
|
||||
import { ImportResult, Progress } from "./types";
|
||||
|
||||
const UploadCard = ({
|
||||
importResults,
|
||||
onFileChange,
|
||||
progress,
|
||||
}: {
|
||||
importResults: any;
|
||||
importResults: ImportResult | null;
|
||||
onFileChange: ChangeEventHandler<HTMLInputElement>;
|
||||
progress: Progress;
|
||||
}) => {
|
||||
|
||||
@@ -273,7 +273,7 @@ const useImportFile = () => {
|
||||
let retries = 0;
|
||||
const submitRecord = async (recordData: ImportLine) => {
|
||||
try {
|
||||
const response = await dataProvider.getOne("users", { id: recordData.id });
|
||||
await dataProvider.getOne("users", { id: recordData.id });
|
||||
|
||||
if (LOGGING) console.log("already existed");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user