Skip to content

Commit 914f4c6

Browse files
committed
seems to work
1 parent c73d918 commit 914f4c6

File tree

10 files changed

+232
-246
lines changed

10 files changed

+232
-246
lines changed

frontend/src/components/resources/resource-sync/pending-or-config.tsx

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,13 @@ export const PendingOrConfig = ({ id }: { id: string }) => {
5454
<Section titleOther={tabsList}>
5555
{pending?.hash && pending.message && (
5656
<Card>
57-
<CardHeader className="flex items-center gap-4 text-muted-foreground">
58-
Commit: {pending.hash}: {pending.message}
59-
</CardHeader>
57+
<div className="flex items-center gap-4 px-8 py-4">
58+
<div className="text-muted-foreground">Latest Commit</div>
59+
<div className="text-muted-foreground">|</div>
60+
<div>{pending.hash}</div>
61+
<div className="text-muted-foreground">|</div>
62+
<div>{pending.message}</div>
63+
</div>
6064
</Card>
6165
)}
6266
{pending?.data.type === "Ok" &&
@@ -103,25 +107,28 @@ const PendingView = ({
103107
<div className="flex gap-4 items-center m-0">
104108
{pending.to_create ? (
105109
<>
106-
|
110+
<div className="text-muted-foreground">|</div>
107111
<div className="flex gap-2 items-center">
108-
To Create: {pending.to_create}
112+
<div className="text-muted-foreground">To Create:</div>
113+
<div>{pending.to_create}</div>
109114
</div>
110115
</>
111116
) : undefined}
112117
{pending.to_update ? (
113118
<>
114-
|
119+
<div className="text-muted-foreground">|</div>
115120
<div className="flex gap-2 items-center">
116-
To Update: {pending.to_update}
121+
<div className="text-muted-foreground">To Update:</div>
122+
<div>{pending.to_update}</div>
117123
</div>
118124
</>
119125
) : undefined}
120126
{pending.to_delete ? (
121127
<>
122-
|
128+
<div className="text-muted-foreground">|</div>
123129
<div className="flex gap-2 items-center">
124-
To Delete: {pending.to_delete}
130+
<div className="text-muted-foreground">To Delete:</div>
131+
<div>{pending.to_delete}</div>
125132
</div>
126133
</>
127134
) : undefined}

frontend/src/components/resources/resource-sync/table.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,21 @@ export const ResourceSyncTable = ({
2222
cell: ({ row }) => (
2323
<ResourceLink type="ResourceSync" id={row.original.id} />
2424
),
25+
size: 200,
26+
},
27+
{
28+
accessorKey: "info.repo",
29+
header: ({ column }) => (
30+
<SortableHeader column={column} title="Repo" />
31+
),
32+
size: 200,
33+
},
34+
{
35+
accessorKey: "info.branch",
36+
header: ({ column }) => (
37+
<SortableHeader column={column} title="Branch" />
38+
),
39+
size: 200,
2540
},
2641
{
2742
accessorKey: "info.state",

frontend/src/components/sidebar.tsx

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,20 @@ import {
77
Box,
88
Boxes,
99
FolderTree,
10-
Key,
11-
Tag,
12-
User,
13-
Variable,
10+
Settings,
1411
} from "lucide-react";
1512
import { Link, useLocation } from "react-router-dom";
1613
import { ResourceComponents } from "./resources";
1714
import { Separator } from "@ui/separator";
1815
import { ReactNode } from "react";
1916
import { useAtom } from "jotai";
2017
import { homeViewAtom } from "@main";
21-
import { useUser } from "@lib/hooks";
2218

2319
export const Sidebar = () => {
24-
const user = useUser().data;
2520
const [view, setView] = useAtom(homeViewAtom);
2621
return (
2722
<Card className="h-fit m-4 hidden lg:flex">
28-
<CardContent className="h-fit grid gap-[2px] px-6 py-2">
23+
<CardContent className="h-fit grid gap-[4px] px-6 py-2">
2924
<SidebarLink
3025
label="Dashboard"
3126
to="/"
@@ -82,32 +77,12 @@ export const Sidebar = () => {
8277
icon={<Bell className="w-4 h-4" />}
8378
/>
8479

85-
<SidebarLink
86-
label="Variables"
87-
to="/variables"
88-
icon={<Variable className="w-4 h-4" />}
89-
/>
90-
91-
<SidebarLink
92-
label="Tags"
93-
to="/tags"
94-
icon={<Tag className="w-4 h-4" />}
95-
/>
96-
9780
<Separator />
9881

99-
{user?.admin && (
100-
<SidebarLink
101-
label="Users"
102-
to="/users"
103-
icon={<User className="w-4 h-4" />}
104-
/>
105-
)}
106-
10782
<SidebarLink
108-
label="Api Keys"
109-
to="/keys"
110-
icon={<Key className="w-4 h-4" />}
83+
label="Settings"
84+
to="/settings"
85+
icon={<Settings className="w-4 h-4" />}
11186
/>
11287
</CardContent>
11388
</Card>

frontend/src/components/topbar.tsx

Lines changed: 8 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useRead, useResourceParamType, useUser } from "@lib/hooks";
1+
import { useRead, useResourceParamType } from "@lib/hooks";
22
import { ResourceComponents } from "./resources";
33
import {
44
AlertTriangle,
@@ -8,12 +8,10 @@ import {
88
FileQuestion,
99
FolderTree,
1010
Home,
11-
Key,
1211
SearchX,
13-
Tag,
12+
Settings,
1413
User,
1514
Users,
16-
Variable,
1715
} from "lucide-react";
1816
import {
1917
DropdownMenu,
@@ -117,8 +115,6 @@ export const Topbar = () => {
117115
};
118116

119117
const PrimaryDropdown = () => {
120-
const user = useUser().data;
121-
122118
const type = useResourceParamType();
123119
const Components = type && ResourceComponents[type];
124120

@@ -133,20 +129,15 @@ const PrimaryDropdown = () => {
133129
]
134130
: location.pathname === "/"
135131
? [<Home className="w-4 h-4" />, "Home"]
136-
: location.pathname === "/keys"
137-
? [<Key className="w-4 h-4" />, "Api Keys"]
138-
: location.pathname === "/tags"
139-
? [<Tag className="w-4 h-4" />, "Tags"]
140-
: location.pathname === "/variables"
141-
? [<Variable className="w-4 h-4" />, "Variables"]
132+
: location.pathname === "/settings"
133+
? [<Settings className="w-4 h-4" />, "Settings"]
142134
: location.pathname === "/alerts"
143135
? [<AlertTriangle className="w-4 h-4" />, "Alerts"]
144136
: location.pathname === "/updates"
145137
? [<Bell className="w-4 h-4" />, "Updates"]
146138
: location.pathname.split("/")[1] === "user-groups"
147139
? [<Users className="w-4 h-4" />, "User Groups"]
148-
: location.pathname === "/users" ||
149-
location.pathname.split("/")[1] === "users"
140+
: location.pathname.split("/")[1] === "users"
150141
? [<User className="w-4 h-4" />, "Users"]
151142
: [<FileQuestion className="w-4 h-4" />, "Unknown"];
152143
// : [<Box className="w-4 h-4" />, "Dashboard"];
@@ -199,32 +190,12 @@ const PrimaryDropdown = () => {
199190
to="/updates"
200191
/>
201192

202-
<DropdownLinkItem
203-
label="Variables"
204-
icon={<Variable className="w-4 h-4" />}
205-
to="/variables"
206-
/>
207-
208-
<DropdownLinkItem
209-
label="Tags"
210-
icon={<Tag className="w-4 h-4" />}
211-
to="/tags"
212-
/>
213-
214193
<DropdownMenuSeparator />
215194

216-
{user?.admin && (
217-
<DropdownLinkItem
218-
label="Users"
219-
icon={<User className="w-4 h-4" />}
220-
to="/users"
221-
/>
222-
)}
223-
224195
<DropdownLinkItem
225-
label="Api Keys"
226-
icon={<Box className="w-4 h-4" />}
227-
to="/keys"
196+
label="Settings"
197+
icon={<Settings className="w-4 h-4" />}
198+
to="/settings"
228199
/>
229200
</DropdownMenuGroup>
230201
</DropdownMenuContent>
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { useLocalStorage, useUser } from "@lib/hooks";
2+
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@ui/tabs";
3+
import { CreateVariable, Variables } from "./variables";
4+
import { CreateTag, Tags } from "./tags";
5+
import { UsersPage } from "./users";
6+
import { CreateKey, Keys } from "./keys";
7+
import { Page } from "@components/layouts";
8+
import { useState } from "react";
9+
import { Input } from "@ui/input";
10+
11+
export const Settings = () => {
12+
const user = useUser().data;
13+
const [view, setView] = useLocalStorage("settings-view-v0", "Variables");
14+
const [search, setSearch] = useState("");
15+
const currentView = view === "Users" && !user?.admin ? "Variables" : view;
16+
return (
17+
<Page>
18+
<Tabs value={currentView} onValueChange={setView} className="grid gap-6">
19+
<div className="flex items-center justify-between">
20+
<TabsList className="justify-start w-fit">
21+
<TabsTrigger value="Variables">Variables</TabsTrigger>
22+
<TabsTrigger value="Tags">Tags</TabsTrigger>
23+
{user?.admin && <TabsTrigger value="Users">Users</TabsTrigger>}
24+
<TabsTrigger value="Api Keys">Api Keys</TabsTrigger>
25+
</TabsList>
26+
27+
{currentView === "Variables" && <CreateVariable />}
28+
{currentView === "Tags" && <CreateTag />}
29+
{currentView === "Api Keys" && <CreateKey />}
30+
{currentView === "Users" && (
31+
<Input
32+
placeholder="Search"
33+
value={search}
34+
onChange={(e) => setSearch(e.target.value)}
35+
className="w-[250px]"
36+
/>
37+
)}
38+
</div>
39+
40+
<TabsContent value="Variables">
41+
<Variables />
42+
</TabsContent>
43+
<TabsContent value="Tags">
44+
<Tags />
45+
</TabsContent>
46+
{user?.admin && (
47+
<TabsContent value="Users">
48+
<UsersPage search={search} />
49+
</TabsContent>
50+
)}
51+
<TabsContent value="Api Keys">
52+
<Keys />
53+
</TabsContent>
54+
</Tabs>
55+
</Page>
56+
);
57+
};

frontend/src/pages/keys.tsx renamed to frontend/src/pages/settings/keys.tsx

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { Page } from "@components/layouts";
21
import { ConfirmButton, CopyButton } from "@components/util";
32
import { useInvalidate, useManageUser, useRead, useSetTitle } from "@lib/hooks";
43
import {
@@ -11,7 +10,7 @@ import {
1110
} from "@ui/dialog";
1211
import { Button } from "@ui/button";
1312
import { useToast } from "@ui/use-toast";
14-
import { Trash, PlusCircle, Loader2, Check, Key } from "lucide-react";
13+
import { Trash, PlusCircle, Loader2, Check } from "lucide-react";
1514
import { useState } from "react";
1615
import { Input } from "@ui/input";
1716
import {
@@ -26,22 +25,14 @@ import { KeysTable } from "@components/keys/table";
2625
export const Keys = () => {
2726
useSetTitle("Api Keys");
2827
const keys = useRead("ListApiKeys", {}).data ?? [];
29-
return (
30-
<Page
31-
title="Api Keys"
32-
icon={<Key className="w-8 h-8" />}
33-
actions={<CreateKey />}
34-
>
35-
<KeysTable keys={keys} DeleteKey={DeleteKey} />
36-
</Page>
37-
);
28+
return <KeysTable keys={keys} DeleteKey={DeleteKey} />;
3829
};
3930

4031
const ONE_DAY_MS = 1000 * 60 * 60 * 24;
4132

4233
type ExpiresOptions = "90 days" | "180 days" | "1 year" | "never";
4334

44-
const CreateKey = () => {
35+
export const CreateKey = () => {
4536
const [open, setOpen] = useState(false);
4637
const [name, setName] = useState("");
4738
const [expires, setExpires] = useState<ExpiresOptions>("never");

0 commit comments

Comments
 (0)