Skip to content

Commit

Permalink
Merge pull request #196 from FC4E-CAT/devel
Browse files Browse the repository at this point in the history
Release v1.2.0
  • Loading branch information
kkoumantaros authored Jun 10, 2024
2 parents 91ba121 + a31af7e commit 5a518b1
Show file tree
Hide file tree
Showing 12 changed files with 166 additions and 87 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@

All notable changes in FC4E-CAT-UI project are documented here

## [v1.2.0](https://github.com/FC4E-CAT/fc4e-cat-ui/releases/tag/v1.2.0) (2024-06-10)

### Added:

- CAT-380 Add iframe ([#189](https://github.com/FC4E-CAT/fc4e-cat-ui/pull/189))
- CAT-382 Add user name in delete/restore modal ([#193](https://github.com/FC4E-CAT/fc4e-cat-ui/pull/193))

### Changed:

- CAT-380 Update iframe view name to Pid Selection. Make view visible (… ([#190](https://github.com/FC4E-CAT/fc4e-cat-ui/pull/190))
- CAT-378 Restrict subject input fields to 200 chars max ([#192](https://github.com/FC4E-CAT/fc4e-cat-ui/pull/192))

### Fixed:

- CAT-379 Fix orcid validation regex ([#191](https://github.com/FC4E-CAT/fc4e-cat-ui/pull/191))
- CAT-367 Fix key press enter issue in assessment edit view ([#194](https://github.com/FC4E-CAT/fc4e-cat-ui/pull/194))

## [v1.1.0](https://github.com/FC4E-CAT/fc4e-cat-ui/releases/tag/v1.1.0) (2024-04-29)

### Added:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "fc4e-cat-ui",
"private": true,
"version": "1.1.0",
"version": "1.2.0",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
2 changes: 2 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import About from "./pages/About";
import { AssessmentEditMode } from "./types";
import AdminUsers from "./pages/admin/AdminUsers";
import AdminValidations from "./pages/admin/AdminValidations";
import PidSelection from "./pages/PidSelection";

const queryClient = new QueryClient();

Expand Down Expand Up @@ -69,6 +70,7 @@ function App() {
<Routes>
<Route path="/" element={<Home />} />
<Route path="/about" element={<About />} />
<Route path="/pid-selection" element={<PidSelection />} />
<Route
path="/assessments/create/:valID"
element={<ProtectedRoute />}
Expand Down
5 changes: 5 additions & 0 deletions src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ function Header() {
ASSESSMENTS
</Link>
</NavItem>
<NavItem>
<Link to="/pid-selection" className="cat-nav-link">
PID SELECTION
</Link>
</NavItem>
</Nav>

{authenticated && userProfile?.user_type === "Admin" && (
Expand Down
3 changes: 3 additions & 0 deletions src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
"api": {
"base_url": "http://localhost:8080",
"version": "v1"
},
"embedded_views": {
"pid_selection_view": ""
}
}
37 changes: 37 additions & 0 deletions src/pages/PidSelection.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { useEffect, useRef } from "react";
import config from "@/config.json";

function PidSelection() {
const iframeRef = useRef<HTMLIFrameElement>(null);
// const [iframeHeight, setIframeHeight] = useState('0px');

useEffect(() => {
const handleResize = (event: MessageEvent) => {
if (event.origin === config?.embedded_views?.pid_selection_view) {
// Replace with the actual domain of pageB
console.log("received size from child:", event.data);
if (iframeRef.current)
iframeRef.current.style.height = event.data + "px";
}
};

window.addEventListener("message", handleResize);

// Cleanup function to remove the event listener
return () => {
window.removeEventListener("message", handleResize);
};
}, []);

return (
<div>
<iframe
src={config?.embedded_views?.pid_selection_view}
style={{ width: "100%", height: "800px" }}
ref={iframeRef}
></iframe>
</div>
);
}

export default PidSelection;
2 changes: 1 addition & 1 deletion src/pages/ProfileUpdate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export default function ProfileUpdate() {
<input
{...register("orcid_id", {
pattern: {
value: /[0-9]{4}-[0-9]{4}-[0-9]{4}-[0-9]{4}/,
value: /^(\d{4}-){3}\d{3}(\d|X)$/,
message: "Invalid ORCID id",
},
})}
Expand Down
19 changes: 15 additions & 4 deletions src/pages/admin/AdminUsers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ enum UserModalMode {
type UserModalBasicConfig = {
mode: UserModalMode;
id: string;
name?: string;
show: boolean;
};

Expand Down Expand Up @@ -104,10 +105,17 @@ export function UserModal(props: UserModalProps) {
</Modal.Header>
<Modal.Body>
<Form>
<p>
Are you sure you want to delete user with id:{" "}
<strong>{props.id}</strong> ?
</p>
<div>
<div>Are you sure you want to delete the following user ?</div>
<div>
id: <strong>{props.id}</strong>
</div>
{props.name && (
<div>
name: <strong>{props.name}</strong>
</div>
)}
</div>
<Form.Group className="mb-3" controlId="input-delete-user-reason">
<Form.Label>
<strong>Reason (*)</strong>
Expand Down Expand Up @@ -223,6 +231,7 @@ export default function AdminUsers() {
mode: UserModalMode.Delete,
show: false,
id: "",
name: "",
});

// hooks for handling subjects in through the backend
Expand Down Expand Up @@ -471,6 +480,7 @@ export default function AdminUsers() {
id: item.id,
mode: UserModalMode.Restore,
show: true,
name: item.name,
});
}}
>
Expand All @@ -485,6 +495,7 @@ export default function AdminUsers() {
setUserModalConfig({
id: item.id,
mode: UserModalMode.Delete,
name: item.name,
show: true,
});
}}
Expand Down
3 changes: 3 additions & 0 deletions src/pages/assessments/components/AssessmentSelectSubject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export const AssessmentSelectSubject = (
id="input-info-subject-id"
placeholder="A unique identifier for the current subject"
value={props.subject?.id || ""}
maxLength={200}
onChange={(e) => {
props.onSubjectChange(
handleSubjectChange("id", e.target.value),
Expand Down Expand Up @@ -167,6 +168,7 @@ export const AssessmentSelectSubject = (
id="input-info-subject-name"
placeholder="The name of the subject of the assessment as identified above"
value={props.subject?.name || ""}
maxLength={200}
onChange={(e) => {
props.onSubjectChange(
handleSubjectChange("name", e.target.value),
Expand Down Expand Up @@ -204,6 +206,7 @@ export const AssessmentSelectSubject = (
id="input-info-subject-type"
placeholder="The type of object for which the assessment will be completed"
value={props.subject?.type || ""}
maxLength={200}
onChange={(e) => {
props.onSubjectChange(
handleSubjectChange("type", e.target.value),
Expand Down
5 changes: 5 additions & 0 deletions src/pages/assessments/components/tests/EvidenceURLS.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ export const EvidenceURLS = (props: EvidenceURLSProps) => {
}}
aria-describedby="label-add-url"
placeholder="Please enter and add a valid url to support your claim"
onKeyDown={(event) => {
if (event.key === "Enter") {
handleAddURL();
}
}}
/>
<span className="btn btn-primary btn-sm" onClick={handleAddURL}>
Add
Expand Down
60 changes: 29 additions & 31 deletions src/pages/assessments/components/tests/TestBinaryForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,38 +71,36 @@ export const TestBinaryForm = (props: AssessmentTestProps) => {

<Row>
<Col>
<Form>
<div className="">
<h5>{props.test.text}</h5>
<Form.Check
inline
label="Yes"
value="1"
name="test-input-group"
type="radio"
id="test-check-yes"
checked={props.test.value === true}
onChange={handleValueChange}
/>
<Form.Check
inline
label="No"
value="0"
name="test-input-group"
type="radio"
id="test-check-no"
checked={props.test.value === false}
onChange={handleValueChange}
/>
</div>
<div className="">
<h5>{props.test.text}</h5>
<Form.Check
inline
label="Yes"
value="1"
name="test-input-group"
type="radio"
id="test-check-yes"
checked={props.test.value === true}
onChange={handleValueChange}
/>
<Form.Check
inline
label="No"
value="0"
name="test-input-group"
type="radio"
id="test-check-no"
checked={props.test.value === false}
onChange={handleValueChange}
/>
</div>

{props.test.evidence_url !== undefined && (
<EvidenceURLS
urls={props.test.evidence_url}
onListChange={onURLChange}
/>
)}
</Form>
{props.test.evidence_url !== undefined && (
<EvidenceURLS
urls={props.test.evidence_url}
onListChange={onURLChange}
/>
)}
</Col>
</Row>
</div>
Expand Down
98 changes: 48 additions & 50 deletions src/pages/assessments/components/tests/TestValueForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,57 +100,56 @@ export const TestValueForm = (props: AssessmentTestProps) => {

<Row>
<Col>
<Form>
<div>
<h5>{props.test.text}</h5>
<Row>
<Col xs={2}>
<InputGroup className="mt-1">
<InputGroup.Text id="label-first-value">
{props.test.value_name}:
</InputGroup.Text>
<Form.Control
value={props.test.value || ""}
type="text"
id="input-value-control"
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
handleValueChange(TestValueEventType.Value, e)
}
/>
</InputGroup>
</Col>
</Row>
{props.test.threshold !== undefined && (
<>
<Row className="mt-1">
<Col xs={2}>
<InputGroup className="mt-2">
<InputGroup.Text id="label-second-value">
{props.test.threshold_name || "Threshold"}:{" "}
</InputGroup.Text>
<Form.Control
value={props.test.threshold || ""}
type="text"
id="input-value-community"
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
handleValueChange(TestValueEventType.Threshold, e)
}
/>
</InputGroup>
</Col>
</Row>
</>
)}
</div>

{props.test.evidence_url !== undefined && (
<EvidenceURLS
urls={props.test.evidence_url}
onListChange={onURLChange}
/>
<div>
<h5>{props.test.text}</h5>
<Row>
<Col xs={2}>
<InputGroup className="mt-1">
<InputGroup.Text id="label-first-value">
{props.test.value_name}:
</InputGroup.Text>
<Form.Control
value={props.test.value || ""}
type="text"
id="input-value-control"
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
handleValueChange(TestValueEventType.Value, e)
}
/>
</InputGroup>
</Col>
</Row>
{props.test.threshold !== undefined && (
<>
<Row className="mt-1">
<Col xs={2}>
<InputGroup className="mt-2">
<InputGroup.Text id="label-second-value">
{props.test.threshold_name || "Threshold"}:{" "}
</InputGroup.Text>
<Form.Control
value={props.test.threshold || ""}
type="text"
id="input-value-community"
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
handleValueChange(TestValueEventType.Threshold, e)
}
/>
</InputGroup>
</Col>
</Row>
</>
)}
</div>

{props.test.evidence_url !== undefined && (
<EvidenceURLS
urls={props.test.evidence_url}
onListChange={onURLChange}
/>
)}

{/* <div className="text-muted mt-2 border-top align-right">
{/* <div className="text-muted mt-2 border-top align-right">
<small>
<em>Test Result: </em>
{props.test.result !== null ? (
Expand All @@ -162,7 +161,6 @@ export const TestValueForm = (props: AssessmentTestProps) => {
)}
</small>
</div> */}
</Form>
</Col>
</Row>
</div>
Expand Down

0 comments on commit 5a518b1

Please sign in to comment.