-
-
+
-
+
{{$t('Search')}}
+
+
+
+ :label="$t('Action')"
+ >
+
+
+ {{scope.row.installed ? $t('Uninstall') : $t('Install')}}
+
+
+
@@ -65,7 +84,9 @@ export default {
langList: [],
depName: '',
depList: [],
- loading: false
+ loading: false,
+ isShowInstalled: false,
+ installedDepList: []
}
},
computed: {
@@ -79,15 +100,53 @@ export default {
}
}
return {}
+ },
+ computedDepList () {
+ if (this.isShowInstalled) {
+ return this.installedDepList
+ } else {
+ return this.depList
+ }
}
},
methods: {
async getDepList () {
+ this.loading = true
const res = await this.$request.get(`/nodes/${this.nodeForm._id}/deps`, {
lang: this.activeLang.executable_name,
dep_name: this.depName
})
- this.depList = res.data.data
+ this.loading = false
+ this.depList = res.data.data.sort((a, b) => a.name > b.name ? 1 : -1)
+ },
+ async getInstalledDepList () {
+ this.loading = true
+ const res = await this.$request.get(`/nodes/${this.nodeForm._id}/deps/installed`, {
+ lang: this.activeLang.executable_name
+ })
+ this.loading = false
+ this.installedDepList = res.data.data
+ },
+ async fetchAllDepList (queryString, callback) {
+ const res = await this.$request.get('/system/deps', {
+ lang: this.activeLang.executable_name,
+ dep_name: queryString
+ })
+ callback(res.data.data ? res.data.data.map(d => {
+ return { value: d, label: d }
+ }) : [])
+ },
+ onSearch () {
+ if (!this.isShowInstalled) {
+ this.getDepList()
+ } else {
+ this.getInstalledDepList()
+ }
+ },
+ onIsShowInstalledChange (val) {
+ if (val) {
+ this.getInstalledDepList()
+ }
}
},
async created () {
diff --git a/frontend/src/i18n/zh.js b/frontend/src/i18n/zh.js
index 1ce52e99..7fef483c 100644
--- a/frontend/src/i18n/zh.js
+++ b/frontend/src/i18n/zh.js
@@ -66,6 +66,7 @@ export default {
'New File': '新建文件',
'Rename': '重命名',
'Install': '安装',
+ 'Uninstall': '卸载',
// 主页
'Total Tasks': '总任务数',
@@ -265,6 +266,7 @@ export default {
'ARCH': '操作架构',
'Number of CPU': 'CPU数',
'Executables': '执行文件',
+ 'Latest Version': '最新版本',
// 弹出框
'Notification': '提示',
@@ -297,6 +299,7 @@ export default {
'Disclaimer': '免责声明',
'Please search dependencies': '请搜索依赖',
'No Data': '暂无数据',
+ 'Show installed': '只看已安装',
// 登录
'Sign in': '登录',