MCPcopy Create free account
hub / github.com/chieapp/chie / constructor

Method constructor

src/view/new-assistant-window.ts:32–173  ·  view source on GitHub ↗
(assistant?: Assistant)

Source from the content-addressed store, hash-verified

30 apiParams?: APIParamsView;
31
32 constructor(assistant?: Assistant) {
33 super({pressEscToClose: true});
34 this.assistant = assistant;
35
36 this.contentView.setStyle({
37 gap: basicStyle.padding / 2,
38 padding: basicStyle.padding,
39 paddingLeft: 50,
40 paddingRight: 50,
41 });
42
43 this.serviceSelector = new ParamsView([
44 {
45 name: 'name',
46 type: 'string',
47 displayName: 'Name',
48 value: assistant?.service.name,
49 },
50 {
51 name: 'icon',
52 type: 'image',
53 displayName: 'Icon',
54 value: assistant?.service.icon,
55 },
56 {
57 name: 'shortcut',
58 type: 'shortcut',
59 displayName: 'Shortcut',
60 value: assistant?.shortcut,
61 },
62 {
63 name: 'tray',
64 type: 'boolean',
65 displayName: 'Tray',
66 title: 'Show tray icon for the assistant',
67 value: assistant?.tray != null,
68 },
69 {
70 name: 'api',
71 type: 'selection',
72 displayName: 'API',
73 selected: assistant?.service.api.credential.name,
74 selections: apiManager.getCredentialSelections(),
75 },
76 {
77 name: 'service',
78 type: 'selection',
79 displayName: 'Service',
80 selected: assistant?.service.constructor.name,
81 selections: serviceManager.getServiceSelections(),
82 constrainedBy: 'api',
83 constrain: (credential: APICredential, record: ServiceRecord) => {
84 const apiClass = apiManager.getAPIRecord(credential.type).apiClass;
85 for (const A of record.apiClasses) {
86 if (matchClass(A, apiClass))
87 return true;
88 }
89 return false;

Callers

nothing calls this directly

Calls 15

#toggleAPIParamsMethod · 0.95
#updateAPIParamsViewMethod · 0.95
#updateDefaultIconMethod · 0.95
addButtonMethod · 0.95
addCloseButtonMethod · 0.95
matchClassFunction · 0.90
isEmptyObjectFunction · 0.90
getServiceSelectionsMethod · 0.80
getAPIRecordMethod · 0.80
getViewSelectionsMethod · 0.80

Tested by

no test coverage detected