1
0
Fork 0

Merge branch 'v2.1' into master

This commit is contained in:
Fernandez Ludovic 2019-12-03 10:43:25 +01:00
commit 829649e905
73 changed files with 1497 additions and 517 deletions

View file

@ -3,15 +3,12 @@ import { APP } from '../_helpers/APP'
const apiBase = '/http'
function getAllRouters (params) {
return APP.api.get(`${apiBase}/routers?search=${params.query}&status=${params.status}`)
return APP.api.get(`${apiBase}/routers?search=${params.query}&status=${params.status}&per_page=${params.limit}&page=${params.page}`)
.then(body => {
const total = body.data ? body.data.length : 0
return APP.api.get(`${apiBase}/routers?search=${params.query}&status=${params.status}&per_page=${params.limit}&page=${params.page}`)
.then(body => {
console.log('Success -> HttpService -> getAllRouters', body.data)
// TODO - suggestion: add the total-pages in api response to optimize the query
return { data: body.data || [], total }
})
console.log('Success -> HttpService -> getAllRouters', body.data)
// TODO - suggestion: add the total-pages in api response to optimize the query
return { data: body.data || [], total }
})
}
@ -24,15 +21,12 @@ function getRouterByName (name) {
}
function getAllServices (params) {
return APP.api.get(`${apiBase}/services?search=${params.query}&status=${params.status}`)
return APP.api.get(`${apiBase}/services?search=${params.query}&status=${params.status}&per_page=${params.limit}&page=${params.page}`)
.then(body => {
const total = body.data ? body.data.length : 0
return APP.api.get(`${apiBase}/services?search=${params.query}&status=${params.status}&per_page=${params.limit}&page=${params.page}`)
.then(body => {
console.log('Success -> HttpService -> getAllServices', body.data)
// TODO - suggestion: add the total-pages in api response to optimize the query
return { data: body.data || [], total }
})
console.log('Success -> HttpService -> getAllServices', body.data)
// TODO - suggestion: add the total-pages in api response to optimize the query
return { data: body.data || [], total }
})
}
@ -45,15 +39,12 @@ function getServiceByName (name) {
}
function getAllMiddlewares (params) {
return APP.api.get(`${apiBase}/middlewares?search=${params.query}&status=${params.status}`)
return APP.api.get(`${apiBase}/middlewares?search=${params.query}&status=${params.status}&per_page=${params.limit}&page=${params.page}`)
.then(body => {
const total = body.data ? body.data.length : 0
return APP.api.get(`${apiBase}/middlewares?search=${params.query}&status=${params.status}&per_page=${params.limit}&page=${params.page}`)
.then(body => {
console.log('Success -> HttpService -> getAllMiddlewares', body.data)
// TODO - suggestion: add the total-pages in api response to optimize the query
return { data: body.data || [], total }
})
console.log('Success -> HttpService -> getAllMiddlewares', body.data)
// TODO - suggestion: add the total-pages in api response to optimize the query
return { data: body.data || [], total }
})
}

View file

@ -3,15 +3,12 @@ import { APP } from '../_helpers/APP'
const apiBase = '/tcp'
function getAllRouters (params) {
return APP.api.get(`${apiBase}/routers?search=${params.query}&status=${params.status}`)
return APP.api.get(`${apiBase}/routers?search=${params.query}&status=${params.status}&per_page=${params.limit}&page=${params.page}`)
.then(body => {
const total = body.data ? body.data.length : 0
return APP.api.get(`${apiBase}/routers?search=${params.query}&status=${params.status}&per_page=${params.limit}&page=${params.page}`)
.then(body => {
console.log('Success -> HttpService -> getAllRouters', body.data)
// TODO - suggestion: add the total-pages in api response to optimize the query
return { data: body.data || [], total }
})
console.log('Success -> HttpService -> getAllRouters', body.data)
// TODO - suggestion: add the total-pages in api response to optimize the query
return { data: body.data || [], total }
})
}
@ -24,15 +21,12 @@ function getRouterByName (name) {
}
function getAllServices (params) {
return APP.api.get(`${apiBase}/services?search=${params.query}&status=${params.status}`)
return APP.api.get(`${apiBase}/services?search=${params.query}&status=${params.status}&per_page=${params.limit}&page=${params.page}`)
.then(body => {
const total = body.data ? body.data.length : 0
return APP.api.get(`${apiBase}/services?search=${params.query}&status=${params.status}&per_page=${params.limit}&page=${params.page}`)
.then(body => {
console.log('Success -> HttpService -> getAllServices', body.data)
// TODO - suggestion: add the total-pages in api response to optimize the query
return { data: body.data || [], total }
})
console.log('Success -> HttpService -> getAllServices', body.data)
// TODO - suggestion: add the total-pages in api response to optimize the query
return { data: body.data || [], total }
})
}

