Add more pages in the WebUI
This commit is contained in:
parent
2b828765e3
commit
fcc1109e76
82 changed files with 5005 additions and 249 deletions
75
webui/src/_services/HttpService.js
Normal file
75
webui/src/_services/HttpService.js
Normal file
|
@ -0,0 +1,75 @@
|
|||
import { APP } from '../_helpers/APP'
|
||||
|
||||
const apiBase = '/http'
|
||||
|
||||
function getAllRouters (params) {
|
||||
return APP.api.get(`${apiBase}/routers?search=${params.query}&status=${params.status}`)
|
||||
.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 }
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function getRouterByName (name) {
|
||||
return APP.api.get(`${apiBase}/routers/${name}`)
|
||||
.then(body => {
|
||||
console.log('Success -> HttpService -> getRouterByName', body.data)
|
||||
return body.data
|
||||
})
|
||||
}
|
||||
|
||||
function getAllServices (params) {
|
||||
return APP.api.get(`${apiBase}/services?search=${params.query}&status=${params.status}`)
|
||||
.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 }
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function getServiceByName (name) {
|
||||
return APP.api.get(`${apiBase}/services/${name}`)
|
||||
.then(body => {
|
||||
console.log('Success -> HttpService -> getServiceByName', body.data)
|
||||
return body.data
|
||||
})
|
||||
}
|
||||
|
||||
function getAllMiddlewares (params) {
|
||||
return APP.api.get(`${apiBase}/middlewares?search=${params.query}&status=${params.status}`)
|
||||
.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 }
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function getMiddlewareByName (name) {
|
||||
return APP.api.get(`${apiBase}/middlewares/${name}`)
|
||||
.then(body => {
|
||||
console.log('Success -> HttpService -> getMiddlewareByName', body.data)
|
||||
return body.data
|
||||
})
|
||||
}
|
||||
|
||||
export default {
|
||||
getAllRouters,
|
||||
getRouterByName,
|
||||
getAllServices,
|
||||
getServiceByName,
|
||||
getAllMiddlewares,
|
||||
getMiddlewareByName
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue