Commit 61943d3f authored by Quentin David's avatar Quentin David
Browse files

New stuff for client: Login pages, renaming of some components, Error 404....

New stuff for client: Login pages, renaming of some components, Error 404. Implementation of DefineCorpus logic
parent 126cd999
...@@ -3418,9 +3418,9 @@ ...@@ -3418,9 +3418,9 @@
"dev": true "dev": true
}, },
"copy-webpack-plugin": { "copy-webpack-plugin": {
"version": "5.1.1", "version": "5.1.2",
"resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-5.1.1.tgz", "resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-5.1.2.tgz",
"integrity": "sha512-P15M5ZC8dyCjQHWwd4Ia/dm0SgVvZJMYeykVIVYXbGyqO4dWB5oyPHp9i7wjwo5LhtlhKbiBCdS2NvM07Wlybg==", "integrity": "sha512-Uh7crJAco3AjBvgAy9Z75CjK8IG+gxaErro71THQ+vv/bl4HaQcpkexAY8KVW/T6D2W2IRr+couF/knIRkZMIQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"cacache": "^12.0.3", "cacache": "^12.0.3",
...@@ -3433,7 +3433,7 @@ ...@@ -3433,7 +3433,7 @@
"normalize-path": "^3.0.0", "normalize-path": "^3.0.0",
"p-limit": "^2.2.1", "p-limit": "^2.2.1",
"schema-utils": "^1.0.0", "schema-utils": "^1.0.0",
"serialize-javascript": "^2.1.2", "serialize-javascript": "^4.0.0",
"webpack-log": "^2.0.0" "webpack-log": "^2.0.0"
}, },
"dependencies": { "dependencies": {
...@@ -3511,10 +3511,13 @@ ...@@ -3511,10 +3511,13 @@
} }
}, },
"serialize-javascript": { "serialize-javascript": {
"version": "2.1.2", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-2.1.2.tgz", "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz",
"integrity": "sha512-rs9OggEUF0V4jUSecXazOYsLfu7OGK2qIn3c7IPBiffz32XniEp/TX9Xmc9LQfK2nQ2QKHvZ2oygKUGU0lG4jQ==", "integrity": "sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==",
"dev": true "dev": true,
"requires": {
"randombytes": "^2.1.0"
}
}, },
"slash": { "slash": {
"version": "1.0.0", "version": "1.0.0",
...@@ -4381,9 +4384,9 @@ ...@@ -4381,9 +4384,9 @@
"dev": true "dev": true
}, },
"elliptic": { "elliptic": {
"version": "6.5.2", "version": "6.5.3",
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz", "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz",
"integrity": "sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw==", "integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==",
"dev": true, "dev": true,
"requires": { "requires": {
"bn.js": "^4.4.0", "bn.js": "^4.4.0",
...@@ -6782,9 +6785,9 @@ ...@@ -6782,9 +6785,9 @@
} }
}, },
"lodash": { "lodash": {
"version": "4.17.15", "version": "4.17.20",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==",
"dev": true "dev": true
}, },
"lodash.defaultsdeep": { "lodash.defaultsdeep": {
...@@ -7288,9 +7291,9 @@ ...@@ -7288,9 +7291,9 @@
} }
}, },
"node-forge": { "node-forge": {
"version": "0.9.0", "version": "0.10.0",
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.9.0.tgz", "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz",
"integrity": "sha512-7ASaDa3pD+lJ3WvXFsxekJQelBKRpne+GOVbLbtHYdd7pFspyeuJHnWfLplGf3SwKGbfs/aYl5V/JCIaHVUKKQ==", "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==",
"dev": true "dev": true
}, },
"node-ipc": { "node-ipc": {
...@@ -9282,12 +9285,12 @@ ...@@ -9282,12 +9285,12 @@
"dev": true "dev": true
}, },
"selfsigned": { "selfsigned": {
"version": "1.10.7", "version": "1.10.8",
"resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-1.10.7.tgz", "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-1.10.8.tgz",
"integrity": "sha512-8M3wBCzeWIJnQfl43IKwOmC4H/RAp50S8DF60znzjW5GVqTcSe2vWclt7hmYVPkKPlHWOu5EaWOMZ2Y6W8ZXTA==", "integrity": "sha512-2P4PtieJeEwVgTU9QEcwIRDQ/mXJLX8/+I3ur+Pg16nS8oNbrGxEso9NyYWy8NAmXiNl4dlAp5MwoNeCWzON4w==",
"dev": true, "dev": true,
"requires": { "requires": {
"node-forge": "0.9.0" "node-forge": "^0.10.0"
} }
}, },
"semver": { "semver": {
...@@ -11129,6 +11132,11 @@ ...@@ -11129,6 +11132,11 @@
"loader-utils": "^1.2.0" "loader-utils": "^1.2.0"
} }
}, },
"vuex": {
"version": "3.5.1",
"resolved": "https://registry.npmjs.org/vuex/-/vuex-3.5.1.tgz",
"integrity": "sha512-w7oJzmHQs0FM9LXodfskhw9wgKBiaB+totOdb8sNzbTB2KDCEEwEs29NzBZFh/lmEK1t5tDmM1vtsO7ubG1DFw=="
},
"watchpack": { "watchpack": {
"version": "1.7.2", "version": "1.7.2",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.2.tgz", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.2.tgz",
......
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
"vue-flag-icon": "^1.0.6", "vue-flag-icon": "^1.0.6",
"vue-i18n": "^8.17.3", "vue-i18n": "^8.17.3",
"vue-router": "^3.3.3", "vue-router": "^3.3.3",
"vuetify": "^2.2.11" "vuetify": "^2.2.11",
"vuex": "^3.5.1"
}, },
"devDependencies": { "devDependencies": {
"@intlify/vue-i18n-loader": "^1.0.0", "@intlify/vue-i18n-loader": "^1.0.0",
......
...@@ -13,78 +13,98 @@ ...@@ -13,78 +13,98 @@
<v-tabs-items v-model="tab" class="my-4" vertical> <v-tabs-items v-model="tab" class="my-4" vertical>
<v-tab-item> <v-tab-item>
<!-- Local files --> <!-- Local files -->
<v-card outlined height=8em> <LocalFilesTab :isSelectedTab="isSelectedTab(0)"/>
<v-card-text
class="justify-center text-center"
>
<v-file-input
:label="$t('local-file-label')"
multiple
:hint="$t('local-file-hint')"
persistent-hint
small-chips
>
</v-file-input>
</v-card-text>
</v-card>
</v-tab-item> </v-tab-item>
<v-tab-item> <v-tab-item>
<!-- Input text --> <!-- Input text -->
<InputText /> <InputTextTab
:isSelectedTab="isSelectedTab(1)"
@input-text-update="updateChosenCorpus(1, $event)"
/>
</v-tab-item> </v-tab-item>
<v-tab-item> <v-tab-item>
<!-- Profile text --> <!-- Profile text -->
<v-card outlined height=8em> <ProfileCorporaTab
<v-card-text> :isSelectedTab="isSelectedTab(2)"
<v-select :items="test_profile_corpus" @profile-corpora-update="updateChosenCorpus(2, $event)"
:label="$t('profile-corpus-label')" />
:hint="$t('profile-corpus-hint')"
persistent-hint
outlined
>
</v-select>
</v-card-text>
</v-card>
</v-tab-item> </v-tab-item>
<v-tab-item> <v-tab-item>
<!-- Shared corpus --> <!-- Shared corpus -->
<v-card outlined height=8em> <PublicCorporaTab
<v-card-text :isSelectedTab="isSelectedTab(3)"
class="justify-center text-center" @public-corpora-update="updateChosenCorpus(3,$event)"
> />
<v-select :items="test_common_corpus"
:label="$t('shared-corpus-label')"
outlined
>
</v-select>
</v-card-text>
</v-card>
</v-tab-item> </v-tab-item>
</v-tabs-items> </v-tabs-items>
</v-tabs> </v-tabs>
</v-container> </v-container>
</template> </template>
<script> <script>
import InputText from '@/components/DefineCorpus/InputText'; import InputTextTab from '@/components/DefineCorpus/CorpusTabs/InputTextTab';
import LocalFilesTab from '@/components/DefineCorpus/CorpusTabs/LocalFilesTab';
import ProfileCorporaTab from '@/components/DefineCorpus/CorpusTabs/ProfileCorporaTab';
import PublicCorporaTab from '@/components/DefineCorpus/CorpusTabs/PublicCorporaTab';
export default { export default {
data: () => ({ data: () => ({
tab: null, tab: null,
tab_items: [ tab_items: [
{ tab: 'local-file', content: 'Fichier local'}, { tab: 'local-file', content: 'Fichier local'},
{ tab: 'input-text', content: InputText}, { tab: 'input-text', content: 'Champ de texte'},
{ tab: 'profile-corpus', content: 'Corpus du profil'}, { tab: 'profile-corpus', content: 'Corpora du profil'},
{ tab: 'shared-corpus', content: 'Corpus partagé'}, { tab: 'public-corpus', content: 'Corpora publics'},
], ],
selected: null, selected: null,
test: { "fr": false, "en": false}, test: { "fr": false, "en": false},
test_profile_corpus: ["My_Corpus1","À la recherche du temps perdu", "Libé_1980_2010"], inputText: '',
test_common_corpus: ["CommonCorpus1", "LIPN_Articles", "Sequoia","LaVoixDuNord_Solr"] profileCorpus : null,
publicCorpus: null
}), }),
components: { components: {
InputText, InputTextTab,
LocalFilesTab,
ProfileCorporaTab,
PublicCorporaTab
},
methods: {
isSelectedTab(tabNumber) {
return tabNumber == this.tab;
},
// emit here ?
// { activeTab: tabName, corpus: corpus}
updateChosenCorpus(tabNumber, corpus) {
switch (tabNumber) {
case 0:
this.localFile = corpus;
break;
case 1:
this.inputText = corpus;
break;
case 2:
this.profileCorpus = corpus;
break;
case 3:
this.publicCorpus = corpus;
break;
}
this.emitUpdate(tabNumber, corpus);
},
emitUpdate(tabNumber, corpus) {
const tabNumberToString = { 0: 'local-file', 1: 'input-text', 2: 'profile-corpus', 3: 'public-corpus'};
// If this function is called when tabNumber !== this.tab
// this means that we asked for a reset of 'tabNumber'
// So we can emit corpus null
if (!this.isSelectedTab(tabNumber)) {
this.$emit('chosen-corpus-update', { activeTab: tabNumberToString[this.tab], corpus: null});
} }
// Else it means the user has just modified in the same tab its input
else {
this.$emit('chosen-corpus-update', { activeTab: tabNumberToString[tabNumber], corpus: corpus });
} }
}
}
}
</script> </script>
<i18n> <i18n>
{ {
...@@ -92,23 +112,13 @@ ...@@ -92,23 +112,13 @@
"local-file":"Depuis un fichier local", "local-file":"Depuis un fichier local",
"input-text":"Depuis un champ de texte", "input-text":"Depuis un champ de texte",
"profile-corpus":"Depuis un corpus du profil", "profile-corpus":"Depuis un corpus du profil",
"shared-corpus":"Depuis un corpus partagé", "public-corpus":"Depuis un corpus partagé"
"local-file-label":"Choisissez un ou plusieurs fichiers",
"local-file-hint":"Formats acceptés: PDF, TXT, ...",
"profile-corpus-label":"Choisissez le corpus que vous voulez traiter",
"profile-corpus-hint":"Vous pouvez définir vos corpora dans votre profil",
"shared-corpus-label":"Choisissez le corpus que vous voulez traiter"
}, },
"en":{ "en":{
"local-file":"From a local file", "local-file":"From a local file",
"input-text":"From a text field", "input-text":"From a text field",
"profile-corpus":"From a profile corpus", "profile-corpus":"From a profile corpus",
"shared-corpus":"From a shared corpus", "public-corpus":"From a shared corpus"
"local-file-label":"Chose one or multiple files",
"local-file-hint":"Accepted formats: PDF, TXT, ...",
"profile-corpus-label":"Chose the corpus you want to process",
"profile-corpus-hint":"You can define your corpora in your profile",
"shared-corpus-label":"Chose the corpus you want to process"
} }
} }
</i18n> </i18n>
\ No newline at end of file
...@@ -7,17 +7,43 @@ ...@@ -7,17 +7,43 @@
<h2 class="display-1">{{ $t('corpus-option-title') }}</h2> <h2 class="display-1">{{ $t('corpus-option-title') }}</h2>
</v-card-title> </v-card-title>
<v-form class="px-12"> <v-form
ref="form"
class="px-12 pb-5"
v-model="valid"
@input="emitForm()"
>
<v-row> <v-row>
<v-col cols="6"> <v-col cols="6">
<v-text-field
class="pt-5"
outlined
required
:rules="titleRules"
label="Titre du corpus"
v-model="formData.title"
></v-text-field>
<v-textarea
hide-details
outlined
height=7em
auto-grow
clearable
label="Description du corpus"
v-model="formData.description"
></v-textarea>
<v-select <v-select
class="my-5" class="my-5"
v-model="lang_select"
:items="languages"
:label="$t('corpus-language')"
required
outlined outlined
max-width=80% max-width=80%
:items="languages"
:label="$t('corpus-language')"
v-model="formData.language"
></v-select> ></v-select>
</v-col> </v-col>
<v-divider/> <v-divider/>
...@@ -28,24 +54,27 @@ ...@@ -28,24 +54,27 @@
<v-card-text> <v-card-text>
<v-text-field <v-text-field
class="mt-0" class="mt-0"
v-model="author"
:label="$t('metadata-author')" :label="$t('metadata-author')"
v-model="formData.author"
></v-text-field> ></v-text-field>
<v-text-field <v-text-field
class="pt-0 mt-0" class="pt-0 mt-0"
v-model="date"
:label="$t('metadata-date')" :label="$t('metadata-date')"
v-model="formData.date"
></v-text-field> ></v-text-field>
<v-text-field <v-text-field
class="mt-0 pt-0" class="mt-0 pt-0"
v-model="type"
:label="$t('metadata-corpus-type')" :label="$t('metadata-corpus-type')"
v-model="formData.type"
></v-text-field> ></v-text-field>
<v-row <v-row
v-for="metadata in additional_metadata" v-for="metadata in formData.additionalMetadata"
:key="metadata.id" :key="metadata.id"
> >
<v-col> <v-col>
...@@ -78,47 +107,75 @@ ...@@ -78,47 +107,75 @@
</v-card> </v-card>
</v-col> </v-col>
</v-row> </v-row>
<v-btn
:disabled="!valid"
color="success"
@click="validate"
>Validate
</v-btn>
</v-form> </v-form>
{{ formData }}
{{ valid }}
</v-card> </v-card>
</template> </template>
<script> <script>
export default { export default {
data: () => ({ data: () => ({
lang_select: 'Français', valid: true,
languages: ['Français','Anglais','Mandarin','Roumain', 'Nahuatl', 'Multilingue'], languages: ['Français','Anglais','Mandarin','Roumain', 'Nahuatl', 'Multilingue'],
additional_metadata_id: 0,
titleRules: [
v => !!v || 'Title is required'
],
// Correspond to metadata in Corpus Model
formData: {
title: '',
description: '',
language: null,
author: '', author: '',
date: '', date: '',
type: '', type: '',
additional_metadata_id: 0, additionalMetadata: []
additional_metadata: [], }
}), }),
methods: methods:
{ {
add_metadata : function() { add_metadata() {
this.additional_metadata_id += 1; this.additional_metadata_id += 1;
this.additional_metadata.push({id: this.additional_metadata_id, name:"", value: ""}) this.formData.additionalMetadata.push({id: this.additional_metadata_id, name:"", value: ""})
}, },
delete_metadata: function(metadata_id) { delete_metadata(metadata_id) {
var index = null; var index = null;
for (var i=0; i<this.additional_metadata.length; i++) { for (var i=0; i<this.formData.additionalMetadata.length; i++) {
if (this.additional_metadata[i].id == metadata_id) { if (this.formData.additionalMetadata[i].id == metadata_id) {
index = i; index = i;
} }
} }
if (index !== null) { if (index !== null) {
this.additional_metadata.splice(index, 1); this.formData.additionalMetadata.splice(index, 1);
}
} }
}, },
validate() {
this.$refs.form.validate();
},
// Send the form to the parent for each change
// Also send if the form is valid or not.
emitForm() {
if (this.$refs.form) {
const valid = this.$refs.form.validate()
this.$emit('corpus-parameters-update', { isValid: valid, data: this.formData });
} }
}
},
}
</script> </script>
<i18n> <i18n>
{ {
"fr":{ "fr":{
"corpus-option-title":"Paramètres du corpus", "corpus-option-title":"Paramètres du corpus",
"corpus-language":"Langue du corpus", "corpus-language":"Langue du corpus",
"metadata-title":"Métadonnées (facultatif)", "metadata-title":"Métadonnées",
"metadata-author":"Auteur", "metadata-author":"Auteur",
"metadata-date":"Date", "metadata-date":"Date",
"metadata-corpus-type":"Type", "metadata-corpus-type":"Type",
...@@ -129,7 +186,7 @@ ...@@ -129,7 +186,7 @@
"en":{ "en":{
"corpus-option-title":"Parameters of the corpus", "corpus-option-title":"Parameters of the corpus",
"corpus-language":"Corpus language", "corpus-language":"Corpus language",
"metadata-title":"Metadata (not mandatory)", "metadata-title":"Metadata",
"metadata-author":"Author", "metadata-author":"Author",
"metadata-date":"Date", "metadata-date":"Date",
"metadata-corpus-type":"Type", "metadata-corpus-type":"Type",
......
<template>
<v-textarea
@input="updateValue()"
hide-details
outlined
height=8em
auto-grow
clearable
v-model="inputText"
:label="$t('input-text')"
></v-textarea>