|
|
|
|
@ -22,7 +22,8 @@ |
|
|
|
|
<div class="field 2"> |
|
|
|
|
<div class="8"> |
|
|
|
|
<div id="replace" class="field-checkbox"> |
|
|
|
|
<input class="appearance-none checked:bg-support-4 outline-none" name="replace" type="checkbox" value="1" id="qf_5b8df0" v-model="replace" /> |
|
|
|
|
<input class="appearance-none checked:bg-support-4 outline-none" name="replace" type="checkbox" value="1" |
|
|
|
|
id="qf_5b8df0" v-model="replace"/> |
|
|
|
|
<label for="qf_5b8df0" class=""> |
|
|
|
|
Delete all terms before import. |
|
|
|
|
</label> |
|
|
|
|
@ -32,7 +33,8 @@ |
|
|
|
|
<div class="field 2"> |
|
|
|
|
<div class="8"> |
|
|
|
|
<div id="update" class="field-checkbox"> |
|
|
|
|
<input class="appearance-none checked:bg-support-4 outline-none" name="update" type="checkbox" value="1" id="qf_594e6e" v-model="update" /> |
|
|
|
|
<input class="appearance-none checked:bg-support-4 outline-none" name="update" type="checkbox" value="1" |
|
|
|
|
id="qf_594e6e" v-model="update"/> |
|
|
|
|
<label for="qf_594e6e" class=""> |
|
|
|
|
Update existing terms. |
|
|
|
|
</label> |
|
|
|
|
@ -49,7 +51,7 @@ |
|
|
|
|
</form> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
<script setup> |
|
|
|
|
import axios from 'axios'; |
|
|
|
|
import {ENTRYPOINT} from "../../config/entrypoint"; |
|
|
|
|
import {useRoute, useRouter} from "vue-router"; |
|
|
|
|
@ -57,17 +59,15 @@ import { useI18n } from "vue-i18n"; |
|
|
|
|
import {ref} from "vue"; |
|
|
|
|
import {RESOURCE_LINK_PUBLISHED} from "../resource_links/visibility"; |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
setup() { |
|
|
|
|
const route = useRoute(); |
|
|
|
|
const router = useRouter(); |
|
|
|
|
const { t } = useI18n(); |
|
|
|
|
const route = useRoute() |
|
|
|
|
const router = useRouter() |
|
|
|
|
const {t} = useI18n() |
|
|
|
|
|
|
|
|
|
const fileInputRef = ref(null); |
|
|
|
|
const fileType = ref("csv"); |
|
|
|
|
const replace = ref(false); |
|
|
|
|
const update = ref(false); |
|
|
|
|
const parentResourceNodeId = ref(Number(route.params.node)); |
|
|
|
|
const fileInputRef = ref(null) |
|
|
|
|
const fileType = ref("csv") |
|
|
|
|
const replace = ref(false) |
|
|
|
|
const update = ref(false) |
|
|
|
|
const parentResourceNodeId = ref(Number(route.params.node)) |
|
|
|
|
|
|
|
|
|
const resourceLinkList = ref( |
|
|
|
|
JSON.stringify([ |
|
|
|
|
@ -77,51 +77,41 @@ export default { |
|
|
|
|
visibility: RESOURCE_LINK_PUBLISHED, // visible by default |
|
|
|
|
}, |
|
|
|
|
]) |
|
|
|
|
); |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
const submitForm = async () => { |
|
|
|
|
const fileInput = document.getElementById('glossary_file'); |
|
|
|
|
const file = fileInput.files[0]; |
|
|
|
|
const formData = new FormData(); |
|
|
|
|
formData.append("file", file); |
|
|
|
|
formData.append("file_type", fileType.value); |
|
|
|
|
formData.append("replace", replace.value); |
|
|
|
|
formData.append("update", update.value); |
|
|
|
|
formData.append("sid", route.query.sid); |
|
|
|
|
formData.append("cid", route.query.cid); |
|
|
|
|
formData.append("parentResourceNodeId", parentResourceNodeId.value); |
|
|
|
|
formData.append("resourceLinkList", resourceLinkList.value); |
|
|
|
|
const fileInput = document.getElementById('glossary_file') |
|
|
|
|
const file = fileInput.files[0] |
|
|
|
|
const formData = new FormData() |
|
|
|
|
formData.append("file", file) |
|
|
|
|
formData.append("file_type", fileType.value) |
|
|
|
|
formData.append("replace", replace.value) |
|
|
|
|
formData.append("update", update.value) |
|
|
|
|
formData.append("sid", route.query.sid) |
|
|
|
|
formData.append("cid", route.query.cid) |
|
|
|
|
formData.append("parentResourceNodeId", parentResourceNodeId.value) |
|
|
|
|
formData.append("resourceLinkList", resourceLinkList.value) |
|
|
|
|
|
|
|
|
|
console.log('formData', formData); |
|
|
|
|
console.log('formData', formData) |
|
|
|
|
|
|
|
|
|
console.log(ENTRYPOINT + 'glossaries/import'); |
|
|
|
|
console.log(ENTRYPOINT + 'glossaries/import') |
|
|
|
|
try { |
|
|
|
|
// eslint-disable-next-line no-unused-vars |
|
|
|
|
const response = await axios.post(ENTRYPOINT + 'glossaries/import', formData, { |
|
|
|
|
headers: { |
|
|
|
|
'Content-Type': 'multipart/form-data' |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
router.push({ |
|
|
|
|
name: "GlossaryList", |
|
|
|
|
query: route.query, |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
} catch (error) { |
|
|
|
|
fileInputRef.value = null; |
|
|
|
|
fileType.value = "csv"; |
|
|
|
|
replace.value = false; |
|
|
|
|
update.value = false; |
|
|
|
|
fileInputRef.value = null |
|
|
|
|
fileType.value = "csv" |
|
|
|
|
replace.value = false |
|
|
|
|
update.value = false |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
fileInputRef, |
|
|
|
|
fileType, |
|
|
|
|
replace, |
|
|
|
|
update, |
|
|
|
|
submitForm, |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|
|