diff --git a/client/src/components/builder/errorDomain.js b/client/src/components/builder/errorDomain.js
index 8104567f..3deee765 100644
--- a/client/src/components/builder/errorDomain.js
+++ b/client/src/components/builder/errorDomain.js
@@ -39,11 +39,11 @@ export const ErrorDomain = ({onSave}) => {
};
const defaultAlgorithmicError = `{
- "algorithmic_error": {}
+ "algorithmic_error": "null"
}`;
const defaultEmpiricalError = `{
- "empirical_error": {}
+ "empirical_error": "null"
}`;
return (
diff --git a/client/src/components/builder/index.js b/client/src/components/builder/index.js
index c0a8c54b..f2377f60 100644
--- a/client/src/components/builder/index.js
+++ b/client/src/components/builder/index.js
@@ -133,71 +133,71 @@ export default function BuilderColorCode () {
}
- {
- bcoStatus === "idle" ?(<>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- >
- ) :(
-
- {bcoStatus === "loading" ?(
-
-
-
- ) :(
-
-
+ {(bcoStatus === "loading") ? (
+
+
+
+
+
+ ) : ((bcoStatus === "failed") ? (
+
+
+
-
- )}
-
- )}
+
+
+ ) : (<>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ >
+ )
+ )}
)
diff --git a/client/src/layouts/objectSideBar.js b/client/src/layouts/objectSideBar.js
index f7ab7afd..82b2e350 100644
--- a/client/src/layouts/objectSideBar.js
+++ b/client/src/layouts/objectSideBar.js
@@ -57,8 +57,8 @@ export default function ObjectSideBar ({domain, setDomain}) {
const prefix = useSelector(state => state.bco.prefix);
const bcoStatus = useSelector(state => state.bco.status);
const BCODB_URL = process.env.REACT_APP_BCOAPI_URL;
+ const bcoValidation = useSelector(state => state.bco.validation);
const allowUpdate = (bcoStatus === "writing") ? (true) : (false)
- const allowPublish = (bcoStatus === "valid") ? (true) : (false)
function a11yProps(index) {
return {
@@ -133,7 +133,7 @@ export default function ObjectSideBar ({domain, setDomain}) {
variant="contained"
color="primary"
onClick={publishDraft}
- disabled={!allowPublish}
+ disabled={bcoValidation !== "valid"}
>Publish BCO
diff --git a/client/src/slices/bcoSlice.js b/client/src/slices/bcoSlice.js
index 97bd394e..622e39bb 100644
--- a/client/src/slices/bcoSlice.js
+++ b/client/src/slices/bcoSlice.js
@@ -37,6 +37,7 @@ const bcoSlice = createSlice({
},
prefix: null,
status: "idle",
+ validation: "unvalidated",
writingStatus: "idle",
error: null
},
@@ -133,7 +134,6 @@ const bcoSlice = createSlice({
state.status = "idle"
})
.addCase(getDraftBco.rejected, (state, action) => {
- state.error = action.payload.data
state.status = "failed"
state.error = action.payload
console.log("draft failed", action.payload)
@@ -177,17 +177,20 @@ const bcoSlice = createSlice({
state.status = "idle"
state.error = null
})
+ .addCase(validateBco.pending, (state, action) => {
+ state.validation = "pending"
+ })
.addCase(validateBco.fulfilled, (state, action) => {
if (action.payload === 200) {
- state.status = "valid"
+ state.validation = "valid"
state.error = null
} else {
- state.status = "invalid"
+ state.validation = "invalid"
state.error = action.payload[0].data
}
})
.addCase(validateBco.rejected, (state, action) => {
- state.status = "invalid"
+ state.validation = "invalid"
})
.addCase(getExtension.fulfilled, (state, action) => {
console.log(action.payload)
@@ -197,7 +200,7 @@ const bcoSlice = createSlice({
})
.addCase(publishDraftBco.rejected, (state, action) => {
state.error = action.payload[0].data
- state.status = "failed"
+ state.status = "rejected"
})
}
})
@@ -251,6 +254,8 @@ export const publishDraftBco = createAsyncThunk(
"publishDraft",
async ({prefix, bcoURL, bcoObject}, thunkAPI) => {
try {
+ const updateResponse = await BcoService.updateDraftBco(bcoURL, bcoObject)
+ console.log(updateResponse)
const response = await BcoService.publishDraftBco(prefix, bcoURL, bcoObject);
thunkAPI.dispatch(setMessage(response.data[0].message))
return response.data;