{{activeLang.name + $t(' is not installed, do you want to install it?')}}
-
+
{{$t('Install')}}
@@ -86,7 +101,8 @@ export default {
depList: [],
loading: false,
isShowInstalled: false,
- installedDepList: []
+ installedDepList: [],
+ depLoadingDict: {}
}
},
computed: {
@@ -147,6 +163,59 @@ export default {
if (val) {
this.getInstalledDepList()
}
+ },
+ async onClickInstallDep (dep) {
+ const name = dep.name
+ this.$set(this.depLoadingDict, name, true)
+ const arr = this.$route.path.split('/')
+ const id = arr[arr.length - 1]
+ const data = await this.$request.post(`/nodes/${id}/deps/install`, {
+ lang: this.activeLang.executable_name,
+ dep_name: name
+ })
+ if (!data || data.error) {
+ this.$notify.error({
+ title: this.$t('Installing dependency failed'),
+ message: this.$t('The dependency installation is unsuccessful: ') + name
+ })
+ } else {
+ this.$notify.success({
+ title: this.$t('Installing dependency successful'),
+ message: this.$t('You have successfully installed a dependency: ') + name
+ })
+ dep.installed = true
+ }
+ this.$set(this.depLoadingDict, name, false)
+ },
+ async onClickUninstallDep (dep) {
+ const name = dep.name
+ this.$set(this.depLoadingDict, name, true)
+ const arr = this.$route.path.split('/')
+ const id = arr[arr.length - 1]
+ const data = await this.$request.post(`/nodes/${id}/deps/uninstall`, {
+ lang: this.activeLang.executable_name,
+ dep_name: name
+ })
+ if (!data || data.error) {
+ this.$notify.error({
+ title: this.$t('Uninstalling dependency failed'),
+ message: this.$t('The dependency uninstallation is unsuccessful: ') + name
+ })
+ } else {
+ this.$notify.success({
+ title: this.$t('Uninstalling dependency successful'),
+ message: this.$t('You have successfully uninstalled a dependency: ') + name
+ })
+ dep.installed = false
+ }
+ this.$set(this.depLoadingDict, name, false)
+ },
+ getDepLoading (dep) {
+ const name = dep.name
+ if (this.depLoadingDict[name] === undefined) {
+ return false
+ }
+ return this.depLoadingDict[name]
}
},
async created () {
@@ -160,5 +229,7 @@ export default {
diff --git a/frontend/src/i18n/zh.js b/frontend/src/i18n/zh.js
index 7fef483c..665f49e5 100644
--- a/frontend/src/i18n/zh.js
+++ b/frontend/src/i18n/zh.js
@@ -300,6 +300,14 @@ export default {
'Please search dependencies': '请搜索依赖',
'No Data': '暂无数据',
'Show installed': '只看已安装',
+ 'Installing dependency successful': '安装依赖成功',
+ 'Installing dependency failed': '安装依赖失败',
+ 'You have successfully installed a dependency: ': '您已成功安装依赖: ',
+ 'The dependency installation is unsuccessful: ': '安装依赖失败: ',
+ 'Uninstalling dependency successful': '卸载依赖成功',
+ 'Uninstalling dependency failed': '卸载依赖失败',
+ 'You have successfully uninstalled a dependency: ': '您已成功卸载依赖: ',
+ 'The dependency uninstallation is unsuccessful: ': '卸载依赖失败: ',
// 登录
'Sign in': '登录',