diff --git a/entries/static/entries/js/entries_index.js b/entries/static/entries/js/entries_index.js index 6cd8c3ae4e2e76df5cb14f28e0acacec26e4adc9..2837381246a877b253d5e4d3823330360d657e9f 100644 --- a/entries/static/entries/js/entries_index.js +++ b/entries/static/entries/js/entries_index.js @@ -4,3 +4,10 @@ window.update_entries = function () { window.unificationLeftPaneApp.lexicalUnitId = null; } } + +window.update_view = function () { + if(window.unificationLeftPaneApp) { + window.unificationLeftPaneApp.unificationEntriesListRefreshKey++; + window.unificationLeftPaneApp.lexicalUnitId = null; + } +} diff --git a/frontend/src/components/unification/free_lu/FreeLu.vue b/frontend/src/components/unification/free_lu/FreeLu.vue index 1303f3b95857ace7d2481460a248e258d4bed421..7d64971770b55d2cea58b2cb02f3710b35041ccb 100644 --- a/frontend/src/components/unification/free_lu/FreeLu.vue +++ b/frontend/src/components/unification/free_lu/FreeLu.vue @@ -31,6 +31,11 @@ </script> <template> + <div id="overlay"> + <div class="cv-spinner"> + <span class="spinner"></span> + </div> + </div> <div id="entries-list" class="col h-100 w-100 pr-0 overflow-hidden"> <div id="entries-list-div" class="col p-0 h-100 w-100 overflow-hidden"> <free-lus-list @entry-selected="entrySelected"/> diff --git a/frontend/src/components/unification/free_lu/FreeLuEdit.vue b/frontend/src/components/unification/free_lu/FreeLuEdit.vue index 770d697d3922bce22c204e3c159d2fb9264c3acc..df5d8ad5f0b6cb49b1a5a7e692fca329a5cba080 100644 --- a/frontend/src/components/unification/free_lu/FreeLuEdit.vue +++ b/frontend/src/components/unification/free_lu/FreeLuEdit.vue @@ -161,7 +161,7 @@ { 'frame_id': this.active_slowal_frame.id, }, - (reponse) => { + (response) => { show_info('Rama została przełączona w tryb edycji.'); this.loadEntry(); $.prompt.close(); @@ -210,27 +210,22 @@ if (v === 1) { e.preventDefault(); let lu_ids = normalizeFormData(f.lus); - const data = { - 'lu_ids': JSON.stringify(lu_ids), - 'entry_id': this.entryId, - 'frame_id': frame_in_progress ? frame_in_progress.id : null - }; - $.ajax({ - type: 'post', - url: '/' + lang + '/freelus/' + (frame_in_progress ? 'change_lus_in_slowal_frame' : 'create_new_slowal_frame') + '/', - dataType: 'json', - data: data, - timeout: 60000, - success: function (response) { - // show_info(frame_in_progress ? 'Nowa rama została stworzona.' : 'Lista podpiętych jednostek leksyklanych zostala zmieniona.'); + + send_post_request('/freelus/' + (frame_in_progress ? 'change_lus_in_slowal_frame' : 'create_new_slowal_frame') + '/', + { + 'lu_ids': JSON.stringify(lu_ids), + 'entry_id': this.entryId, + 'frame_id': frame_in_progress ? frame_in_progress.id : null + }, + (response) => { + show_info(frame_in_progress ? 'Nowa rama została stworzona.' : 'Lista podpiętych jednostek leksyklanych zostala zmieniona.'); this.loadEntry(); $.prompt.close(); - }.bind(this), - error: function (request, errorType, errorMessage) { + }, + (request, errorType, errorMessage) => { show_error(errorType + ' (' + errorMessage + ')'); $.prompt.close(); - } - }); + }) } }.bind(this) } @@ -260,26 +255,21 @@ if (v === 1) { e.preventDefault(); let example_ids = normalizeFormData(f.lus); - const data = { - 'example_ids': JSON.stringify(example_ids), - 'selected_lus': JSON.stringify(this.selectedLus.map(e => e.id)), - }; - $.ajax({ - type: 'post', - url: '/' + lang + '/freelus/attach_examples_to_frame/', - dataType: 'json', - data: data, - timeout: 60000, - success: function (response) { + + send_post_request('/freelus/attach_examples_to_frame/', + { + 'example_ids': JSON.stringify(example_ids), + 'selected_lus': JSON.stringify(this.selectedLus.map(e => e.id)), + }, + (response) => { show_info('Przykłady zostały przypisane.'); this.loadEntry(); $.prompt.close(); - }.bind(this), - error: function (request, errorType, errorMessage) { + }, + (request, errorType, errorMessage) => { show_error(errorType + ' (' + errorMessage + ')'); $.prompt.close(); - } - }); + }) } }.bind(this) } @@ -319,7 +309,7 @@ 'frame_id': this.frame_in_progress.id, 'opinion_id': opinion_id, }, - (reponse) => { + (response) => { show_info('Opinia została zmieniona.'); this.loadEntry(); $.prompt.close(); @@ -351,26 +341,19 @@ if (this.selected_frame_argument_id === null) { alert(gettext("Zaznacz argument, który chcesz usunąć.")); } else { - const data = { - 'argument_id': parseInt(this.selected_frame_argument_id.split('-')[1]), - }; - $.ajax({ - type: 'post', - url: '/' + lang + '/freelus/remove_argument_from_frame/', - dataType: 'json', - data: data, - timeout: 60000, - success: function (response) { - // alert(gettext("Argument został usunięty.")); + send_post_request('/freelus/remove_argument_from_frame/', + { + 'argument_id': parseInt(this.selected_frame_argument_id.split('-')[1]), + }, + (response) => { show_info('Argument został usunięty.'); this.loadEntry(); $.prompt.close(); - }.bind(this), - error: function (request, errorType, errorMessage) { + }, + (request, errorType, errorMessage) => { show_error(errorType + ' (' + errorMessage + ')'); $.prompt.close(); - } - }); + }) } }, change_role(selected_frame_argument_id, api_path) { @@ -414,31 +397,24 @@ const sub_attribute_id = normalizeFormData(f.sub_attribute)[0]; - const data = { - 'frame_id': this.frame_in_progress.id, - 'argument_id': selected_frame_argument_id, - 'role_id': role_id, - 'attribute_id': attribute_id, - 'sub_attribute_id': sub_attribute_id - }; - $.ajax({ - type: 'post', - url: '/' + lang + '/freelus/' + api_path + '/', - dataType: 'json', - data: data, - timeout: 60000, - success: function (response) { - // alert(gettext("Nowa rola zosała zapisana.")); + send_post_request('/freelus/' + api_path + '/', + { + 'frame_id': this.frame_in_progress.id, + 'argument_id': selected_frame_argument_id, + 'role_id': role_id, + 'attribute_id': attribute_id, + 'sub_attribute_id': sub_attribute_id + }, + (response) => { show_info('Nowa rola zosała zapisana.'); this.loadEntry(); $.prompt.close(); - }.bind(this), - error: function (request, errorType, errorMessage) { + }, + (request, errorType, errorMessage) => { alert(errorType + ' (' + errorMessage + ')'); show_error(errorType + ' (' + errorMessage + ')'); $.prompt.close(); - } - }); + }) } else { alert(gettext("Musisz wybrać typ oraz rolę.")); } @@ -462,101 +438,79 @@ this.selected_frame_argument_id = null; this.selectedFrameArguments = []; } - // const selectedArguments = this.frame_in_progress.arguments.filter(argument => argument.selected) - // this.$emit('frameSelectionChanged', selectedArguments); }, assign_schema() { if (this.frame_in_progress && this.selected_schemata_position_id && this.selected_frame_argument_id) { - const data = { - 'frame_id': parseInt(this.frame_in_progress.id), - 'subentry_id': parseInt(this.selected_schemata_subentry_id), - 'argument_id': parseInt(this.selected_frame_argument_id.split('-')[1]), - 'schema_id': parseInt(this.selectedSchemas[0].id), - 'schema_position_id': parseInt(this.selected_schemata_position_id.split('-')[1]), - 'schema_alternation_id': (parseInt(this.selected_schemata_position_alternation_id)+1) - }; - $.ajax({ - type: 'post', - url: '/' + lang + '/freelus/attach_schema_to_argument/', - dataType: 'json', - data: data, - timeout: 60000, - success: function (response) { + send_post_request('/freelus/attach_schema_to_argument/', + { + 'frame_id': parseInt(this.frame_in_progress.id), + 'subentry_id': parseInt(this.selected_schemata_subentry_id), + 'argument_id': parseInt(this.selected_frame_argument_id.split('-')[1]), + 'schema_id': parseInt(this.selectedSchemas[0].id), + 'schema_position_id': parseInt(this.selected_schemata_position_id.split('-')[1]), + 'schema_alternation_id': (parseInt(this.selected_schemata_position_alternation_id)+1) + }, + (response) => { if(response['succ'] == true) { - // alert(gettext("Argument ramy został powiązany z tybranym argumentem schematu.")); - show_info('Argument ramy został powiązany z tybranym argumentem schematu.'); + show_info('Argument ramy został powiązany z wybranym argumentem schematu.'); this.loadEntry(); } else { alert(gettext(response['error'])); show_info(response['error']); } $.prompt.close(); - }.bind(this), - error: function (request, errorType, errorMessage) { + }, + (request, errorType, errorMessage) => { alert(errorType + ' (' + errorMessage + ')'); show_error(errorType + ' (' + errorMessage + ')'); $.prompt.close(); - } - }); + }) } else { alert(gettext("W celu powiązania schamatu oraz ramy zaznacz argument ramy oraz argument schematu.")); } }, delete_schema_connections() { if (this.frame_in_progress && this.selected_schemata_position_id && this.selected_frame_argument_id) { - const data = { - 'frame_id': this.frame_in_progress.id, - 'subentry_id': parseInt(this.selected_schemata_subentry_id), - 'argument_id': this.selected_frame_argument_id.split('-')[1], - 'schema_id': this.selectedSchemas[0].id, - 'schema_position_id': this.selected_schemata_position_id.split('-')[1], - 'schema_alternation_id': (parseInt(this.selected_schemata_position_alternation_id)+1) - }; - $.ajax({ - type: 'post', - url: '/' + lang + '/freelus/delete_schema_to_argument_connection/', - dataType: 'json', - data: data, - timeout: 60000, - success: function (response) { - // alert(gettext("Powiązanie pomiędzy argumentem ramy a argumentem schematu zostało usunięte.")); + send_post_request('/freelus/delete_schema_to_argument_connection/', + { + 'frame_id': this.frame_in_progress.id, + 'subentry_id': parseInt(this.selected_schemata_subentry_id), + 'argument_id': this.selected_frame_argument_id.split('-')[1], + 'schema_id': this.selectedSchemas[0].id, + 'schema_position_id': this.selected_schemata_position_id.split('-')[1], + 'schema_alternation_id': (parseInt(this.selected_schemata_position_alternation_id)+1) + }, + (response) => { show_info('Powiązanie pomiędzy argumentem ramy a argumentem schematu zostało usunięte.'); this.loadEntry(); $.prompt.close(); - }.bind(this), - error: function (request, errorType, errorMessage) { + }, + (request, errorType, errorMessage) => { alert(errorType + ' (' + errorMessage + ')'); show_error(errorType + ' (' + errorMessage + ')'); $.prompt.close(); - } - }); + }) } else { alert(gettext("W celu usunięcia powiązania schamatu oraz ramy zaznacz argument ramy oraz argument schematu.")); } }, finish_frame_building() { if (this.frame_in_progress) { - const data = { - 'frame_id': this.frame_in_progress.id, - }; - $.ajax({ - type: 'post', - url: '/' + lang + '/freelus/finish_frame_processing/', - dataType: 'json', - data: data, - timeout: 60000, - success: function (response) { + send_post_request('/freelus/finish_frame_processing/', + { + 'frame_id': this.frame_in_progress.id, + }, + (response) => { alert(gettext("Rama została oznaczona jako gotowa.")); show_info('Rama została oznaczona jako gotowa.'); this.loadEntry(); $.prompt.close(); - }.bind(this), - error: function (request, errorType, errorMessage) { + }, + (request, errorType, errorMessage) => { alert(errorType + ' (' + errorMessage + ')'); show_error(errorType + ' (' + errorMessage + ')'); $.prompt.close(); - } - }); + }) } else { alert(gettext("W celu usunięcia powiązania schamatu oraz ramy zaznacz argument ramy oraz argument schematu.")); } @@ -620,12 +574,12 @@ @click="change_role(selected_frame_argument_id ? selected_frame_argument_id.split('-')[1] : null, 'change_role')" style="padding: 10px 15px 10px 15px; color: #000000;">Zmień rolę </td> - <td id="remove-argument" class="table-button-menu-td" @click="remove_argument()" - style="padding: 10px 15px 10px 15px; color: #000000;">Usuń argument - </td> <td id="delete-schema" class="table-button-menu-td" @click="delete_schema_connections()" style="padding: 10px 15px 10px 15px; color: #000000;">Odłącz argument </td> + <td id="remove-argument" class="table-button-menu-td" @click="remove_argument()" + style="padding: 10px 15px 10px 15px; color: #000000;">Usuń argument + </td> <td id="change-frame-opinion" class="table-button-menu-td" @click="change_frame_opinion()" style="padding: 10px 15px 10px 15px; color: #000000;">Zmień opinię </td> diff --git a/frontend/src/components/unification/hierarchy/Hierarchy.vue b/frontend/src/components/unification/hierarchy/Hierarchy.vue index 5f501f6854c2cf410ea551e0dccc8fe7e9609007..6c1a9c443c930b14cfbe53971a6c326228c4c8b4 100644 --- a/frontend/src/components/unification/hierarchy/Hierarchy.vue +++ b/frontend/src/components/unification/hierarchy/Hierarchy.vue @@ -50,6 +50,11 @@ export default { </script> <template> + <div id="overlay"> + <div class="cv-spinner"> + <span class="spinner"></span> + </div> + </div> <div id="entries-list" class="col h-100 w-100 pr-0 overflow-hidden"> <div id="entries-list-div" class="col p-0 h-100 w-100 overflow-hidden"> <unification-frames-list