-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from UoA-eResearch/IDS-956-implement-validatio…
…ns-in-pages IDS-956 implement validations in pages
- Loading branch information
Showing
20 changed files
with
722 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.error { | ||
border-left: 6px solid rgb(212, 53, 28); | ||
padding-left: 1rem; | ||
} | ||
|
||
.error-msg { | ||
color: rgb(212, 53, 28); | ||
font-family: 'NationalBold'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
.option-list { | ||
margin-top: 1rem; | ||
display: grid; | ||
grid-template-columns: max-content 1fr; | ||
gap: 1rem; | ||
align-items: center; | ||
} | ||
|
||
.option-list input[type=radio] { | ||
height: 1.5rem; | ||
width: 1.5rem; | ||
} | ||
|
||
.form-group { | ||
display: flex; | ||
flex-direction: column; | ||
margin-top: 1.5rem; | ||
} | ||
|
||
input[type=text], | ||
input[type=number], | ||
textarea { | ||
border: 2px solid gray; | ||
padding: 0.35rem; | ||
margin-top: 0.5rem; | ||
} | ||
|
||
/*Remove default spinner in number field.*/ | ||
input[type=number] { | ||
appearance: textfield; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
.page-title { | ||
font-family: "NationalBold"; | ||
font-size: 2.5rem; | ||
margin-bottom: 2rem; | ||
} | ||
|
||
.app-title { | ||
font-size: 1.5rem; | ||
color: gray; | ||
} | ||
|
||
.title-section { | ||
margin-bottom: 2rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/** | ||
* Fixtures containing a sample project and drive. TODO replace with an API client. | ||
*/ | ||
import type { ResearchDriveService, Project, Member, Role } from "./project"; | ||
|
||
export function getDrive(): ResearchDriveService { | ||
return { | ||
name: "reslig-202200001-Tītoki-metabolomics", | ||
allocated_gb: 25600.0, | ||
used_gb: 1596.0 | ||
}; | ||
} | ||
|
||
export function getProject(): Project { | ||
return { | ||
title: "Tītoki metabolomics", | ||
description: "Stress in plants could be defined as any change in growth condition(s) that disrupts metabolic homeostasis and requires an adjustment of metabolic pathways in a process that is usually referred to as acclimation. Metabolomics could contribute significantly to the study of stress biology in plants and other organisms by identifying different compounds, such as by-products of stress metabolism, stress signal transduction molecules or molecules that are part of the acclimation response of plants.", | ||
division: "Liggins Institute", | ||
members: [ | ||
{ | ||
person: { | ||
full_name: "Samina Nicholas", | ||
email: "[email protected]", | ||
username: "snic021" | ||
}, | ||
roles: [{ | ||
name: "Project Owner" | ||
}] | ||
}, | ||
{ | ||
person: { | ||
full_name: "Zach Luther", | ||
email: "[email protected]", | ||
username: "zlut014" | ||
}, | ||
roles: [{ | ||
name: "Project Team Member" | ||
}] | ||
}, | ||
{ | ||
person: { | ||
full_name: "Jarrod Hossam", | ||
email: "[email protected]", | ||
username: "jhos225" | ||
}, | ||
roles: [{ | ||
name: "Project Team Member" | ||
}] | ||
}, | ||
{ | ||
person: { | ||
full_name: "Melisa Edric", | ||
email: "[email protected]", | ||
username: "medr894" | ||
}, | ||
roles: [{ | ||
name: "Project Team Member" | ||
}] | ||
} | ||
] | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/** | ||
* Type definitions for project information. TODO - generate based on output types in Python. | ||
*/ | ||
export interface Person { | ||
email: string | null; | ||
full_name: string; | ||
username: string; | ||
} | ||
|
||
export interface Role { | ||
name: string | ||
} | ||
|
||
export interface Member { | ||
person: Person; | ||
roles: Role[] | ||
} | ||
|
||
export interface Project { | ||
title: string | ||
description: string | ||
division: string | ||
members: Member[] | ||
} | ||
|
||
export interface ResearchDriveService { | ||
allocated_gb: number | ||
name: string | ||
used_gb: number | ||
} | ||
|
||
export enum DataClassification { | ||
Public = "Public", | ||
Internal = "Internal", | ||
Sensitive = "Sensitive", | ||
Restricted = "Restricted" | ||
} | ||
|
||
/** | ||
* Makes and returns an empty Project. | ||
* @returns An empty Project. | ||
*/ | ||
export function makeProject(): Project { | ||
return { | ||
title: "", | ||
description: "", | ||
division: "", | ||
members: [] | ||
} | ||
} | ||
|
||
/** | ||
* Given a list of members, filter for project owners. | ||
* @param members List of members to search through | ||
* @returns Members who are project owners. | ||
*/ | ||
export function getProjectOwners(members: Member[]): Member[] { | ||
return members.filter(member => | ||
member.roles.some( | ||
(role: Role) => role.name === "Project Owner" | ||
) | ||
); | ||
} | ||
|
||
/** | ||
* Given a list of project members, filter for ordinary members. | ||
* @param members List of members to search through | ||
* @returns Members who are not project owners. | ||
*/ | ||
export function getProjectMembers(members: Member[]): Member[] { | ||
return members.filter(member => | ||
!member.roles.some( | ||
(role: Role) => role.name === "Project Owner" | ||
) | ||
); | ||
} | ||
|
||
/** | ||
* Given a list of members, return a string of their names. | ||
* @param members Members to return names for. | ||
* @returns A string representing all member names. | ||
*/ | ||
export function membersToString(members: Member[]): string { | ||
return members.map(member => | ||
member.person.full_name | ||
).join(", "); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { reactive } from 'vue'; | ||
import { DataClassification, makeProject, type Project } from './project'; | ||
|
||
interface FormStateStore { | ||
hasStartedForm: boolean; | ||
hasFinishedForm: boolean; | ||
isCorrectDrive: boolean | null; | ||
areProjectDetailsCorrect: boolean | null; | ||
project: Project; | ||
dataClassification: DataClassification | null; | ||
retentionPeriod: number | null; | ||
isRetentionPeriodCustom: boolean | null; | ||
} | ||
|
||
export const formState: FormStateStore = reactive({ | ||
hasStartedForm: false, | ||
hasFinishedForm: false, | ||
isCorrectDrive: null, | ||
areProjectDetailsCorrect: null, | ||
project: makeProject(), | ||
dataClassification: null, | ||
isRetentionPeriodCustom: null, | ||
retentionPeriod: null | ||
}); |
Oops, something went wrong.