From d08edaa007e7227ce2b7a08917a17a8570b5761f Mon Sep 17 00:00:00 2001 From: vincent Date: Thu, 9 May 2019 13:17:03 +0200 Subject: [PATCH 1/3] add range functionality --- client/src/components/chainetv.vue | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/client/src/components/chainetv.vue b/client/src/components/chainetv.vue index 7fc1823..3813325 100644 --- a/client/src/components/chainetv.vue +++ b/client/src/components/chainetv.vue @@ -92,10 +92,17 @@ export default { } this.$store.state.arrayresultchaines = []; const arraychaine = [...new Set(this.chaine.split(" "))]; - + const re = new RegExp("^[0-9]*-[0-9]*$"); arraychaine.forEach(element => { if (element != "") { - this.$store.dispatch('getchaine',{num:element}); + if(re.test(element)){ + var range=element.split("-") + for (var i = range[0]; i <= range[1]; i++) { + this.$store.dispatch('getchaine',{num:i}); + } + }else{ + this.$store.dispatch('getchaine',{num:element}); + } } }); }, From d56236f7727aba5c7b63c3f705b4e69a388f480c Mon Sep 17 00:00:00 2001 From: vincent Date: Thu, 9 May 2019 13:17:21 +0200 Subject: [PATCH 2/3] add sort --- client/src/store/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/src/store/index.js b/client/src/store/index.js index 69a9202..9804620 100644 --- a/client/src/store/index.js +++ b/client/src/store/index.js @@ -71,6 +71,9 @@ const mutations = { }else{ state.arrayresultchaines.push({chaine: payload.chaine,name: payload.name,emission: payload.emission}); } + state.arrayresultchaines=state.arrayresultchaines.sort(function (a,b){ + return ((a.chaine < b.chaine) ? -1 : ((a.chaine > b.chaine) ? 1 : 0)); + }) }, setUserData (state, payload) { console.log('setUserData payload = ', payload) From 09cbae18048d5f5670e85657d46e0c325e7a7770 Mon Sep 17 00:00:00 2001 From: vincent Date: Thu, 9 May 2019 15:25:05 +0200 Subject: [PATCH 3/3] correct syntax lint error --- client/src/App.vue | 1 - client/src/api/index.js | 36 +++----- client/src/components/chainetv.vue | 67 +++++++-------- client/src/components/login.vue | 62 +++++++------- client/src/components/ping.vue | 2 +- client/src/main.js | 6 +- client/src/router/index.js | 14 +-- client/src/store/index.js | 133 ++++++++++++++--------------- client/src/utils/index.js | 17 ++-- 9 files changed, 161 insertions(+), 177 deletions(-) diff --git a/client/src/App.vue b/client/src/App.vue index b670f82..c5e5b1a 100644 --- a/client/src/App.vue +++ b/client/src/App.vue @@ -16,7 +16,6 @@ export default { font-family: 'Avenir', Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; - } h1, h2 { diff --git a/client/src/api/index.js b/client/src/api/index.js index cd4d848..db4281f 100644 --- a/client/src/api/index.js +++ b/client/src/api/index.js @@ -1,28 +1,18 @@ -import axios from "axios"; +import axios from 'axios'; -const API_PATH=`${process.env.ROOT_API}/api/v1`; - -export function fetchchaine(num){ - - return axios.get(`${API_PATH}/chaine/${num}`) +const API_PATH = `${process.env.ROOT_API}/api/v1`; +export function fetchchaine(num) { + return axios.get(`${API_PATH}/chaine/${num}`); } - -export function fetchemission(num){ - - return axios.get(`${API_PATH}/chaine/${num}/emission`) - +export function fetchemission(num) { + return axios.get(`${API_PATH}/chaine/${num}/emission`); } - -export function putparsechaine(jwt){ - - return axios.put(`${API_PATH}/chaine/`,'',{ headers: { Authorization: `Bearer: ${jwt}` }}); - +export function putparsechaine(jwt) { + return axios.put(`${API_PATH}/chaine/`, '', { headers: { Authorization: `Bearer: ${jwt}` } }); } - -export function authenticate (userData) { - return axios.post(`${API_PATH}/login/`, userData) +export function authenticate(userData) { + return axios.post(`${API_PATH}/login/`, userData); } - -// export function register (userData) { -// return axios.post(`${API_URL}/register/`, userData) -// } \ No newline at end of file +// export function register(userData) { +// return axios.post(`${API_URL}/register/`, userData); +// } diff --git a/client/src/components/chainetv.vue b/client/src/components/chainetv.vue index 3813325..cd8cd59 100644 --- a/client/src/components/chainetv.vue +++ b/client/src/components/chainetv.vue @@ -30,7 +30,8 @@
    -
  • +
  • {{result.chaine}} : {{result.name}}

    • @@ -74,64 +75,60 @@