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 @@
"dev": true
},
"copy-webpack-plugin": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-5.1.1.tgz",
"integrity": "sha512-P15M5ZC8dyCjQHWwd4Ia/dm0SgVvZJMYeykVIVYXbGyqO4dWB5oyPHp9i7wjwo5LhtlhKbiBCdS2NvM07Wlybg==",
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-5.1.2.tgz",
"integrity": "sha512-Uh7crJAco3AjBvgAy9Z75CjK8IG+gxaErro71THQ+vv/bl4HaQcpkexAY8KVW/T6D2W2IRr+couF/knIRkZMIQ==",
"dev": true,
"requires": {
"cacache": "^12.0.3",
......@@ -3433,7 +3433,7 @@
"normalize-path": "^3.0.0",
"p-limit": "^2.2.1",
"schema-utils": "^1.0.0",
"serialize-javascript": "^2.1.2",
"serialize-javascript": "^4.0.0",
"webpack-log": "^2.0.0"
},
"dependencies": {
......@@ -3511,10 +3511,13 @@
}
},
"serialize-javascript": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-2.1.2.tgz",
"integrity": "sha512-rs9OggEUF0V4jUSecXazOYsLfu7OGK2qIn3c7IPBiffz32XniEp/TX9Xmc9LQfK2nQ2QKHvZ2oygKUGU0lG4jQ==",
"dev": true
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz",
"integrity": "sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==",
"dev": true,
"requires": {
"randombytes": "^2.1.0"
}
},
"slash": {
"version": "1.0.0",
......@@ -4381,9 +4384,9 @@
"dev": true
},
"elliptic": {
"version": "6.5.2",
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz",
"integrity": "sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw==",
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz",
"integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==",
"dev": true,
"requires": {
"bn.js": "^4.4.0",
......@@ -6782,9 +6785,9 @@
}
},
"lodash": {
"version": "4.17.15",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
"version": "4.17.20",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
"integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==",
"dev": true
},
"lodash.defaultsdeep": {
......@@ -7288,9 +7291,9 @@
}
},
"node-forge": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.9.0.tgz",
"integrity": "sha512-7ASaDa3pD+lJ3WvXFsxekJQelBKRpne+GOVbLbtHYdd7pFspyeuJHnWfLplGf3SwKGbfs/aYl5V/JCIaHVUKKQ==",
"version": "0.10.0",
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz",
"integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==",
"dev": true
},
"node-ipc": {
......@@ -9282,12 +9285,12 @@
"dev": true
},
"selfsigned": {
"version": "1.10.7",
"resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-1.10.7.tgz",
"integrity": "sha512-8M3wBCzeWIJnQfl43IKwOmC4H/RAp50S8DF60znzjW5GVqTcSe2vWclt7hmYVPkKPlHWOu5EaWOMZ2Y6W8ZXTA==",
"version": "1.10.8",
"resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-1.10.8.tgz",
"integrity": "sha512-2P4PtieJeEwVgTU9QEcwIRDQ/mXJLX8/+I3ur+Pg16nS8oNbrGxEso9NyYWy8NAmXiNl4dlAp5MwoNeCWzON4w==",
"dev": true,
"requires": {
"node-forge": "0.9.0"
"node-forge": "^0.10.0"
}
},
"semver": {
......@@ -11129,6 +11132,11 @@
"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": {
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.2.tgz",
......
......@@ -15,7 +15,8 @@
"vue-flag-icon": "^1.0.6",
"vue-i18n": "^8.17.3",
"vue-router": "^3.3.3",
"vuetify": "^2.2.11"
"vuetify": "^2.2.11",
"vuex": "^3.5.1"
},
"devDependencies": {
"@intlify/vue-i18n-loader": "^1.0.0",
......
......@@ -13,78 +13,98 @@
<v-tabs-items v-model="tab" class="my-4" vertical>
<v-tab-item>
<!-- Local files -->
<v-card outlined height=8em>
<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>
<LocalFilesTab :isSelectedTab="isSelectedTab(0)"/>
</v-tab-item>
<v-tab-item>
<!-- Input text -->
<InputText />
<InputTextTab
:isSelectedTab="isSelectedTab(1)"
@input-text-update="updateChosenCorpus(1, $event)"
/>
</v-tab-item>
<v-tab-item>
<!-- Profile text -->
<v-card outlined height=8em>
<v-card-text>
<v-select :items="test_profile_corpus"
:label="$t('profile-corpus-label')"
:hint="$t('profile-corpus-hint')"
persistent-hint
outlined
>
</v-select>
</v-card-text>
</v-card>
<ProfileCorporaTab
:isSelectedTab="isSelectedTab(2)"
@profile-corpora-update="updateChosenCorpus(2, $event)"
/>
</v-tab-item>
<v-tab-item>
<!-- Shared corpus -->
<v-card outlined height=8em>
<v-card-text
class="justify-center text-center"
>
<v-select :items="test_common_corpus"
:label="$t('shared-corpus-label')"
outlined
>
</v-select>
</v-card-text>
</v-card>
<PublicCorporaTab
:isSelectedTab="isSelectedTab(3)"
@public-corpora-update="updateChosenCorpus(3,$event)"
/>
</v-tab-item>
</v-tabs-items>
</v-tabs>
</v-container>
</template>
<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 {
data: () => ({
tab: null,
tab_items: [
{ tab: 'local-file', content: 'Fichier local'},
{ tab: 'input-text', content: InputText},
{ tab: 'profile-corpus', content: 'Corpus du profil'},
{ tab: 'shared-corpus', content: 'Corpus partagé'},
],
selected: null,
test: { "fr": false, "en": false},
test_profile_corpus: ["My_Corpus1","À la recherche du temps perdu", "Libé_1980_2010"],
test_common_corpus: ["CommonCorpus1", "LIPN_Articles", "Sequoia","LaVoixDuNord_Solr"]
}),
components: {
InputText,
export default {
data: () => ({
tab: null,
tab_items: [
{ tab: 'local-file', content: 'Fichier local'},
{ tab: 'input-text', content: 'Champ de texte'},
{ tab: 'profile-corpus', content: 'Corpora du profil'},
{ tab: 'public-corpus', content: 'Corpora publics'},
],
selected: null,
test: { "fr": false, "en": false},
inputText: '',
profileCorpus : null,
publicCorpus: null
}),
components: {
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>
<i18n>
{
......@@ -92,23 +112,13 @@
"local-file":"Depuis un fichier local",
"input-text":"Depuis un champ de texte",
"profile-corpus":"Depuis un corpus du profil",
"shared-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"
"public-corpus":"Depuis un corpus partagé"
},
"en":{
"local-file":"From a local file",
"input-text":"From a text field",
"profile-corpus":"From a profile corpus",
"shared-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"
"public-corpus":"From a shared corpus"
}
}
</i18n>
\ No newline at end of file
......@@ -7,17 +7,43 @@
<h2 class="display-1">{{ $t('corpus-option-title') }}</h2>
</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-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
class="my-5"
v-model="lang_select"
:items="languages"
:label="$t('corpus-language')"
required
outlined
max-width=80%
:items="languages"
:label="$t('corpus-language')"
v-model="formData.language"
></v-select>
</v-col>
<v-divider/>
......@@ -28,24 +54,27 @@
<v-card-text>
<v-text-field
class="mt-0"
v-model="author"
:label="$t('metadata-author')"
v-model="formData.author"
></v-text-field>
<v-text-field
class="pt-0 mt-0"
v-model="date"
:label="$t('metadata-date')"
v-model="formData.date"
></v-text-field>
<v-text-field
class="mt-0 pt-0"
v-model="type"
:label="$t('metadata-corpus-type')"
v-model="formData.type"
></v-text-field>
<v-row
v-for="metadata in additional_metadata"
v-for="metadata in formData.additionalMetadata"
:key="metadata.id"
>
<v-col>
......@@ -78,47 +107,75 @@
</v-card>
</v-col>
</v-row>
</v-form>
<v-btn
:disabled="!valid"
color="success"
@click="validate"
>Validate
</v-btn>
</v-form>
{{ formData }}
{{ valid }}
</v-card>
</template>
<script>
export default {
data: () => ({
lang_select: 'Français',
languages: ['Français','Anglais','Mandarin','Roumain', 'Nahuatl', 'Multilingue'],
author: '',
date: '',
type: '',
additional_metadata_id: 0,
additional_metadata: [],
}),
methods:
{
add_metadata : function() {
this.additional_metadata_id += 1;
this.additional_metadata.push({id: this.additional_metadata_id, name:"", value: ""})
},
delete_metadata: function(metadata_id) {
var index = null;
for (var i=0; i<this.additional_metadata.length; i++) {
if (this.additional_metadata[i].id == metadata_id) {
index = i;
}
}
if (index !== null) {
this.additional_metadata.splice(index, 1);
}
}
},
export default {
data: () => ({
valid: true,
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: '',
date: '',
type: '',
additionalMetadata: []
}
}),
methods:
{
add_metadata() {
this.additional_metadata_id += 1;
this.formData.additionalMetadata.push({id: this.additional_metadata_id, name:"", value: ""})
},
delete_metadata(metadata_id) {
var index = null;
for (var i=0; i<this.formData.additionalMetadata.length; i++) {
if (this.formData.additionalMetadata[i].id == metadata_id) {
index = i;
}
}
if (index !== null) {
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>
<i18n>
{
"fr":{
"corpus-option-title":"Paramètres du corpus",
"corpus-language":"Langue du corpus",
"metadata-title":"Métadonnées (facultatif)",
"metadata-title":"Métadonnées",
"metadata-author":"Auteur",
"metadata-date":"Date",
"metadata-corpus-type":"Type",
......@@ -129,7 +186,7 @@
"en":{
"corpus-option-title":"Parameters of the corpus",
"corpus-language":"Corpus language",
"metadata-title":"Metadata (not mandatory)",
"metadata-title":"Metadata",
"metadata-author":"Author",
"metadata-date":"Date",
"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>
</template>
<script>
export default {
data: () => ({
inputText: ''
}),
props: ['isSelectedTab'],
watch: {
isSelectedTab: function() {
if (!this.isSelectedTab) {
this.inputText = '';
this.updateValue();
}
}
},
methods: {
updateValue: function() {
this.$emit('input-text-update', this.inputText);
}
}
}
</script>
<i18n>
{
"fr":{
"input-text":"Entrez ou collez votre texte ici"
},
"en":{
"input-text":"Type or paste your text here"
}
}
\ No newline at end of file
<template>
<v-card outlined height=8em>
<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>
</template>
<script>
export default {
props: ['isSelectedTab']
}
</script>
<i18n>
{
"fr":{
"local-file-label":"Choisissez un ou plusieurs fichiers",
"local-file-hint":"Formats acceptés: PDF, TXT, ..."
},
"en":{
"local-file-label":"Chose one or multiple files",
"local-file-hint":"Accepted formats: PDF, TXT, ..."
}
}
</i18n>
\ No newline at end of file
<template>
<v-card outlined height=8em>
<v-card-text>
<v-select :items="test_profile_corpus"
:label="$t('profile-corpus-label')"
:hint="$t('profile-corpus-hint')"
persistent-hint
outlined
v-model="chosenProfileCorpus"
@change="updateValue()"
>
</v-select>
</v-card-text>
</v-card>
</template>
<script>
export default {
data: () => ({
chosenProfileCorpus: null,
test_profile_corpus: ["My_Corpus1","À la recherche du temps perdu", "Libé_1980_2010"],
}),
props: ['isSelectedTab'],
methods: {
updateValue: function() {
this.$emit('profile-corpora-update', this.chosenProfileCorpus);
}
},
watch: {
isSelectedTab: function() {
if (!this.isSelectedTab) {
this.chosenProfileCorpus = null,
this.updateValue();
}