feat: mock extension preview in web

This commit is contained in:
scarqin 2022-06-23 00:32:11 +08:00
parent 8d5771a011
commit 1bbedc50c4
4 changed files with 7 additions and 5 deletions

View File

@ -14,7 +14,7 @@ export class ExtensionService {
this.getInstalledList();
}
getInstalledList() {
this.localModules = window.eo.getModules();
this.localModules = window.eo?.getModules()||new Map();
this.updateExtensionIDs();
}
public async requestList() {

View File

@ -278,7 +278,7 @@ export class SettingComponent implements OnInit {
// 获取本地设置
this.localSettings = window.eo.getSettings();
// const featureList = window.eo.getFeature('configuration');
const modules = window.eo.getModules();
const modules = window.eo?.getModules();
// const extensitonConfigurations = [...modules.values()].filter((n) => n.contributes?.configuration);
const extensitonConfigurations = [...modules.values()].filter((n) => n.features?.configuration);
const controls = {};

View File

@ -69,8 +69,10 @@ export class SidebarComponent implements OnInit, OnDestroy {
moduleID: '@eo-core-extension',
isOffical: true,
icon: 'puzzle',
activeRoute: this.electron.isElectron ? 'home/extension' : 'home/preview',
route: this.electron.isElectron ? 'home/extension/list' : 'home/preview',
activeRoute: 'home/extension',
route: 'home/extension/list',
// activeRoute: this.electron.isElectron ? 'home/extension' : 'home/preview',
// route: this.electron.isElectron ? 'home/extension/list' : 'home/preview',
},
];
if (this.electron.isElectron) {

View File

@ -31,7 +31,7 @@ export class SyncApiComponent implements OnInit {
const action = feature.action || null;
const module = window.eo.loadFeatureModule(this.currentExtension);
// TODO 临时取值方式需要修改
const { token: secretKey, projectId } = window.eo.getModuleSettings(
const { token: secretKey, projectId } = window.eo?.getModuleSettings(
'eoapi-feature-push-eolink.eolink.remoteServer'
);
if (module && module[action] && typeof module[action] === 'function') {