refactor: move integration pages to management pages (#419)

This commit is contained in:
Manuel
2024-05-01 21:57:18 +02:00
committed by GitHub
parent fba767bde3
commit 84801d3174
21 changed files with 31 additions and 12 deletions

View File

@@ -37,7 +37,7 @@ export const AppDeleteButton = ({ app }: AppDeleteButtonProps) => {
title: t("notification.success.title"), title: t("notification.success.title"),
message: t("notification.success.message"), message: t("notification.success.message"),
}); });
void revalidatePathAction("/apps"); void revalidatePathAction("/manage/apps");
}, },
onError: () => { onError: () => {
showErrorNotification({ showErrorNotification({

View File

@@ -47,7 +47,7 @@ export const AppForm = (props: AppFormProps) => {
<TextInput {...form.getInputProps("href")} label="URL" /> <TextInput {...form.getInputProps("href")} label="URL" />
<Group justify="end"> <Group justify="end">
<Button variant="default" component={Link} href="/apps"> <Button variant="default" component={Link} href="/manage/apps">
{t("common.action.backToOverview")} {t("common.action.backToOverview")}
</Button> </Button>
<Button type="submit" loading={isPending}> <Button type="submit" loading={isPending}>

View File

@@ -30,8 +30,8 @@ export const AppEditForm = ({ app }: AppEditFormProps) => {
title: t("success.title"), title: t("success.title"),
message: t("success.message"), message: t("success.message"),
}); });
void revalidatePathAction("/apps").then(() => { void revalidatePathAction("/manage/apps").then(() => {
router.push("/apps"); router.push("/manage/apps");
}); });
}, },
onError: () => { onError: () => {

View File

@@ -25,8 +25,8 @@ export const AppNewForm = () => {
title: t("success.title"), title: t("success.title"),
message: t("success.message"), message: t("success.message"),
}); });
void revalidatePathAction("/apps").then(() => { void revalidatePathAction("/manage/apps").then(() => {
router.push("/apps"); router.push("/manage/apps");
}); });
}, },
onError: () => { onError: () => {

View File

@@ -28,7 +28,7 @@ export default async function AppsPage() {
<Stack> <Stack>
<Group justify="space-between" align="center"> <Group justify="space-between" align="center">
<Title>Apps</Title> <Title>Apps</Title>
<Button component={Link} href="/apps/new"> <Button component={Link} href="/manage/apps/new">
New app New app
</Button> </Button>
</Group> </Group>
@@ -82,7 +82,7 @@ const AppCard = ({ app }: AppCardProps) => {
<ActionIconGroup> <ActionIconGroup>
<ActionIcon <ActionIcon
component={Link} component={Link}
href={`/apps/edit/${app.id}`} href={`/manage/apps/edit/${app.id}`}
variant="subtle" variant="subtle"
color="gray" color="gray"
aria-label="Edit app" aria-label="Edit app"
@@ -107,7 +107,7 @@ const AppNoResults = async () => {
<Text fw={500} size="lg"> <Text fw={500} size="lg">
{t("app.page.list.noResults.title")} {t("app.page.list.noResults.title")}
</Text> </Text>
<Anchor href="/apps/new"> <Anchor href="/manage/apps/new">
{t("app.page.list.noResults.description")} {t("app.page.list.noResults.description")}
</Anchor> </Anchor>
</Stack> </Stack>

View File

@@ -20,6 +20,7 @@ import { useI18n } from "@homarr/translation/client";
import type { z } from "@homarr/validation"; import type { z } from "@homarr/validation";
import { validation } from "@homarr/validation"; import { validation } from "@homarr/validation";
import { revalidatePathAction } from "~/app/revalidatePathAction";
import { SecretCard } from "../../_integration-secret-card"; import { SecretCard } from "../../_integration-secret-card";
import { IntegrationSecretInput } from "../../_integration-secret-inputs"; import { IntegrationSecretInput } from "../../_integration-secret-inputs";
import { import {
@@ -27,7 +28,6 @@ import {
TestConnectionNoticeAlert, TestConnectionNoticeAlert,
useTestConnectionDirty, useTestConnectionDirty,
} from "../../_integration-test-connection"; } from "../../_integration-test-connection";
import { revalidatePathAction } from "../../../../../revalidatePathAction";
interface EditIntegrationForm { interface EditIntegrationForm {
integration: RouterOutputs["integration"]["byId"]; integration: RouterOutputs["integration"]["byId"];

View File

@@ -1,6 +1,6 @@
"use client"; "use client";
import { useMemo, useState } from "react"; import React, { ChangeEvent, useMemo, useState } from "react";
import Link from "next/link"; import Link from "next/link";
import { Group, Menu, ScrollArea, Stack, Text, TextInput } from "@mantine/core"; import { Group, Menu, ScrollArea, Stack, Text, TextInput } from "@mantine/core";
import { IconSearch } from "@tabler/icons-react"; import { IconSearch } from "@tabler/icons-react";
@@ -20,13 +20,18 @@ export const IntegrationCreateDropdownContent = () => {
); );
}, [search]); }, [search]);
const handleSearch = React.useCallback(
(event: ChangeEvent<HTMLInputElement>) => setSearch(event.target.value),
[setSearch],
);
return ( return (
<Stack> <Stack>
<TextInput <TextInput
leftSection={<IconSearch stroke={1.5} size={20} />} leftSection={<IconSearch stroke={1.5} size={20} />}
placeholder={t("integration.page.list.search")} placeholder={t("integration.page.list.search")}
value={search} value={search}
onChange={(event) => setSearch(event.target.value)} onChange={handleSearch}
/> />
{filteredKinds.length > 0 ? ( {filteredKinds.length > 0 ? (

View File

@@ -2,6 +2,7 @@ import type { PropsWithChildren } from "react";
import { AppShellMain } from "@mantine/core"; import { AppShellMain } from "@mantine/core";
import { import {
IconBook2, IconBook2,
IconBox,
IconBrandDiscord, IconBrandDiscord,
IconBrandDocker, IconBrandDocker,
IconBrandGithub, IconBrandGithub,
@@ -11,6 +12,7 @@ import {
IconLayoutDashboard, IconLayoutDashboard,
IconLogs, IconLogs,
IconMailForward, IconMailForward,
IconPlug,
IconQuestionMark, IconQuestionMark,
IconTool, IconTool,
IconUser, IconUser,
@@ -38,6 +40,16 @@ export default async function ManageLayout({ children }: PropsWithChildren) {
href: "/manage/boards", href: "/manage/boards",
label: t("items.boards"), label: t("items.boards"),
}, },
{
icon: IconBox,
href: "/manage/apps",
label: t("items.apps"),
},
{
icon: IconPlug,
href: "/manage/integrations",
label: t("items.integrations"),
},
{ {
icon: IconUser, icon: IconUser,
label: t("items.users.label"), label: t("items.users.label"),

View File

@@ -961,6 +961,8 @@ export default {
items: { items: {
home: "Home", home: "Home",
boards: "Boards", boards: "Boards",
apps: "Apps",
integrations: "Integrations",
users: { users: {
label: "Users", label: "Users",
items: { items: {