Merge pull request #503 from crawlab-team/develop

Develop
This commit is contained in:
Marvin Zhang
2020-02-03 11:38:54 +08:00
committed by GitHub
4 changed files with 43 additions and 19 deletions

View File

@@ -6,6 +6,7 @@
- **示例爬虫**. 当初始化时,自动加入示例爬虫. [#379](https://github.com/crawlab-team/crawlab/issues/379)
- **用户管理优化**. 限制管理用户的权限. [#456](https://github.com/crawlab-team/crawlab/issues/456)
- **设置页面优化**.
- **任务结果页面优化**.
### Bug 修复
- **无法找到爬虫文件错误**. [#485](https://github.com/crawlab-team/crawlab/issues/485)
@@ -14,6 +15,7 @@
- **下载结果错误**. [#465](https://github.com/crawlab-team/crawlab/issues/465)
- **crawlab-sdk CLI 错误**. [#458](https://github.com/crawlab-team/crawlab/issues/458)
- **页面刷新问题**. [#441](https://github.com/crawlab-team/crawlab/issues/441)
- **结果不支持 JSON**. [#202](https://github.com/crawlab-team/crawlab/issues/202)
- **修复“删除爬虫后获取所有爬虫”错误**.
- **修复 i18n 警告**.

View File

@@ -6,6 +6,7 @@
- **Demo Spiders**. Added demo spiders when Crawlab is initialized. [#379](https://github.com/crawlab-team/crawlab/issues/379)
- **User Admin Optimization**. Restrict privilleges of admin users. [#456](https://github.com/crawlab-team/crawlab/issues/456)
- **Setting Page Optimization**.
- **Task Results Optimization**.
### Bug Fixes
- **Unable to find spider file error**. [#485](https://github.com/crawlab-team/crawlab/issues/485)
@@ -14,6 +15,7 @@
- **Download results error**. [#465](https://github.com/crawlab-team/crawlab/issues/465)
- **crawlab-sdk CLI error**. [#458](https://github.com/crawlab-team/crawlab/issues/458)
- **Page refresh issue**. [#441](https://github.com/crawlab-team/crawlab/issues/441)
- **Results not support JSON**. [#202](https://github.com/crawlab-team/crawlab/issues/202)
- **Getting all spider after deleting a spider**.
- **i18n warning**.

View File

@@ -2,9 +2,9 @@ package utils
import (
"crawlab/constants"
"encoding/json"
"github.com/globalsign/mgo/bson"
"strconv"
"time"
"strings"
)
func IsObjectIdNull(id bson.ObjectId) bool {
@@ -12,16 +12,13 @@ func IsObjectIdNull(id bson.ObjectId) bool {
}
func InterfaceToString(value interface{}) string {
switch realValue := value.(type) {
case bson.ObjectId:
return realValue.Hex()
case string:
return realValue
case int:
return strconv.Itoa(realValue)
case time.Time:
return realValue.String()
default:
bytes, err := json.Marshal(value)
if err != nil {
return ""
}
str := string(bytes)
if strings.HasPrefix(str, "\"") && strings.HasSuffix(str, "\"") {
str = str[1 : len(str)-1]
}
return str
}

View File

@@ -6,6 +6,13 @@
border>
<template v-for="col in columns">
<el-table-column :key="col" :label="col" :property="col" min-width="120">
<template slot-scope="scope">
<el-popover trigger="hover" :content="getString(scope.row[col])" popper-class="cell-popover">
<div slot="reference" class="wrapper">
{{getString(scope.row[col])}}
</div>
</el-popover>
</template>
</el-table-column>
</template>
</el-table>
@@ -58,23 +65,39 @@ export default {
computed: {
filteredData () {
return this.data
// .map(d => d)
// .filter((d, index) => {
// // pagination
// const pageNum = this.pageNum
// const pageSize = this.pageSize
// return (pageSize * (pageNum - 1) <= index) && (index < pageSize * pageNum)
// })
}
},
methods: {
onPageChange () {
this.$emit('page-change', { pageNum: this.pageNum, pageSize: this.pageSize })
},
getString (value) {
if (value === undefined) return ''
const str = JSON.stringify(value)
if (str.match(/^"(.*)"$/)) return str.match(/^"(.*)"$/)[1]
return str
}
}
}
</script>
<style scoped>
.general-table-view >>> .cell .wrapper:hover {
text-decoration: underline;
}
.general-table-view >>> .cell .wrapper {
font-size: 12px;
height: 24px;
line-height: 24px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
</style>
<style>
.cell-popover {
max-width: 480px;
}
</style>