From 210f76b5ea85571bd4047ec74e5fb5ef7585fe56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=99=AF=E9=98=B3?= <1656488874@qq.com> Date: Tue, 7 Jan 2020 01:32:11 +0800 Subject: [PATCH 1/5] =?UTF-8?q?fix=20=E5=89=8D=E7=AB=AF=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/conf/config.yml | 2 +- backend/routes/system.go | 1 + backend/services/system.go | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/conf/config.yml b/backend/conf/config.yml index 9fb0dee5..6f8652f8 100644 --- a/backend/conf/config.yml +++ b/backend/conf/config.yml @@ -34,7 +34,7 @@ spider: task: workers: 4 other: - tmppath: "/tmp" + tmppath: "./tmp" version: 0.4.3 setting: allowRegister: "N" diff --git a/backend/routes/system.go b/backend/routes/system.go index b4e130a9..8c443d2a 100644 --- a/backend/routes/system.go +++ b/backend/routes/system.go @@ -259,6 +259,7 @@ func GetDepJson(c *gin.Context) { _dep, err := services.FetchPythonDepInfo(depName) if err != nil { HandleError(http.StatusInternalServerError, c, err) + return } dep = _dep } else { diff --git a/backend/services/system.go b/backend/services/system.go index 12b8744c..6181afee 100644 --- a/backend/services/system.go +++ b/backend/services/system.go @@ -251,6 +251,9 @@ func FetchPythonDepInfo(depName string) (entity.Dependency, error) { return entity.Dependency{}, err } var data PythonDepJsonData + if res.Response().StatusCode == 404 { + return entity.Dependency{}, errors.New("get depName from [https://pypi.org] error: 404") + } if err := res.ToJSON(&data); err != nil { log.Errorf(err.Error()) debug.PrintStack() From 3a81a241aa268659b2586be376909459bec68dc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=99=AF=E9=98=B3?= <1656488874@qq.com> Date: Tue, 7 Jan 2020 01:32:22 +0800 Subject: [PATCH 2/5] =?UTF-8?q?fix=20=E5=89=8D=E7=AB=AF=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/Node/NodeInstallation.vue | 14 ++++++++------ frontend/src/views/layout/components/Navbar.vue | 1 + frontend/src/views/node/NodeDetail.vue | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/Node/NodeInstallation.vue b/frontend/src/components/Node/NodeInstallation.vue index 3924cd76..1ec9894a 100644 --- a/frontend/src/components/Node/NodeInstallation.vue +++ b/frontend/src/components/Node/NodeInstallation.vue @@ -2,7 +2,7 @@
- + > - { - const res = await this.$request.get(`/system/deps/${this.activeLang.executable_name}/${dep.name}/json`) - dep.version = res.data.data.version - dep.description = res.data.data.description + const resp = await this.$request.get(`/system/deps/${this.activeLang.executable_name}/${dep.name}/json`) + if (resp) { + dep.version = resp.data.data.version + dep.description = resp.data.data.description + } }) } }, diff --git a/frontend/src/views/layout/components/Navbar.vue b/frontend/src/views/layout/components/Navbar.vue index 882fbfa7..caabc338 100644 --- a/frontend/src/views/layout/components/Navbar.vue +++ b/frontend/src/views/layout/components/Navbar.vue @@ -44,6 +44,7 @@ :aria-label="$t('Star crawlab-team/crawlab on GitHub')"> Star +
diff --git a/frontend/src/views/node/NodeDetail.vue b/frontend/src/views/node/NodeDetail.vue index dca3d818..4dab386b 100644 --- a/frontend/src/views/node/NodeDetail.vue +++ b/frontend/src/views/node/NodeDetail.vue @@ -3,7 +3,7 @@
- +
From be98fecfca51336433a73a56293249836caa3201 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=99=AF=E9=98=B3?= <1656488874@qq.com> Date: Tue, 7 Jan 2020 01:54:49 +0800 Subject: [PATCH 3/5] =?UTF-8?q?fix=20=E6=8E=A7=E5=88=B6=E5=8F=B0=E5=A4=A7?= =?UTF-8?q?=E9=87=8F=E5=91=8A=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/InfoView/SpiderInfoView.vue | 6 +----- frontend/src/components/Stats/SpiderStats.vue | 8 ++++---- frontend/src/i18n/zh.js | 1 + frontend/src/store/modules/schedule.js | 14 ++++++++------ 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/frontend/src/components/InfoView/SpiderInfoView.vue b/frontend/src/components/InfoView/SpiderInfoView.vue index 74e48d08..93fa9c12 100644 --- a/frontend/src/components/InfoView/SpiderInfoView.vue +++ b/frontend/src/components/InfoView/SpiderInfoView.vue @@ -51,7 +51,7 @@ - {{$t('Run')}} @@ -69,10 +69,6 @@ {{$t('Upload')}} - - {{$t('Run')}} - {{$t('Save')}} diff --git a/frontend/src/components/Stats/SpiderStats.vue b/frontend/src/components/Stats/SpiderStats.vue index f239f823..f7993e2b 100644 --- a/frontend/src/components/Stats/SpiderStats.vue +++ b/frontend/src/components/Stats/SpiderStats.vue @@ -3,19 +3,19 @@
- - - - diff --git a/frontend/src/i18n/zh.js b/frontend/src/i18n/zh.js index b15efd50..e739b979 100644 --- a/frontend/src/i18n/zh.js +++ b/frontend/src/i18n/zh.js @@ -225,6 +225,7 @@ export default { 'Not Found Spider': '爬虫配置错误', '[minute] [hour] [day] [month] [day of week]': '[分] [时] [天] [月] [星期几]', 'Enable/Disable': '启用/禁用', + 'Cron': 'Cron', // 网站 'Site': '网站', diff --git a/frontend/src/store/modules/schedule.js b/frontend/src/store/modules/schedule.js index 9fde4e84..9e60169c 100644 --- a/frontend/src/store/modules/schedule.js +++ b/frontend/src/store/modules/schedule.js @@ -21,12 +21,14 @@ const actions = { getScheduleList ({ state, commit }) { request.get('/schedules') .then(response => { - commit('SET_SCHEDULE_LIST', response.data.data.map(d => { - const arr = d.cron.split(' ') - arr.splice(0, 1) - d.cron = arr.join(' ') - return d - })) + if (response.data.data) { + commit('SET_SCHEDULE_LIST', response.data.data.map(d => { + const arr = d.cron.split(' ') + arr.splice(0, 1) + d.cron = arr.join(' ') + return d + })) + } }) }, addSchedule ({ state }) { From 7f264fe67e6c7fbb69f97de5fb1670087a631629 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=99=AF=E9=98=B3?= <1656488874@qq.com> Date: Tue, 7 Jan 2020 02:07:52 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E8=BF=98=E5=8E=9Fconfig.yaml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/conf/config.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/backend/conf/config.yml b/backend/conf/config.yml index 6f8652f8..a51a34c9 100644 --- a/backend/conf/config.yml +++ b/backend/conf/config.yml @@ -1,25 +1,25 @@ api: address: "localhost:8000" mongo: - host: "192.168.235.26" + host: localhost port: 27017 - db: crawlab_local - username: "root" - password: "example" + db: crawlab_test + username: "" + password: "" authSource: "admin" redis: - address: 127.0.0.1 - password: + address: localhost + password: "" database: 1 port: 6379 log: level: info - path: "./logs/crawlab" + path: "/var/logs/crawlab" isDeletePeriodically: "N" deleteFrequency: "@hourly" server: host: 0.0.0.0 - port: 8001 + port: 8000 master: "Y" secret: "crawlab" register: @@ -30,11 +30,11 @@ server: python: "Y" node: "N" spider: - path: "./spiders" + path: "/app/spiders" task: workers: 4 other: - tmppath: "./tmp" + tmppath: "/tmp" version: 0.4.3 setting: - allowRegister: "N" + allowRegister: "N" \ No newline at end of file From c4ed90733bd961f3cf7d0d4487c4efec17d78c5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=99=AF=E9=98=B3?= <1656488874@qq.com> Date: Tue, 7 Jan 2020 02:08:41 +0800 Subject: [PATCH 5/5] =?UTF-8?q?fix=20UI=E9=94=99=E8=AF=AF=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/layout/components/Navbar.vue | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/frontend/src/views/layout/components/Navbar.vue b/frontend/src/views/layout/components/Navbar.vue index caabc338..f47380c8 100644 --- a/frontend/src/views/layout/components/Navbar.vue +++ b/frontend/src/views/layout/components/Navbar.vue @@ -27,14 +27,13 @@ - + +
Star - - +
@@ -130,7 +128,8 @@ export default { .documentation { margin-right: 35px; - + color: #606266; + font-size: 14px; .span { margin-left: 5px; }