added chromedriver

This commit is contained in:
marvzhang
2020-07-30 12:02:11 +08:00
parent b08fcc77da
commit 375d7a96da
6 changed files with 157 additions and 11 deletions

View File

@@ -72,7 +72,11 @@
<i class="el-icon-error" />
{{ $t('Not Installed') }}
</el-tag>
<el-button type="primary" size="mini" @click="onInstallLang(scope.row._id, scope.column.label, $event)">
<el-button
type="primary"
size="mini"
@click="onInstallLang(scope.row._id, scope.column.label, $event)"
>
{{ $t('Install') }}
</el-button>
</div>
@@ -203,6 +207,97 @@
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="Web Driver" name="webdriver">
<div class="webdriver-table">
<el-table
class="table"
:data="nodeList"
:header-cell-style="{background:'rgb(48, 65, 86)',color:'white',height:'50px'}"
border
@row-click="onLangTableRowClick"
>
<el-table-column
:label="$t('Node')"
width="240px"
prop="name"
fixed
/>
<el-table-column
:label="$t('nodeList.type')"
width="120px"
fixed
>
<template slot-scope="scope">
<el-tag v-if="scope.row.is_master" type="primary">{{ $t('Master') }}</el-tag>
<el-tag v-else type="warning">{{ $t('Worker') }}</el-tag>
</template>
</el-table-column>
<el-table-column
:label="$t('Status')"
width="120px"
fixed
>
<template slot-scope="scope">
<el-tag v-if="scope.row.status === 'offline'" type="info">{{ $t('Offline') }}</el-tag>
<el-tag v-else-if="scope.row.status === 'online'" type="success">{{ $t('Online') }}</el-tag>
<el-tag v-else type="danger">{{ $t('Unavailable') }}</el-tag>
</template>
</el-table-column>
<el-table-column
v-for="wd in webdrivers"
:key="wd.name"
:label="wd.label"
width="220px"
>
<template slot="header" slot-scope="scope">
<div class="header-with-action">
<span>{{ scope.column.label }}</span>
<el-button type="primary" size="mini" @click="onInstallLangAll(scope.column.label, $event)">
{{ $t('Install') }}
</el-button>
</div>
</template>
<template slot-scope="scope">
<template v-if="getLangInstallStatus(scope.row._id, wd.name) === 'installed'">
<el-tag type="success">
<i class="el-icon-check" />
{{ $t('Installed') }}
</el-tag>
</template>
<template v-else-if="getLangInstallStatus(scope.row._id, wd.name) === 'installing'">
<el-tag type="warning">
<i class="el-icon-loading" />
{{ $t('Installing') }}
</el-tag>
</template>
<template
v-else-if="['installing-other', 'not-installed'].includes(getLangInstallStatus(scope.row._id, wd.name))"
>
<div class="cell-with-action">
<el-tag type="danger">
<i class="el-icon-error" />
{{ $t('Not Installed') }}
</el-tag>
<el-button
type="primary"
size="mini"
@click="onInstallLang(scope.row._id, scope.column.label, $event)"
>
{{ $t('Install') }}
</el-button>
</div>
</template>
<template v-else-if="getLangInstallStatus(scope.row._id, wd.name) === 'na'">
<el-tag type="info">
<i class="el-icon-question" />
{{ $t('N/A') }}
</el-tag>
</template>
</template>
</el-table-column>
</el-table>
</div>
</el-tab-pane>
</el-tabs>
</div>
</template>
@@ -220,13 +315,16 @@
},
data() {
return {
langs: [
{ label: 'Python', name: 'python', hasDeps: true },
{ label: 'Node.js', name: 'node', hasDeps: true },
{ label: 'Java', name: 'java', hasDeps: false },
{ label: '.Net Core', name: 'dotnet', hasDeps: false },
{ label: 'PHP', name: 'php', hasDeps: false },
{ label: 'Golang', name: 'go', hasDeps: false }
allLangs: [
// 语言
{ label: 'Python', name: 'python', hasDeps: true, type: 'lang' },
{ label: 'Node.js', name: 'node', hasDeps: true, type: 'lang' },
{ label: 'Java', name: 'java', hasDeps: false, type: 'lang' },
{ label: '.Net Core', name: 'dotnet', hasDeps: false, type: 'lang' },
{ label: 'PHP', name: 'php', hasDeps: false, type: 'lang' },
{ label: 'Golang', name: 'go', hasDeps: false, type: 'lang' },
// web driver
{ label: 'Chrome Driver', name: 'chromedriver', type: 'webdriver' }
],
langsDataDict: {},
handle: undefined,
@@ -244,6 +342,12 @@
...mapState('node', [
'nodeList'
]),
langs() {
return this.allLangs.filter(d => d.type === 'lang')
},
webdrivers() {
return this.allLangs.filter(d => d.type === 'webdriver')
},
activeNodes() {
return this.nodeList.filter(d => d.status === 'online')
},
@@ -255,7 +359,7 @@
})
},
langsWithDeps() {
return this.langs.filter(l => l.hasDeps)
return this.allLangs.filter(l => l.hasDeps)
}
},
watch: {
@@ -316,8 +420,8 @@
return lang.install_status
},
getLangFromLabel(label) {
for (let i = 0; i < this.langs.length; i++) {
const lang = this.langs[i]
for (let i = 0; i < this.allLangs.length; i++) {
const lang = this.allLangs[i]
if (lang.label === label) {
return lang
}