-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Expand file tree
/
Copy pathclusters.tsx
More file actions
902 lines (801 loc) · 22.9 KB
/
clusters.tsx
File metadata and controls
902 lines (801 loc) · 22.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
import {
showErrorMessage,
Toolbar,
ToolbarButton,
CommandToolbarButton,
} from "@jupyterlab/apputils";
import { IChangedArgs } from "@jupyterlab/coreutils";
import * as nbformat from "@jupyterlab/nbformat";
import { ServerConnection } from "@jupyterlab/services";
import { refreshIcon } from "@jupyterlab/ui-components";
import { ArrayExt } from "@lumino/algorithm";
import { JSONObject, JSONExt, MimeData } from "@lumino/coreutils";
import { ElementExt } from "@lumino/domutils";
import { Drag } from "@lumino/dragdrop";
import { Message } from "@lumino/messaging";
import { Poll } from "@lumino/polling";
import { ISignal, Signal } from "@lumino/signaling";
import { Widget, PanelLayout } from "@lumino/widgets";
import { newClusterDialog, INewCluster } from "./dialog";
import * as React from "react";
import { createRoot } from "react-dom/client";
import { CommandRegistry } from "@lumino/commands";
import { CommandIDs } from "./commands";
/**
* A refresh interval (in ms) for polling the backend cluster manager.
*/
const REFRESH_INTERVAL = 5000;
/**
* The threshold in pixels to start a drag event.
*/
const DRAG_THRESHOLD = 5;
/**
* The mimetype used for Jupyter cell data.
*/
const JUPYTER_CELL_MIME = "application/vnd.jupyter.cells";
const CLUSTER_PREFIX = "ipyparallel/clusters";
/**
* A widget for IPython cluster management.
*/
export class ClusterManager extends Widget {
/**
* Create a new cluster manager.
*/
constructor(options: ClusterManager.IOptions) {
super();
this.addClass("ipp-ClusterManager");
this._serverSettings = ServerConnection.makeSettings();
this._injectClientCodeForCluster = options.injectClientCodeForCluster;
this._getClientCodeForCluster = options.getClientCodeForCluster;
this._registry = options.registry;
// A function to set the active cluster.
this._setActiveById = (id: string) => {
const cluster = this._clusters.find((c) => c.id === id);
if (!cluster) {
return;
}
const old = this._activeCluster;
if (old && old.id === cluster.id) {
return;
}
this._activeCluster = cluster;
this._activeClusterChanged.emit({
name: "cluster",
oldValue: old,
newValue: cluster,
});
this.update();
};
const layout = (this.layout = new PanelLayout());
this._clusterListing = new Widget();
this._clusterListing.addClass("ipp-ClusterListing");
// Create the toolbar.
const toolbar = new Toolbar<Widget>();
// Make a label widget for the toolbar.
const toolbarLabel = new Widget();
toolbarLabel.node.textContent = "CLUSTERS";
toolbarLabel.addClass("ipp-ClusterManager-label");
toolbar.addItem("label", toolbarLabel);
// Make a refresh button for the toolbar.
toolbar.addItem(
"refresh",
new ToolbarButton({
icon: refreshIcon,
onClick: async () => {
return this._updateClusterList();
},
tooltip: "Refresh Cluster List",
}),
);
// Make a new cluster button for the toolbar.
toolbar.addItem(
CommandIDs.newCluster,
new CommandToolbarButton({
commands: this._registry,
id: CommandIDs.newCluster,
}),
);
layout.addWidget(toolbar);
layout.addWidget(this._clusterListing);
// Do an initial refresh of the cluster list.
void this._updateClusterList();
// Also refresh periodically.
this._poll = new Poll({
factory: async () => {
await this._updateClusterList();
},
frequency: { interval: REFRESH_INTERVAL, backoff: true, max: 60 * 1000 },
standby: "when-hidden",
});
}
/**
* The currently selected cluster, or undefined if there is none.
*/
get activeCluster(): IClusterModel | undefined {
return this._activeCluster;
}
/**
* Set an active cluster by id.
*/
setActiveCluster(id: string): void {
this._setActiveById(id);
}
/**
* A signal that is emitted when an active cluster changes.
*/
get activeClusterChanged(): ISignal<
this,
IChangedArgs<IClusterModel | undefined>
> {
return this._activeClusterChanged;
}
/**
* Whether the cluster manager is ready to launch a cluster
*/
get isReady(): boolean {
return this._isReady;
}
/**
* Get the current clusters known to the manager.
*/
get clusters(): IClusterModel[] {
return this._clusters;
}
/**
* Refresh the current list of clusters.
*/
async refresh(): Promise<void> {
await this._updateClusterList();
}
/**
* Create a new cluster.
*/
async create(): Promise<IClusterModel> {
const clusterRequest = await newClusterDialog({});
if (!clusterRequest) {
return;
}
const cluster = await this._newCluster(clusterRequest);
return cluster;
}
/**
* Start a cluster by ID.
*/
async start(id: string): Promise<void> {
const cluster = this._clusters.find((c) => c.id === id);
if (!cluster) {
throw Error(`Cannot find cluster ${id}`);
}
await this._startById(id);
}
/**
* Stop a cluster by ID.
*/
async stop(id: string): Promise<void> {
const cluster = this._clusters.find((c) => c.id === id);
if (!cluster) {
throw Error(`Cannot find cluster ${id}`);
}
await this._stopById(id);
}
/**
* Scale a cluster by ID.
*/
async scale(id: string): Promise<IClusterModel> {
const cluster = this._clusters.find((c) => c.id === id);
if (!cluster) {
throw Error(`Cannot find cluster ${id}`);
}
const newCluster = await this._scaleById(id);
return newCluster;
}
/**
* Dispose of the cluster manager.
*/
dispose(): void {
if (this.isDisposed) {
return;
}
this._poll.dispose();
super.dispose();
}
/**
* Handle an update request.
*/
protected onUpdateRequest(msg: Message): void {
// Don't bother if the sidebar is not visible
if (!this.isVisible) {
return;
}
const root = createRoot(this._clusterListing.node);
root.render(
<ClusterListing
clusters={this._clusters}
activeClusterId={(this._activeCluster && this._activeCluster.id) || ""}
scaleById={(id: string) => {
return this._scaleById(id);
}}
startById={(id: string) => {
return this._startById(id);
}}
stopById={(id: string) => {
return this._stopById(id);
}}
setActiveById={this._setActiveById}
injectClientCodeForCluster={this._injectClientCodeForCluster}
/>,
);
}
/**
* Rerender after showing.
*/
protected onAfterShow(msg: Message): void {
this.update();
}
/**
* Handle `after-attach` messages for the widget.
*/
protected onAfterAttach(msg: Message): void {
super.onAfterAttach(msg);
const node = this._clusterListing.node;
node.addEventListener("p-dragenter", this);
node.addEventListener("p-dragleave", this);
node.addEventListener("p-dragover", this);
node.addEventListener("mousedown", this);
}
/**
* Handle `before-detach` messages for the widget.
*/
protected onBeforeDetach(msg: Message): void {
const node = this._clusterListing.node;
node.removeEventListener("p-dragenter", this);
node.removeEventListener("p-dragleave", this);
node.removeEventListener("p-dragover", this);
node.removeEventListener("mousedown", this);
document.removeEventListener("mouseup", this, true);
document.removeEventListener("mousemove", this, true);
}
/**
* Handle the DOM events for the directory listing.
*
* @param event - The DOM event sent to the widget.
*
* #### Notes
* This method implements the DOM `EventListener` interface and is
* called in response to events on the panel's DOM node. It should
* not be called directly by user code.
*/
handleEvent(event: Event): void {
switch (event.type) {
case "mousedown":
this._evtMouseDown(event as MouseEvent);
break;
case "mouseup":
this._evtMouseUp(event as MouseEvent);
break;
case "mousemove":
this._evtMouseMove(event as MouseEvent);
break;
default:
break;
}
}
/**
* Handle `mousedown` events for the widget.
*/
private _evtMouseDown(event: MouseEvent): void {
const { button, shiftKey } = event;
// We only handle main or secondary button actions.
if (!(button === 0 || button === 2)) {
return;
}
// Shift right-click gives the browser default behavior.
if (shiftKey && button === 2) {
return;
}
// Find the target cluster.
const clusterIndex = this._findCluster(event);
if (clusterIndex === -1) {
return;
}
// Prepare for a drag start
this._dragData = {
pressX: event.clientX,
pressY: event.clientY,
index: clusterIndex,
};
// Enter possible drag mode
document.addEventListener("mouseup", this, true);
document.addEventListener("mousemove", this, true);
event.preventDefault();
}
/**
* Handle the `'mouseup'` event on the document.
*/
private _evtMouseUp(event: MouseEvent): void {
// Remove the event listeners we put on the document
if (event.button !== 0 || !this._drag) {
document.removeEventListener("mousemove", this, true);
document.removeEventListener("mouseup", this, true);
}
event.preventDefault();
event.stopPropagation();
}
/**
* Handle the `'mousemove'` event for the widget.
*/
private _evtMouseMove(event: MouseEvent): void {
const data = this._dragData;
if (!data) {
return;
}
// Check for a drag initialization.
const dx = Math.abs(event.clientX - data.pressX);
const dy = Math.abs(event.clientY - data.pressY);
if (dx >= DRAG_THRESHOLD || dy >= DRAG_THRESHOLD) {
event.preventDefault();
event.stopPropagation();
void this._startDrag(data.index, event.clientX, event.clientY);
}
}
/**
* Start a drag event.
*/
private async _startDrag(
index: number,
clientX: number,
clientY: number,
): Promise<void> {
// Create the drag image.
const model = this._clusters[index];
const listingItem = this._clusterListing.node.querySelector(
`li.ipp-ClusterListingItem[data-cluster-id="${model.id}"]`,
) as HTMLElement;
const dragImage = Private.createDragImage(listingItem);
// Set up the drag event.
this._drag = new Drag({
mimeData: new MimeData(),
dragImage,
supportedActions: "copy",
proposedAction: "copy",
source: this,
});
// Add mimeData for plain text so that normal editors can
// receive the data.
const textData = this._getClientCodeForCluster(model);
this._drag.mimeData.setData("text/plain", textData);
// Add cell data for notebook drops.
const cellData: nbformat.ICodeCell[] = [
{
cell_type: "code",
source: textData,
outputs: [],
execution_count: null,
metadata: {},
},
];
this._drag.mimeData.setData(JUPYTER_CELL_MIME, cellData);
// Remove mousemove and mouseup listeners and start the drag.
document.removeEventListener("mousemove", this, true);
document.removeEventListener("mouseup", this, true);
return this._drag.start(clientX, clientY).then((action) => {
if (this.isDisposed) {
return;
}
this._drag = null;
this._dragData = null;
});
}
/**
* Launch a new cluster on the server.
*/
private async _newCluster(
clusterRequest: INewCluster,
): Promise<IClusterModel> {
this._isReady = false;
this._registry.notifyCommandChanged(CommandIDs.newCluster);
// TODO: allow requesting a profile, options
const response = await ServerConnection.makeRequest(
`${this._serverSettings.baseUrl}${CLUSTER_PREFIX}`,
{ method: "POST", body: JSON.stringify(clusterRequest) },
this._serverSettings,
);
if (response.status !== 200) {
const err = await response.json();
void showErrorMessage("Cluster Create Error", err);
this._isReady = true;
this._registry.notifyCommandChanged(CommandIDs.newCluster);
throw err;
}
const model = (await response.json()) as IClusterModel;
await this._updateClusterList();
this._isReady = true;
this._registry.notifyCommandChanged(CommandIDs.newCluster);
return model;
}
/**
* Refresh the list of clusters on the server.
*/
private async _updateClusterList(): Promise<void> {
const response = await ServerConnection.makeRequest(
`${this._serverSettings.baseUrl}${CLUSTER_PREFIX}`,
{},
this._serverSettings,
);
if (response.status !== 200) {
const msg =
"Failed to list clusters: might the server extension not be installed/enabled?";
const err = new Error(msg);
if (!this._serverErrorShown) {
void showErrorMessage("IPP Extension Server Error", err);
this._serverErrorShown = true;
}
throw err;
}
const data = (await response.json()) as IClusterModel[];
this._clusters = data;
// Check to see if the active cluster still exits.
// If it doesn't, or if there is no active cluster,
// select the first one.
const active = this._clusters.find(
(c) => c.id === (this._activeCluster && this._activeCluster.id),
);
if (!active) {
const id = (this._clusters[0] && this._clusters[0].id) || "";
this._setActiveById(id);
}
this.update();
}
/**
* Start a cluster by its id.
*/
private async _startById(id: string): Promise<void> {
const response = await ServerConnection.makeRequest(
`${this._serverSettings.baseUrl}${CLUSTER_PREFIX}/${id}`,
{ method: "POST" },
this._serverSettings,
);
if (response.status > 299) {
const err = await response.json();
void showErrorMessage("Failed to start cluster", err);
throw err;
}
await this._updateClusterList();
}
/**
* Stop a cluster by its id.
*/
private async _stopById(id: string): Promise<void> {
const response = await ServerConnection.makeRequest(
`${this._serverSettings.baseUrl}${CLUSTER_PREFIX}/${id}`,
{ method: "DELETE" },
this._serverSettings,
);
if (response.status !== 204) {
const err = await response.json();
void showErrorMessage("Failed to close cluster", err);
throw err;
}
await this._updateClusterList();
}
/**
* Scale a cluster by its id.
*/
private async _scaleById(id: string): Promise<IClusterModel> {
const cluster = this._clusters.find((c) => c.id === id);
if (!cluster) {
throw Error(`Failed to find cluster ${id} to scale`);
}
// TODO: scale not implemented
// should add an engine set
void showErrorMessage("Scale not implemented", "");
// const update = await showScalingDialog(cluster);
const update = cluster;
if (JSONExt.deepEqual(update, cluster)) {
// If the user canceled, or the model is identical don't try to update.
return Promise.resolve(cluster);
}
const response = await ServerConnection.makeRequest(
`${this._serverSettings.baseUrl}${CLUSTER_PREFIX}/${id}`,
{
method: "PATCH",
body: JSON.stringify(update),
},
this._serverSettings,
);
if (response.status !== 200) {
const err = await response.json();
void showErrorMessage("Failed to scale cluster", err);
throw err;
}
const model = (await response.json()) as IClusterModel;
await this._updateClusterList();
return model;
}
private _findCluster(event: MouseEvent): number {
const nodes = Array.from(
this.node.querySelectorAll("li.ipp-ClusterListingItem"),
);
return ArrayExt.findFirstIndex(nodes, (node) => {
return ElementExt.hitTest(node, event.clientX, event.clientY);
});
}
private _drag: Drag | null;
private _dragData: {
pressX: number;
pressY: number;
index: number;
} | null = null;
private _clusterListing: Widget;
private _clusters: IClusterModel[] = [];
private _activeCluster: IClusterModel | undefined;
private _setActiveById: (id: string) => void;
private _injectClientCodeForCluster: (model: IClusterModel) => void;
private _getClientCodeForCluster: (model: IClusterModel) => string;
private _poll: Poll;
private _serverSettings: ServerConnection.ISettings;
private _activeClusterChanged = new Signal<
this,
IChangedArgs<IClusterModel | undefined>
>(this);
private _serverErrorShown = false;
private _isReady = true;
private _registry: CommandRegistry;
}
/**
* A namespace for DasClusterManager statics.
*/
export namespace ClusterManager {
/**
* Options for the constructor.
*/
export interface IOptions {
/**
* Registry of all commands
*/
registry: CommandRegistry;
/**
* A callback to inject client connection cdoe.
*/
injectClientCodeForCluster: (model: IClusterModel) => void;
/**
* A callback to get client code for a cluster.
*/
getClientCodeForCluster: (model: IClusterModel) => string;
}
}
/**
* A React component for a launcher button listing.
*/
function ClusterListing(props: IClusterListingProps) {
const listing = props.clusters.map((cluster) => {
return (
<ClusterListingItem
isActive={cluster.id === props.activeClusterId}
key={cluster.id}
cluster={cluster}
scale={() => props.scaleById(cluster.id)}
start={() => props.startById(cluster.id)}
stop={() => props.stopById(cluster.id)}
setActive={() => props.setActiveById(cluster.id)}
injectClientCode={() => props.injectClientCodeForCluster(cluster)}
/>
);
});
// Return the JSX component.
return (
<div>
<ul className="ipp-ClusterListing-list">{listing}</ul>
</div>
);
}
/**
* Props for the cluster listing component.
*/
export interface IClusterListingProps {
/**
* A list of items to render.
*/
clusters: IClusterModel[];
/**
* The id of the active cluster.
*/
activeClusterId: string;
/**
* A function for starting a cluster by ID.
*/
startById: (id: string) => Promise<void>;
/**
* A function for stopping a cluster by ID.
*/
stopById: (id: string) => Promise<void>;
/**
* Scale a cluster by id.
*/
scaleById: (id: string) => Promise<IClusterModel>;
/**
* A callback to set the active cluster by id.
*/
setActiveById: (id: string) => void;
/**
* A callback to inject client code for a cluster.
*/
injectClientCodeForCluster: (model: IClusterModel) => void;
}
/**
* A TSX functional component for rendering a single running cluster.
*/
function ClusterListingItem(props: IClusterListingItemProps) {
const { cluster, isActive, setActive, scale, start, stop, injectClientCode } =
props;
let itemClass = "ipp-ClusterListingItem";
itemClass = isActive ? `${itemClass} jp-mod-active` : itemClass;
let cluster_state = "Stopped";
if (cluster.controller) {
cluster_state = cluster.controller.state.state;
if (cluster_state === "after") {
cluster_state = "Stopped";
}
}
// stop action is 'delete' for already-stopped clusters
const STOP = cluster_state === "Stopped" ? "DELETE" : "STOP";
return (
<li
className={itemClass}
data-cluster-id={cluster.id}
onClick={(evt) => {
setActive();
evt.stopPropagation();
}}
>
<div className="ipp-ClusterListingItem-title">{cluster.id}</div>
<div className="ipp-ClusterListingItem-stats">State: {cluster_state}</div>
<div className="ipp-ClusterListingItem-stats">
Number of engines: {cluster.engines.n || cluster.cluster.n || "auto"}
</div>
<div className="ipp-ClusterListingItem-button-panel">
<button
className="ipp-ClusterListingItem-button ipp-ClusterListingItem-code ipp-CodeIcon jp-mod-styled"
onClick={(evt) => {
injectClientCode();
evt.stopPropagation();
}}
title={`Inject client code for ${cluster.id}`}
/>
<button
className={`ipp-ClusterListingItem-button ipp-ClusterListingItem-start jp-mod-styled ${
cluster_state === "Stopped" ? "" : "ipp-hidden"
}`}
onClick={async (evt) => {
evt.stopPropagation();
return start();
}}
title={`Start ${cluster.id}`}
>
START
</button>
<button
className="ipp-ClusterListingItem-button ipp-ClusterListingItem-scale jp-mod-styled ipp-hidden"
onClick={async (evt) => {
evt.stopPropagation();
return scale();
}}
title={`Rescale ${cluster.id}`}
>
SCALE
</button>
<button
className={`ipp-ClusterListingItem-button ipp-ClusterListingItem-stop jp-mod-styled ${
cluster_state === "Stopped" && cluster.cluster.cluster_id === ""
? "ipp-hidden"
: ""
}`}
onClick={async (evt) => {
evt.stopPropagation();
return stop();
}}
title={STOP}
>
{STOP}
</button>
</div>
</li>
);
}
/**
* Props for the cluster listing component.
*/
export interface IClusterListingItemProps {
/**
* A cluster model to render.
*/
cluster: IClusterModel;
/**
* Whether the cluster is currently active.
*/
isActive: boolean;
/**
* A function for starting the cluster.
*/
start: () => Promise<void>;
/**
* A function for scaling the cluster.
*/
scale: () => Promise<IClusterModel>;
/**
* A function for stopping the cluster.
*/
stop: () => Promise<void>;
/**
* A callback function to set the active cluster.
*/
setActive: () => void;
/**
* A callback to inject client code into an editor.
*/
injectClientCode: () => void;
}
/**
* An interface for a JSON-serializable representation of a cluster.
*/
export interface IClusterModel extends JSONObject {
/**
* A unique string ID for the cluster.
*/
id: string;
/**
* the cluster file for `Cluster.from_file`
*/
cluster_file: string;
cluster: {
/**
* The number of engines (null = auto)
*/
n?: number;
/**
* The cluster id
*/
cluster_id: string;
/**
* The profile directory
*/
profile_dir: string;
/**
* The profile, abbreviated
*/
profle: string;
/**
* The class import string
*/
class: string;
};
controller?: {
class: string;
state?: {
state: string;
};
};
engines: {
n: number;
class: string;
sets: {
[key: string]: {
n: number;
state: string;
};
};
};
}
/**
* A namespace for module-private functionality.
*/
namespace Private {
/**
* Create a drag image for an HTML node.
*/
export function createDragImage(node: HTMLElement): HTMLElement {
const image = node.cloneNode(true) as HTMLElement;
image.classList.add("ipp-ClusterListingItem-drag");
return image;
}
}