summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-11-30 00:11:34 +0100
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-11-30 00:11:34 +0100
commitcd8d64e86de540aea78a253c5fcc7826e8f15456 (patch)
tree4120b442c7cf94890e4b12fbbac0cd2d54a5affb
parentb5f2398c5cfb44bc18b6d1ab7c59be0ef090d8cf (diff)
Fixed build page when no project exists
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
-rw-r--r--webapp/src/app/pages/build/build.component.html14
-rw-r--r--webapp/src/app/pages/build/build.component.ts71
-rw-r--r--webapp/src/app/pages/build/settings/project-select-dropdown.component.ts4
-rw-r--r--webapp/src/app/pages/config/config-xds/config-xds.component.ts2
-rw-r--r--webapp/src/app/pages/dashboard/dashboard.component.html5
5 files changed, 58 insertions, 38 deletions
diff --git a/webapp/src/app/pages/build/build.component.html b/webapp/src/app/pages/build/build.component.html
index 1ce9484..6c8df72 100644
--- a/webapp/src/app/pages/build/build.component.html
+++ b/webapp/src/app/pages/build/build.component.html
@@ -27,7 +27,7 @@
<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>
@@ -35,19 +35,19 @@
<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>
@@ -57,10 +57,10 @@
</nb-tab>
<nb-tab tabTitle="Deploy">
- <span> Content deploy...</span>
+ <br><span>&nbsp;&nbsp; Under construction...</span>
</nb-tab>
<nb-tab tabTitle="Debug">
- <span> Content debug...</span>
+ <br><span>&nbsp;&nbsp; Under construction...</span>
</nb-tab>
</nb-tabset>
</nb-card>
diff --git a/webapp/src/app/pages/build/build.component.ts b/webapp/src/app/pages/build/build.component.ts
index 99b7e54..681efe2 100644
--- a/webapp/src/app/pages/build/build.component.ts
+++ b/webapp/src/app/pages/build/build.component.ts
@@ -31,6 +31,7 @@ export class BuildComponent implements OnInit, AfterViewChecked {
public buildIsCollapsed = false;
public cmdOutput: string;
public cmdInfo: string;
+ public curPrj: IProject;
private startTime: Map<string, number> = new Map<string, number>();
@@ -42,11 +43,13 @@ export class BuildComponent implements OnInit, AfterViewChecked {
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;
@@ -76,66 +79,82 @@ export class BuildComponent implements OnInit, AfterViewChecked {
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();
diff --git a/webapp/src/app/pages/build/settings/project-select-dropdown.component.ts b/webapp/src/app/pages/build/settings/project-select-dropdown.component.ts
index a83ec0a..a99dc6b 100644
--- a/webapp/src/app/pages/build/settings/project-select-dropdown.component.ts
+++ b/webapp/src/app/pages/build/settings/project-select-dropdown.component.ts
@@ -28,7 +28,9 @@ export class ProjectSelectDropdownComponent implements OnInit {
}
select() {
- this.projectSvr.setCurrentById(this.curPrj.id);
+ if (this.curPrj) {
+ this.projectSvr.setCurrentById(this.curPrj.id);
+ }
}
}
diff --git a/webapp/src/app/pages/config/config-xds/config-xds.component.ts b/webapp/src/app/pages/config/config-xds/config-xds.component.ts
index e62cd37..bd46145 100644
--- a/webapp/src/app/pages/config/config-xds/config-xds.component.ts
+++ b/webapp/src/app/pages/config/config-xds/config-xds.component.ts
@@ -20,7 +20,7 @@ export class ConfigXdsComponent {
// TODO: cleanup agentStatus$: Observable<IAgentStatus>;
applying = false;
xdsServerUrl = '';
- server: IXDServerCfg = { id: '', url: '', connRetry: 10, connected: false };
+ server: IXDServerCfg = { id: '', url: 'http://localhost:8000', connRetry: 10, connected: false };
configFormChanged = false;
diff --git a/webapp/src/app/pages/dashboard/dashboard.component.html b/webapp/src/app/pages/dashboard/dashboard.component.html
index 9160019..ed6cfdb 100644
--- a/webapp/src/app/pages/dashboard/dashboard.component.html
+++ b/webapp/src/app/pages/dashboard/dashboard.component.html
@@ -1,10 +1,9 @@
<div class="row">
- Dashboard page...
- <!--
<div class="col-xxxl-3 col-md-6">
+ <!--
<ngx-status-card title="Light" type="primary">
<i class="nb-lightbulb"></i>
</ngx-status-card>
+ -->
</div>
--->
</div>