Skip to content

Commit

Permalink
修复首次安装扩展后设置按钮没显示问题
Browse files Browse the repository at this point in the history
  • Loading branch information
monkeyWie committed Nov 2, 2018
1 parent c36d107 commit cb1c1a7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
3 changes: 2 additions & 1 deletion front/src/i18n/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ export default {
extCenter: 'Extension center',
installLocalExt: 'Install local extension',
installOk: 'Installed successfully',
installErr: 'Installation failed, please check the manifest.json file'
installErr: 'Installation failed, please check the manifest.json file',
setting: 'Setting'
},
setting: {
downSetting: 'Download settings',
Expand Down
3 changes: 2 additions & 1 deletion front/src/i18n/zh-TW.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ export default {
extCenter: '擴充中心',
installLocalExt: '加載本地擴充',
installOk: '加載成功',
installErr: '加載失敗,請檢查manifest.json文件'
installErr: '加載失敗,請檢查manifest.json文件',
setting: '預設'
},
setting: {
downSetting: '下載設定',
Expand Down
22 changes: 16 additions & 6 deletions front/src/views/Extension.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<Table :columns="localColumns"
:data="localAllList"></Table>
<Modal v-model="settingModal"
title="设置">
:title="$t('extension.setting')">
<ExtensionSetting :settings="settings" />
<span slot="footer">
<Button @click="settingModal = false">{{ $t('tip.cancel') }}</Button>
Expand Down Expand Up @@ -303,7 +303,9 @@ export default {
row.meta = { path: row.meta.path, enabled: true }
this.localAllList.push(row)
}
this.refreshExtensions()
this.getLocalExtensions(() => {
this.refreshExtensions()
})
this.spinShow = false
this.$Message.success({
content: this.$t('extension.downloadOk'),
Expand Down Expand Up @@ -386,16 +388,23 @@ export default {
}
})
},
loadExtensions() {
// Loading proxy mode
getProxyMode().then(mode => (this.proxySwitch = mode === 1))
// Get local installed extension
getLocalExtensions(callback) {
getExtensions().then(localAllList => {
this.localAllList = localAllList
this.localAllList.forEach(localExt => {
localExt.installed = true
localExt.currVersion = localExt.version
})
if (callback) {
callback()
}
})
},
loadExtensions() {
// Loading proxy mode
getProxyMode().then(mode => (this.proxySwitch = mode === 1))
// Get local installed extension
this.getLocalExtensions(() => {
this.searchExtensions()
})
},
Expand All @@ -417,6 +426,7 @@ export default {
this.$set(onlineExt, 'installed', true)
this.$set(onlineExt, 'currVersion', localExt.version)
this.$set(onlineExt, 'meta', localExt.meta)
this.$set(onlineExt, 'settings', localExt.settings)
} else {
onlineExt.installed = false
onlineExt.meta = { path: onlineExt.path, enabled: false }
Expand Down

0 comments on commit cb1c1a7

Please sign in to comment.