Skip to content

Commit

Permalink
Merge pull request #169 from CSCfi/CSCFC4EMSCR-422v2
Browse files Browse the repository at this point in the history
Cscfc4 emscr 422v2
  • Loading branch information
maariaw authored May 24, 2024
2 parents 083adf5 + 68a5dd8 commit b53be77
Show file tree
Hide file tree
Showing 18 changed files with 551 additions and 346 deletions.
1 change: 1 addition & 0 deletions mscr-ui/public/locales/en/admin.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
"missing-target-schema": "Target schema hasn't been selected",
"modified": "Modified",
"optional": "optional",
"register-crosswalk-file-uri-reference": "Provide crosswalk file URI reference",
"register-schema": "Register Schema",
"register-schema-file-required": "You must provide a schema file to register a schema.",
"register-schema-file-uri-reference": "Provide schema file URI reference",
Expand Down
1 change: 1 addition & 0 deletions mscr-ui/public/locales/fi/admin.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
"missing-target-schema": "Kohdeskeemaa ei ole määritelty",
"modified": "Muokattu",
"optional": "valinnainen",
"register-crosswalk-file-uri-reference": "",
"register-schema": "",
"register-schema-file-required": "",
"register-schema-file-uri-reference": "",
Expand Down
1 change: 1 addition & 0 deletions mscr-ui/public/locales/sv/admin.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
"missing-target-schema": "",
"modified": "",
"optional": "",
"register-crosswalk-file-uri-reference": "",
"register-schema": "",
"register-schema-file-required": "",
"register-schema-file-uri-reference": "",
Expand Down
6 changes: 3 additions & 3 deletions mscr-ui/src/common/components/file-drop-area-mscr/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ export default function FileDropAreaMscr({
>
<div>
<FileBlockWrapper>
{isSchemaUpload && (

<>
<Block>
<WideTextInput
labelText={t('register-schema-file-uri-reference')}
labelText={isSchemaUpload ? t('register-schema-file-uri-reference') : t('register-crosswalk-file-uri-reference')}
onChange={(value) => setFileUriField(value?.toString() ?? '')}
value={fileUriField}
disabled={disabled}
Expand All @@ -144,7 +144,7 @@ export default function FileDropAreaMscr({
<br/>
<CaptionText>{t('upload-documents')}</CaptionText>
</>
)}


<FileBlock padding="m" id="file-drop-block">
{file === null ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ export const MultiSelect = styled(MultiSelectDS)<{ $isWide?: boolean }>`
`;

export const LanguageBlock = styled(Block)`
//border: 1px solid ${(props) => props.theme.suomifi.colors.depthLight1};
//margin-top: ${(props) => props.theme.suomifi.spacing.xs};
//background: ${(props) => props.theme.suomifi.colors.highlightLight3};
//border: 1px solid ${(props) => props.theme.suomifi.colors.depthLight1};
//margin-top: ${(props) => props.theme.suomifi.spacing.xs};
//background: ${(props) => props.theme.suomifi.colors.highlightLight3};
.name-input {
margin-bottom: ${(props) => props.theme.suomifi.spacing.s};
}
`;

export const NameInput = styled(TextInput)`
export const WideTextInput = styled(TextInput)`
width: 100%;
`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,24 @@ import {
MultiSelectProps,
Paragraph,
Text,
TextInput,
} from 'suomifi-ui-components';
import {
LanguageBlock,
NameInput,
MultiSelect,
DescriptionInput,
WideTextInput,
} from './mscr-language-selector.styles';
import { TEXT_AREA_MAX, TEXT_INPUT_MAX } from 'yti-common-ui/utils/constants';

export interface LanguageBlockType {
labelText: string;
uniqueItemId: string;
title: string;
description: string;
selected: boolean;
}
import { LanguageBlockType } from 'yti-common-ui/components/form/language-selector';

export default function MscrLanguageSelector(
props: MultiSelectProps<LanguageBlockType> & {
setLanguages: (value: LanguageBlockType[]) => void;
userPosted: boolean;
setVersionLabel: (value: string) => void;
versionLabel: string;
versionLabelCaption: string;
translations: {
textInput: string;
textDescription: string;
Expand Down Expand Up @@ -125,36 +122,51 @@ export default function MscrLanguageSelector(
id={`language-block-${item.uniqueItemId}`}
>
{/* <Paragraph marginBottomSpacing="m">
<Text variant="bold">{item.labelText}</Text>
</Paragraph> */}
<NameInput
labelText={props.translations.textInput}
className={'name-input'}
onBlur={(e) => handleTitleChange(e.target.value, item.uniqueItemId)}
status={
props.userPosted &&
props.items.find((l) => l.uniqueItemId === item.uniqueItemId)
?.title === ''
? 'error'
: 'default'
}
defaultValue={item.title}
id={`name-input-${item.uniqueItemId}`}
maxLength={TEXT_INPUT_MAX}
disabled={props.disabled}
/>
<DescriptionInput
labelText={props.translations.textDescription}
className={'description-input'}
optionalText={props.translations.optionalText}
onBlur={(e) =>
handleDescriptionChange(e.target.value, item.uniqueItemId)
}
defaultValue={item.description}
id={`description-input-${item.uniqueItemId}`}
maxLength={TEXT_AREA_MAX}
disabled={props.disabled}
/>
<Text variant="bold">{item.labelText}</Text>
</Paragraph> */}
<div className="row">
<div className="col-6">
<WideTextInput
labelText={props.translations.textInput}
className={'name-input'}
onBlur={(e) =>
handleTitleChange(e.target.value, item.uniqueItemId)
}
status={
props.userPosted &&
props.items.find((l) => l.uniqueItemId === item.uniqueItemId)
?.title === ''
? 'error'
: 'default'
}
defaultValue={item.title}
id={`name-input-${item.uniqueItemId}`}
maxLength={TEXT_INPUT_MAX}
disabled={props.disabled}
/>
</div>
<div className="col-6">
<WideTextInput
labelText={props.versionLabelCaption}
defaultValue={props.versionLabel ?? '1'}
onBlur={(e) => props.setVersionLabel(e.target.value)}
/>
</div>
<div className="col-12">
<DescriptionInput
labelText={props.translations.textDescription}
className={'description-input'}
optionalText={props.translations.optionalText}
onBlur={(e) =>
handleDescriptionChange(e.target.value, item.uniqueItemId)
}
defaultValue={item.description}
id={`description-input-${item.uniqueItemId}`}
maxLength={TEXT_AREA_MAX}
disabled={props.disabled}
/>
</div>
</div>
</LanguageBlock>
))}
</>
Expand Down
2 changes: 2 additions & 0 deletions mscr-ui/src/common/components/spinner-overlay/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ export enum SpinnerType {
SchemaRegistrationModal = 'schema-registration-modal',
CrosswalkRegistrationModal = 'crosswalk-registration-modal',
CrosswalkCreationModal = 'crosswalk-creation-modal',
SchemaRevisionModal = 'schema-revision-modal',
CrosswalkRevisionModal = 'crosswalk-revision-modal',
}

export const delay = async (ms) => {
Expand Down
1 change: 1 addition & 0 deletions mscr-ui/src/common/interfaces/search.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export interface ResultInfo {
versionLabel: string;
namespace: string;
format?: Format;
owner: [] | undefined;
}

export interface PaginatedQuery {
Expand Down
8 changes: 2 additions & 6 deletions mscr-ui/src/common/utils/getApiErrors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@ import { SerializedError } from '@reduxjs/toolkit';
import { AxiosBaseQueryError } from 'yti-common-ui/interfaces/axios-base-query.interface';
import { MSCRError } from '../interfaces/error.interface';



export default function getApiError(
error: AxiosBaseQueryError | SerializedError
): MSCRError {

const mscrError: MSCRError = {};
mscrError.status = '';
mscrError.message = '';
Expand All @@ -25,15 +22,14 @@ export default function getApiError(
mscrError.status = error.data.status.toString();
}
if ('message' in error.data && typeof error.data.message === 'string') {
mscrError.message = error.data.message ?? 'Unexpected error occured';
mscrError.message = error.data.message ?? 'Unexpected error occurred';
}
if ('title' in error.data && typeof error.data.title === 'string') {
mscrError.message = error.data.title ?? 'Unexpected error occured';
mscrError.message = error.data.title ?? 'Unexpected error occurred';
}
if ('detail' in error.data && typeof error.data.detail === 'string') {
mscrError.detail = error.data.detail ?? 'Server Error';
}
}

return mscrError;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import styled from 'styled-components';
export const ActionMenuWrapper = styled.div`
margin-bottom: -40px;
margin-top: 18px;
z-index: 200;
z-index: 0;
position: relative;
`;

Expand Down
Loading

0 comments on commit b53be77

Please sign in to comment.