+
{dataLoaded && (
-
-
- {!schemaSelectorDisabled && (
-
- amount === 1 ? 'option available' : 'options available'
- }
- onItemSelect={setSource}
- />
- )}
- {schemaSelectorDisabled && (
-
- )}
- {/**/}
- {/* */}
- {/*
Select a schema to see properties.
*/}
- {/*
*/}
- {/**/}
-
+ <>
+
+
+ {!schemaSelectorDisabled && (
+ <>
+
+ {
+ setSelectedSourceWorkspace(e);
+ }}
+ >
+ {workspaceValues.map((format) => (
+
+ {format.labelText}
+
+ ))}
+
+
+
+ amount === 1 ? 'option available' : 'options available'
+ }
+ onItemSelect={setSource}
+ />
+ >
+ )}
+ {schemaSelectorDisabled && (
+
+ )}
+ {/**/}
+ {/* */}
+ {/*
Select a schema to see properties.
*/}
+ {/*
*/}
+ {/**/}
+
-
- {!schemaSelectorDisabled && (
-
- amount === 1 ? 'option available' : 'options available'
- }
- onItemSelect={setTarget}
- />
- )}
- {schemaSelectorDisabled && (
-
- )}
- {/**/}
- {/* */}
- {/*
Select a schema to see properties.
*/}
- {/*
*/}
- {/**/}
+
+ {!schemaSelectorDisabled && (
+ <>
+
+ {
+ setSelectedTargetWorkspace(e);
+ }}
+ >
+ {workspaceValues.map((format) => (
+
+ {format.labelText}
+
+ ))}
+
+
+
+ amount === 1 ? 'option available' : 'options available'
+ }
+ onItemSelect={setTarget}
+ />
+ >
+ )}
+ {schemaSelectorDisabled && (
+
+ )}
+ {/**/}
+ {/* */}
+ {/*
Select a schema to see properties.
*/}
+ {/*
*/}
+ {/**/}
+
-
+ >
)}
-
+
);
}
diff --git a/mscr-ui/src/modules/form/revision-form-modal/index.tsx b/mscr-ui/src/modules/form/revision-form-modal/index.tsx
index b0bb4ba48..8974b8c56 100644
--- a/mscr-ui/src/modules/form/revision-form-modal/index.tsx
+++ b/mscr-ui/src/modules/form/revision-form-modal/index.tsx
@@ -206,26 +206,40 @@ export default function RevisionFormModal({
const spinnerDelay = async () => {
setSubmitAnimationVisible(true);
- await delay(2000);
+ if (!(errors && Object.values(errors).includes(true))) {
+ await delay(2000);
+ }
return Promise.resolve();
};
- const handleSubmit = () => {
- scrollToModalTop();
- setUserPosted(true);
- if (!formData) {
- return;
- }
+ function isFormValid() {
+ if (errors && Object.values(errors).includes(true)) {
+ return false;
+ } else if (gatherInputError().length > 0) {
+ return false;
+ } else return true;
+ }
+
+ function validateForm() {
let errors;
- if (type == Type.Schema) {
+ if (type == Type.Schema && formData) {
errors = validateSchemaForm(formData, fileData, fileUri);
setErrors(errors);
- } else {
+ } else if (formData) {
errors = validateCrosswalkForm(formData as CrosswalkFormType);
setErrors(errors);
}
+ }
+
+ const handleSubmit = () => {
+ scrollToModalTop();
+ setUserPosted(true);
+ if (!formData) {
+ return;
+ }
+ validateForm();
- if (Object.values(errors).includes(true)) {
+ if (errors && Object.values(errors).includes(true)) {
return;
}
const validatedFormData: SchemaFormType = {
@@ -296,7 +310,6 @@ export default function RevisionFormModal({
errors = validateCrosswalkForm(formData as CrosswalkFormType);
setErrors(errors);
}
- //console.log(errors);
}, [userPosted, formData, fileData, fileUri, type]);
// This part was checking the user permission and based on that showing the button in every render
@@ -319,12 +332,13 @@ export default function RevisionFormModal({
} else if (resultCrosswalkFullRevision.isError) {
errorObject = getApiError(resultCrosswalkFullRevision.error);
} else {
- return;
+ return '';
}
if (errorObject.status && errorObject.message) {
errorMessage = `${errorObject.status}: ${errorObject.message}`;
return errorMessage;
}
+ return '';
}
function getErrorDetail() {
@@ -408,7 +422,11 @@ export default function RevisionFormModal({
{submitAnimationVisible && (
)}
>
@@ -459,10 +477,12 @@ export default function RevisionFormModal({
)}
{userPosted && gatherInputError() && !submitAnimationVisible && (
-
+ <>
+
+ >
)}
{/*Showing API Error if only input form error is not present*/}
{userPosted &&
diff --git a/mscr-ui/src/modules/form/schema-form/schema-form-fields.tsx b/mscr-ui/src/modules/form/schema-form/schema-form-fields.tsx
index 20dde4fee..6686005b4 100644
--- a/mscr-ui/src/modules/form/schema-form/schema-form-fields.tsx
+++ b/mscr-ui/src/modules/form/schema-form/schema-form-fields.tsx
@@ -1,17 +1,16 @@
/* eslint-disable */
import { useTranslation } from 'next-i18next';
-import { Dropdown, DropdownItem, TextInput } from 'suomifi-ui-components';
+import { DropdownItem } from 'suomifi-ui-components';
import { ModelFormContainer } from '../form.styles';
-import LanguageSelector from 'yti-common-ui/components/form/language-selector';
import { FormErrors } from './validate-schema-form';
import { SchemaFormType } from '@app/common/interfaces/schema.interface';
import {
Format,
- formatsAvailableForCrosswalkRegistration,
formatsAvailableForSchemaRegistration,
} from '@app/common/interfaces/format.interface';
import { State } from '@app/common/interfaces/state.interface';
import MscrLanguageSelector from '@app/common/components/language-selector/mscr-language-selector';
+import { WideDropdown } from '@app/modules/form/crosswalk-form/crosswalk-form.styles';
interface SchemaFormProps {
formData: SchemaFormType;
@@ -37,39 +36,65 @@ SchemaFormProps) {
// Creating the actual schema Input form
return (
- {renderSchemaFormat()}
{renderLanguages()}
- {/*!editMode && renderContributors()*/}
- {renderVersionLabel()}
- {renderState()}
+ {renderFormatAndState()}
{/*editMode && renderContributors()*/}
);
- function renderSchemaFormat() {
+ function renderFormatAndState() {
+ // may be load the formats from an array
return (
-
-
- setFormData({
- ...formData,
- format: e,
- })
- }
- >
- {formatsAvailableForSchemaRegistration.map((format) => (
-
- {format}
-
- ))}
-
-
+ <>
+
+
+
+ setFormData({
+ ...formData,
+ format: e,
+ })
+ }
+ >
+ {formatsAvailableForSchemaRegistration.map((format) => (
+
+ {format}
+
+ ))}
+
+
+
+
+
+ setFormData({
+ ...formData,
+ state: e as State,
+ })
+ }
+ >
+ {'DRAFT'}
+ {'PUBLISHED'}
+ {'DEPRECATED'}
+
+
+
+
+ >
);
}
@@ -97,6 +122,9 @@ SchemaFormProps) {
textDescription: t('schema-form.description'),
optionalText: '',
}}
+ versionLabelCaption={t('schema-form.version-label')}
+ versionLabel={formData.versionLabel ?? '1'}
+ setVersionLabel={(e) => setVersionLabel(e)}
allowItemAddition={false}
ariaChipActionLabel={''}
ariaSelectedAmountText={''}
@@ -113,72 +141,10 @@ SchemaFormProps) {
);
}
- function renderVersionLabel() {
- return (
-
- setFormData({
- ...formData,
- versionLabel: value as string,
- })
- }
- />
- );
- }
-
- function renderState() {
- return (
-
-
- setFormData({
- ...formData,
- state: e as State,
- })
- }
- >
- {'DRAFT'}
- {'PUBLISHED'}
- {'DEPRECATED'}
-
-
- );
+ function setVersionLabel(value: any) {
+ setFormData({
+ ...formData,
+ versionLabel: value as string,
+ });
}
-
- // function renderContributors() {
- // return (
- //
- // setFormData({
- // ...formData,
- // organizations: e,
- // })
- // }
- // items={formData.organizations}
- // status={
- // 'default'
- // /* Old value below, can it be perma-removed? (leftover from https://github.com/CSCfi/mscr-ui-monorepo/pull/17)
- // {userPosted && errors?.organizations ? 'error' : 'default'}*/
- // }
- // ariaChipActionLabel={''}
- // ariaSelectedAmountText={''}
- // ariaOptionsAvailableText={''}
- // ariaOptionChipRemovedText={''}
- // noItemsText={''}
- // />
- // );
- // }
}
diff --git a/mscr-ui/src/modules/form/schema-form/schema-form-modal.tsx b/mscr-ui/src/modules/form/schema-form/schema-form-modal.tsx
index 38581da32..2faf3de73 100644
--- a/mscr-ui/src/modules/form/schema-form/schema-form-modal.tsx
+++ b/mscr-ui/src/modules/form/schema-form/schema-form-modal.tsx
@@ -141,7 +141,6 @@ export default function SchemaFormModal({
} else {
return;
}
-
Promise.all([spinnerDelay(), putSchemaFull(schemaFormData)]).then(
(values) => {
setSubmitAnimationVisible(false);
diff --git a/mscr-ui/src/pages/mscr-style-customizations.scss b/mscr-ui/src/pages/mscr-style-customizations.scss
index 8a15c446b..d9ea0d333 100644
--- a/mscr-ui/src/pages/mscr-style-customizations.scss
+++ b/mscr-ui/src/pages/mscr-style-customizations.scss
@@ -133,6 +133,42 @@ body {
height: calc(100% - 70vh);
}
}
+ &.crosswalk-revision-modal {
+ height: calc(100% - 44vh);
+ @media screen and (min-height: 600px) {
+ height: calc(100% - 40vh);
+ }
+ @media screen and (min-height: 650px) {
+ height: calc(100% - 40vh);
+ }
+ @media screen and (min-height: 800px) {
+ height: calc(100% - 53vh);
+ }
+ @media screen and (min-height: 950px) {
+ height: calc(100% - 58vh);
+ }
+ @media screen and (min-height: 1150px) {
+ height: calc(100% - 65vh);
+ }
+ }
+ &.schema-revision-modal {
+ height: calc(100% - 48vh);
+ @media screen and (min-height: 600px) {
+ height: calc(100% - 39vh);
+ }
+ @media screen and (min-height: 650px) {
+ height: calc(100% - 36vh);
+ }
+ @media screen and (min-height: 800px) {
+ height: calc(100% - 30vh);
+ }
+ @media screen and (min-height: 1000px) {
+ height: calc(100% - 30vh);
+ }
+ @media screen and (min-height: 1150px) {
+ height: calc(100% - 41vh);
+ }
+ }
}
.crosswalk-editor {
@@ -299,20 +335,4 @@ body {
.selected-row {
background: #eaf2fa;
}
-
- /* CROSSWALK SELECTION */
- .crosswalk-selection-modal {
- font-size: 0.85rem;
-
- .source-select-dropdown {
- width: 100% !important;
- }
-
- .source-select-info-box {
- margin-top: 15px;
- padding: 5px;
- width: 100%;
- background: #e2f1fd;
- }
- }
}