1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | Object.defineProperty(exports, "__esModule", { value: true });
|
18 | exports.AboutDialog = exports.AboutDialogProps = exports.ABOUT_EXTENSIONS_CLASS = exports.ABOUT_CONTENT_CLASS = void 0;
|
19 | const tslib_1 = require("tslib");
|
20 | const React = require("react");
|
21 | const inversify_1 = require("inversify");
|
22 | const dialogs_1 = require("./dialogs");
|
23 | const react_dialog_1 = require("./dialogs/react-dialog");
|
24 | const application_protocol_1 = require("../common/application-protocol");
|
25 | const frontend_application_config_provider_1 = require("./frontend-application-config-provider");
|
26 | const api_1 = require("@theia/application-package/lib/api");
|
27 | const window_service_1 = require("./window/window-service");
|
28 | const keys_1 = require("./keys");
|
29 | const nls_1 = require("../common/nls");
|
30 | exports.ABOUT_CONTENT_CLASS = 'theia-aboutDialog';
|
31 | exports.ABOUT_EXTENSIONS_CLASS = 'theia-aboutExtensions';
|
32 | let AboutDialogProps = class AboutDialogProps extends dialogs_1.DialogProps {
|
33 | };
|
34 | AboutDialogProps = (0, tslib_1.__decorate)([
|
35 | (0, inversify_1.injectable)()
|
36 | ], AboutDialogProps);
|
37 | exports.AboutDialogProps = AboutDialogProps;
|
38 | let AboutDialog = class AboutDialog extends react_dialog_1.ReactDialog {
|
39 | constructor(props) {
|
40 | super({
|
41 | title: frontend_application_config_provider_1.FrontendApplicationConfigProvider.get().applicationName,
|
42 | });
|
43 | this.props = props;
|
44 | this.extensionsInfos = [];
|
45 | |
46 |
|
47 |
|
48 |
|
49 | this.doOpenExternalLink = (url) => this.windowService.openNewWindow(url, { external: true });
|
50 | this.doOpenExternalLinkEnter = (e, url) => {
|
51 | if (this.isEnterKey(e)) {
|
52 | this.doOpenExternalLink(url);
|
53 | }
|
54 | };
|
55 | this.appendAcceptButton(dialogs_1.Dialog.OK);
|
56 | }
|
57 | init() {
|
58 | this.doInit();
|
59 | }
|
60 | async doInit() {
|
61 | this.applicationInfo = await this.appServer.getApplicationInfo();
|
62 | this.extensionsInfos = await this.appServer.getExtensionsInfos();
|
63 | this.update();
|
64 | }
|
65 | renderHeader() {
|
66 | const applicationInfo = this.applicationInfo;
|
67 | const compatibilityUrl = 'https://eclipse-theia.github.io/vscode-theia-comparator/status.html';
|
68 | const detailsLabel = nls_1.nls.localizeByDefault('Details');
|
69 | const versionLabel = nls_1.nls.localize('theia/core/about/version', 'Version');
|
70 | const defaultApiLabel = nls_1.nls.localize('theia/core/about/defaultApi', 'Default {0} API', 'VS Code');
|
71 | const compatibilityLabel = nls_1.nls.localize('theia/core/about/compatibility', '{0} Compatibility', 'VS Code');
|
72 | return React.createElement(React.Fragment, null,
|
73 | React.createElement("h3", null, detailsLabel),
|
74 | React.createElement("div", { className: 'about-details' },
|
75 | applicationInfo && React.createElement("p", null, `${versionLabel}: ${applicationInfo.version}`),
|
76 | React.createElement("p", null, `${defaultApiLabel}: ${api_1.DEFAULT_SUPPORTED_API_VERSION}`),
|
77 | React.createElement("p", null,
|
78 | React.createElement("a", { role: 'button', tabIndex: 0, onClick: () => this.doOpenExternalLink(compatibilityUrl), onKeyDown: (e) => this.doOpenExternalLinkEnter(e, compatibilityUrl) }, compatibilityLabel))));
|
79 | }
|
80 | renderExtensions() {
|
81 | const extensionsInfos = this.extensionsInfos;
|
82 | return React.createElement(React.Fragment, null,
|
83 | React.createElement("h3", null, "List of extensions"),
|
84 | React.createElement("ul", { className: exports.ABOUT_EXTENSIONS_CLASS }, extensionsInfos
|
85 | .sort((a, b) => a.name.toLowerCase().localeCompare(b.name.toLowerCase()))
|
86 | .map((extension) => React.createElement("li", { key: extension.name },
|
87 | extension.name,
|
88 | " ",
|
89 | extension.version))));
|
90 | }
|
91 | render() {
|
92 | return React.createElement("div", { className: exports.ABOUT_CONTENT_CLASS },
|
93 | this.renderHeader(),
|
94 | this.renderExtensions());
|
95 | }
|
96 | onAfterAttach(msg) {
|
97 | super.onAfterAttach(msg);
|
98 | this.update();
|
99 | }
|
100 | isEnterKey(e) {
|
101 | var _a;
|
102 | return keys_1.Key.ENTER.keyCode === ((_a = keys_1.KeyCode.createKeyCode(e.nativeEvent).key) === null || _a === void 0 ? void 0 : _a.keyCode);
|
103 | }
|
104 | get value() { return undefined; }
|
105 | };
|
106 | (0, tslib_1.__decorate)([
|
107 | (0, inversify_1.inject)(application_protocol_1.ApplicationServer),
|
108 | (0, tslib_1.__metadata)("design:type", Object)
|
109 | ], AboutDialog.prototype, "appServer", void 0);
|
110 | (0, tslib_1.__decorate)([
|
111 | (0, inversify_1.inject)(window_service_1.WindowService),
|
112 | (0, tslib_1.__metadata)("design:type", Object)
|
113 | ], AboutDialog.prototype, "windowService", void 0);
|
114 | (0, tslib_1.__decorate)([
|
115 | (0, inversify_1.postConstruct)(),
|
116 | (0, tslib_1.__metadata)("design:type", Function),
|
117 | (0, tslib_1.__metadata)("design:paramtypes", []),
|
118 | (0, tslib_1.__metadata)("design:returntype", void 0)
|
119 | ], AboutDialog.prototype, "init", null);
|
120 | AboutDialog = (0, tslib_1.__decorate)([
|
121 | (0, inversify_1.injectable)(),
|
122 | (0, tslib_1.__param)(0, (0, inversify_1.inject)(AboutDialogProps)),
|
123 | (0, tslib_1.__metadata)("design:paramtypes", [AboutDialogProps])
|
124 | ], AboutDialog);
|
125 | exports.AboutDialog = AboutDialog;
|
126 |
|
\ | No newline at end of file |