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

MAT-7723a: partial #168

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/cqlLibraryEditor/CqlLibraryEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const CqlLibraryEditor = ({
onChange={onChange}
value={value}
inboundAnnotations={inboundAnnotations}
height="calc(100vh - 135px)"
height="100%"
readOnly={readOnly}
setOutboundAnnotations={setOutboundAnnotations}
/>
Expand Down
6 changes: 3 additions & 3 deletions src/components/editCqlLibrary/EditCQLLibrary.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
position: sticky;
bottom: 0;
left: 0;
z-index: 10;
z-index: 99;
padding: 0 32px;
background: #ffffff;
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
Expand All @@ -57,11 +57,11 @@
}

.allotment-wrapper {
margin: 0 32px;
margin: 0;
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);

.inner-right {
margin-left: 30px;
padding: 24px 16px;
}

.split-view {
Expand Down
279 changes: 142 additions & 137 deletions src/components/editCqlLibrary/EditCqlLibrary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
setErrorMessage("An error occurred while fetching the CQL Library!");
});
}
}, [id, resetForm, loadedCqlLibrary, cqlLibraryServiceApi]);

Check warning on line 176 in src/components/editCqlLibrary/EditCqlLibrary.tsx

View workflow job for this annotation

GitHub Actions / Checkout, install, lint, build and test with coverage

React Hook useEffect has a missing dependency: 'handleAnnotations'. Either include it or remove the dependency array

// fetch organizations DB using measure service and sorts alphabetically
useEffect(() => {
Expand All @@ -189,7 +189,7 @@
const message = `Error fetching organizations`;
handleToast("danger", message, true);
});
}, []);

Check warning on line 192 in src/components/editCqlLibrary/EditCqlLibrary.tsx

View workflow job for this annotation

GitHub Actions / Checkout, install, lint, build and test with coverage

React Hook useEffect has a missing dependency: 'organizationApi'. Either include it or remove the dependency array

