diff options
Diffstat (limited to 'webapp/src/app/devel/deploy')
-rw-r--r-- | webapp/src/app/devel/deploy/deploy.component.css | 45 | ||||
-rw-r--r-- | webapp/src/app/devel/deploy/deploy.component.html | 31 | ||||
-rw-r--r-- | webapp/src/app/devel/deploy/deploy.component.ts | 63 |
3 files changed, 139 insertions, 0 deletions
diff --git a/webapp/src/app/devel/deploy/deploy.component.css b/webapp/src/app/devel/deploy/deploy.component.css new file mode 100644 index 0000000..c1b39d8 --- /dev/null +++ b/webapp/src/app/devel/deploy/deploy.component.css @@ -0,0 +1,45 @@ +.vcenter { + display: inline-block; + vertical-align: middle; +} + +.blocks .btn-primary { + margin-left: 5px; + margin-right: 5px; + margin-top: 5px; + border-radius: 4px !important; +} + +.table-center { + width: 99%; + margin-left: auto; + margin-right: auto; +} + +.table-borderless>tbody>tr>td, +.table-borderless>tbody>tr>th, +.table-borderless>tfoot>tr>td, +.table-borderless>tfoot>tr>th, +.table-borderless>thead>tr>td, +.table-borderless>thead>tr>th { + border: none; +} + +.btn-large { + width: 10em; +} + +.fa-size-x2 { + font-size: 18px; +} + +.textarea-scroll { + width: 100%; + overflow-y: scroll; +} + +h2 { + font-family: sans-serif; + font-variant: small-caps; + font-size: x-large; +}
\ No newline at end of file diff --git a/webapp/src/app/devel/deploy/deploy.component.html b/webapp/src/app/devel/deploy/deploy.component.html new file mode 100644 index 0000000..7a15fa6 --- /dev/null +++ b/webapp/src/app/devel/deploy/deploy.component.html @@ -0,0 +1,31 @@ +<div class="panel panel-default"> + <div class="panel-heading"> + <h2 class="panel-title">Deployment</h2> + </div> + <div class="panel-body"> + <form [formGroup]="deployForm"> + <div class="col-xs-12"> + <table class="table table-borderless table-center"> + <tbody> + <tr> + <th>Board IP</th> + <td> <input type="text" style="width:99%;" formControlName="boardIP" placeholder="1.2.3.4"> </td> + </tr> + <tr> + <th>File to deploy</th> + <td> <input type="text" style="width:99%;" formControlName="wgtFile"> </td> + </tr> + </tbody> + </table> + </div> + <div class="row"> + <div class="col-xs-12 text-center"> + <div class="btn-group blocks"> + <button class="btn btn-primary btn-large" (click)="deploy()" [disabled]="!curProject ">Deploy</button> + </div> + </div> + </div> + </form> + + </div> +</div>
\ No newline at end of file diff --git a/webapp/src/app/devel/deploy/deploy.component.ts b/webapp/src/app/devel/deploy/deploy.component.ts new file mode 100644 index 0000000..4dba256 --- /dev/null +++ b/webapp/src/app/devel/deploy/deploy.component.ts @@ -0,0 +1,63 @@ +import { Component, OnInit, Input } from "@angular/core"; +import { Observable } from 'rxjs'; +import { FormControl, FormGroup, Validators, FormBuilder } from '@angular/forms'; + +import 'rxjs/add/operator/scan'; +import 'rxjs/add/operator/startWith'; + +import { XDSAgentService, IXDSDeploy } from "../../services/xdsagent.service"; +import { ConfigService, IConfig, IProject } from "../../services/config.service"; +import { AlertService, IAlert } from "../../services/alert.service"; +import { SdkService } from "../../services/sdk.service"; + +@Component({ + selector: 'panel-deploy', + moduleId: module.id, + templateUrl: './deploy.component.html', + styleUrls: ['./deploy.component.css'] +}) + +export class DeployComponent implements OnInit { + + @Input() curProject: IProject; + + deploying: boolean; + deployForm: FormGroup; + + constructor(private configSvr: ConfigService, + private xdsAgent: XDSAgentService, + private fb: FormBuilder, + private alert: AlertService, + ) { + this.deployForm = fb.group({ + boardIP: ["", Validators.nullValidator], + wgtFile: ["", Validators.nullValidator], + }); + } + + ngOnInit() { + this.deploying = false; + if (this.curProject && this.curProject.path) { + this.deployForm.patchValue({ wgtFile: this.curProject.path }); + } + } + + deploy() { + this.deploying = true; + + this.xdsAgent.deploy( + { + boardIP: this.deployForm.value.boardIP, + file: this.deployForm.value.wgtFile + } + ).subscribe(res => { + this.deploying = false; + }, err => { + this.deploying = false; + let msg = '<span>ERROR while deploying "' + this.deployForm.value.wgtFile + '"<br>'; + msg += err; + msg += '</span>'; + this.alert.error(msg); + }); + } +}
\ No newline at end of file |