Skip to content

Commit

Permalink
[#3] added breadcrumbs to all dashboards
Browse files Browse the repository at this point in the history
  • Loading branch information
Eriikah committed Jun 25, 2024
1 parent 32b9f12 commit fd5085a
Show file tree
Hide file tree
Showing 2 changed files with 181 additions and 157 deletions.
296 changes: 146 additions & 150 deletions src/dashboards/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,105 +54,90 @@ export function HomePage() {

return (
<>
<div className="main">
<div>
<div>
<div>
<img
className="logo"
src={require("./../static/logo_llng_400px.png")}
alt="logo"
/>
</div>
<strong className="title1">{t("Configuration Manager")}</strong>
<img
className="logo"
src={require("./../static/logo_llng_400px.png")}
alt="logo"
/>
</div>
<div className="search-container">
<div className="search">
<Button
component="label"
role={undefined}
variant="contained"
tabIndex={-1}
startIcon={<DownloadIcon />}
onClick={async () =>
await exportData("full", config.data.metadata.cfgNum)
}
>
{t("downloadIt")}
</Button>
</div>
<div className="search">
<Button
component="label"
role={undefined}
variant="contained"
tabIndex={-1}
startIcon={<CloudUploadIcon />}
>
{t("restore")}
<VisuallyHiddenInput
type="file"
onChange={(e) => {
if (e.target instanceof HTMLInputElement) {
handleChangeFile(
e as ChangeEvent<HTMLInputElement>
).then((fileContent) => {
<strong className="title1">{t("Configuration Manager")}</strong>
</div>
<div className="search-container">
<div className="search">
<Button
component="label"
role={undefined}
variant="contained"
tabIndex={-1}
startIcon={<DownloadIcon />}
onClick={async () =>
await exportData("full", config.data.metadata.cfgNum)
}
>
{t("downloadIt")}
</Button>
</div>
<div className="search">
<Button
component="label"
role={undefined}
variant="contained"
tabIndex={-1}
startIcon={<CloudUploadIcon />}
>
{t("restore")}
<VisuallyHiddenInput
type="file"
onChange={(e) => {
if (e.target instanceof HTMLInputElement) {
handleChangeFile(e as ChangeEvent<HTMLInputElement>).then(
(fileContent) => {
console.debug("File content:", fileContent);
dispatch(
saveConfigAsync(
JSON.parse(fileContent) as llngConfig
)
);
setOpenSavePopup(true);
});
}
}}
/>
</Button>
</div>
<div className="search">
<Button
variant="contained"
onClick={() => dispatch(push(`#authParams/latest`))}
>
{t("authParams")}
</Button>
</div>
<div className="search">
<Button
variant="contained"
onClick={() => dispatch(push(`#tree/latest`))}
>
{t("tree")}
</Button>
</div>
<div className="search">
<TextField
type="number"
size="small"
error={aimedConf <= 0}
helperText={`${
aimedConf === 0
? "Enter only positive and non nul numbers"
: ""
}`}
placeholder={t("search config num")}
onChange={(e) => SetAimedConf(Number(e.target.value))}
onKeyDown={(e) => {
if (e.key === "Enter") {
if (aimedConf <= config.data.metadata.cfgNum) {
dispatch(push(`#conf/${aimedConf}`));
} else
dispatch(
setError(
`Latest Config : ${config.data.metadata.cfgNum}`
)
);
}
);
}
}}
/>
<Button
variant="contained"
onClick={() => {
</Button>
</div>
<div className="search">
<Button
variant="contained"
onClick={() => dispatch(push(`#authParams/latest`))}
>
{t("authParams")}
</Button>
</div>
<div className="search">
<Button
variant="contained"
onClick={() => dispatch(push(`#tree/latest`))}
>
{t("tree")}
</Button>
</div>
<div className="search">
<TextField
type="number"
size="small"
error={aimedConf <= 0}
helperText={`${
aimedConf === 0
? "Enter only positive and non nul numbers"
: ""
}`}
placeholder={t("search config num")}
onChange={(e) => SetAimedConf(Number(e.target.value))}
onKeyDown={(e) => {
if (e.key === "Enter") {
if (aimedConf <= config.data.metadata.cfgNum) {
dispatch(push(`#conf/${aimedConf}`));
} else
Expand All @@ -161,73 +146,84 @@ export function HomePage() {
`Latest Config : ${config.data.metadata.cfgNum}`
)
);
}}
>
{t("go")}
</Button>
</div>
</div>
<div className="desc">
<div>
<table className="infoTable">
<thead>
<tr>
<th>
<strong>{t("Latest conf info")}</strong>
</th>
</tr>
</thead>
<tbody>
<tr>
<th>
<span>{t("latest")}</span>
</th>
<td>
<Button
variant="contained"
onClick={() => {
dispatch(push(`#conf/latest`));
dispatch(getConfigAsync());
}}
>
{config.data.metadata.cfgNum}
</Button>
</td>
</tr>
<tr>
<th>
<span>{t("date")}</span>
</th>
<td>{createdDate.toLocaleString()}</td>
</tr>
<tr>
<th>
<span>{t("author")}</span>
</th>
<td>{config.data.metadata.cfgAuthor}</td>
</tr>
<tr>
<th>
<span>{t("authorIPAddress")}</span>
</th>
<td>{config.data.metadata.cfgAuthorIP}</td>
</tr>
</tbody>
</table>
</div>
}
}}
/>
<Button
variant="contained"
onClick={() => {
if (aimedConf <= config.data.metadata.cfgNum) {
dispatch(push(`#conf/${aimedConf}`));
} else
dispatch(
setError(`Latest Config : ${config.data.metadata.cfgNum}`)
);
}}
>
{t("go")}
</Button>
</div>
</div>
<div className="desc">
<div>
<strong className="title2">{t("Latest conf stats")}</strong>
<ConfStats config={config.data.config} />
</div>
<div
style={{
visibility: config.error.errorContent ? "visible" : "hidden",
}}
>
<strong>{t("latestError")}</strong> {config.error.errorContent}
<table className="infoTable">
<thead>
<tr>
<th>
<strong>{t("Latest conf info")}</strong>
</th>
</tr>
</thead>
<tbody>
<tr>
<th>
<span>{t("latest")}</span>
</th>
<td>
<Button
variant="contained"
onClick={() => {
dispatch(push(`#conf/latest`));
dispatch(getConfigAsync());
}}
>
{config.data.metadata.cfgNum}
</Button>
</td>
</tr>
<tr>
<th>
<span>{t("date")}</span>
</th>
<td>{createdDate.toLocaleString()}</td>
</tr>
<tr>
<th>
<span>{t("author")}</span>
</th>
<td>{config.data.metadata.cfgAuthor}</td>
</tr>
<tr>
<th>
<span>{t("authorIPAddress")}</span>
</th>
<td>{config.data.metadata.cfgAuthorIP}</td>
</tr>
</tbody>
</table>
</div>
</div>
<div>
<strong className="title2">{t("Latest conf stats")}</strong>
<ConfStats config={config.data.config} />
</div>
<div
style={{
visibility: config.error.errorContent ? "visible" : "hidden",
}}
>
<strong>{t("latestError")}</strong> {config.error.errorContent}
</div>
<Footer cfgVersion={config.data.config.cfgVersion} />
<SavePopup
config={config}
Expand Down
Loading

0 comments on commit fd5085a

Please sign in to comment.