UNPKG

youzanyun-devtool-worker

Version:

- web - ws - proxy

53 lines (52 loc) 2.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const spring4js_nodejs_1 = require("spring4js-nodejs"); const Command_1 = require("../Command"); let CommandCloseAllMock = class CommandCloseAllMock extends Command_1.AbstractCommand { getKey() { return 'close-all-mock'; } async getDescription(workbenchId, projectId) { let mockPlatformService = await this.getService("mockPlatformService"); let url = this.contentWindowService.getContentUrl(workbenchId); let isBepMock = url.indexOf('bep') > -1; if (isBepMock) { let bepMockList = await mockPlatformService.getAllMockedBep(projectId); return { key: this.getKey(), text: "关闭所有mock", disable: bepMockList.length == 0, }; } else { let mepMockList = await mockPlatformService.getAllMockedMep(projectId); return { key: this.getKey(), text: "关闭所有mock", disable: mepMockList.length == 0, }; } } async execute(workbenchId, projectId) { let mockPlatformService = await this.getService("mockPlatformService"); let notifyService = await this.getService("notifyService"); let url = this.contentWindowService.getContentUrl(workbenchId); let isBepMock = url.indexOf('bep') > -1; notifyService.showLoading(workbenchId); if (isBepMock) { await mockPlatformService.closeAllBepMock(projectId); } else { await mockPlatformService.closeAllMepMock(projectId); } notifyService.closeLoading(workbenchId); this.toolBarService.updateControlPanel(workbenchId, projectId); } async reset(workbenchId, projectId) { } }; CommandCloseAllMock = tslib_1.__decorate([ spring4js_nodejs_1.Service() ], CommandCloseAllMock); exports.default = CommandCloseAllMock;