Implement Fixed Node Management
This commit is contained in:
@@ -155,7 +155,7 @@ const BotsManagement: React.FC<BotsManagementProps> = ({ token, logoutUser }) =>
|
|||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
fetchData();
|
fetchData();
|
||||||
setIsAddIdDialogOpen(false);
|
setIsAddIdDialogOpen(false);
|
||||||
setNewIdData({ discord_id: '', name: '', token: '', active: false, guild_ids: '' });
|
setNewIdData({ discord_id: '', name: '', token: '', active: false, guild_ids: '', fixed_node: '' });
|
||||||
setEditingId(null);
|
setEditingId(null);
|
||||||
} else {
|
} else {
|
||||||
let errorMsg = `Failed to ${editingId ? 'update' : 'add'} Discord ID (${response.status})`;
|
let errorMsg = `Failed to ${editingId ? 'update' : 'add'} Discord ID (${response.status})`;
|
||||||
@@ -292,7 +292,7 @@ const BotsManagement: React.FC<BotsManagementProps> = ({ token, logoutUser }) =>
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<h3 className="text-lg font-semibold mb-2">Manage Discord IDs</h3>
|
<h3 className="text-lg font-semibold mb-2">Manage Discord IDs</h3>
|
||||||
<Button onClick={() => { setEditingId(null); setNewIdData({ discord_id: '', name: '', token: '', active: false, guild_ids: '' }); setIsAddIdDialogOpen(true);}} className="mb-4" disabled={!token}>Add New Discord ID</Button>
|
<Button onClick={() => { setEditingId(null); setNewIdData({ discord_id: '', name: '', token: '', active: false, guild_ids: '', fixed_node: '' }); setIsAddIdDialogOpen(true);}} className="mb-4" disabled={!token}>Add New Discord ID</Button>
|
||||||
<Button onClick={() => setIsAssignDismissDialogOpen(true)} className="mb-4 ml-2" disabled={!token}>Assign/Dismiss Bot System</Button>
|
<Button onClick={() => setIsAssignDismissDialogOpen(true)} className="mb-4 ml-2" disabled={!token}>Assign/Dismiss Bot System</Button>
|
||||||
|
|
||||||
<Table>
|
<Table>
|
||||||
@@ -303,6 +303,7 @@ const BotsManagement: React.FC<BotsManagementProps> = ({ token, logoutUser }) =>
|
|||||||
<TableHead>Token (Partial)</TableHead>
|
<TableHead>Token (Partial)</TableHead>
|
||||||
<TableHead>Active</TableHead>
|
<TableHead>Active</TableHead>
|
||||||
<TableHead>Guilds</TableHead>
|
<TableHead>Guilds</TableHead>
|
||||||
|
<TableHead>Fixed Node ID</TableHead>
|
||||||
<TableHead>Actions</TableHead>
|
<TableHead>Actions</TableHead>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableHeader>
|
</TableHeader>
|
||||||
@@ -315,6 +316,7 @@ const BotsManagement: React.FC<BotsManagementProps> = ({ token, logoutUser }) =>
|
|||||||
<TableCell className="truncate max-w-xs">{dId.token ? dId.token.substring(0, 8) + '...' : 'N/A'}</TableCell>
|
<TableCell className="truncate max-w-xs">{dId.token ? dId.token.substring(0, 8) + '...' : 'N/A'}</TableCell>
|
||||||
<TableCell>{dId.active ? 'Yes' : 'No'}</TableCell>
|
<TableCell>{dId.active ? 'Yes' : 'No'}</TableCell>
|
||||||
<TableCell>{dId.guild_ids?.join(', ')}</TableCell>
|
<TableCell>{dId.guild_ids?.join(', ')}</TableCell>
|
||||||
|
<TableCell>{dId?.fixed_node ? dId?.fixed_node : "None"}</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<Button variant="outline" size="sm" className="mr-2"
|
<Button variant="outline" size="sm" className="mr-2"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@@ -325,6 +327,7 @@ const BotsManagement: React.FC<BotsManagementProps> = ({ token, logoutUser }) =>
|
|||||||
token: dId.token,
|
token: dId.token,
|
||||||
active: dId.active,
|
active: dId.active,
|
||||||
guild_ids: dId.guild_ids?.join(', '),
|
guild_ids: dId.guild_ids?.join(', '),
|
||||||
|
fixed_node: dId.fixed_node,
|
||||||
});
|
});
|
||||||
setIsAddIdDialogOpen(true);
|
setIsAddIdDialogOpen(true);
|
||||||
}}
|
}}
|
||||||
@@ -389,6 +392,15 @@ const BotsManagement: React.FC<BotsManagementProps> = ({ token, logoutUser }) =>
|
|||||||
className="col-span-3"
|
className="col-span-3"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="grid grid-cols-4 items-center gap-4">
|
||||||
|
<Label htmlFor="guild_ids" className="text-right">Fixed Node</Label>
|
||||||
|
<Input
|
||||||
|
id="fixed_node"
|
||||||
|
value={newIdData?.fixed_node}
|
||||||
|
onChange={(e) => setNewIdData({ ...newIdData, fixed_node: e.target.value })}
|
||||||
|
className="col-span-3"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<div className="grid grid-cols-4 items-center gap-4">
|
<div className="grid grid-cols-4 items-center gap-4">
|
||||||
<Label htmlFor="active" className="text-right">Active</Label>
|
<Label htmlFor="active" className="text-right">Active</Label>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ export enum DemodTypes {
|
|||||||
token: string;
|
token: string;
|
||||||
active: boolean;
|
active: boolean;
|
||||||
guild_ids: string[];
|
guild_ids: string[];
|
||||||
|
fixed_node?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface System {
|
export interface System {
|
||||||
|
|||||||
Reference in New Issue
Block a user