-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
1,319 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
mapping_workbench/frontend/src/api/fields-registry/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import {SectionApi} from "../section"; | ||
|
||
class FieldsRegistryApi extends SectionApi { | ||
get SECTION_TITLE() { | ||
return "Fields Registry"; | ||
} | ||
|
||
get SECTION_ITEM_TITLE() { | ||
return "Fields Registry"; | ||
} | ||
|
||
constructor() { | ||
super("fields_registry"); | ||
} | ||
} | ||
|
||
export const fieldsRegistryApi = new FieldsRegistryApi(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
mapping_workbench/frontend/src/pages/app/fields-registry/[id]/edit.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
import ArrowLeftIcon from '@untitled-ui/icons-react/build/esm/ArrowLeft'; | ||
import Chip from '@mui/material/Chip'; | ||
import Link from '@mui/material/Link'; | ||
import Stack from '@mui/material/Stack'; | ||
import SvgIcon from '@mui/material/SvgIcon'; | ||
import Typography from '@mui/material/Typography'; | ||
|
||
import {fieldsRegistryApi as sectionApi} from 'src/api/fields-registry'; | ||
import {RouterLink} from 'src/components/router-link'; | ||
import {Seo} from 'src/components/seo'; | ||
import {usePageView} from 'src/hooks/use-page-view'; | ||
import {Layout as AppLayout} from 'src/layouts/app'; | ||
import {paths} from 'src/paths'; | ||
import {EditForm} from 'src/sections/app/fields-registry/edit-form'; | ||
import {ForItemEditForm} from "src/contexts/app/section/for-item-form"; | ||
import {useItem} from "src/contexts/app/section/for-item-data-state"; | ||
import {useRouter} from "src/hooks/use-router"; | ||
|
||
|
||
const Page = () => { | ||
const router = useRouter(); | ||
if (!router.isReady) return; | ||
|
||
const {id} = router.query; | ||
|
||
if (!id) { | ||
return; | ||
} | ||
|
||
const formState = useItem(sectionApi, id); | ||
const item = formState.item; | ||
|
||
usePageView(); | ||
|
||
if (!item) { | ||
return; | ||
} | ||
|
||
return ( | ||
<> | ||
<Seo title={`App: ${sectionApi.SECTION_ITEM_TITLE} Edit`}/> | ||
<Stack spacing={4}> | ||
<Stack spacing={4}> | ||
<div> | ||
<Link | ||
color="text.primary" | ||
component={RouterLink} | ||
href={paths.app[sectionApi.section].index} | ||
sx={{ | ||
alignItems: 'center', | ||
display: 'inline-flex' | ||
}} | ||
underline="hover" | ||
> | ||
<SvgIcon sx={{mr: 1}}> | ||
<ArrowLeftIcon/> | ||
</SvgIcon> | ||
<Typography variant="subtitle2"> | ||
{sectionApi.SECTION_TITLE} | ||
</Typography> | ||
</Link> | ||
</div> | ||
<Stack | ||
alignItems="flex-start" | ||
direction={{ | ||
xs: 'column', | ||
md: 'row' | ||
}} | ||
justifyContent="space-between" | ||
spacing={4} | ||
> | ||
<Stack | ||
alignItems="center" | ||
direction="row" | ||
spacing={2} | ||
> | ||
<Stack spacing={1}> | ||
<Typography variant="h4"> | ||
{item.prefix} | ||
</Typography> | ||
<Stack | ||
alignItems="center" | ||
direction="row" | ||
spacing={1} | ||
> | ||
<Chip | ||
label={item._id} | ||
size="small" | ||
/> | ||
</Stack> | ||
</Stack> | ||
</Stack> | ||
</Stack> | ||
</Stack> | ||
<EditForm itemctx={new ForItemEditForm(item, sectionApi, formState.setState)}/> | ||
</Stack> | ||
</> | ||
); | ||
}; | ||
|
||
Page.getLayout = (page) => ( | ||
<AppLayout> | ||
{page} | ||
</AppLayout> | ||
); | ||
|
||
export default Page; |
Oops, something went wrong.