Skip to content

Commit 10a5ae8

Browse files
committed
feat: update namespace handling to use index instead of number for improved clarity
1 parent e068725 commit 10a5ae8

10 files changed

Lines changed: 31 additions & 47 deletions

File tree

src/packages/ce/src/application/components/ApplicationAttentionFlowsComponent.tsx

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,11 @@ import {FlowService} from "@edition/flow/services/Flow.service";
2020
import {FlowView} from "@edition/flow/services/Flow.view";
2121
import {Namespace} from "@code0-tech/sagittarius-graphql-types";
2222
import {useUserSession} from "@edition/user/hooks/User.session.hook";
23-
import {IconChevronRight} from "@tabler/icons-react";
23+
import {IconChevronRight, IconPointFilled} from "@tabler/icons-react";
2424
import {formatDistanceToNow} from "date-fns";
2525
import {useRouter} from "next/navigation";
2626

2727
export interface ApplicationAttentionFlowsComponentProps {
28-
// When omitted, flows across every namespace the user is a member of are
29-
// considered. When set, only flows inside that namespace are shown.
3028
namespaceId?: Namespace['id']
3129
}
3230

@@ -105,19 +103,10 @@ export const ApplicationAttentionFlowsComponent: React.FC<ApplicationAttentionFl
105103
return <Card color={"secondary"} clickable onClick={() => setOpen(previous => !previous)}>
106104
<Flex align={"center"} justify={"space-between"} style={{gap: "0.75rem"}}>
107105
<Flex align={"center"} style={{gap: "0.75rem", minWidth: 0}}>
108-
<div style={{
109-
width: 8,
110-
height: 8,
111-
borderRadius: "50%",
112-
background: "#FFBE0B",
113-
flexShrink: 0
114-
}}/>
106+
<IconPointFilled size={16} color={"#FFBE0B"} style={{flexShrink: 0}}/>
115107
<Text size={"md"}>{count} {count === 1 ? "flow needs" : "flows need"} attention</Text>
116108
</Flex>
117-
<IconChevronRight size={16} style={{
118-
transform: open ? "rotate(90deg)" : "none",
119-
transition: "transform 0.2s"
120-
}}/>
109+
<IconChevronRight size={16} style={{transform: open ? "rotate(90deg)" : "none"}}/>
121110
</Flex>
122111
{open && (
123112
<div onClick={(e) => e.stopPropagation()}>

src/packages/ce/src/application/pages/ApplicationPage.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ export const ApplicationPage = () => {
1717
height: "100%",
1818
position: "relative",
1919
boxSizing: "border-box",
20-
borderRadius: "1rem",
21-
padding: "1rem",
20+
borderRadius: "1rem"
2221
}}>
2322
<ScrollArea h={"100%"} type={"scroll"}>
2423
<ScrollAreaViewport>

src/packages/ce/src/application/views/ApplicationNavigationView.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
Avatar,
66
Button,
77
Flex,
8+
Icon,
89
Menu,
910
MenuContent,
1011
MenuItem,
@@ -70,11 +71,7 @@ export const ApplicationNavigationView: React.FC = () => {
7071
<TooltipTrigger asChild>
7172
<Link href={"/"} prefetch>
7273
<Button variant={"none"} p={0.5}>
73-
<svg xmlns="http://www.w3.org/2000/svg" height={16} width={16} fill={"#fff"} id="c"
74-
viewBox="8.01 8.97 23.83 23.83">
75-
<path
76-
d="M25.498,8.966h-11.132c-3.508,0-6.351,2.843-6.351,6.351v11.132c0,3.507,2.843,6.351,6.351,6.351h11.132c3.508,0,6.351-2.843,6.351-6.351v-11.132c0-3.507-2.843-6.351-6.351-6.351ZM24.829,15.569h-.379c-.454,0-.759.101-.915.303-.157.202-.234.514-.234.938v2.011c0,.525-.071.968-.212,1.331s-.423.676-.847.938c.424.262.706.575.847.938s.212.807.212,1.331v2.012c0,.423.078.736.234.937.156.202.461.303.915.303h.379v1.8h-.303c-.635,0-1.167-.061-1.596-.182-.429-.121-.771-.298-1.029-.53s-.441-.516-.552-.855c-.111-.337-.167-.724-.167-1.157v-2.285c0-.423-.101-.766-.303-1.028-.198-.258-.522-.387-.965-.391-.443.004-.766.132-.966.391-.201.262-.302.605-.302,1.028v2.285c0,.433-.056.819-.167,1.157-.111.338-.295.623-.552.855s-.6.408-1.029.53c-.428.12-.96.182-1.596.182h-.303v-1.8h.379c.454,0,.758-.101.915-.303.156-.201.234-.514.234-.937v-2.012c0-.524.07-.968.212-1.331.141-.363.423-.676.847-.938-.423-.262-.705-.575-.847-.938-.142-.363-.212-.806-.212-1.331v-2.011c0-.424-.078-.736-.234-.938-.157-.201-.461-.303-.915-.303h-.379v-1.799h.303c.635,0,1.167.06,1.596.182.429.12.771.297,1.029.529.257.233.441.517.552.855.111.338.167.724.167,1.158v2.284c0,.423.101.766.302,1.029.199.258.522.386.966.39.443-.004.766-.131.965-.39.202-.262.303-.606.303-1.029v-2.284c0-.434.055-.819.167-1.158.111-.337.295-.622.552-.855.257-.232.6-.408,1.029-.529.428-.121.96-.182,1.596-.182h.303v1.799Z"/>
77-
</svg>
74+
<Icon icon={"codezero:codezero"} color={"#fff"} size={16}/>
7875
</Button>
7976
</Link>
8077
</TooltipTrigger>

src/packages/ce/src/datatype/components/inputs/json/DataTypeJSONInputTreeComponent.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export const DataTypeJSONInputTreeComponent: React.FC<DataTypeJSONInputTreeCompo
8989
{icon}
9090
<Text hierarchy="tertiary">{Array.isArray(value) ? "is a list of" : "is a nested object"}</Text>
9191
</Flex>
92-
{!isCollapsed && (renderNodes?.length ?? 0) > 0 && <ul className="jsonTree">{renderNodes}</ul>}
92+
{!isCollapsed && (renderNodes?.length ?? 0) > 0 && <ul className="json-tree">{renderNodes}</ul>}
9393
</div>
9494
)
9595
}
@@ -139,7 +139,7 @@ export const DataTypeJSONInputTreeComponent: React.FC<DataTypeJSONInputTreeCompo
139139
/>
140140
) : null
141141
return (
142-
<li key={pathKey} className="jsonTree__item">
142+
<li key={pathKey} className="json-tree__item">
143143
<div
144144
onClick={e => {
145145
e.stopPropagation()
@@ -162,5 +162,5 @@ export const DataTypeJSONInputTreeComponent: React.FC<DataTypeJSONInputTreeCompo
162162
const nodes = rootNode && isRoot ? [rootNode] : renderNodes
163163
const validNodes = (nodes ?? []).filter(Boolean)
164164
if (validNodes.length <= 0) return null
165-
return <ul className="jsonTree">{validNodes}</ul>
165+
return <ul className="json-tree">{validNodes}</ul>
166166
}

src/packages/ce/src/datatype/components/inputs/type/DataTypeTypeInputComponent.style.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
@use "@core/style/box";
33
@use "@core/style/variables";
44

5-
.jsonTree {
5+
.json-tree {
66
list-style: none;
77
margin: 0;
88
margin-inline-start: 2px;
@@ -15,7 +15,7 @@
1515
gap: variables.$xxs;
1616
}
1717

18-
.jsonTree__item {
18+
.json-tree__item {
1919
position: relative;
2020
padding-inline-start: variables.$xs;
2121
list-style: none;

src/packages/ce/src/flow/views/FlowRecentListView.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ export const FlowRecentListView: React.FC = () => {
2020
const projectService = useService(ProjectService)
2121
const projectStore = useStore(ProjectService)
2222

23-
const namespaceNumber = params.namespaceId as any as number
24-
const namespaceId: Namespace['id'] = `gid://sagittarius/Namespace/${namespaceNumber}`
23+
const namespaceIndex = params.namespaceId as any as number
24+
const namespaceId: Namespace['id'] = `gid://sagittarius/Namespace/${namespaceIndex}`
2525

2626
const projects = React.useMemo(
2727
() => projectService.values({namespaceId})
@@ -52,12 +52,12 @@ export const FlowRecentListView: React.FC = () => {
5252
</Flex>
5353
<Spacing spacing={"xxs"}/>
5454
{flows.map(({flow, project}) => {
55-
const projectNumber = project.id?.match(/NamespaceProject\/(\d+)$/)?.[1]
56-
const flowNumber = flow.id?.match(/Flow\/(\d+)$/)?.[1]
55+
const projectIndex = project.id?.match(/NamespaceProject\/(\d+)$/)?.[1]
56+
const flowIndex = flow.id?.match(/Flow\/(\d+)$/)?.[1]
5757
const name = flow.name ?? ""
5858
const displayName = name.split("/").filter(Boolean).pop() ?? name
5959
return <Link key={flow.id}
60-
href={`/namespace/${namespaceNumber}/project/${projectNumber}/flow/${flowNumber}`}
60+
href={`/namespace/${namespaceIndex}/project/${projectIndex}/flow/${flowIndex}`}
6161
style={{width: "100%"}}
6262
prefetch>
6363
<Button variant={"none"} w={"100%"} justify={"flex-start"} paddingSize={"xxs"}>

src/packages/ce/src/namespace/pages/NamespaceOverviewPage.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ export const NamespaceOverviewPage: React.FC = () => {
2626
height: "100%",
2727
position: "relative",
2828
boxSizing: "border-box",
29-
borderRadius: "1rem",
30-
padding: "1rem",
29+
borderRadius: "1rem"
3130
}}>
3231
<ScrollArea h={"100%"} type={"scroll"}>
3332
<ScrollAreaViewport>

src/packages/ce/src/namespace/views/NamespaceMenuView.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ export const NamespaceMenuView: React.FC = () => {
5151

5252
const currentSession = useUserSession()
5353

54-
const namespaceNumber = params.namespaceId as any as number
55-
const namespaceId: Namespace['id'] = `gid://sagittarius/Namespace/${namespaceNumber}`
54+
const namespaceIndex = params.namespaceId as any as number
55+
const namespaceId: Namespace['id'] = `gid://sagittarius/Namespace/${namespaceIndex}`
5656

5757
const namespace = React.useMemo(
5858
() => namespaceService.getById(namespaceId),
@@ -113,25 +113,25 @@ export const NamespaceMenuView: React.FC = () => {
113113
<MenuLabel>
114114
Workspace
115115
</MenuLabel>
116-
<Link href={`/namespace/${namespaceNumber}/settings`} prefetch style={{display: "contents"}}>
116+
<Link href={`/namespace/${namespaceIndex}/settings`} prefetch style={{display: "contents"}}>
117117
<MenuItem>
118118
<IconSettings size={16}/>
119119
Settings
120120
</MenuItem>
121121
</Link>
122-
<Link href={`/namespace/${namespaceNumber}/settings`} prefetch style={{display: "contents"}}>
122+
<Link href={`/namespace/${namespaceIndex}/settings`} prefetch style={{display: "contents"}}>
123123
<MenuItem>
124124
<IconSettings color={"transparent"} size={16}/>
125125
Members
126126
</MenuItem>
127127
</Link>
128-
<Link href={`/namespace/${namespaceNumber}/settings`} prefetch style={{display: "contents"}}>
128+
<Link href={`/namespace/${namespaceIndex}/settings`} prefetch style={{display: "contents"}}>
129129
<MenuItem>
130130
<IconSettings color={"transparent"} size={16}/>
131131
Roles
132132
</MenuItem>
133133
</Link>
134-
<Link href={`/namespace/${namespaceNumber}/settings`} prefetch style={{display: "contents"}}>
134+
<Link href={`/namespace/${namespaceIndex}/settings`} prefetch style={{display: "contents"}}>
135135
<MenuItem>
136136
<IconSettings color={"transparent"} size={16}/>
137137
Servers

src/packages/ce/src/project/views/ProjectListView.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ export const ProjectListView: React.FC = () => {
1414
const projectService = useService(ProjectService)
1515
const projectStore = useStore(ProjectService)
1616

17-
const namespaceNumber = params.namespaceId as any as number
18-
const namespaceId: Namespace['id'] = `gid://sagittarius/Namespace/${namespaceNumber}`
17+
const namespaceIndex = params.namespaceId as any as number
18+
const namespaceId: Namespace['id'] = `gid://sagittarius/Namespace/${namespaceIndex}`
1919

2020
const projects = React.useMemo(
2121
() => projectService.values({namespaceId})
@@ -34,9 +34,9 @@ export const ProjectListView: React.FC = () => {
3434
</Flex>
3535
<Spacing spacing={"xxs"}/>
3636
{projects.map(project => {
37-
const projectNumber = project.id?.match(/NamespaceProject\/(\d+)$/)?.[1]
37+
const projectIndex = project.id?.match(/NamespaceProject\/(\d+)$/)?.[1]
3838
return <Link key={project.id}
39-
href={`/namespace/${namespaceNumber}/project/${projectNumber}`}
39+
href={`/namespace/${namespaceIndex}/project/${projectIndex}`}
4040
style={{width: "100%"}}
4141
prefetch>
4242
<Button variant={"none"} w={"100%"} justify={"flex-start"} paddingSize={"xxs"}>
@@ -47,7 +47,7 @@ export const ProjectListView: React.FC = () => {
4747
</Button>
4848
</Link>
4949
})}
50-
<Link href={`/namespace/${namespaceNumber}/project/create`} style={{width: "100%"}} prefetch>
50+
<Link href={`/namespace/${namespaceIndex}/project/create`} style={{width: "100%"}} prefetch>
5151
<Button variant={"none"} w={"100%"} justify={"flex-start"} paddingSize={"xxs"}>
5252
<IconPlus size={13}/>
5353
<Text size={"md"} hierarchy={"tertiary"}>

src/packages/ce/src/project/views/ProjectRecentListView.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ export const ProjectRecentListView: React.FC = () => {
5151
</Flex>
5252
<Spacing spacing={"xxs"}/>
5353
{projects.map(project => {
54-
const namespaceNumber = project.namespace?.id?.match(/Namespace\/(\d+)$/)?.[1]
55-
const projectNumber = project.id?.match(/NamespaceProject\/(\d+)$/)?.[1]
54+
const namespaceIndex = project.namespace?.id?.match(/Namespace\/(\d+)$/)?.[1]
55+
const projectIndex = project.id?.match(/NamespaceProject\/(\d+)$/)?.[1]
5656
return <Link key={project.id}
57-
href={`/namespace/${namespaceNumber}/project/${projectNumber}`}
57+
href={`/namespace/${namespaceIndex}/project/${projectIndex}`}
5858
style={{width: "100%"}}
5959
prefetch>
6060
<Button variant={"none"} w={"100%"} justify={"flex-start"} paddingSize={"xxs"}>

0 commit comments

Comments
 (0)