Skip to content

Commit 566433d

Browse files
authored
Merge pull request #44 from CSCfi/Crosswalk-Organization-Fix
Crosswalk organization fix
2 parents de88442 + 946d461 commit 566433d

File tree

8 files changed

+17
-25
lines changed

8 files changed

+17
-25
lines changed

mscr-ui/src/common/components/crosswalk-list/index.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import { useTranslation } from 'next-i18next';
2-
import { Button } from 'suomifi-ui-components';
3-
import { List, ListItem } from './crosswalk-list.styles';
4-
import { Grid, Table, TableBody, TableCell, TableContainer, TableHead, TableRow } from '@mui/material';
2+
import { Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Typography } from '@mui/material';
53
import router from 'next/router';
64
import { Crosswalk } from '@app/common/interfaces/crosswalk.interface';
7-
import { getLanguageVersion } from '@app/common/utils/get-language-version';
85

96
export interface CrosswalkListProps {
107
items: Partial<Crosswalk>[];
@@ -31,7 +28,10 @@ export default function CrosswalkList({
3128
return (
3229
//Creating Header row
3330
<div>
34-
<TableContainer>
31+
<Typography marginTop={5}>
32+
{'Crosswalks'}
33+
</Typography>
34+
<TableContainer >
3535
<Table aria-label={'Schemas'}>
3636
<TableHead>
3737
<TableRow>

mscr-ui/src/common/components/schema-list/index.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
TableContainer,
1212
TableHead,
1313
TableRow,
14+
Typography,
1415
} from '@mui/material';
1516
import router from 'next/router';
1617
import { getLanguageVersion } from '@app/common/utils/get-language-version';
@@ -42,6 +43,9 @@ export default function SchemaList({ items }: SchemaListProps) {
4243
//Creating Header row
4344

4445
<div>
46+
<Typography marginTop={5}>
47+
{'Schemas'}
48+
</Typography>
4549
<TableContainer>
4650
<Table aria-label={'Schemas'}>
4751
<TableHead>

mscr-ui/src/common/components/table/index.tsx

-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as React from 'react';
2-
import Separator from 'yti-common-ui/separator';
32
import SchemaList from '../schema-list';
43
import CrosswalkList from '../crosswalk-list';
54
import { useGetPersonalContentQuery } from '@app/common/components/personal/personal.slice';
@@ -42,7 +41,6 @@ export default function BasicTable() {
4241

4342
return (
4443
<div>
45-
{'Schemas'}
4644
<SchemaList
4745
items={schemas ?? []}
4846
handleRemoval={function (value: string): void {
@@ -51,8 +49,6 @@ export default function BasicTable() {
5149
deleteDisabled={false}
5250
></SchemaList>
5351

54-
{'Crosswalks'}
55-
5652
<CrosswalkList
5753
items={crosswalks ?? []}
5854
handleRemoval={function (value: string): void {

mscr-ui/src/common/interfaces/crosswalk.interface.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ import { Status } from './status.interface';
66
export interface Crosswalk {
77
pid?: string;
88
format: string;
9-
status: string | undefined;
9+
status?: string | undefined;
1010
label: {
1111
[key: string]: string;
1212
};
1313
description: {
1414
[key: string]: string;
1515
};
16-
languages: string[];
17-
organizations: string[];
16+
languages?: string[];
17+
organizations?: string[];
1818
sourceSchema: string;
1919
targetSchema: string;
2020
state?: string;
@@ -28,7 +28,7 @@ export interface CrosswalkFormType {
2828
label: string;
2929
state?: string;
3030
languages: (LanguageBlockType & { selected: boolean })[];
31-
organizations: MultiSelectData[];
31+
organizations?: MultiSelectData[];
3232
status?: Status;
3333
sourceSchema: string;
3434
targetSchema: string;

mscr-ui/src/modules/crosswalk-form/generate-payload.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,10 @@ export default function generatePayload(data: CrosswalkFormType): Crosswalk {
2929
languages: data.languages
3030
.filter((l) => l.title !== '')
3131
.map((l) => l.uniqueItemId),
32-
organizations: data.organizations.map((o) => o.uniqueItemId),
3332
status: 'DRAFT',
3433
state: data.status,
3534
sourceSchema: data.sourceSchema,
3635
targetSchema: data.targetSchema,
37-
versionLabel: "1"
36+
versionLabel: '1',
3837
};
3938
}

mscr-ui/src/modules/crosswalk-form/index.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,7 @@ export default function RegisterCrosswalkForm({
6161
></CrosswalkForm>
6262
{renderCrosswalkFormat()}
6363
{renderLanguages()}
64-
6564
{renderStaus()}
66-
<BlockContainer>{!editMode && renderContributors()}</BlockContainer>
67-
<Separator isLarge />
68-
{editMode && renderContributors()}
6965
</ModelFormContainer>
7066
);
7167

@@ -151,6 +147,7 @@ export default function RegisterCrosswalkForm({
151147
);
152148
}
153149

150+
//Currently Hidden from the form
154151
function renderContributors() {
155152
return (
156153
<WideMultiSelect

mscr-ui/src/modules/crosswalk-form/validate-form.tsx

+2-5
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ export function validateForm(data: CrosswalkFormType) {
3939
errors.titleAmount = langsWithError ?? [];
4040
}
4141

42-
// Should have at least one organization set
43-
if (data.organizations.length < 1) {
44-
errors.organizations = true;
45-
}
46-
42+
// Currently crosswalk is valif withou any organization also
43+
4744
return errors;
4845
}

mscr-ui/src/modules/front-page/index.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ export default function FrontPage() {
6565
</ButtonBlock>
6666
<Separator isLarge />
6767
<BasicTable></BasicTable>
68-
<Separator isLarge />
6968
</main>
7069
);
7170
}

0 commit comments

Comments
 (0)