@codingame/monaco-vscode-policy-service-override 37.6.1 → 38.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/common.js +5 -1
- package/package.json +2 -2
- package/vscode/src/vs/workbench/services/policies/browser/accountPolicyGate.contribution.js +4 -0
- package/vscode/src/vs/workbench/services/policies/browser/accountPolicyGateContribution.d.ts +0 -1
- package/vscode/src/vs/workbench/services/policies/browser/accountPolicyGateContribution.js +18 -49
- package/vscode/src/vs/workbench/services/policies/browser/managedSettingsUpdate.contribution.d.ts +11 -0
- package/vscode/src/vs/workbench/services/policies/browser/managedSettingsUpdate.contribution.js +135 -0
- package/vscode/src/vs/workbench/services/policies/browser/managedSettingsUpdateService.d.ts +12 -0
- package/vscode/src/vs/workbench/services/policies/browser/managedSettingsUpdateService.js +35 -0
package/common.js
CHANGED
|
@@ -3,6 +3,9 @@ import '@codingame/monaco-vscode-api/vscode/vs/base/common/policy';
|
|
|
3
3
|
import { SyncDescriptor } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/descriptors';
|
|
4
4
|
import { AbstractPolicyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/policy/common/policy';
|
|
5
5
|
import { IPolicyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/policy/common/policy.service';
|
|
6
|
+
import { ManagedSettingsUpdateService } from './vscode/src/vs/workbench/services/policies/browser/managedSettingsUpdateService.js';
|
|
7
|
+
import { IManagedSettingsUpdateService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/policies/common/managedSettingsUpdate.service';
|
|
8
|
+
import './vscode/src/vs/workbench/services/policies/browser/managedSettingsUpdate.contribution.js';
|
|
6
9
|
|
|
7
10
|
class PolicyService extends AbstractPolicyService {
|
|
8
11
|
constructor(defaultPolicies) {
|
|
@@ -18,7 +21,8 @@ class PolicyService extends AbstractPolicyService {
|
|
|
18
21
|
}
|
|
19
22
|
function getServiceOverride(defaultPolicies) {
|
|
20
23
|
return {
|
|
21
|
-
[IPolicyService.toString()]: new SyncDescriptor(PolicyService, [defaultPolicies], true)
|
|
24
|
+
[IPolicyService.toString()]: new SyncDescriptor(PolicyService, [defaultPolicies], true),
|
|
25
|
+
[IManagedSettingsUpdateService.toString()]: new SyncDescriptor(ManagedSettingsUpdateService, [], true)
|
|
22
26
|
};
|
|
23
27
|
}
|
|
24
28
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-policy-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "38.0.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "VSCode public API plugged on the monaco editor - policy service-override",
|
|
6
6
|
"keywords": [],
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@codingame/monaco-vscode-api": "
|
|
18
|
+
"@codingame/monaco-vscode-api": "38.0.1"
|
|
19
19
|
},
|
|
20
20
|
"main": "index.js",
|
|
21
21
|
"module": "index.js",
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
import { registerWorkbenchContribution2, WorkbenchPhase } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/contributions';
|
|
3
|
+
import { CommandsRegistry } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands';
|
|
4
|
+
import { whenAccountPolicySettled } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/policies/common/accountPolicyService';
|
|
5
|
+
import { IAccountPolicyGateService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/policies/common/accountPolicyService.service';
|
|
3
6
|
import { AccountPolicyGateContribution } from './accountPolicyGateContribution.js';
|
|
4
7
|
|
|
5
8
|
registerWorkbenchContribution2(AccountPolicyGateContribution.ID, AccountPolicyGateContribution, WorkbenchPhase.AfterRestored);
|
|
9
|
+
CommandsRegistry.registerCommand('_workbench.whenAccountPolicySettled', accessor => whenAccountPolicySettled(accessor.get(IAccountPolicyGateService)));
|
|
@@ -144,35 +144,35 @@ let AccountPolicyGateContribution = class AccountPolicyGateContribution extends
|
|
|
144
144
|
let message;
|
|
145
145
|
if (accountName && hasConcreteOrgs) {
|
|
146
146
|
message = ( localize(
|
|
147
|
-
|
|
147
|
+
24767,
|
|
148
148
|
"Your administrator restricts AI features to GitHub accounts in the following organizations: {0}. The account \"{1}\" is not a member of any of these.",
|
|
149
149
|
orgList,
|
|
150
150
|
accountName
|
|
151
151
|
));
|
|
152
152
|
} else if (accountName) {
|
|
153
153
|
message = ( localize(
|
|
154
|
-
|
|
154
|
+
24768,
|
|
155
155
|
"Your administrator restricts AI features to specific GitHub accounts. The account \"{0}\" does not qualify.",
|
|
156
156
|
accountName
|
|
157
157
|
));
|
|
158
158
|
} else if (hasConcreteOrgs) {
|
|
159
159
|
message = ( localize(
|
|
160
|
-
|
|
160
|
+
24769,
|
|
161
161
|
"Your administrator restricts AI features to GitHub accounts in the following organizations: {0}.",
|
|
162
162
|
orgList
|
|
163
163
|
));
|
|
164
164
|
} else {
|
|
165
165
|
message = ( localize(
|
|
166
|
-
|
|
166
|
+
24770,
|
|
167
167
|
"Your administrator restricts AI features to specific GitHub accounts."
|
|
168
168
|
));
|
|
169
169
|
}
|
|
170
170
|
const handleDisposables = ( new DisposableStore());
|
|
171
171
|
const handle = this.notificationService.prompt(Severity.Warning, message, [{
|
|
172
|
-
label: ( localize(
|
|
172
|
+
label: ( localize(24771, "Sign In")),
|
|
173
173
|
run: () => this.commandService.executeCommand(DEFAULT_ACCOUNT_SIGN_IN_COMMAND)
|
|
174
174
|
}, {
|
|
175
|
-
label: ( localize(
|
|
175
|
+
label: ( localize(24772, "Learn More")),
|
|
176
176
|
run: () => this.openerService.open(( URI.parse("https://code.visualstudio.com/docs/enterprise/overview")))
|
|
177
177
|
}], {
|
|
178
178
|
sticky: true
|
|
@@ -196,7 +196,6 @@ let AccountPolicyGateContribution = class AccountPolicyGateContribution extends
|
|
|
196
196
|
}
|
|
197
197
|
updateManagedSettingsCompatibilityState() {
|
|
198
198
|
this.updatePolicyGateState();
|
|
199
|
-
this.maybeShowManagedSettingsDialog();
|
|
200
199
|
}
|
|
201
200
|
updateManagedSettingsPendingNotification(freshness) {
|
|
202
201
|
if (freshness?.state !== ManagedSettingsFreshnessState.Pending) {
|
|
@@ -210,7 +209,7 @@ let AccountPolicyGateContribution = class AccountPolicyGateContribution extends
|
|
|
210
209
|
this.managedSettingsPendingNotificationHandle.value = store;
|
|
211
210
|
store.add(disposableTimeout(() => {
|
|
212
211
|
const handle = this.notificationService.prompt(Severity.Info, ( localize(
|
|
213
|
-
|
|
212
|
+
24773,
|
|
214
213
|
"{0} is resolving your organization's policy. AI features will remain unavailable until this completes.",
|
|
215
214
|
this.productService.nameShort
|
|
216
215
|
)), [], {
|
|
@@ -240,7 +239,7 @@ let AccountPolicyGateContribution = class AccountPolicyGateContribution extends
|
|
|
240
239
|
}
|
|
241
240
|
getManagedSettingsDialogKey() {
|
|
242
241
|
if (this.defaultAccountService.managedSettingsCompatibilityError) {
|
|
243
|
-
return
|
|
242
|
+
return undefined;
|
|
244
243
|
}
|
|
245
244
|
const freshness = this.getBlockedManagedSettingsFreshness();
|
|
246
245
|
return freshness?.failure === ManagedSettingsFreshnessFailure.UpdateRequired ? undefined : freshness?.failure;
|
|
@@ -250,10 +249,6 @@ let AccountPolicyGateContribution = class AccountPolicyGateContribution extends
|
|
|
250
249
|
return freshness?.state === ManagedSettingsFreshnessState.Blocked ? freshness : undefined;
|
|
251
250
|
}
|
|
252
251
|
showManagedSettingsDialog() {
|
|
253
|
-
const compatibilityError = this.defaultAccountService.managedSettingsCompatibilityError;
|
|
254
|
-
if (compatibilityError) {
|
|
255
|
-
return this.showManagedSettingsCompatibilityDialog(compatibilityError);
|
|
256
|
-
}
|
|
257
252
|
const freshness = this.getBlockedManagedSettingsFreshness();
|
|
258
253
|
return freshness && isManagedSettingsBlockedDialogFreshness(freshness) ? this.showManagedSettingsBlockedDialog(freshness) : Promise.resolve();
|
|
259
254
|
}
|
|
@@ -261,37 +256,37 @@ let AccountPolicyGateContribution = class AccountPolicyGateContribution extends
|
|
|
261
256
|
switch (freshness.failure) {
|
|
262
257
|
case ManagedSettingsFreshnessFailure.NoToken:
|
|
263
258
|
return localize(
|
|
264
|
-
|
|
259
|
+
24774,
|
|
265
260
|
"AI features are unavailable because {0} must refresh your organization's managed settings. Sign in to continue.",
|
|
266
261
|
this.productService.nameShort
|
|
267
262
|
);
|
|
268
263
|
case ManagedSettingsFreshnessFailure.NoUrl:
|
|
269
264
|
return localize(
|
|
270
|
-
|
|
265
|
+
24775,
|
|
271
266
|
"AI features are unavailable because {0} cannot locate your organization's managed settings service. Contact your administrator.",
|
|
272
267
|
this.productService.nameShort
|
|
273
268
|
);
|
|
274
269
|
case ManagedSettingsFreshnessFailure.RateLimited:
|
|
275
270
|
return localize(
|
|
276
|
-
|
|
271
|
+
24776,
|
|
277
272
|
"AI features are temporarily unavailable because your organization's managed settings service is rate limiting requests. Try again later."
|
|
278
273
|
);
|
|
279
274
|
case ManagedSettingsFreshnessFailure.HttpError:
|
|
280
275
|
return localize(
|
|
281
|
-
|
|
276
|
+
24777,
|
|
282
277
|
"AI features are unavailable because {0} could not refresh your organization's managed settings (HTTP {1}). Retry after checking your connection.",
|
|
283
278
|
this.productService.nameShort,
|
|
284
279
|
freshness.httpStatus
|
|
285
280
|
);
|
|
286
281
|
case ManagedSettingsFreshnessFailure.Malformed:
|
|
287
282
|
return localize(
|
|
288
|
-
|
|
283
|
+
24778,
|
|
289
284
|
"AI features are unavailable because {0} received an invalid managed settings response. Retry or contact your administrator.",
|
|
290
285
|
this.productService.nameShort
|
|
291
286
|
);
|
|
292
287
|
case ManagedSettingsFreshnessFailure.Network:
|
|
293
288
|
return localize(
|
|
294
|
-
|
|
289
|
+
24779,
|
|
295
290
|
"Your organization requires {0} to refresh managed settings whenever it starts or reloads.\n\nAn error prevented the required policy from being retrieved, so AI features are unavailable. Retry, or contact your organization's administrator if the issue persists.",
|
|
296
291
|
this.productService.nameShort
|
|
297
292
|
);
|
|
@@ -301,12 +296,12 @@ let AccountPolicyGateContribution = class AccountPolicyGateContribution extends
|
|
|
301
296
|
const buttons = [];
|
|
302
297
|
if (freshness.failure === ManagedSettingsFreshnessFailure.NoToken) {
|
|
303
298
|
buttons.push({
|
|
304
|
-
label: ( localize(
|
|
299
|
+
label: ( localize(24780, "Sign In")),
|
|
305
300
|
run: () => this.commandService.executeCommand(DEFAULT_ACCOUNT_SIGN_IN_COMMAND)
|
|
306
301
|
});
|
|
307
302
|
} else if (freshness.failure !== ManagedSettingsFreshnessFailure.NoUrl) {
|
|
308
303
|
buttons.push({
|
|
309
|
-
label: ( localize(
|
|
304
|
+
label: ( localize(24781, "Retry")),
|
|
310
305
|
run: () => {
|
|
311
306
|
void this.defaultAccountService.refresh({
|
|
312
307
|
forceRefresh: true,
|
|
@@ -315,40 +310,14 @@ let AccountPolicyGateContribution = class AccountPolicyGateContribution extends
|
|
|
315
310
|
}
|
|
316
311
|
});
|
|
317
312
|
}
|
|
318
|
-
const title = freshness.failure === ManagedSettingsFreshnessFailure.Malformed ? ( localize(
|
|
313
|
+
const title = freshness.failure === ManagedSettingsFreshnessFailure.Malformed ? ( localize(24782, "Invalid Managed Settings")) : ( localize(24783, "Managed Settings Unavailable"));
|
|
319
314
|
return this.dialogService.prompt({
|
|
320
315
|
type: Severity.Warning,
|
|
321
316
|
title,
|
|
322
317
|
message: this.getManagedSettingsBlockedMessage(freshness),
|
|
323
318
|
custom: true,
|
|
324
319
|
buttons,
|
|
325
|
-
cancelButton: ( localize(
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
showManagedSettingsCompatibilityDialog(error) {
|
|
329
|
-
const message = error.minimumClientVersion ? ( localize(
|
|
330
|
-
22201,
|
|
331
|
-
"Your version of {0} cannot enforce your organization's managed settings. Update {0} to version {1} or later to continue using AI features.",
|
|
332
|
-
this.productService.nameShort,
|
|
333
|
-
error.minimumClientVersion
|
|
334
|
-
)) : ( localize(
|
|
335
|
-
22202,
|
|
336
|
-
"Your version of {0} cannot enforce your organization's managed settings. Update {0} to continue using AI features.",
|
|
337
|
-
this.productService.nameShort
|
|
338
|
-
));
|
|
339
|
-
return this.dialogService.prompt({
|
|
340
|
-
type: Severity.Warning,
|
|
341
|
-
title: ( localize(22203, "Update Required")),
|
|
342
|
-
message,
|
|
343
|
-
custom: true,
|
|
344
|
-
buttons: [{
|
|
345
|
-
label: ( localize(22204, "Check for Updates")),
|
|
346
|
-
run: () => this.commandService.executeCommand("update.checkForUpdate")
|
|
347
|
-
}, {
|
|
348
|
-
label: ( localize(22205, "Learn More")),
|
|
349
|
-
run: () => this.openerService.open(( URI.parse("https://code.visualstudio.com/docs/enterprise/overview")))
|
|
350
|
-
}],
|
|
351
|
-
cancelButton: ( localize(22206, "Close"))
|
|
320
|
+
cancelButton: ( localize(24784, "Close"))
|
|
352
321
|
});
|
|
353
322
|
}
|
|
354
323
|
};
|
package/vscode/src/vs/workbench/services/policies/browser/managedSettingsUpdate.contribution.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
|
+
import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
|
|
3
|
+
import { IContextKeyService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service";
|
|
4
|
+
import { IWorkbenchContribution } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/contributions";
|
|
5
|
+
import { IBannerService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/banner/browser/bannerService.service";
|
|
6
|
+
import { IWorkbenchEnvironmentService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/environmentService.service";
|
|
7
|
+
import { IManagedSettingsUpdateService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/policies/common/managedSettingsUpdate.service";
|
|
8
|
+
export declare class ManagedSettingsUpdateContribution extends Disposable implements IWorkbenchContribution {
|
|
9
|
+
static readonly ID = "workbench.contrib.managedSettingsUpdate";
|
|
10
|
+
constructor(updateService: IManagedSettingsUpdateService, configurationService: IConfigurationService, contextKeyService: IContextKeyService, bannerService: IBannerService, environmentService: IWorkbenchEnvironmentService);
|
|
11
|
+
}
|
package/vscode/src/vs/workbench/services/policies/browser/managedSettingsUpdate.contribution.js
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import './managedSettingsUpdateService.js';
|
|
4
|
+
import { status } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/aria/aria';
|
|
5
|
+
import { getActiveElement, isHTMLElement } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
|
|
6
|
+
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
7
|
+
import { Disposable, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
8
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
9
|
+
import { ChatAIDisabledSettingId } from '@codingame/monaco-vscode-api/vscode/vs/platform/chat/common/chatSettings';
|
|
10
|
+
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
11
|
+
import { observableConfigValue } from '@codingame/monaco-vscode-api/vscode/vs/platform/observable/common/platformObservableUtils';
|
|
12
|
+
import { ContextKeyExpr } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey';
|
|
13
|
+
import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
14
|
+
import { AccessibleContentProvider, AccessibleViewProviderId, AccessibleViewType } from '@codingame/monaco-vscode-api/vscode/vs/platform/accessibility/browser/accessibleView';
|
|
15
|
+
import { AccessibleViewRegistry } from '@codingame/monaco-vscode-api/vscode/vs/platform/accessibility/browser/accessibleViewRegistry';
|
|
16
|
+
import { FocusedViewContext, IsSessionsWindowContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/contextkeys';
|
|
17
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
18
|
+
import { registerWorkbenchContribution2, WorkbenchPhase } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/contributions';
|
|
19
|
+
import { IBannerService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/banner/browser/bannerService.service';
|
|
20
|
+
import { IWorkbenchEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/environmentService.service';
|
|
21
|
+
import { ManagedSettingsUpdateRequiredContext, MANAGED_SETTINGS_UPDATE_VIEW_ID } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/policies/common/managedSettingsUpdate';
|
|
22
|
+
import { IManagedSettingsUpdateService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/policies/common/managedSettingsUpdate.service';
|
|
23
|
+
import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/reactions/autorun';
|
|
24
|
+
|
|
25
|
+
var ManagedSettingsUpdateContribution_1;
|
|
26
|
+
let ManagedSettingsUpdateContribution = class ManagedSettingsUpdateContribution extends Disposable {
|
|
27
|
+
static {
|
|
28
|
+
ManagedSettingsUpdateContribution_1 = this;
|
|
29
|
+
}
|
|
30
|
+
static {
|
|
31
|
+
this.ID = "workbench.contrib.managedSettingsUpdate";
|
|
32
|
+
}
|
|
33
|
+
constructor(
|
|
34
|
+
updateService,
|
|
35
|
+
configurationService,
|
|
36
|
+
contextKeyService,
|
|
37
|
+
bannerService,
|
|
38
|
+
environmentService
|
|
39
|
+
) {
|
|
40
|
+
super();
|
|
41
|
+
const context = ManagedSettingsUpdateRequiredContext.bindTo(contextKeyService);
|
|
42
|
+
const hidden = observableConfigValue(ChatAIDisabledSettingId, false, configurationService);
|
|
43
|
+
let dismissed = false;
|
|
44
|
+
let lastMessage;
|
|
45
|
+
this._register(toDisposable(() => {
|
|
46
|
+
context.reset();
|
|
47
|
+
if (!environmentService.isSessionsWindow) {
|
|
48
|
+
bannerService.hide(ManagedSettingsUpdateContribution_1.ID);
|
|
49
|
+
}
|
|
50
|
+
}));
|
|
51
|
+
this._register(autorun(reader => {
|
|
52
|
+
const info = updateService.updateInfo.read(reader);
|
|
53
|
+
const visible = !!info && !hidden.read(reader);
|
|
54
|
+
context.set(visible);
|
|
55
|
+
if (environmentService.isSessionsWindow) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (!visible) {
|
|
59
|
+
dismissed = false;
|
|
60
|
+
lastMessage = undefined;
|
|
61
|
+
bannerService.hide(ManagedSettingsUpdateContribution_1.ID);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (lastMessage !== info.message) {
|
|
65
|
+
status(info.message);
|
|
66
|
+
lastMessage = info.message;
|
|
67
|
+
}
|
|
68
|
+
if (!dismissed) {
|
|
69
|
+
bannerService.show({
|
|
70
|
+
id: ManagedSettingsUpdateContribution_1.ID,
|
|
71
|
+
icon: Codicon.info,
|
|
72
|
+
message: info.updateStatus ? ( localize(24785, "{0} {1}", info.message, info.updateStatus)) : info.message,
|
|
73
|
+
ariaLabel: [info.title, info.message, info.detail, info.updateStatus].filter(Boolean).join(" "),
|
|
74
|
+
actions: info.action ? [info.action] : [],
|
|
75
|
+
priority: -1,
|
|
76
|
+
neutral: true,
|
|
77
|
+
onClose: () => {
|
|
78
|
+
dismissed = true;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
ManagedSettingsUpdateContribution = ManagedSettingsUpdateContribution_1 = ( __decorate([( __param(0, IManagedSettingsUpdateService)), ( __param(1, IConfigurationService)), ( __param(2, IContextKeyService)), ( __param(3, IBannerService)), ( __param(4, IWorkbenchEnvironmentService))], ManagedSettingsUpdateContribution));
|
|
86
|
+
registerWorkbenchContribution2(
|
|
87
|
+
ManagedSettingsUpdateContribution.ID,
|
|
88
|
+
ManagedSettingsUpdateContribution,
|
|
89
|
+
WorkbenchPhase.AfterRestored
|
|
90
|
+
);
|
|
91
|
+
AccessibleViewRegistry.register({
|
|
92
|
+
priority: 125,
|
|
93
|
+
name: "managedSettingsUpdate",
|
|
94
|
+
type: AccessibleViewType.Help,
|
|
95
|
+
when: ( ContextKeyExpr.and(ManagedSettingsUpdateRequiredContext, ( ContextKeyExpr.or(( FocusedViewContext.isEqualTo(MANAGED_SETTINGS_UPDATE_VIEW_ID)), IsSessionsWindowContext)))),
|
|
96
|
+
getProvider: accessor => {
|
|
97
|
+
const info = accessor.get(IManagedSettingsUpdateService).updateInfo.get();
|
|
98
|
+
if (!info) {
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
const previousFocus = getActiveElement();
|
|
102
|
+
const isSessionsWindow = accessor.get(IWorkbenchEnvironmentService).isSessionsWindow;
|
|
103
|
+
return (new AccessibleContentProvider(AccessibleViewProviderId.PanelChat, {
|
|
104
|
+
type: AccessibleViewType.Help
|
|
105
|
+
}, () => [
|
|
106
|
+
info.title,
|
|
107
|
+
info.message,
|
|
108
|
+
info.detail,
|
|
109
|
+
info.updateStatus,
|
|
110
|
+
isSessionsWindow ? ( localize(
|
|
111
|
+
24786,
|
|
112
|
+
"The Agents window is blocked by your organization's minimum-version requirement. The overlay explains the required update."
|
|
113
|
+
)) : ( localize(24787, "Chat is read-only while this requirement is active.")),
|
|
114
|
+
( localize(
|
|
115
|
+
24788,
|
|
116
|
+
"Use Tab or Shift+Tab to move between available actions, then press Enter or Space to activate one."
|
|
117
|
+
)),
|
|
118
|
+
info.action ? ( localize(24789, "The available update action is {0}.", info.action.label)) : undefined,
|
|
119
|
+
isSessionsWindow ? ( localize(
|
|
120
|
+
24790,
|
|
121
|
+
"Use Tab or Shift+Tab to reach Open Editor Window, then press Enter or Space. This opens a new editor window."
|
|
122
|
+
)) : undefined,
|
|
123
|
+
!isSessionsWindow ? ( localize(
|
|
124
|
+
24791,
|
|
125
|
+
"The window banner is also available with the Focus Banner command. In the banner, use the arrow keys to reach its actions. Closing the banner does not dismiss the explanation in Chat or change your organization's requirement."
|
|
126
|
+
)) : undefined
|
|
127
|
+
].filter(Boolean).join("\n"), () => {
|
|
128
|
+
if (isHTMLElement(previousFocus) && previousFocus.isConnected) {
|
|
129
|
+
previousFocus.focus();
|
|
130
|
+
}
|
|
131
|
+
}, "accessibility.verbosity.chat"));
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
export { ManagedSettingsUpdateContribution };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
|
+
import { IObservable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/observable";
|
|
3
|
+
import { IDefaultAccountService } from "@codingame/monaco-vscode-api/vscode/vs/platform/defaultAccount/common/defaultAccount.service";
|
|
4
|
+
import { IProductService } from "@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service";
|
|
5
|
+
import { IUpdateService } from "@codingame/monaco-vscode-api/vscode/vs/platform/update/common/update.service";
|
|
6
|
+
import { IManagedSettingsUpdateInfo } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/policies/common/managedSettingsUpdate";
|
|
7
|
+
import { IManagedSettingsUpdateService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/policies/common/managedSettingsUpdate.service";
|
|
8
|
+
export declare class ManagedSettingsUpdateService extends Disposable implements IManagedSettingsUpdateService {
|
|
9
|
+
readonly _serviceBrand: undefined;
|
|
10
|
+
readonly updateInfo: IObservable<IManagedSettingsUpdateInfo | undefined>;
|
|
11
|
+
constructor(defaultAccountService: IDefaultAccountService, productService: IProductService, updateService: IUpdateService);
|
|
12
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
4
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
5
|
+
import { equals } from '@codingame/monaco-vscode-api/vscode/vs/base/common/objects';
|
|
6
|
+
import { IDefaultAccountService } from '@codingame/monaco-vscode-api/vscode/vs/platform/defaultAccount/common/defaultAccount.service';
|
|
7
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/extensions';
|
|
8
|
+
import { IProductService } from '@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service';
|
|
9
|
+
import { IUpdateService } from '@codingame/monaco-vscode-api/vscode/vs/platform/update/common/update.service';
|
|
10
|
+
import { getManagedSettingsUpdateInfo } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/policies/common/managedSettingsUpdate';
|
|
11
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
12
|
+
import { observableFromEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableFromEvent';
|
|
13
|
+
import { derivedOpts } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/derived';
|
|
14
|
+
|
|
15
|
+
let ManagedSettingsUpdateService = class ManagedSettingsUpdateService extends Disposable {
|
|
16
|
+
constructor(defaultAccountService, productService, updateService) {
|
|
17
|
+
super();
|
|
18
|
+
const compatibilityError = observableFromEvent(
|
|
19
|
+
this,
|
|
20
|
+
defaultAccountService.onDidChangeManagedSettingsCompatibilityError,
|
|
21
|
+
() => defaultAccountService.managedSettingsCompatibilityError
|
|
22
|
+
);
|
|
23
|
+
const updateState = observableFromEvent(this, updateService.onStateChange, () => updateService.state);
|
|
24
|
+
this.updateInfo = derivedOpts({
|
|
25
|
+
owner: this,
|
|
26
|
+
equalsFn: equals
|
|
27
|
+
}, reader => {
|
|
28
|
+
const error = compatibilityError.read(reader);
|
|
29
|
+
return error ? getManagedSettingsUpdateInfo(error, productService, updateState.read(reader)) : undefined;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
ManagedSettingsUpdateService = ( __decorate([( __param(0, IDefaultAccountService)), ( __param(1, IProductService)), ( __param(2, IUpdateService))], ManagedSettingsUpdateService));
|
|
34
|
+
|
|
35
|
+
export { ManagedSettingsUpdateService };
|