Add more pages in the WebUI
This commit is contained in:
parent
2b828765e3
commit
fcc1109e76
82 changed files with 5005 additions and 249 deletions
|
@ -1,8 +1,8 @@
|
|||
import entrypointsService from '../../_services/EntrypointsService'
|
||||
import EntrypointsService from '../../_services/EntrypointsService'
|
||||
|
||||
export function getAll ({ commit }) {
|
||||
commit('getAllRequest')
|
||||
return entrypointsService.getAll()
|
||||
return EntrypointsService.getAll()
|
||||
.then(body => {
|
||||
commit('getAllSuccess', body)
|
||||
return body
|
||||
|
@ -12,3 +12,16 @@ export function getAll ({ commit }) {
|
|||
return Promise.reject(error)
|
||||
})
|
||||
}
|
||||
|
||||
export function getByName ({ commit }, name) {
|
||||
commit('getByNameRequest')
|
||||
return EntrypointsService.getByName(name)
|
||||
.then(body => {
|
||||
commit('getByNameSuccess', body)
|
||||
return body
|
||||
})
|
||||
.catch(error => {
|
||||
commit('getByNameFailure', error)
|
||||
return Promise.reject(error)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -4,3 +4,10 @@
|
|||
export function all (state) {
|
||||
return state.all
|
||||
}
|
||||
|
||||
// ----------------------------
|
||||
// byName
|
||||
// ----------------------------
|
||||
export function byName (state) {
|
||||
return state.byName
|
||||
}
|
||||
|
|
|
@ -16,3 +16,22 @@ export function getAllFailure (state, error) {
|
|||
export function getAllClear (state) {
|
||||
state.all = {}
|
||||
}
|
||||
|
||||
// ----------------------------
|
||||
// Get By Name
|
||||
// ----------------------------
|
||||
export function getByNameRequest (state) {
|
||||
state.byName.loading = true
|
||||
}
|
||||
|
||||
export function getByNameSuccess (state, body) {
|
||||
state.byName = { item: body, loading: false }
|
||||
}
|
||||
|
||||
export function getByNameFailure (state, error) {
|
||||
state.byName = { error }
|
||||
}
|
||||
|
||||
export function getByNameClear (state) {
|
||||
state.byName = {}
|
||||
}
|
||||
|
|
79
webui/src/store/http/actions.js
Normal file
79
webui/src/store/http/actions.js
Normal file
|
@ -0,0 +1,79 @@
|
|||
import HttpService from '../../_services/HttpService'
|
||||
|
||||
export function getAllRouters ({ commit }, params) {
|
||||
commit('getAllRoutersRequest')
|
||||
return HttpService.getAllRouters(params)
|
||||
.then(body => {
|
||||
commit('getAllRoutersSuccess', body)
|
||||
return body
|
||||
})
|
||||
.catch(error => {
|
||||
commit('getAllRoutersFailure', error)
|
||||
return Promise.reject(error)
|
||||
})
|
||||
}
|
||||
|
||||
export function getRouterByName ({ commit }, name) {
|
||||
commit('getRouterByNameRequest')
|
||||
return HttpService.getRouterByName(name)
|
||||
.then(body => {
|
||||
commit('getRouterByNameSuccess', body)
|
||||
return body
|
||||
})
|
||||
.catch(error => {
|
||||
commit('getRouterByNameFailure', error)
|
||||
return Promise.reject(error)
|
||||
})
|
||||
}
|
||||
|
||||
export function getAllServices ({ commit }, params) {
|
||||
commit('getAllServicesRequest')
|
||||
return HttpService.getAllServices(params)
|
||||
.then(body => {
|
||||
commit('getAllServicesSuccess', body)
|
||||
return body
|
||||
})
|
||||
.catch(error => {
|
||||
commit('getAllServicesFailure', error)
|
||||
return Promise.reject(error)
|
||||
})
|
||||
}
|
||||
|
||||
export function getServiceByName ({ commit }, name) {
|
||||
commit('getServiceByNameRequest')
|
||||
return HttpService.getServiceByName(name)
|
||||
.then(body => {
|
||||
commit('getServiceByNameSuccess', body)
|
||||
return body
|
||||
})
|
||||
.catch(error => {
|
||||
commit('getServiceByNameFailure', error)
|
||||
return Promise.reject(error)
|
||||
})
|
||||
}
|
||||
|
||||
export function getAllMiddlewares ({ commit }, params) {
|
||||
commit('getAllMiddlewaresRequest')
|
||||
return HttpService.getAllMiddlewares(params)
|
||||
.then(body => {
|
||||
commit('getAllMiddlewaresSuccess', body)
|
||||
return body
|
||||
})
|
||||
.catch(error => {
|
||||
commit('getAllMiddlewaresFailure', error)
|
||||
return Promise.reject(error)
|
||||
})
|
||||
}
|
||||
|
||||
export function getMiddlewareByName ({ commit }, name) {
|
||||
commit('getMiddlewareByNameRequest')
|
||||
return HttpService.getMiddlewareByName(name)
|
||||
.then(body => {
|
||||
commit('getMiddlewareByNameSuccess', body)
|
||||
return body
|
||||
})
|
||||
.catch(error => {
|
||||
commit('getMiddlewareByNameFailure', error)
|
||||
return Promise.reject(error)
|
||||
})
|
||||
}
|
41
webui/src/store/http/getters.js
Normal file
41
webui/src/store/http/getters.js
Normal file
|
@ -0,0 +1,41 @@
|
|||
// ----------------------------
|
||||
// all Routers
|
||||
// ----------------------------
|
||||
export function allRouters (state) {
|
||||
return state.allRouters
|
||||
}
|
||||
|
||||
// ----------------------------
|
||||
// Router by Name
|
||||
// ----------------------------
|
||||
export function routerByName (state) {
|
||||
return state.routerByName
|
||||
}
|
||||
|
||||
// ----------------------------
|
||||
// all Services
|
||||
// ----------------------------
|
||||
export function allServices (state) {
|
||||
return state.allServices
|
||||
}
|
||||
|
||||
// ----------------------------
|
||||
// Service by Name
|
||||
// ----------------------------
|
||||
export function serviceByName (state) {
|
||||
return state.serviceByName
|
||||
}
|
||||
|
||||
// ----------------------------
|
||||
// all Middlewares
|
||||
// ----------------------------
|
||||
export function allMiddlewares (state) {
|
||||
return state.allMiddlewares
|
||||
}
|
||||
|
||||
// ----------------------------
|
||||
// Middleware by Name
|
||||
// ----------------------------
|
||||
export function middlewareByName (state) {
|
||||
return state.middlewareByName
|
||||
}
|
12
webui/src/store/http/index.js
Normal file
12
webui/src/store/http/index.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
import state from './state'
|
||||
import * as getters from './getters'
|
||||
import * as mutations from './mutations'
|
||||
import * as actions from './actions'
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
getters,
|
||||
mutations,
|
||||
actions,
|
||||
state
|
||||
}
|
113
webui/src/store/http/mutations.js
Normal file
113
webui/src/store/http/mutations.js
Normal file
|
@ -0,0 +1,113 @@
|
|||
// ----------------------------
|
||||
// Get All Routers
|
||||
// ----------------------------
|
||||
export function getAllRoutersRequest (state) {
|
||||
state.allRouters.loading = true
|
||||
}
|
||||
|
||||
export function getAllRoutersSuccess (state, body) {
|
||||
state.allRouters = { items: body.data, total: body.total, loading: false }
|
||||
}
|
||||
|
||||
export function getAllRoutersFailure (state, error) {
|
||||
state.allRouters = { error }
|
||||
}
|
||||
|
||||
export function getAllRoutersClear (state) {
|
||||
state.allRouters = {}
|
||||
}
|
||||
|
||||
// ----------------------------
|
||||
// Get Router By Name
|
||||
// ----------------------------
|
||||
export function getRouterByNameRequest (state) {
|
||||
state.routerByName.loading = true
|
||||
}
|
||||
|
||||
export function getRouterByNameSuccess (state, body) {
|
||||
state.routerByName = { item: body, loading: false }
|
||||
}
|
||||
|
||||
export function getRouterByNameFailure (state, error) {
|
||||
state.routerByName = { error }
|
||||
}
|
||||
|
||||
export function getRouterByNameClear (state) {
|
||||
state.routerByName = {}
|
||||
}
|
||||
|
||||
// ----------------------------
|
||||
// Get All Services
|
||||
// ----------------------------
|
||||
export function getAllServicesRequest (state) {
|
||||
state.allServices.loading = true
|
||||
}
|
||||
|
||||
export function getAllServicesSuccess (state, body) {
|
||||
state.allServices = { items: body.data, total: body.total, loading: false }
|
||||
}
|
||||
|
||||
export function getAllServicesFailure (state, error) {
|
||||
state.allServices = { error }
|
||||
}
|
||||
|
||||
export function getAllServicesClear (state) {
|
||||
state.allServices = {}
|
||||
}
|
||||
|
||||
// ----------------------------
|
||||
// Get Service By Name
|
||||
// ----------------------------
|
||||
export function getServiceByNameRequest (state) {
|
||||
state.serviceByName.loading = true
|
||||
}
|
||||
|
||||
export function getServiceByNameSuccess (state, body) {
|
||||
state.serviceByName = { item: body, loading: false }
|
||||
}
|
||||
|
||||
export function getServiceByNameFailure (state, error) {
|
||||
state.serviceByName = { error }
|
||||
}
|
||||
|
||||
export function getServiceByNameClear (state) {
|
||||
state.serviceByName = {}
|
||||
}
|
||||
|
||||
// ----------------------------
|
||||
// Get All Middlewares
|
||||
// ----------------------------
|
||||
export function getAllMiddlewaresRequest (state) {
|
||||
state.allMiddlewares.loading = true
|
||||
}
|
||||
|
||||
export function getAllMiddlewaresSuccess (state, body) {
|
||||
state.allMiddlewares = { items: body.data, total: body.total, loading: false }
|
||||
}
|
||||
|
||||
export function getAllMiddlewaresFailure (state, error) {
|
||||
state.allMiddlewares = { error }
|
||||
}
|
||||
|
||||
export function getAllMiddlewaresClear (state) {
|
||||
state.allMiddlewares = {}
|
||||
}
|
||||
|
||||
// ----------------------------
|
||||
// Get Middleware By Name
|
||||
// ----------------------------
|
||||
export function getMiddlewareByNameRequest (state) {
|
||||
state.middlewareByName.loading = true
|
||||
}
|
||||
|
||||
export function getMiddlewareByNameSuccess (state, body) {
|
||||
state.middlewareByName = { item: body, loading: false }
|
||||
}
|
||||
|
||||
export function getMiddlewareByNameFailure (state, error) {
|
||||
state.middlewareByName = { error }
|
||||
}
|
||||
|
||||
export function getMiddlewareByNameClear (state) {
|
||||
state.middlewareByName = {}
|
||||
}
|
8
webui/src/store/http/state.js
Normal file
8
webui/src/store/http/state.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
export default {
|
||||
allRouters: {},
|
||||
routerByName: {},
|
||||
allServices: {},
|
||||
serviceByName: {},
|
||||
allMiddlewares: {},
|
||||
middlewareByName: {}
|
||||
}
|
|
@ -3,6 +3,8 @@ import Vuex from 'vuex'
|
|||
|
||||
import core from './core'
|
||||
import entrypoints from './entrypoints'
|
||||
import http from './http'
|
||||
import tcp from './tcp'
|
||||
|
||||
Vue.use(Vuex)
|
||||
|
||||
|
@ -15,7 +17,9 @@ export default function (/* { ssrContext } */) {
|
|||
const Store = new Vuex.Store({
|
||||
modules: {
|
||||
core,
|
||||
entrypoints
|
||||
entrypoints,
|
||||
http,
|
||||
tcp
|
||||
},
|
||||
|
||||
// enable strict mode (adds overhead!)
|
||||
|
|
53
webui/src/store/tcp/actions.js
Normal file
53
webui/src/store/tcp/actions.js
Normal file
|
@ -0,0 +1,53 @@
|
|||
import TcpService from '../../_services/TcpService'
|
||||
|
||||
export function getAllRouters ({ commit }, params) {
|
||||
commit('getAllRoutersRequest')
|
||||
return TcpService.getAllRouters(params)
|
||||
.then(body => {
|
||||
commit('getAllRoutersSuccess', body)
|
||||
return body
|
||||
})
|
||||
.catch(error => {
|
||||
commit('getAllRoutersFailure', error)
|
||||
return Promise.reject(error)
|
||||
})
|
||||
}
|
||||
|
||||
export function getRouterByName ({ commit }, name) {
|
||||
commit('getRouterByNameRequest')
|
||||
return TcpService.getRouterByName(name)
|
||||
.then(body => {
|
||||
commit('getRouterByNameSuccess', body)
|
||||
return body
|
||||
})
|
||||
.catch(error => {
|
||||
commit('getRouterByNameFailure', error)
|
||||
return Promise.reject(error)
|
||||
})
|
||||
}
|
||||
|
||||
export function getAllServices ({ commit }, params) {
|
||||
commit('getAllServicesRequest')
|
||||
return TcpService.getAllServices(params)
|
||||
.then(body => {
|
||||
commit('getAllServicesSuccess', body)
|
||||
return body
|
||||
})
|
||||
.catch(error => {
|
||||
commit('getAllServicesFailure', error)
|
||||
return Promise.reject(error)
|
||||
})
|
||||
}
|
||||
|
||||
export function getServiceByName ({ commit }, name) {
|
||||
commit('getServiceByNameRequest')
|
||||
return TcpService.getServiceByName(name)
|
||||
.then(body => {
|
||||
commit('getServiceByNameSuccess', body)
|
||||
return body
|
||||
})
|
||||
.catch(error => {
|
||||
commit('getServiceByNameFailure', error)
|
||||
return Promise.reject(error)
|
||||
})
|
||||
}
|
27
webui/src/store/tcp/getters.js
Normal file
27
webui/src/store/tcp/getters.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
// ----------------------------
|
||||
// all Routers
|
||||
// ----------------------------
|
||||
export function allRouters (state) {
|
||||
return state.allRouters
|
||||
}
|
||||
|
||||
// ----------------------------
|
||||
// Router by Name
|
||||
// ----------------------------
|
||||
export function routerByName (state) {
|
||||
return state.routerByName
|
||||
}
|
||||
|
||||
// ----------------------------
|
||||
// all Services
|
||||
// ----------------------------
|
||||
export function allServices (state) {
|
||||
return state.allServices
|
||||
}
|
||||
|
||||
// ----------------------------
|
||||
// Service by Name
|
||||
// ----------------------------
|
||||
export function serviceByName (state) {
|
||||
return state.serviceByName
|
||||
}
|
12
webui/src/store/tcp/index.js
Normal file
12
webui/src/store/tcp/index.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
import state from './state'
|
||||
import * as getters from './getters'
|
||||
import * as mutations from './mutations'
|
||||
import * as actions from './actions'
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
getters,
|
||||
mutations,
|
||||
actions,
|
||||
state
|
||||
}
|
75
webui/src/store/tcp/mutations.js
Normal file
75
webui/src/store/tcp/mutations.js
Normal file
|
@ -0,0 +1,75 @@
|
|||
// ----------------------------
|
||||
// Get All Routers
|
||||
// ----------------------------
|
||||
export function getAllRoutersRequest (state) {
|
||||
state.allRouters.loading = true
|
||||
}
|
||||
|
||||
export function getAllRoutersSuccess (state, body) {
|
||||
state.allRouters = { items: body.data, total: body.total, loading: false }
|
||||
}
|
||||
|
||||
export function getAllRoutersFailure (state, error) {
|
||||
state.allRouters = { error }
|
||||
}
|
||||
|
||||
export function getAllRoutersClear (state) {
|
||||
state.allRouters = {}
|
||||
}
|
||||
|
||||
// ----------------------------
|
||||
// Get Router By Name
|
||||
// ----------------------------
|
||||
export function getRouterByNameRequest (state) {
|
||||
state.routerByName.loading = true
|
||||
}
|
||||
|
||||
export function getRouterByNameSuccess (state, body) {
|
||||
state.routerByName = { item: body, loading: false }
|
||||
}
|
||||
|
||||
export function getRouterByNameFailure (state, error) {
|
||||
state.routerByName = { error }
|
||||
}
|
||||
|
||||
export function getRouterByNameClear (state) {
|
||||
state.routerByName = {}
|
||||
}
|
||||
|
||||
// ----------------------------
|
||||
// Get All Services
|
||||
// ----------------------------
|
||||
export function getAllServicesRequest (state) {
|
||||
state.allServices.loading = true
|
||||
}
|
||||
|
||||
export function getAllServicesSuccess (state, body) {
|
||||
state.allServices = { items: body.data, total: body.total, loading: false }
|
||||
}
|
||||
|
||||
export function getAllServicesFailure (state, error) {
|
||||
state.allServices = { error }
|
||||
}
|
||||
|
||||
export function getAllServicesClear (state) {
|
||||
state.allServices = {}
|
||||
}
|
||||
|
||||
// ----------------------------
|
||||
// Get Service By Name
|
||||
// ----------------------------
|
||||
export function getServiceByNameRequest (state) {
|
||||
state.serviceByName.loading = true
|
||||
}
|
||||
|
||||
export function getServiceByNameSuccess (state, body) {
|
||||
state.serviceByName = { item: body, loading: false }
|
||||
}
|
||||
|
||||
export function getServiceByNameFailure (state, error) {
|
||||
state.serviceByName = { error }
|
||||
}
|
||||
|
||||
export function getServiceByNameClear (state) {
|
||||
state.serviceByName = {}
|
||||
}
|
6
webui/src/store/tcp/state.js
Normal file
6
webui/src/store/tcp/state.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
export default {
|
||||
allRouters: {},
|
||||
routerByName: {},
|
||||
allServices: {},
|
||||
serviceByName: {}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue