@nu-art/build-and-install 0.204.70 → 0.204.72
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/build-and-install.js +6 -3
- package/package.json +1 -1
- package/v2/phase-runner/PhaseRunner.d.ts +2 -2
- package/v2/phase-runner/PhaseRunner.js +4 -0
- package/v2/phase-runner/PhaseRunnerDispatcher.d.ts +20 -7
- package/v2/phase-runner/PhaseRunnerDispatcher.js +2 -1
- package/v2/screens/BAIScreen.d.ts +20 -0
- package/v2/screens/BAIScreen.js +58 -0
- package/v2/screens/BAIScreen_UnitList.d.ts +31 -0
- package/v2/screens/{list-screen.js → BAIScreen_UnitList.js} +30 -58
- package/v2/screens/list-screen.d.ts +0 -47
package/build-and-install.js
CHANGED
|
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const ts_common_1 = require("@nu-art/ts-common");
|
|
4
4
|
const params_1 = require("./core/params/params");
|
|
5
5
|
const PhaseRunner_1 = require("./v2/phase-runner/PhaseRunner");
|
|
6
|
-
const list_screen_1 = require("./v2/screens/list-screen");
|
|
7
6
|
const thunderstorm_1 = require("./v2/unit/thunderstorm");
|
|
7
|
+
const BAIScreen_UnitList_1 = require("./v2/screens/BAIScreen_UnitList");
|
|
8
8
|
ts_common_1.DebugFlag.DefaultLogLevel = params_1.RuntimeParams.debug ? ts_common_1.LogLevel.Debug : ts_common_1.LogLevel.Info;
|
|
9
9
|
const runner = new PhaseRunner_1.PhaseRunner('./.config/project-config-v2.ts');
|
|
10
|
-
const screen = new
|
|
11
|
-
screen.
|
|
10
|
+
const screen = new BAIScreen_UnitList_1.BAIScreen_UnitList();
|
|
11
|
+
screen.setOnKillCallback(async () => await runner.killRunner());
|
|
12
12
|
runner.setScreen(screen);
|
|
13
13
|
if (params_1.RuntimeParams.runWithThunderstorm)
|
|
14
14
|
runner.registerUnits(thunderstorm_1.allTSUnits);
|
|
@@ -16,6 +16,9 @@ runner
|
|
|
16
16
|
.execute()
|
|
17
17
|
.then(() => {
|
|
18
18
|
ts_common_1.StaticLogger.logInfo('completed');
|
|
19
|
+
//TODO: make it an array of non exit params
|
|
20
|
+
if (!params_1.RuntimeParams.launch)
|
|
21
|
+
process.exit(0);
|
|
19
22
|
})
|
|
20
23
|
.catch(err => {
|
|
21
24
|
ts_common_1.StaticLogger.logError('Failed with error: ', err);
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@ import { RelativePath } from '@nu-art/ts-common';
|
|
|
2
2
|
import { Phase, Phase_Debug, Phase_Help, Phase_PrintEnv } from '../phase';
|
|
3
3
|
import { UnitPhaseImplementor } from '../unit/types';
|
|
4
4
|
import { BaseUnit } from '../unit/core';
|
|
5
|
-
import {
|
|
5
|
+
import { BAIScreen } from '../screens/BAIScreen';
|
|
6
6
|
export declare class PhaseRunner extends BaseUnit implements UnitPhaseImplementor<[Phase_Help, Phase_PrintEnv, Phase_Debug]> {
|
|
7
7
|
private readonly phases;
|
|
8
8
|
private readonly units;
|
|
@@ -68,7 +68,7 @@ export declare class PhaseRunner extends BaseUnit implements UnitPhaseImplemento
|
|
|
68
68
|
private loadRunningStatus;
|
|
69
69
|
execute(): Promise<void>;
|
|
70
70
|
killRunner(): Promise<void>;
|
|
71
|
-
setScreen(screen:
|
|
71
|
+
setScreen(screen: BAIScreen): void;
|
|
72
72
|
printHelp(): Promise<void>;
|
|
73
73
|
printEnv(): Promise<void>;
|
|
74
74
|
debug(): Promise<void>;
|
|
@@ -121,7 +121,10 @@ class PhaseRunner extends core_1.BaseUnit {
|
|
|
121
121
|
if (!useUnits.includes(unit.config.key))
|
|
122
122
|
unitsToRemove.push(unit);
|
|
123
123
|
}
|
|
124
|
+
if (!unitsToRemove.length)
|
|
125
|
+
return;
|
|
124
126
|
unitsToRemove.forEach(unit => (0, ts_common_1.removeItemFromArray)(this.units, unit));
|
|
127
|
+
PhaseRunnerDispatcher_1.dispatcher_UnitChange.dispatch(this.units);
|
|
125
128
|
}
|
|
126
129
|
async loadProject() {
|
|
127
130
|
if (!fs_1.default.existsSync(this.project.path))
|
|
@@ -225,6 +228,7 @@ class PhaseRunner extends core_1.BaseUnit {
|
|
|
225
228
|
//TS units after project units, but before the rest
|
|
226
229
|
return thunderstorm_1.allTSUnits.includes(unit) ? 2 : 3;
|
|
227
230
|
});
|
|
231
|
+
PhaseRunnerDispatcher_1.dispatcher_UnitChange.dispatch(this.units);
|
|
228
232
|
}
|
|
229
233
|
getUnitsForPhase(phase) {
|
|
230
234
|
return (0, ts_common_1.filterInstances)(this.unitDependencyTree.map(row => {
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { FunctionKeys, ParamResolver } from '@nu-art/ts-common';
|
|
2
2
|
import { Phase } from '../phase/types';
|
|
3
3
|
import { BaseUnit } from '../unit/core';
|
|
4
|
-
|
|
5
|
-
__onPhaseChange: (data: Phase<string>) => void;
|
|
6
|
-
__onUnitStatusChange: (data: BaseUnit) => void;
|
|
7
|
-
}
|
|
8
|
-
declare class PhaseRunnerDispatcher<K extends FunctionKeys<PhaseRunnerEventListener>, P extends ParamResolver<PhaseRunnerEventListener, K> = ParamResolver<PhaseRunnerEventListener, K>> {
|
|
4
|
+
declare class PhaseRunnerDispatcher<T, K extends FunctionKeys<T> = FunctionKeys<T>, P extends ParamResolver<T, K> = ParamResolver<T, K>> {
|
|
9
5
|
private readonly method;
|
|
10
6
|
constructor(method: K);
|
|
11
7
|
private listeners;
|
|
@@ -13,8 +9,14 @@ declare class PhaseRunnerDispatcher<K extends FunctionKeys<PhaseRunnerEventListe
|
|
|
13
9
|
removeListener(listener: any): void;
|
|
14
10
|
dispatch(...data: P): void;
|
|
15
11
|
}
|
|
16
|
-
export
|
|
17
|
-
|
|
12
|
+
export interface PhaseRunner_OnPhaseChange {
|
|
13
|
+
__onPhaseChange: (data: Phase<string>) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare const dispatcher_PhaseChange: PhaseRunnerDispatcher<PhaseRunner_OnPhaseChange, "__onPhaseChange", [data: Phase<string>]>;
|
|
16
|
+
export interface PhaseRunner_OnUnitStatusChange {
|
|
17
|
+
__onUnitStatusChange: (data: BaseUnit) => void;
|
|
18
|
+
}
|
|
19
|
+
export declare const dispatcher_UnitStatusChange: PhaseRunnerDispatcher<PhaseRunner_OnUnitStatusChange, "__onUnitStatusChange", [data: BaseUnit<{}, {}, {
|
|
18
20
|
key: string;
|
|
19
21
|
label: string;
|
|
20
22
|
filter?: (() => boolean | Promise<boolean>) | undefined;
|
|
@@ -22,4 +24,15 @@ export declare const dispatcher_UnitStatusChange: PhaseRunnerDispatcher<"__onUni
|
|
|
22
24
|
dependencyName: string;
|
|
23
25
|
unitDependencyNames: string[];
|
|
24
26
|
}>]>;
|
|
27
|
+
export interface PhaseRunner_OnUnitsChange {
|
|
28
|
+
__onUnitsChange: (data: BaseUnit[]) => void;
|
|
29
|
+
}
|
|
30
|
+
export declare const dispatcher_UnitChange: PhaseRunnerDispatcher<PhaseRunner_OnUnitsChange, "__onUnitsChange", [data: BaseUnit<{}, {}, {
|
|
31
|
+
key: string;
|
|
32
|
+
label: string;
|
|
33
|
+
filter?: (() => boolean | Promise<boolean>) | undefined;
|
|
34
|
+
}, {
|
|
35
|
+
dependencyName: string;
|
|
36
|
+
unitDependencyNames: string[];
|
|
37
|
+
}>[]]>;
|
|
25
38
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dispatcher_UnitStatusChange = exports.dispatcher_PhaseChange = void 0;
|
|
3
|
+
exports.dispatcher_UnitChange = exports.dispatcher_UnitStatusChange = exports.dispatcher_PhaseChange = void 0;
|
|
4
4
|
const ts_common_1 = require("@nu-art/ts-common");
|
|
5
5
|
class PhaseRunnerDispatcher {
|
|
6
6
|
constructor(method) {
|
|
@@ -24,3 +24,4 @@ class PhaseRunnerDispatcher {
|
|
|
24
24
|
}
|
|
25
25
|
exports.dispatcher_PhaseChange = new PhaseRunnerDispatcher('__onPhaseChange');
|
|
26
26
|
exports.dispatcher_UnitStatusChange = new PhaseRunnerDispatcher('__onUnitStatusChange');
|
|
27
|
+
exports.dispatcher_UnitChange = new PhaseRunnerDispatcher('__onUnitsChange');
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ConsoleContainer } from '@nu-art/commando/console/ConsoleContainer';
|
|
2
|
+
import { AsyncVoidFunction } from '@nu-art/ts-common';
|
|
3
|
+
export declare abstract class BAIScreen<State extends {} = {}> extends ConsoleContainer<'screen', State> {
|
|
4
|
+
private onKillCallback?;
|
|
5
|
+
private logClient;
|
|
6
|
+
/**
|
|
7
|
+
* Creates an instance of ConsoleScreen.
|
|
8
|
+
*
|
|
9
|
+
* @param {Widgets.IScreenOptions} [props] - The properties to apply to the screen widget.
|
|
10
|
+
* @param {ScreenKeyBinding[]} [keyBinding] - An array of key bindings for the screen widget.
|
|
11
|
+
*/
|
|
12
|
+
constructor();
|
|
13
|
+
private createLogClient;
|
|
14
|
+
startLogClient: () => void;
|
|
15
|
+
stopLogClient: () => void;
|
|
16
|
+
protected abstract onLogUpdated: () => void;
|
|
17
|
+
protected getLogs: () => string;
|
|
18
|
+
protected onKill(): Promise<never>;
|
|
19
|
+
setOnKillCallback: (cb: AsyncVoidFunction) => AsyncVoidFunction;
|
|
20
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BAIScreen = void 0;
|
|
4
|
+
const ConsoleContainer_1 = require("@nu-art/commando/console/ConsoleContainer");
|
|
5
|
+
const ts_common_1 = require("@nu-art/ts-common");
|
|
6
|
+
class BAIScreen extends ConsoleContainer_1.ConsoleContainer {
|
|
7
|
+
//######################### Initialization #########################
|
|
8
|
+
/**
|
|
9
|
+
* Creates an instance of ConsoleScreen.
|
|
10
|
+
*
|
|
11
|
+
* @param {Widgets.IScreenOptions} [props] - The properties to apply to the screen widget.
|
|
12
|
+
* @param {ScreenKeyBinding[]} [keyBinding] - An array of key bindings for the screen widget.
|
|
13
|
+
*/
|
|
14
|
+
constructor() {
|
|
15
|
+
super('screen', { smartCSR: true, title: 'Build and Install' }, [{
|
|
16
|
+
keys: ['escape', 'q', 'C-c'],
|
|
17
|
+
callback: async () => await this.onKill(),
|
|
18
|
+
}]);
|
|
19
|
+
//######################### Log Client Interaction #########################
|
|
20
|
+
this.startLogClient = () => {
|
|
21
|
+
//Remove terminal from BeLogged
|
|
22
|
+
ts_common_1.BeLogged.removeConsole(ts_common_1.LogClient_Terminal);
|
|
23
|
+
//Add this log client to BeLogged
|
|
24
|
+
ts_common_1.BeLogged.addClient(this.logClient);
|
|
25
|
+
};
|
|
26
|
+
this.stopLogClient = () => {
|
|
27
|
+
ts_common_1.BeLogged.removeClient(this.logClient);
|
|
28
|
+
};
|
|
29
|
+
this.getLogs = () => this.logClient.buffers[0];
|
|
30
|
+
this.setOnKillCallback = (cb) => this.onKillCallback = cb;
|
|
31
|
+
this.createLogClient();
|
|
32
|
+
}
|
|
33
|
+
createLogClient() {
|
|
34
|
+
//Create the log client
|
|
35
|
+
this.logClient = new ts_common_1.LogClient_MemBuffer('log-out.txt');
|
|
36
|
+
//Set for terminal flag
|
|
37
|
+
this.logClient.setForTerminal();
|
|
38
|
+
//Set log composer to print logs with timestamps
|
|
39
|
+
this.logClient.setComposer((tag, level) => {
|
|
40
|
+
ts_common_1._logger_finalDate.setTime(Date.now() - ts_common_1._logger_timezoneOffset);
|
|
41
|
+
const date = ts_common_1._logger_finalDate.toISOString().replace(/T/, '_').replace(/Z/, '').substring(0, 23).split('_')[1];
|
|
42
|
+
return ` ${date} ${(0, ts_common_1._logger_getPrefix)(level)} ${tag}: `;
|
|
43
|
+
});
|
|
44
|
+
//Connect callback to listen when log is appended
|
|
45
|
+
this.logClient.setLogAppendedListener(() => {
|
|
46
|
+
this.onLogUpdated();
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
//######################### Kill Functionality #########################
|
|
50
|
+
async onKill() {
|
|
51
|
+
var _a;
|
|
52
|
+
this.logInfo('Kill command received');
|
|
53
|
+
await ((_a = this.onKillCallback) === null || _a === void 0 ? void 0 : _a.call(this));
|
|
54
|
+
this.logInfo('Killed!');
|
|
55
|
+
return process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.BAIScreen = BAIScreen;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { PhaseRunner_OnPhaseChange, PhaseRunner_OnUnitsChange, PhaseRunner_OnUnitStatusChange } from '../phase-runner/PhaseRunnerDispatcher';
|
|
2
|
+
import { Phase } from '../phase';
|
|
3
|
+
import { BaseUnit } from '../unit/core';
|
|
4
|
+
import { BAIScreen } from './BAIScreen';
|
|
5
|
+
type State = {
|
|
6
|
+
currentPhaseName?: string;
|
|
7
|
+
selectedUnit?: BaseUnit;
|
|
8
|
+
};
|
|
9
|
+
export declare class BAIScreen_UnitList extends BAIScreen<State> implements PhaseRunner_OnPhaseChange, PhaseRunner_OnUnitStatusChange, PhaseRunner_OnUnitsChange {
|
|
10
|
+
private units;
|
|
11
|
+
private unitWrapperWidget;
|
|
12
|
+
private unitWidgets;
|
|
13
|
+
private logWidget;
|
|
14
|
+
private phaseWidget;
|
|
15
|
+
__onPhaseChange(phase: Phase<string>): void;
|
|
16
|
+
__onUnitStatusChange(unit: BaseUnit): void;
|
|
17
|
+
__onUnitsChange(data: BaseUnit[]): void;
|
|
18
|
+
protected onLogUpdated: () => void;
|
|
19
|
+
private destroyUnitListWidget;
|
|
20
|
+
protected createContent(): void;
|
|
21
|
+
private createPhaseWidget;
|
|
22
|
+
private createUnitListWidget;
|
|
23
|
+
private createUnitItemWidget;
|
|
24
|
+
private createLogWidget;
|
|
25
|
+
protected render(): void;
|
|
26
|
+
private renderPhase;
|
|
27
|
+
private renderUnitList;
|
|
28
|
+
private renderLogs;
|
|
29
|
+
private onUnitSelect;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const ConsoleContainer_1 = require("@nu-art/commando/console/ConsoleContainer");
|
|
3
|
+
exports.BAIScreen_UnitList = void 0;
|
|
5
4
|
const PhaseRunnerDispatcher_1 = require("../phase-runner/PhaseRunnerDispatcher");
|
|
6
|
-
const
|
|
7
|
-
|
|
5
|
+
const BAIScreen_1 = require("./BAIScreen");
|
|
6
|
+
const consts_1 = require("../phase-runner/consts");
|
|
7
|
+
class BAIScreen_UnitList extends BAIScreen_1.BAIScreen {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.units = [];
|
|
11
|
+
this.unitWidgets = [];
|
|
12
|
+
this.onLogUpdated = () => {
|
|
13
|
+
this.renderLogs();
|
|
14
|
+
};
|
|
15
|
+
}
|
|
8
16
|
//######################### Lifecycle #########################
|
|
9
17
|
__onPhaseChange(phase) {
|
|
10
18
|
this.setState({ currentPhaseName: phase.name });
|
|
@@ -13,54 +21,28 @@ class BAI_ListScreen extends ConsoleContainer_1.ConsoleContainer {
|
|
|
13
21
|
this.renderUnitList();
|
|
14
22
|
this.container.screen.render();
|
|
15
23
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
* @param units - The units this screen should keep track of
|
|
20
|
-
* @param {Widgets.IScreenOptions} [props] - The properties to apply to the screen widget.
|
|
21
|
-
* @param {ScreenKeyBinding[]} [keyBinding] - An array of key bindings for the screen widget.
|
|
22
|
-
*/
|
|
23
|
-
constructor(units, props, keyBinding = []) {
|
|
24
|
-
super('screen', { smartCSR: true, title: 'Build and Install' }, [{
|
|
25
|
-
keys: ['escape', 'q', 'C-c'],
|
|
26
|
-
callback: async () => {
|
|
27
|
-
var _a;
|
|
28
|
-
this.logInfo('Kill command received');
|
|
29
|
-
await ((_a = this.onKillCB) === null || _a === void 0 ? void 0 : _a.call(this));
|
|
30
|
-
this.logInfo('Killed!');
|
|
31
|
-
return process.exit(1);
|
|
32
|
-
}
|
|
33
|
-
}]);
|
|
34
|
-
this.unitWidgets = [];
|
|
35
|
-
this.units = units;
|
|
24
|
+
__onUnitsChange(data) {
|
|
25
|
+
this.createUnitListWidget();
|
|
26
|
+
this.renderUnitList();
|
|
36
27
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
this.
|
|
42
|
-
this.logClient.setComposer((tag, level) => {
|
|
43
|
-
ts_common_1._logger_finalDate.setTime(Date.now() - ts_common_1._logger_timezoneOffset);
|
|
44
|
-
const date = ts_common_1._logger_finalDate.toISOString().replace(/T/, '_').replace(/Z/, '').substring(0, 23).split('_')[1];
|
|
45
|
-
return ` ${date} ${(0, ts_common_1._logger_getPrefix)(level)} ${tag}: `;
|
|
46
|
-
});
|
|
47
|
-
this.logClient.setLogAppendedListener(() => {
|
|
48
|
-
this.renderLogs();
|
|
49
|
-
});
|
|
28
|
+
//######################### Content Destruction #########################
|
|
29
|
+
destroyUnitListWidget() {
|
|
30
|
+
var _a, _b;
|
|
31
|
+
(_a = this.unitWrapperWidget) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
32
|
+
(_b = this.unitWidgets) === null || _b === void 0 ? void 0 : _b.forEach(group => group.forEach(widget => widget.destroy()));
|
|
50
33
|
}
|
|
51
34
|
//######################### Content Creation #########################
|
|
52
|
-
create() {
|
|
53
|
-
if (!this.logClient)
|
|
54
|
-
this.initLogger();
|
|
55
|
-
super.create();
|
|
56
|
-
return this;
|
|
57
|
-
}
|
|
58
35
|
createContent() {
|
|
36
|
+
//Create widgets
|
|
59
37
|
this.createPhaseWidget();
|
|
60
38
|
this.createUnitListWidget();
|
|
61
39
|
this.createLogWidget();
|
|
40
|
+
//Start listening on dispatchers
|
|
62
41
|
PhaseRunnerDispatcher_1.dispatcher_UnitStatusChange.addListener(this);
|
|
63
42
|
PhaseRunnerDispatcher_1.dispatcher_PhaseChange.addListener(this);
|
|
43
|
+
PhaseRunnerDispatcher_1.dispatcher_UnitChange.addListener(this);
|
|
44
|
+
//Start the log client
|
|
45
|
+
this.startLogClient();
|
|
64
46
|
}
|
|
65
47
|
createPhaseWidget() {
|
|
66
48
|
const props = {
|
|
@@ -71,7 +53,7 @@ class BAI_ListScreen extends ConsoleContainer_1.ConsoleContainer {
|
|
|
71
53
|
content: 'phases',
|
|
72
54
|
border: { type: 'line' },
|
|
73
55
|
tags: true,
|
|
74
|
-
|
|
56
|
+
style: {
|
|
75
57
|
border: { fg: 'blue' },
|
|
76
58
|
fg: 'blue',
|
|
77
59
|
},
|
|
@@ -80,6 +62,8 @@ class BAI_ListScreen extends ConsoleContainer_1.ConsoleContainer {
|
|
|
80
62
|
this.phaseWidget = this.createWidget('text', props);
|
|
81
63
|
}
|
|
82
64
|
createUnitListWidget() {
|
|
65
|
+
this.units = consts_1.MemKey_PhaseRunner.get().getUnits();
|
|
66
|
+
this.destroyUnitListWidget();
|
|
83
67
|
const props = {
|
|
84
68
|
top: 3,
|
|
85
69
|
left: 0,
|
|
@@ -169,22 +153,10 @@ class BAI_ListScreen extends ConsoleContainer_1.ConsoleContainer {
|
|
|
169
153
|
}
|
|
170
154
|
renderLogs() {
|
|
171
155
|
const scrollPosition = this.logWidget.getScroll();
|
|
172
|
-
const content = this.state.selectedUnit ? this.state.selectedUnit.getLogs() : this.
|
|
156
|
+
const content = this.state.selectedUnit ? this.state.selectedUnit.getLogs() : this.getLogs();
|
|
173
157
|
this.logWidget.setContent(content);
|
|
174
158
|
this.logWidget.setScroll(scrollPosition);
|
|
175
159
|
}
|
|
176
|
-
//######################### Kill #########################
|
|
177
|
-
setKillCB(cb) {
|
|
178
|
-
this.onKillCB = cb;
|
|
179
|
-
// Remove all listeners to the process kill event
|
|
180
|
-
// process.listeners('SIGINT').forEach(listener => process.removeListener('SIGINT', listener));
|
|
181
|
-
//Register a new listener for process kill event
|
|
182
|
-
// process.on('SIGINT', async () => {
|
|
183
|
-
// await cb();
|
|
184
|
-
// this.dispose();
|
|
185
|
-
// process.exit(0);
|
|
186
|
-
// });
|
|
187
|
-
}
|
|
188
160
|
//######################### Events #########################
|
|
189
161
|
onUnitSelect(unit, index) {
|
|
190
162
|
this.state.selectedUnit = unit === this.state.selectedUnit ? undefined : unit;
|
|
@@ -193,4 +165,4 @@ class BAI_ListScreen extends ConsoleContainer_1.ConsoleContainer {
|
|
|
193
165
|
this.container.screen.render();
|
|
194
166
|
}
|
|
195
167
|
}
|
|
196
|
-
exports.
|
|
168
|
+
exports.BAIScreen_UnitList = BAIScreen_UnitList;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { ConsoleContainer } from '@nu-art/commando/console/ConsoleContainer';
|
|
2
|
-
import { Widgets } from 'blessed';
|
|
3
|
-
import { PhaseRunnerEventListener } from '../phase-runner/PhaseRunnerDispatcher';
|
|
4
|
-
import { Phase } from '../phase';
|
|
5
|
-
import { BaseUnit } from '../unit/core';
|
|
6
|
-
import { AsyncVoidFunction } from '@nu-art/ts-common';
|
|
7
|
-
type ScreenKeyBinding = {
|
|
8
|
-
keys: string[];
|
|
9
|
-
callback: VoidFunction;
|
|
10
|
-
};
|
|
11
|
-
type State = {
|
|
12
|
-
currentPhaseName?: string;
|
|
13
|
-
selectedUnit?: BaseUnit;
|
|
14
|
-
};
|
|
15
|
-
export declare class BAI_ListScreen extends ConsoleContainer<'screen', State> implements PhaseRunnerEventListener {
|
|
16
|
-
private units;
|
|
17
|
-
private logClient;
|
|
18
|
-
private onKillCB?;
|
|
19
|
-
private unitWrapperWidget;
|
|
20
|
-
private unitWidgets;
|
|
21
|
-
private logWidget;
|
|
22
|
-
private phaseWidget;
|
|
23
|
-
__onPhaseChange(phase: Phase<string>): void;
|
|
24
|
-
__onUnitStatusChange(unit: BaseUnit): void;
|
|
25
|
-
/**
|
|
26
|
-
* Creates an instance of ConsoleScreen.
|
|
27
|
-
*
|
|
28
|
-
* @param units - The units this screen should keep track of
|
|
29
|
-
* @param {Widgets.IScreenOptions} [props] - The properties to apply to the screen widget.
|
|
30
|
-
* @param {ScreenKeyBinding[]} [keyBinding] - An array of key bindings for the screen widget.
|
|
31
|
-
*/
|
|
32
|
-
constructor(units: BaseUnit[], props?: Widgets.IScreenOptions, keyBinding?: ScreenKeyBinding[]);
|
|
33
|
-
private initLogger;
|
|
34
|
-
create(): this;
|
|
35
|
-
protected createContent(): void;
|
|
36
|
-
private createPhaseWidget;
|
|
37
|
-
private createUnitListWidget;
|
|
38
|
-
private createUnitItemWidget;
|
|
39
|
-
private createLogWidget;
|
|
40
|
-
protected render(): void;
|
|
41
|
-
private renderPhase;
|
|
42
|
-
private renderUnitList;
|
|
43
|
-
private renderLogs;
|
|
44
|
-
setKillCB(cb: AsyncVoidFunction): void;
|
|
45
|
-
private onUnitSelect;
|
|
46
|
-
}
|
|
47
|
-
export {};
|