aboutsummaryrefslogtreecommitdiffstats
path: root/webapp/src/app/devel/build/build.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/src/app/devel/build/build.component.ts')
-rw-r--r--webapp/src/app/devel/build/build.component.ts102
1 files changed, 36 insertions, 66 deletions
diff --git a/webapp/src/app/devel/build/build.component.ts b/webapp/src/app/devel/build/build.component.ts
index 87df4e1..49f42eb 100644
--- a/webapp/src/app/devel/build/build.component.ts
+++ b/webapp/src/app/devel/build/build.component.ts
@@ -1,21 +1,21 @@
-import { Component, AfterViewChecked, ElementRef, ViewChild, OnInit, Input } from '@angular/core';
-import { Observable } from 'rxjs';
+import { Component, ViewEncapsulation, AfterViewChecked, ElementRef, ViewChild, OnInit, Input } from '@angular/core';
+import { Observable } from 'rxjs/Observable';
import { FormControl, FormGroup, Validators, FormBuilder } from '@angular/forms';
import { CookieService } from 'ngx-cookie';
import 'rxjs/add/operator/scan';
import 'rxjs/add/operator/startWith';
-import { XDSAgentService, ICmdOutput } from "../../services/xdsagent.service";
-import { ProjectService, IProject } from "../../services/project.service";
-import { AlertService, IAlert } from "../../services/alert.service";
-import { SdkService } from "../../services/sdk.service";
+import { XDSAgentService, ICmdOutput } from '../../services/xdsagent.service';
+import { ProjectService, IProject } from '../../services/project.service';
+import { AlertService, IAlert } from '../../services/alert.service';
+import { SdkService } from '../../services/sdk.service';
@Component({
- selector: 'panel-build',
- moduleId: module.id,
+ selector: 'xds-panel-build',
templateUrl: './build.component.html',
- styleUrls: ['./build.component.css']
+ styleUrls: ['./build.component.css'],
+encapsulation: ViewEncapsulation.None
})
export class BuildComponent implements OnInit, AfterViewChecked {
@@ -24,9 +24,9 @@ export class BuildComponent implements OnInit, AfterViewChecked {
@Input() curProject: IProject;
public buildForm: FormGroup;
- public subpathCtrl = new FormControl("", Validators.required);
- public debugEnable: boolean = false;
- public buildIsCollapsed: boolean = false;
+ public subpathCtrl = new FormControl('', Validators.required);
+ public debugEnable = false;
+ public buildIsCollapsed = false;
public cmdOutput: string;
public cmdInfo: string;
@@ -39,16 +39,16 @@ export class BuildComponent implements OnInit, AfterViewChecked {
private sdkSvr: SdkService,
private cookie: CookieService,
) {
- this.cmdOutput = "";
- this.cmdInfo = ""; // TODO: to be remove (only for debug)
+ this.cmdOutput = '';
+ this.cmdInfo = ''; // TODO: to be remove (only for debug)
this.buildForm = fb.group({
subpath: this.subpathCtrl,
- cmdClean: ["", Validators.nullValidator],
- cmdPrebuild: ["", Validators.nullValidator],
- cmdBuild: ["", Validators.nullValidator],
- cmdPopulate: ["", Validators.nullValidator],
- cmdArgs: ["", Validators.nullValidator],
- envVars: ["", Validators.nullValidator],
+ cmdClean: ['', Validators.nullValidator],
+ cmdPrebuild: ['', Validators.nullValidator],
+ cmdBuild: ['', Validators.nullValidator],
+ cmdPopulate: ['', Validators.nullValidator],
+ cmdArgs: ['', Validators.nullValidator],
+ envVars: ['', Validators.nullValidator],
});
}
@@ -56,13 +56,13 @@ export class BuildComponent implements OnInit, AfterViewChecked {
// Set default settings
// TODO save & restore values from cookies
this.buildForm.patchValue({
- subpath: "",
- cmdClean: "rm -rf build",
- cmdPrebuild: "mkdir -p build && cd build && cmake ..",
- cmdBuild: "cd build && make",
- cmdPopulate: "cd build && make remote-target-populate",
- cmdArgs: "",
- envVars: "",
+ subpath: '',
+ cmdClean: 'rm -rf build',
+ cmdPrebuild: 'mkdir -p build && cd build && cmake ..',
+ cmdBuild: 'cd build && make',
+ cmdPopulate: 'cd build && make remote-target-populate',
+ cmdArgs: '',
+ envVars: '',
});
// Command output data tunneling
@@ -79,14 +79,14 @@ export class BuildComponent implements OnInit, AfterViewChecked {
}
if (exit && exit.code !== 0) {
- this.cmdOutput += "--- Command exited with code " + exit.code + " ---\n\n";
+ this.cmdOutput += '--- Command exited with code ' + exit.code + ' ---\n\n';
}
});
this._scrollToBottom();
// only use for debug
- this.debugEnable = (this.cookie.get("debug_build") === "1");
+ this.debugEnable = (this.cookie.get('debug_build') === '1');
}
ngAfterViewChecked() {
@@ -145,17 +145,17 @@ export class BuildComponent implements OnInit, AfterViewChecked {
this.alertSvr.warning('No active project', true);
}
- let prjID = this.curProject.id;
+ const prjID = this.curProject.id;
this.cmdOutput += this._outputHeader();
- let sdkid = this.sdkSvr.getCurrentId();
+ const sdkid = this.sdkSvr.getCurrentId();
// Detect key=value in env string to build array of string
- let envArr = [];
+ const envArr = [];
env.split(';').forEach(v => envArr.push(v.trim()));
- let t0 = performance.now();
+ const t0 = performance.now();
this.cmdInfo = 'Start build of ' + prjID + ' at ' + t0;
this.xdsSvr.exec(prjID, dir, cmd, sdkid, args, envArr)
@@ -168,36 +168,6 @@ export class BuildComponent implements OnInit, AfterViewChecked {
});
}
- make(args: string) {
- if (!this.curProject) {
- this.alertSvr.warning('No active project', true);
- }
-
- let prjID = this.curProject.id;
-
- this.cmdOutput += this._outputHeader();
-
- let sdkid = this.sdkSvr.getCurrentId();
-
- let argsArr = args ? args.split(' ') : this.buildForm.value.cmdArgs.split(' ');
-
- // Detect key=value in env string to build array of string
- let envArr = [];
- this.buildForm.value.envVars.split(';').forEach(v => envArr.push(v.trim()));
-
- let t0 = performance.now();
- this.cmdInfo = 'Start build of ' + prjID + ' at ' + t0;
-
- this.xdsSvr.make(prjID, this.buildForm.value.subpath, sdkid, argsArr, envArr)
- .subscribe(res => {
- this.startTime.set(String(res.cmdID), t0);
- },
- err => {
- this.cmdInfo = 'Last command duration: ' + this._computeTime(t0);
- this.alertSvr.error('ERROR: ' + err);
- });
- }
-
private _scrollToBottom(): void {
try {
this.scrollContainer.nativeElement.scrollTop = this.scrollContainer.nativeElement.scrollHeight;
@@ -205,7 +175,7 @@ export class BuildComponent implements OnInit, AfterViewChecked {
}
private _computeTime(t0: number, t1?: number): string {
- let enlap = Math.round((t1 || performance.now()) - t0);
+ const enlap = Math.round((t1 || performance.now()) - t0);
if (enlap < 1000.0) {
return enlap.toFixed(2) + ' ms';
} else {
@@ -214,10 +184,10 @@ export class BuildComponent implements OnInit, AfterViewChecked {
}
private _outputHeader(): string {
- return "--- " + new Date().toString() + " ---\n";
+ return '--- ' + new Date().toString() + ' ---\n';
}
private _outputFooter(): string {
- return "\n";
+ return '\n';
}
}