From 8f547b7e8d8a7961fa6cee007ab47d4555955f6d Mon Sep 17 00:00:00 2001 From: ouqiang Date: Tue, 26 Jun 2018 20:23:14 +0800 Subject: [PATCH] =?UTF-8?q?bugfix#=E4=BB=BB=E5=8A=A1=E5=88=97=E8=A1=A8-?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E6=95=B0=E9=87=8F=E5=8F=AA=E8=83=BD=E6=98=BE?= =?UTF-8?q?=E7=A4=BA20=E4=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/routers/routers.go | 1 + web/vue/src/api/host.js | 4 ++++ web/vue/src/api/task.js | 4 ++-- web/vue/src/pages/task/edit.vue | 2 +- web/vue/src/pages/task/list.vue | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) 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() }