<nb-card-body>
<nb-actions size="medium" fullWidth>
- <nb-action (click)="settingsShow()">
+ <nb-action (click)="settingsShow()" [disabled]="!isSetupValid()">
<i class="fa fa-cog"></i>
<span>Settings</span>
</nb-action>
<nb-action>
</nb-action>
- <nb-action (click)="clean()">
+ <nb-action (click)="clean()" [disabled]="!isSetupValid()">
<i class="fa fa-eraser"></i>
<span>Clean</span>
</nb-action>
- <nb-action (click)="preBuild()">
+ <nb-action (click)="preBuild()" [disabled]="!isSetupValid()">
<i class="nb-list"></i>
<span>Pre-Build</span>
</nb-action>
- <nb-action (click)="build()">
+ <nb-action (click)="build()" [disabled]="!isSetupValid()">
<i class="fa fa-wrench"></i>
<span>Build</span>
</nb-action>
- <nb-action (click)="populate()">
+ <nb-action (click)="populate()" [disabled]="!isSetupValid()">
<i class="fa fa-send"></i>
<span>Populate</span>
</nb-action>
</nb-tab>
<nb-tab tabTitle="Deploy">
- <span> Content deploy...</span>
+ <br><span> Under construction...</span>
</nb-tab>
<nb-tab tabTitle="Debug">
- <span> Content debug...</span>
+ <br><span> Under construction...</span>
</nb-tab>
</nb-tabset>
</nb-card>
public buildIsCollapsed = false;
public cmdOutput: string;
public cmdInfo: string;
+ public curPrj: IProject;
private startTime: Map<string, number> = new Map<string, number>();
private modalService: NgbModal,
) {
this.cmdOutput = '';
- this.cmdInfo = ''; // TODO: to be remove (only for debug)
-
+ this.cmdInfo = ''; // TODO: to be remove (only for debug)
}
ngOnInit() {
+ // Retreive current project
+ this.prjSvr.curProject$.subscribe(p => this.curPrj = p);
+
// Command output data tunneling
this.xdsSvr.CmdOutput$.subscribe(data => {
this.cmdOutput += data.stdout;
this.cmdOutput = '';
}
+ isSetupValid(): boolean {
+ return (typeof this.curPrj !== 'undefined');
+ }
+
settingsShow() {
+ if (!this.isSetupValid()) {
+ return this.alertSvr.warning('Please select first a valid project.', true);
+ }
+
const activeModal = this.modalService.open(BuildSettingsModalComponent, { size: 'lg', container: 'nb-layout' });
activeModal.componentInstance.modalHeader = 'Large Modal';
}
clean() {
- const curPrj = this.prjSvr.getCurrent();
+ if (!this.isSetupValid()) {
+ return this.alertSvr.warning('Please select first a valid project.', true);
+ }
this._exec(
- curPrj.uiSettings.cmdClean,
- curPrj.uiSettings.subpath,
+ this.curPrj.uiSettings.cmdClean,
+ this.curPrj.uiSettings.subpath,
[],
- curPrj.uiSettings.envVars.join(' '));
+ this.curPrj.uiSettings.envVars.join(' '));
}
preBuild() {
- const curPrj = this.prjSvr.getCurrent();
+ if (!this.isSetupValid()) {
+ return this.alertSvr.warning('Please select first a valid project.', true);
+ }
this._exec(
- curPrj.uiSettings.cmdPrebuild,
- curPrj.uiSettings.subpath,
+ this.curPrj.uiSettings.cmdPrebuild,
+ this.curPrj.uiSettings.subpath,
[],
- curPrj.uiSettings.envVars.join(' '));
+ this.curPrj.uiSettings.envVars.join(' '));
}
build() {
- const curPrj = this.prjSvr.getCurrent();
+ if (!this.isSetupValid()) {
+ return this.alertSvr.warning('Please select first a valid project.', true);
+ }
this._exec(
- curPrj.uiSettings.cmdBuild,
- curPrj.uiSettings.subpath,
+ this.curPrj.uiSettings.cmdBuild,
+ this.curPrj.uiSettings.subpath,
[],
- curPrj.uiSettings.envVars.join(' '),
+ this.curPrj.uiSettings.envVars.join(' '),
);
}
populate() {
- const curPrj = this.prjSvr.getCurrent();
+ if (!this.isSetupValid()) {
+ return this.alertSvr.warning('Please select first a valid project.', true);
+ }
this._exec(
- curPrj.uiSettings.cmdPopulate,
- curPrj.uiSettings.subpath,
+ this.curPrj.uiSettings.cmdPopulate,
+ this.curPrj.uiSettings.subpath,
[], // args
- curPrj.uiSettings.envVars.join(' '),
+ this.curPrj.uiSettings.envVars.join(' '),
);
}
execCmd() {
- const curPrj = this.prjSvr.getCurrent();
+ if (!this.isSetupValid()) {
+ return this.alertSvr.warning('Please select first a valid project.', true);
+ }
this._exec(
- curPrj.uiSettings.cmdArgs.join(' '),
- curPrj.uiSettings.subpath,
+ this.curPrj.uiSettings.cmdArgs.join(' '),
+ this.curPrj.uiSettings.subpath,
[],
- curPrj.uiSettings.envVars.join(' '),
+ this.curPrj.uiSettings.envVars.join(' '),
);
}
private _exec(cmd: string, dir: string, args: string[], env: string) {
- this.curProject = this.prjSvr.getCurrent();
- const prjID = this.curProject.id;
-
- if (!this.curProject) {
+ if (!this.isSetupValid()) {
return this.alertSvr.warning('No active project', true);
}
+ const prjID = this.curPrj.id;
this.cmdOutput += this._outputHeader();