Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ms2/spaces view #423

Merged
merged 12 commits into from
Dec 19, 2024

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ const Layout: FC<
icon: <FaUserEdit />,
},
{
key: 'environments',
key: 'spaces',
title: 'My Spaces',
label: <SpaceLink href={`/environments`}>My Spaces</SpaceLink>,
label: <SpaceLink href={`/spaces`}>My Spaces</SpaceLink>,
icon: <AppstoreOutlined />,
},
],
Expand Down Expand Up @@ -187,7 +187,6 @@ const Layout: FC<
priority
/>
</Link>

{loggedIn ? menu : null}
</AntLayout.Sider>
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
'use client';

import Bar from '@/components/bar';
import { OrganizationEnvironment } from '@/lib/data/environment-schema';
import { Button } from 'antd';
import { FC } from 'react';
import useFuzySearch, { ReplaceKeysWithHighlighted } from '@/lib/useFuzySearch';
import ElementList from '@/components/item-list-view';
import Link from 'next/link';

const highlightedKeys = ['name', 'description'] as const;
export type FilteredEnvironment = ReplaceKeysWithHighlighted<
OrganizationEnvironment,
(typeof highlightedKeys)[number]
>;

const EnvironmentsPage: FC<{ organizationEnvironments: OrganizationEnvironment[] }> = ({
organizationEnvironments,
}) => {
const { searchQuery, filteredData, setSearchQuery } = useFuzySearch({
data: organizationEnvironments,
keys: ['name', 'description'],
highlightedKeys,
transformData: (results) => results.map((result) => result.item),
});

return (
<>
<Bar
leftNode={
<Link href="/create-organization">
<Button type="primary">New Organization</Button>
</Link>
}
searchProps={{
value: searchQuery,
onChange: (e) => setSearchQuery(e.target.value),
placeholder: 'Search Environments',
}}
/>
<ElementList<(typeof filteredData)[number]>
columns={[
{ title: 'Name', render: (_, environment) => environment.name.highlighted },
{
title: 'Description',
render: (_, environment) => environment.description.highlighted,
},
{
dataIndex: 'id',
key: 'tooltip',
title: '',
width: 100,
render: (id: string) => (
<Link href={`/${id}/processes`}>
<Button>Enter</Button>
</Link>
),
},
]}
data={filteredData}
tableProps={{
rowKey: 'id',
}}
/>
</>
);
};
export default EnvironmentsPage;
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Content from '@/components/content';
import { getEnvironmentById } from '@/lib/data/DTOs';
import { getUserOrganizationEnvironments } from '@/lib/data/DTOs';
import { OrganizationEnvironment } from '@/lib/data/environment-schema';
import EnvironmentsPage from './environemnts-page';
import EnvironmentsPage from './environments-page';
import { getUserById } from '@/lib/data/DTOs';
import UnauthorizedFallback from '@/components/unauthorized-fallback';

Expand All @@ -19,7 +19,7 @@ const Page = async () => {
)) as OrganizationEnvironment[];

return (
<Content title="My Environments">
<Content title="My Spaces">
<EnvironmentsPage organizationEnvironments={organizationEnvironments} />
</Content>
);
Expand Down
4 changes: 2 additions & 2 deletions src/management-system-v2/components/header-actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ const HeaderActions: FC = () => {

avatarDropdownItems.push(
{
key: 'environments',
key: 'spaces',
title: 'My Spaces',
label: <SpaceLink href={`/environments`}>My Spaces</SpaceLink>,
label: <SpaceLink href={`/spaces`}>My Spaces</SpaceLink>,
icon: <AppstoreOutlined />,
},
{
Expand Down
1 change: 0 additions & 1 deletion src/management-system-v2/lib/user-preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ const defaultPreferences = {
'role-page-side-panel': { open: false, width: 300 },
'user-page-side-panel': { open: false, width: 300 },
'process-meta-data': { open: false, width: 300 },
'environments-page-side-panel': { open: false, width: 300 },
'tech-data-open-tree-items': [] as { id: string; open: string[] }[],
'tech-data-editor': { siderOpen: true, siderWidth: 300 },
}; /* as const */ /* Does not work for strings */
Expand Down
2 changes: 1 addition & 1 deletion src/management-system-v2/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const nextConfig = {
rewrites: async () => {
return [
'processes',
'environments',
'spaces',
'executions',
'engines',
'tasklist',
Expand Down
Loading