Merge remote-tracking branch 'upstream/develop' into upstream-develop

# Conflicts:
#	backend/main.go
#	frontend/.env.development
This commit is contained in:
陈景阳
2020-01-28 15:51:09 +08:00
22 changed files with 305 additions and 88 deletions

View File

@@ -47,17 +47,16 @@ export default {
},
isCollapse () {
return !this.sidebar.opened
},
version () {
return this.$store.state.version.version || window.sessionStorage.getItem('v')
}
},
data () {
return {
version: ''
}
},
async created () {
const res = await this.$request.get('/version')
this.version = res.data.data
sessionStorage.setItem('v', this.version)
}
}
</script>

View File

@@ -1,26 +1,31 @@
<template>
<div class="app-container">
<!--filter-->
<div v-if="false" class="filter">
<el-input prefix-icon="el-icon-search"
:placeholder="$t('Search')"
class="filter-search"
v-model="filter.keyword"
@change="onSearch">
</el-input>
<div class="right">
<el-button type="success"
icon="el-icon-refresh"
class="refresh"
@click="onRefresh">
{{$t('Refresh')}}
</el-button>
<el-dialog
:visible.sync="isShowAddNodeInstruction"
:title="$t('Notification')"
width="720px"
>
<div
v-html="addNodeInstructionHtml"
class="content markdown-body"
>
</div>
</div>
<!--./filter-->
</el-dialog>
<el-tabs type="border-card" v-model="activeTab">
<el-tab-pane :label="$t('Node List')">
<!--filter-->
<div class="filter-wrapper">
<el-button
size="small"
type="success"
icon="el-icon-plus"
@click="onAddNode"
>
{{$t('Add Node')}}
</el-button>
</div>
<!--./filter-->
<!--table list-->
<el-table :data="filteredTableData"
class="table"
@@ -115,7 +120,8 @@
<el-button type="primary" icon="el-icon-search" size="mini" @click="onView(scope.row)"></el-button>
</el-tooltip>
<el-tooltip :content="$t('Remove')" placement="top">
<el-button v-if="scope.row.status !== 'online'" type="danger" icon="el-icon-delete" size="mini" @click="onRemove(scope.row)"></el-button>
<el-button v-if="scope.row.status !== 'online'" type="danger" icon="el-icon-delete" size="mini"
@click="onRemove(scope.row)"></el-button>
</el-tooltip>
</template>
</el-table-column>
@@ -141,9 +147,11 @@
</template>
<script>
import showdown from 'showdown'
import {
mapState
} from 'vuex'
import 'github-markdown-css/github-markdown.css'
import NodeNetwork from '../../components/Node/NodeNetwork'
export default {
@@ -172,7 +180,11 @@ export default {
nodeFormRules: {
name: [{ required: true, message: 'Required Field', trigger: 'change' }]
},
activeTab: undefined
activeTab: undefined,
isButtonClicked: false,
isShowAddNodeInstruction: false,
converter: new showdown.Converter(),
addNodeInstructionMarkdown: 'addNodeInstruction'
}
},
computed: {
@@ -191,16 +203,23 @@ export default {
}
return false
})
},
addNodeInstructionHtml () {
if (!this.converter) return
return this.converter.makeHtml(this.$t(this.addNodeInstructionMarkdown))
}
},
methods: {
onSearch () {
},
onAdd () {
this.$store.commit('node/SET_NODE_FORM', [])
this.isEditMode = false
this.dialogVisible = true
onAddNode () {
this.isShowAddNodeInstruction = true
},
// onAdd () {
// this.$store.commit('node/SET_NODE_FORM', [])
// this.isEditMode = false
// this.dialogVisible = true
// },
onRefresh () {
this.$store.dispatch('node/getNodeList')
this.$st.sendEv('节点列表', '刷新')
@@ -235,6 +254,11 @@ export default {
this.dialogVisible = true
},
onRemove (row) {
this.isButtonClicked = true
setTimeout(() => {
this.isButtonClicked = false
}, 100)
this.$confirm(this.$t('Are you sure to delete this node?'), this.$t('Notification'), {
confirmButtonText: this.$t('Confirm'),
cancelButtonText: this.$t('Cancel'),
@@ -251,6 +275,11 @@ export default {
})
},
onView (row) {
this.isButtonClicked = true
setTimeout(() => {
this.isButtonClicked = false
}, 100)
this.$router.push(`/nodes/${row._id}`)
this.$st.sendEv('节点列表', '查看节点')
@@ -262,6 +291,7 @@ export default {
this.$store.dispatch('node/getNodeSystemInfo', row._id)
},
onRowClick (row) {
if (this.isButtonClicked) return
this.onView(row)
},
getExecutables (row) {
@@ -312,6 +342,13 @@ export default {
padding: 7px;
}
.filter-wrapper {
text-align: right;
}
.content {
word-break: break-word;
}
</style>
<style>
.node-detail .el-form-item {

View File

@@ -118,9 +118,9 @@ export default {
await this.$store.dispatch('spider/getSpiderList')
// if spider is configurable spider, set to config tab by default
if (this.spiderForm.type === 'configurable') {
this.activeTabName = 'config'
}
// if (this.spiderForm.type === 'configurable') {
// this.activeTabName = 'config'
// }
}
}
</script>