Merge pull request #430 from wo10378931/develop

Develop
This commit is contained in:
Marvin Zhang
2020-01-07 08:22:06 +08:00
committed by GitHub
10 changed files with 43 additions and 38 deletions

View File

@@ -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"
version: 0.4.3
setting:
allowRegister: "N"
allowRegister: "N"

View File

@@ -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 {

View File

@@ -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()

View File

@@ -51,7 +51,7 @@
</el-form>
</el-row>
<el-row class="button-container" v-if="!isView">
<el-button size="normal" v-if="isShowRun" type="danger" @click="onCrawl"
<el-button size="small" v-if="isShowRun" type="danger" @click="onCrawl"
icon="el-icon-video-play" style="margin-right: 10px">
{{$t('Run')}}
</el-button>
@@ -69,10 +69,6 @@
{{$t('Upload')}}
</el-button>
</el-upload>
<el-button size="small" v-if="isShowRun" type="danger" @click="onCrawl"
icon="el-icon-video-play">
{{$t('Run')}}
</el-button>
<el-button size="small" type="success" @click="onSave" icon="el-icon-check">
{{$t('Save')}}
</el-button>

View File

@@ -2,7 +2,7 @@
<div class="node-installation">
<el-form inline>
<el-form-item>
<el-autocomplete
<el-autocomplete size="small" clearable @clear="onSearch"
v-if="activeLang.executable_name === 'python'"
v-model="depName"
style="width: 240px"
@@ -10,7 +10,7 @@
:fetchSuggestions="fetchAllDepList"
:minlength="2"
@select="onSearch"
/>
></el-autocomplete>
<el-input
v-else
v-model="depName"
@@ -19,7 +19,7 @@
/>
</el-form-item>
<el-form-item>
<el-button
<el-button size="small"
icon="el-icon-search"
type="success"
@click="onSearch"
@@ -161,9 +161,11 @@ export default {
// 异步获取python附加信息
this.depList.map(async dep => {
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
}
})
}
},

View File

@@ -3,19 +3,19 @@
<!--overall stats-->
<el-row>
<div class="metric-list">
<metric-card :label="$t('30-Day Tasks')"
<metric-card label="30-Day Tasks"
icon="fa fa-play"
:value="overviewStats.task_count"
type="danger"/>
<metric-card :label="$t('30-Day Results')"
<metric-card label="30-Day Results"
icon="fa fa-table"
:value="overviewStats.result_count"
type="primary"/>
<metric-card :label="$t('Success Rate')"
<metric-card label="Success Rate"
icon="fa fa-check"
:value="getPercentStr(overviewStats.success_rate)"
type="success"/>
<metric-card :label="$t('Avg Duration (sec)')"
<metric-card label="Avg Duration (sec)"
icon="fa fa-hourglass"
:value="getDecimal(overviewStats.avg_runtime_duration)"
type="warning"/>

View File

@@ -225,6 +225,7 @@ export default {
'Not Found Spider': '爬虫配置错误',
'[minute] [hour] [day] [month] [day of week]': '[分] [时] [天] [月] [星期几]',
'Enable/Disable': '启用/禁用',
'Cron': 'Cron',
// 网站
'Site': '网站',

View File

@@ -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 }) {

View File

@@ -27,14 +27,13 @@
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-dropdown class="documentation right">
<div class="documentation right">
<a href="http://docs.crawlab.cn" target="_blank">
<font-awesome-icon :icon="['far', 'question-circle']"/>
<span style="margin-left: 5px;">{{$t('Documentation')}}</span>
</a>
<el-dropdown-menu slot="dropdown"></el-dropdown-menu>
</el-dropdown>
<el-dropdown class="github right">
</div>
<div class="github right">
<!-- Place this tag where you want the button to render. -->
<github-button
href="https://github.com/crawlab-team/crawlab"
@@ -44,7 +43,7 @@
:aria-label="$t('Star crawlab-team/crawlab on GitHub')">
Star
</github-button>
</el-dropdown>
</div>
</div>
</template>
@@ -129,7 +128,8 @@ export default {
.documentation {
margin-right: 35px;
color: #606266;
font-size: 14px;
.span {
margin-left: 5px;
}

View File

@@ -3,7 +3,7 @@
<!--selector-->
<div class="selector">
<label class="label">{{$t('Node')}}: </label>
<el-select v-model="nodeForm._id" @change="onNodeChange">
<el-select size="small" v-model="nodeForm._id" @change="onNodeChange">
<el-option v-for="op in nodeList" :key="op._id" :value="op._id" :label="op.name"></el-option>
</el-select>
</div>