diff --git a/internal/routers/routers.go b/internal/routers/routers.go index 6a31ef3..ba75529 100644 --- a/internal/routers/routers.go +++ b/internal/routers/routers.go @@ -99,6 +99,7 @@ func Register(m *macaron.Macaron) { m.Get("/:id", host.Detail) m.Post("/store", binding.Bind(host.HostForm{}), host.Store) m.Get("", host.Index) + m.Get("/all", host.All) m.Get("/ping/:id", host.Ping) m.Post("/remove/:id", host.Remove) }) diff --git a/web/vue/src/api/host.js b/web/vue/src/api/host.js index a58f20b..eaa9842 100644 --- a/web/vue/src/api/host.js +++ b/web/vue/src/api/host.js @@ -6,6 +6,10 @@ export default { httpClient.get('/host', query, callback) }, + all (query, callback) { + httpClient.get('/host/all', {}, callback) + }, + detail (id, callback) { httpClient.get(`/host/${id}`, {}, callback) }, diff --git a/web/vue/src/api/task.js b/web/vue/src/api/task.js index c950bee..3bc4272 100644 --- a/web/vue/src/api/task.js +++ b/web/vue/src/api/task.js @@ -9,7 +9,7 @@ export default { params: query }, { - uri: '/host' + uri: '/host/all' } ], callback) }, @@ -20,7 +20,7 @@ export default { uri: `/task/${id}` }, { - uri: '/host' + uri: '/host/all' } ], callback) }, diff --git a/web/vue/src/pages/task/edit.vue b/web/vue/src/pages/task/edit.vue index 0d8c5d6..7a2834a 100644 --- a/web/vue/src/pages/task/edit.vue +++ b/web/vue/src/pages/task/edit.vue @@ -416,7 +416,7 @@ export default { this.cancel() return } - this.hosts = hosts.data || [] + this.hosts = hosts || [] if (!taskData) { return } diff --git a/web/vue/src/pages/task/list.vue b/web/vue/src/pages/task/list.vue index 658d9ba..81174a0 100644 --- a/web/vue/src/pages/task/list.vue +++ b/web/vue/src/pages/task/list.vue @@ -287,7 +287,7 @@ export default { taskService.list(this.searchParams, (tasks, hosts) => { this.tasks = tasks.data this.taskTotal = tasks.total - this.hosts = hosts.data + this.hosts = hosts if (callback) { callback() }