UNPKG

2.5 kBTypeScriptView Raw
1import { ITranslator } from '@jupyterlab/translation';
2import { VDomModel, VDomRenderer } from '@jupyterlab/ui-components';
3import { ISessionContext } from './sessioncontext';
4/**
5 * Helper function to translate kernel statuses mapping by using
6 * input translator.
7 *
8 * @param translator - Language translator.
9 * @return The translated kernel status mapping.
10 */
11export declare function translateKernelStatuses(translator?: ITranslator): Record<ISessionContext.KernelDisplayStatus, string>;
12/**
13 * A VDomRenderer widget for displaying the status of a kernel.
14 */
15export declare class KernelStatus extends VDomRenderer<KernelStatus.Model> {
16 /**
17 * Construct the kernel status widget.
18 */
19 constructor(opts: KernelStatus.IOptions, translator?: ITranslator);
20 /**
21 * Render the kernel status item.
22 */
23 render(): JSX.Element | null;
24 translator: ITranslator;
25 private _handleClick;
26}
27/**
28 * A namespace for KernelStatus statics.
29 */
30export declare namespace KernelStatus {
31 /**
32 * A VDomModel for the kernel status indicator.
33 */
34 class Model extends VDomModel {
35 constructor(translator?: ITranslator);
36 /**
37 * The name of the kernel.
38 */
39 get kernelName(): string;
40 /**
41 * The current status of the kernel.
42 */
43 get status(): string | undefined;
44 /**
45 * A display name for the activity.
46 */
47 get activityName(): string;
48 set activityName(val: string);
49 /**
50 * The current client session associated with the kernel status indicator.
51 */
52 get sessionContext(): ISessionContext | null;
53 set sessionContext(sessionContext: ISessionContext | null);
54 /**
55 * React to changes to the kernel status.
56 */
57 private _onKernelStatusChanged;
58 /**
59 * React to changes in the kernel.
60 */
61 private _onKernelChanged;
62 private _getAllState;
63 private _triggerChange;
64 protected translation: ITranslator;
65 private _trans;
66 private _activityName;
67 private _kernelName;
68 private _kernelStatus;
69 private _sessionContext;
70 private readonly _statusNames;
71 }
72 /**
73 * Options for creating a KernelStatus object.
74 */
75 interface IOptions {
76 /**
77 * A click handler for the item. By default
78 * we launch a kernel selection dialog.
79 */
80 onClick: () => void;
81 }
82}