-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Expand file tree
/
Copy pathsidebar.ts
More file actions
62 lines (54 loc) · 1.48 KB
/
sidebar.ts
File metadata and controls
62 lines (54 loc) · 1.48 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
import { Widget, PanelLayout } from "@lumino/widgets";
import { CommandRegistry } from "@lumino/commands";
import { ClusterManager, IClusterModel } from "./clusters";
/**
* A widget for hosting IPP cluster widgets
*/
export class Sidebar extends Widget {
/**
* Create a new IPP sidebar.
*/
constructor(options: Sidebar.IOptions) {
super();
this.addClass("ipp-Sidebar");
const layout = (this.layout = new PanelLayout());
const injectClientCodeForCluster = options.clientCodeInjector;
const getClientCodeForCluster = options.clientCodeGetter;
// Add the cluster manager component.
this._clusters = new ClusterManager({
registry: options.registry,
injectClientCodeForCluster,
getClientCodeForCluster,
});
layout.addWidget(this._clusters);
}
/**
* Get the cluster manager associated with the sidebar.
*/
get clusterManager(): ClusterManager {
return this._clusters;
}
private _clusters: ClusterManager;
}
/**
* A namespace for Sidebar statics.
*/
export namespace Sidebar {
/**
* Options for the constructor.
*/
export interface IOptions {
/**
* Registry of all commands
*/
registry: CommandRegistry;
/**
* A function that injects client-connection code for a given cluster.
*/
clientCodeInjector: (model: IClusterModel) => void;
/**
* A function that gets client-connection code for a given cluster.
*/
clientCodeGetter: (model: IClusterModel) => string;
}
}