Imports the previously untracked working tree as-is so that the review changes that follow (requirements -> design -> implementation) can be reviewed as diffs and reverted if needed. No content changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
34 lines
1.8 KiB
JavaScript
34 lines
1.8 KiB
JavaScript
'use strict';
|
|
const { injectable, inject } = require('@theia/core/shared/inversify');
|
|
const { WidgetManager } = require('@theia/core/lib/browser/widget-manager');
|
|
const { FrontendApplicationContribution } = require('@theia/core/lib/browser/frontend-application-contribution');
|
|
const React = require('@theia/core/shared/react');
|
|
class ManagedExtensionsNotice {
|
|
onStart() {
|
|
const label = widget => {
|
|
if (widget.id !== 'vsx-extensions-view-container') return;
|
|
widget.title.label = 'Extensions · 管理员管理';
|
|
widget.title.caption = '扩展由管理员固定版本安装。可查看已安装扩展;安装、更新与移除须通过平台镜像发布。';
|
|
// ViewContainer restores its title from saved layout/part titles. Put the
|
|
// durable notice in the extension search widget as well as the caption.
|
|
if (!widget.searchBar || widget.searchBar.wishforgeManagedNotice) return;
|
|
const search = widget.searchBar;
|
|
search.wishforgeManagedNotice = true;
|
|
const render = search.render.bind(search);
|
|
search.render = () => React.createElement('div', { style: { width: '100%' } },
|
|
React.createElement('p', { style: { margin: '0 0 8px', fontSize: '12px', lineHeight: '1.6' } },
|
|
'扩展由管理员管理。安装与更新须通过平台镜像发布。'), render());
|
|
search.update();
|
|
};
|
|
this.widgets.getWidgets('vsx-extensions-view-container').forEach(label);
|
|
this.widgets.onDidCreateWidget(({ widget }) => label(widget));
|
|
}
|
|
}
|
|
injectable()(ManagedExtensionsNotice);
|
|
inject(WidgetManager)(ManagedExtensionsNotice.prototype, 'widgets');
|
|
function bindManagedExtensionNotice(bind) {
|
|
bind(ManagedExtensionsNotice).toSelf().inSingletonScope();
|
|
bind(FrontendApplicationContribution).toService(ManagedExtensionsNotice);
|
|
}
|
|
module.exports = { bindManagedExtensionNotice };
|