1
0
Fork 0

Add more pages in the WebUI

This commit is contained in:
Jorge Gonzalez 2019-09-10 14:40:05 +02:00 committed by Traefiker Bot
parent 2b828765e3
commit fcc1109e76
82 changed files with 5005 additions and 249 deletions

View 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)
})
}

View 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
}

View 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
}

View 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 = {}
}

View file

@ -0,0 +1,6 @@
export default {
allRouters: {},
routerByName: {},
allServices: {},
serviceByName: {}
}