View file

@ -27,7 +27,7 @@
<div class="text-subtitle2">RULE</div>
<q-chip
dense
class="app-chip app-chip-rule">
class="app-chip app-chip-wrap app-chip-rule">
{{ data.rule }}
</q-chip>
</div>
@ -39,7 +39,7 @@
<div class="text-subtitle2">NAME</div>
<q-chip
dense
class="app-chip app-chip-name">
class="app-chip app-chip-wrap app-chip-name">
{{ data.name }}
</q-chip>
</div>
@ -66,7 +66,7 @@
dense
clickable
@click.native="$router.push({ path: `/${protocol}/services/${getServiceId()}`})"
class="app-chip app-chip-service">
class="app-chip app-chip-wrap app-chip-service">
{{ data.service }}
</q-chip>
</div>

View file

@ -45,7 +45,7 @@
</div>
</div>
</q-card-section>
<q-card-section v-if="data.loadBalancer">
<q-card-section v-if="data.loadBalancer && $route.meta.protocol !== 'tcp'">
<div class="row items-start no-wrap">
<div class="col">
<div class="text-subtitle2">Pass Host Header</div>
@ -54,6 +54,19 @@
</div>
</q-card-section>
<q-card-section v-if="data.loadBalancer.terminationDelay">
<div class="row items-start no-wrap">
<div class="col">
<div class="text-subtitle2">Termination Delay</div>
<q-chip
dense
class="app-chip app-chip-name">
{{ data.loadBalancer.terminationDelay }} ms
</q-chip>
</div>
</div>
</q-card-section>
<q-separator v-if="sticky" />
<StickyServiceDetails v-if="sticky" :sticky="sticky" :dense="dense"/>
</q-scroll-area>

View file

@ -26,6 +26,8 @@
</template>
<script>
import Helps from '../../_helpers/Helps'
export default {
name: 'ToolBarTable',
props: ['status', 'filter'],
@ -36,6 +38,9 @@ export default {
return {
}
},
mounted () {
this.routeToState(this.$route)
},
computed: {
getStatus: {
get () {
@ -43,6 +48,7 @@ export default {
},
set (newValue) {
this.$emit('update:status', newValue)
this.stateToRoute(this.$route, { status: newValue })
}
},
getFilter: {
@ -51,11 +57,30 @@ export default {
},
set (newValue) {
this.$emit('update:filter', newValue)
this.stateToRoute(this.$route, { filter: newValue })
}
}
},
watch: {
$route (to, from) {
this.routeToState(to)
}
},
methods: {
routeToState (route) {
for (const query in route.query) {
this.$emit(`update:${query}`, route.query[query])
}
},
stateToRoute (route, values) {
this.$router.push({
path: route.path,
query: Helps.removeEmptyObjects({
...route.query,
...values
})
})
}
},
created () {

View file

@ -144,8 +144,8 @@ export default {
loadingOverview: true,
timeOutEntryGetAll: null,
timeOutOverviewAll: null,
intervalRefreshAll: null,
intervalRefreshAllTime: 5000
intervalRefresh: null,
intervalRefreshTime: 5000
}
},
computed: {
@ -167,10 +167,7 @@ export default {
methods: {
...mapActions('entrypoints', { entryGetAll: 'getAll' }),
...mapActions('core', { getOverview: 'getOverview' }),
refreshAll () {
this.onGetAll()
},
onGetAll () {
fetchEntries () {
this.entryGetAll()
.then(body => {
console.log('Success -> dashboard/entrypoints', body)
@ -182,6 +179,8 @@ export default {
.catch(error => {
console.log('Error -> dashboard/entrypoints', error)
})
},
fetchOverview () {
this.getOverview()
.then(body => {
console.log('Success -> dashboard/overview', body)
@ -193,16 +192,18 @@ export default {
.catch(error => {
console.log('Error -> dashboard/overview', error)
})
},
fetchAll () {
this.fetchEntries()
this.fetchOverview()
}
},
created () {
this.refreshAll()
this.intervalRefreshAll = setInterval(() => {
this.refreshAll()
}, this.intervalRefreshAllTime)
this.fetchAll()
this.intervalRefresh = setInterval(this.fetchOverview, this.intervalRefreshTime)
},
beforeDestroy () {
clearInterval(this.intervalRefreshAll)
clearInterval(this.intervalRefresh)
clearTimeout(this.timeOutEntryGetAll)
clearTimeout(this.timeOutOverviewAll)
this.$store.commit('entrypoints/getAllClear')