diff --git a/src/upload/Dashboard.js b/src/upload/Dashboard.js index d42caf035..c613885dd 100644 --- a/src/upload/Dashboard.js +++ b/src/upload/Dashboard.js @@ -40,7 +40,7 @@ const Dashboard = ({ getStatuses, getUploadTypes, uploadTypes = new UploadTypes( const [entityForDownload, setEntityForDownload] = React.useState(""); const [file, setFile] = React.useState(); const [autoApprove, setAutoApprove] = React.useState(false); - const [mode, setMode] = React.useState("relaxed"); + const [mode, setMode] = React.useState("CREATE"); const [hierarchy, setHierarchy] = React.useState(); const [configuredHierarchies, setConfiguredHierarchies] = React.useState([]); @@ -49,7 +49,7 @@ const Dashboard = ({ getStatuses, getUploadTypes, uploadTypes = new UploadTypes( staticTypesWithStaticDownload.getCode(name) || staticTypesWithDynamicDownload.getCode(name) || uploadTypes.getCode(name); const uploadFile = async () => { - const [ok, error] = await api.bulkUpload(getUploadTypeCode(uploadType), file, autoApprove, mode); + const [ok, error] = await api.bulkUpload(getUploadTypeCode(uploadType), file, autoApprove, mode, hierarchy); if (!ok && error) { alert(error); } @@ -89,7 +89,7 @@ const Dashboard = ({ getStatuses, getUploadTypes, uploadTypes = new UploadTypes( const dropdownHandler = option => { setAutoApprove(false); - setMode("relaxed"); + setMode("CREATE"); setUploadType(option); option !== staticTypesWithStaticDownload.getName("metadataZip") && setEntityForDownload(option); }; @@ -97,7 +97,7 @@ const Dashboard = ({ getStatuses, getUploadTypes, uploadTypes = new UploadTypes( const isSampleDownloadDisallowed = isEmpty(entityForDownload) || (uploadType === "Locations" && isEmpty(mode)) || - (uploadType === "Locations" && mode === "relaxed" && isEmpty(hierarchy)); + (uploadType === "Locations" && mode === "CREATE" && isEmpty(hierarchy)); return ( @@ -150,7 +150,7 @@ const Dashboard = ({ getStatuses, getUploadTypes, uploadTypes = new UploadTypes( {uploadType === "Locations" && - mode === "relaxed" && + mode === "CREATE" && (configuredHierarchies && configuredHierarchies.length > 0 ? ( ) : ( diff --git a/src/upload/LocationModes.js b/src/upload/LocationModes.js index 949f5504a..313dc1313 100644 --- a/src/upload/LocationModes.js +++ b/src/upload/LocationModes.js @@ -14,15 +14,15 @@ export const LocationModes = ({ mode, setMode }) => { return ( Select Mode - +
- } label="Create" /> + } label="Create" />
- } label="Edit" /> + } label="Edit" />
diff --git a/src/upload/api.js b/src/upload/api.js index 760680283..460a23952 100644 --- a/src/upload/api.js +++ b/src/upload/api.js @@ -6,9 +6,9 @@ export default { fetchUploadJobStatuses: (params = {}) => { return http.fetchJson(http.withParams("/import/status", { size: 5, ...params })).then(r => r.json); }, - bulkUpload: (type, file, autoApprove, locationUploadMode) => + bulkUpload: (type, file, autoApprove, locationUploadMode, locationHierarchy) => http - .uploadFile(http.withParams("/import/new", { type, autoApprove, locationUploadMode }), file) + .uploadFile(http.withParams("/import/new", { type, autoApprove, locationUploadMode, locationHierarchy }), file) //returns [response, error] .then(r => [r.text, null]) .catch(r => [null, `${get(r, "response.data") || get(r, "message") || "unknown error"}`]), diff --git a/yarn.lock b/yarn.lock index 42460228a..bbc0c21fc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -16944,6 +16944,19 @@ rsvp@^4.8.4: "rules-config@github:avniproject/rules-config#fe552da405368bfd138e2f38e605c1d307e3ebe4": version "0.0.1" resolved "https://codeload.github.com/avniproject/rules-config/tar.gz/fe552da405368bfd138e2f38e605c1d307e3ebe4" + dependencies: + "@quasar/babel-preset-app" "^2.0.1" + babel-preset-env "^1.7.0" + babel-register "^6.26.0" + chai "^4.1.2" + lodash "^4.17.11" + moment "^2.29.4" + superagent "^3.8.3" + test "^0.6.0" + uglifyjs-webpack-plugin "^1.2.5" + webpack "^3.12.0" + webpack-cli "^3.0.3" + webpack-node-externals "1.6.0" run-async@^2.2.0, run-async@^2.4.0: version "2.4.1"