feat: brand-new interface

This was initally generated by ai, but later has been heavily edited.
The reason why it has been implemented is that there are plans to
implement more features to ui, but it becomes hard to add new features
to plain js, so I decided to rewrite it in typescript.

Yet because it is still ai slop, it is still possible to enable old
interface via configuration, even though new interface is turned on by
default to get feedback
This commit is contained in:
2026-02-25 22:49:38 +02:00
parent db46147f0d
commit b8d9bef965
159 changed files with 5955 additions and 307 deletions

View File

@@ -0,0 +1,88 @@
/*
* Copyright (c) 2021-2026 ahriman team.
*
* This file is part of ahriman
* (see https://github.com/arcan1s/ahriman).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import PlayArrowIcon from "@mui/icons-material/PlayArrow";
import { Button, Dialog, DialogActions, DialogContent, TextField } from "@mui/material";
import { ApiError } from "api/client/ApiError";
import DialogHeader from "components/common/DialogHeader";
import RepositorySelect from "components/common/RepositorySelect";
import { useClient } from "hooks/useClient";
import { useNotification } from "hooks/useNotification";
import { useSelectedRepository } from "hooks/useSelectedRepository";
import React, { useState } from "react";
interface PackageRebuildDialogProps {
open: boolean;
onClose: () => void;
}
export default function PackageRebuildDialog({ open, onClose }: PackageRebuildDialogProps): React.JSX.Element {
const client = useClient();
const { showSuccess, showError } = useNotification();
const repositorySelect = useSelectedRepository();
const [dependency, setDependency] = useState("");
const handleClose = (): void => {
setDependency("");
repositorySelect.reset();
onClose();
};
const handleRebuild: () => Promise<void> = async () => {
if (!dependency) {
return;
}
const repository = repositorySelect.selectedRepository;
if (!repository) {
return;
}
try {
await client.service.serviceRebuild(repository, [dependency]);
handleClose();
showSuccess("Success", `Repository rebuild has been run for packages which depend on ${dependency}`);
} catch (exception) {
const detail = ApiError.errorDetail(exception);
showError("Action failed", `Repository rebuild failed: ${detail}`);
}
};
return <Dialog open={open} onClose={handleClose} maxWidth="md" fullWidth>
<DialogHeader onClose={handleClose}>
Rebuild depending packages
</DialogHeader>
<DialogContent>
<RepositorySelect repositorySelect={repositorySelect} />
<TextField
label="dependency"
placeholder="packages dependency"
fullWidth
margin="normal"
value={dependency}
onChange={event => setDependency(event.target.value)}
/>
</DialogContent>
<DialogActions>
<Button onClick={() => void handleRebuild()} variant="contained" startIcon={<PlayArrowIcon />}>rebuild</Button>
</DialogActions>
</Dialog>;
}