async function updateCqlLibrary(cqlLibrary: CqlLibrary) {
setActiveSpinner(true);
Expand Down Expand Up @@ -387,164 +387,169 @@
</div>
</Allotment.Pane>
<Allotment.Pane>
<div id="right-panel">
<div className="right-panel">
<NavTabs
activeTab={activeTab}
handleTabChange={handleTabChange}
/>
<div
style={{
marginTop: 10,
display: "flex",
flexDirection: "row",
justifyContent: "flex-end",
}}
>
<Typography
<div style={{ height: "calc(100% - 48px)", overflowY: "auto" }}>
<div
style={{
fontSize: 14,
fontWeight: 300,
fontFamily: "Rubik",
marginRight: 32,
paddingTop: 10,
display: "flex",
flexDirection: "row",
justifyContent: "flex-end",
}}
>
<span
<Typography
style={{
color: "rgb(174, 28, 28)",
marginRight: 3,
fontWeight: 400,
fontSize: 14,
fontWeight: 300,
fontFamily: "Rubik",
marginRight: 32,
}}
>
*
</span>
Indicates required field
</Typography>
</div>
<div className="inner-right">
{activeTab === "details" && (
<div id="details-tab" data-test-id="details-tab">
{/* These are loaded in first instance and then removed why ? */}
{!formik.values.draft && (
<span
style={{
color: "rgb(174, 28, 28)",
marginRight: 3,
fontWeight: 400,
}}
>
*
</span>
Indicates required field
</Typography>
</div>
<div className="inner-right">
{activeTab === "details" && (
<div id="details-tab" data-test-id="details-tab">
{/* These are loaded in first instance and then removed why ? */}
{!formik.values.draft && (
<div className="form-row">
<MadieAlert
type="info"
content={
<p>
CQL Library is not a draft. Only drafts can be
edited.
</p>
}
canClose={false}
/>
</div>
)}
{!canEdit && (
<div className="form-row">
<MadieAlert
type="info"
content={
<p>
You are not the owner of the CQL Library. Only
owner can edit it.
</p>
}
canClose={false}
/>
</div>
)}

<div className="form-row">
<MadieAlert
type="info"
content={
<p>
CQL Library is not a draft. Only drafts can be
edited.
</p>
<TextField
label="CQL Library Name"
required
id="cqlLibraryName"
data-testid="cql-library-name-text-field"
disabled={!formik.values.draft || !canEdit}
inputProps={{
id: "cql-library-name-text-field-input",
"data-testid": "cql-library-name-text-field-input",
"aria-required": true,
required: true,
}}
error={
formik.touched.cqlLibraryName &&
Boolean(formik.errors.cqlLibraryName)
}
canClose={false}
{...formik.getFieldProps("cqlLibraryName")}
helperText={formikErrorHandler(
"cqlLibraryName",
true
)}
placeholder="Enter a Cql Library Name"
/>
</div>
)}
{!canEdit && (

<div className="form-row">
<MadieAlert
type="info"
content={
<p>
You are not the owner of the CQL Library. Only
owner can edit it.
</p>
<TextArea
label="Description"
disabled={!formik.values.draft || !canEdit}
required
name="cql-library-description"
id="cql-library-description"
onChange={formik.handleChange}
value={formik.values.description}
placeholder="Description"
data-testid={"cql-library-description"}
{...formik.getFieldProps("description")}
error={
formik.touched.description &&
Boolean(formik.errors.description)
}
canClose={false}
helperText={formikErrorHandler("description", true)}
/>
</div>
)}

<div className="form-row">
<TextField
label="CQL Library Name"
required
id="cqlLibraryName"
data-testid="cql-library-name-text-field"
disabled={!formik.values.draft || !canEdit}
inputProps={{
id: "cql-library-name-text-field-input",
"data-testid": "cql-library-name-text-field-input",
"aria-required": true,
required: true,
}}
error={
formik.touched.cqlLibraryName &&
Boolean(formik.errors.cqlLibraryName)
}
{...formik.getFieldProps("cqlLibraryName")}
helperText={formikErrorHandler("cqlLibraryName", true)}
placeholder="Enter a Cql Library Name"
/>
</div>

<div className="form-row">
<TextArea
label="Description"
disabled={!formik.values.draft || !canEdit}
required
name="cql-library-description"
id="cql-library-description"
onChange={formik.handleChange}
value={formik.values.description}
placeholder="Description"
data-testid={"cql-library-description"}
{...formik.getFieldProps("description")}
error={
formik.touched.description &&
Boolean(formik.errors.description)
}
helperText={formikErrorHandler("description", true)}
/>
</div>

<div className="form-row">
<AutoComplete
id="publisher"
dataTestId="publisher"
label="Publisher"
placeholder="-"
required={true}
disabled={!formik.values.draft || !canEdit}
error={
formik.touched.publisher && formik.errors.publisher
}
helperText={
formik.touched.publisher && formik.errors.publisher
}
options={organizations}
{...formik.getFieldProps("publisher")}
onChange={formik.setFieldValue}
/>
</div>
<div className="form-row">
<AutoComplete
id="publisher"
dataTestId="publisher"
label="Publisher"
placeholder="-"
required={true}
disabled={!formik.values.draft || !canEdit}
error={
formik.touched.publisher && formik.errors.publisher
}
helperText={
formik.touched.publisher && formik.errors.publisher
}
options={organizations}
{...formik.getFieldProps("publisher")}
onChange={formik.setFieldValue}
/>
</div>

<div className="form-row">
<FormControlLabel
sx={{
"& .MuiFormControlLabel-label": {
fontSize: 16,
fontWeight: 300,
},
}}
control={
<Checkbox
id="experimental"
data-testid="cql-library-experimental-checkbox"
sx={{ "& .MuiSvgIcon-root": { fontSize: 28 } }}
disabled={!formik.values.draft || !canEdit}
{...formik.getFieldProps("experimental")}
checked={formik.values.experimental}
onChange={(event: any) => {
formik.setFieldValue(
"experimental",
event.target.checked
);
}}
/>
}
label="Experimental"
/>
<div className="form-row">
<FormControlLabel
sx={{
"& .MuiFormControlLabel-label": {
fontSize: 16,
fontWeight: 300,
},
}}
control={
<Checkbox
id="experimental"
data-testid="cql-library-experimental-checkbox"
sx={{ "& .MuiSvgIcon-root": { fontSize: 28 } }}
disabled={!formik.values.draft || !canEdit}
{...formik.getFieldProps("experimental")}
checked={formik.values.experimental}
onChange={(event: any) => {
formik.setFieldValue(
"experimental",
event.target.checked
);
}}
/>
}
label="Experimental"
/>
</div>
</div>
</div>
)}
)}
</div>
</div>
</div>
</Allotment.Pane>
Expand Down
Loading