Skip to content

Commit

Permalink
Merge pull request #286 from orppst/ARE-edit-observing-cycle-dates-fail
Browse files Browse the repository at this point in the history
Are edit observing cycle dates fail
  • Loading branch information
AllanEngland authored Dec 12, 2024
2 parents 74488a0 + b599f0c commit e13dd7e
Show file tree
Hide file tree
Showing 4 changed files with 267 additions and 41 deletions.
14 changes: 7 additions & 7 deletions src/main/webui/[email protected]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--- proposalToolSchemas.ts.orig 2024-11-21 20:37:35
+++ proposalToolSchemas.ts 2024-11-21 20:40:44
--- proposalToolSchemas.ts.orig 2024-12-06 09:17:57
+++ proposalToolSchemas.ts 2024-12-06 09:18:04
@@ -7,6 +7,7 @@
* base proposal
*/
Expand Down Expand Up @@ -234,7 +234,7 @@
xmlId?: string;
/**
* the proposal title
@@ -1683,17 +1716,20 @@
@@ -1703,17 +1736,20 @@
* A target source
*/
export type Target = {
Expand All @@ -255,15 +255,15 @@
xmlId?: string;
name?: string;
};
@@ -1702,6 +1738,7 @@
@@ -1722,6 +1758,7 @@
* an observation of the scientific target
*/
export type TargetObservation = {
+ "@type"?: string;
xmlId?: string;
/**
* any constraints on the observation
@@ -1730,10 +1767,12 @@
@@ -1750,10 +1787,12 @@
*/
performance?: PerformanceParameters;
spectrum?: ScienceSpectralWindow[];
Expand All @@ -276,15 +276,15 @@
xmlId?: string;
/**
* telescope name
@@ -1753,6 +1792,7 @@
@@ -1773,6 +1812,7 @@
* a set of telescopes that are operated together for an observation
*/
export type TelescopeArray = {
+ "@type"?: string;
xmlId?: string;
/**
* the array name
@@ -1834,6 +1874,10 @@
@@ -1854,6 +1894,10 @@
* particular time range
*/
export type TimingWindow = {
Expand Down
46 changes: 21 additions & 25 deletions src/main/webui/src/ProposalManagerView/proposalCycle/dates.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,34 +67,30 @@ export default function CycleDatesPanel() : ReactElement {
}

const handleSave = form.onSubmit((val) => {
const promises=[];

if(val.submissionDeadline?.getTime() !== new Date(data?.submissionDeadline as string).getTime()) {
promises.push(fetchProposalCyclesResourceReplaceCycleDeadline({
fetchProposalCyclesResourceReplaceCycleDeadline({
pathParams: {cycleCode: Number(selectedCycleCode)},
//@ts-ignore
body: val.submissionDeadline?.getTime()
}));
}
if(val.sessionStart?.getTime() !== new Date(data?.observationSessionStart as string).getTime()) {
promises.push(fetchProposalCyclesResourceReplaceCycleSessionStart({
pathParams: {cycleCode: Number(selectedCycleCode)},
//@ts-ignore
body: val.sessionStart?.getTime()
}));
}
if(val.sessionEnd?.getTime() !== new Date(data?.observationSessionEnd as string).getTime()) {
promises.push(fetchProposalCyclesResourceReplaceCycleSessionEnd({
pathParams: {cycleCode: Number(selectedCycleCode)},
//@ts-ignore
body: val.sessionEnd?.getTime()
}))
}
// FIXME: Make this .catch() work correctly
Promise.all(promises)
.then(()=> {
notifySuccess("Update dates", "Changes saved");
form.resetDirty();
})
.then(() => {
fetchProposalCyclesResourceReplaceCycleSessionStart({
pathParams: {cycleCode: Number(selectedCycleCode)},
//@ts-ignore
body: val.sessionStart?.getTime()
}).then(() => {
fetchProposalCyclesResourceReplaceCycleSessionEnd({
pathParams: {cycleCode: Number(selectedCycleCode)},
//@ts-ignore
body: val.sessionEnd?.getTime()
}).then(() => {
notifySuccess("Update dates", "Changes saved");
form.resetDirty();
})
.catch((fault)=>notifyError("Update dates", "Error saving "
+ getErrorMessage(fault)))
})
.catch((fault)=>notifyError("Update dates", "Error saving "
+ getErrorMessage(fault)))
})
.catch((fault)=>notifyError("Update dates", "Error saving "
+ getErrorMessage(fault)))
Expand Down
Loading

0 comments on commit e13dd7e

Please sign in to comment.