diff options
Diffstat (limited to 'webapp/src/app/config')
-rw-r--r-- | webapp/src/app/config/config.component.html | 14 | ||||
-rw-r--r-- | webapp/src/app/config/config.component.spec.ts | 25 | ||||
-rw-r--r-- | webapp/src/app/config/config.component.ts | 51 | ||||
-rw-r--r-- | webapp/src/app/config/downloadXdsAgent.component.ts | 22 |
4 files changed, 63 insertions, 49 deletions
diff --git a/webapp/src/app/config/config.component.html b/webapp/src/app/config/config.component.html index 4dbd238..ba3bd72 100644 --- a/webapp/src/app/config/config.component.html +++ b/webapp/src/app/config/config.component.html @@ -22,7 +22,7 @@ <td style="white-space: nowrap"> <div class="btn-group"> <button class="btn btn-link" (click)="xdsAgentRestartConn()"><span class="fa fa-refresh fa-size-x2"></span></button> - <dl-xds-agent class="button"></dl-xds-agent> + <xds-dwnl-agent class="button"></xds-dwnl-agent> </div> </td> </tr> @@ -62,7 +62,7 @@ </div> <div class="panel-body" [collapse]="sdksIsCollapsed"> <div class="row col-xs-12"> - <sdks-list-accordion [sdks]="(sdks$ | async)"></sdks-list-accordion> + <xds-sdks-list-accordion [sdks]="(sdks$ | async)"></xds-sdks-list-accordion> </div> </div> </div> @@ -82,16 +82,16 @@ </div> <div class="panel-body" [collapse]="projectsIsCollapsed"> <div class="row col-xs-12"> - <projects-list-accordion [projects]="(projects$ | async)"></projects-list-accordion> + <xds-projects-list-accordion [projects]="(projects$ | async)"></xds-projects-list-accordion> </div> </div> </div> <!-- Modals --> -<project-add-modal #childProjectModal [title]="'Add a new project'" [server-id]=curServerID> -</project-add-modal> -<sdk-add-modal #childSdkModal [title]="'Add a new SDK'"> -</sdk-add-modal> +<xds-project-add-modal #childProjectModal [title]="'Add a new project'" [server-id]=curServerID> +</xds-project-add-modal> +<xds-sdk-add-modal #childSdkModal [title]="'Add a new SDK'"> +</xds-sdk-add-modal> <!-- only for debug --> <div *ngIf="false" class="row"> diff --git a/webapp/src/app/config/config.component.spec.ts b/webapp/src/app/config/config.component.spec.ts new file mode 100644 index 0000000..ec5d3be --- /dev/null +++ b/webapp/src/app/config/config.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ConfigComponent } from './config.component'; + +describe('ConfigComponent', () => { + let component: ConfigComponent; + let fixture: ComponentFixture<ConfigComponent>; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ConfigComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ConfigComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/webapp/src/app/config/config.component.ts b/webapp/src/app/config/config.component.ts index 6377844..3db7f60 100644 --- a/webapp/src/app/config/config.component.ts +++ b/webapp/src/app/config/config.component.ts @@ -1,19 +1,20 @@ -import { Component, ViewChild, OnInit } from "@angular/core"; +import { Component, OnInit, ViewChild, ViewEncapsulation } from '@angular/core'; import { Observable } from 'rxjs/Observable'; -import { FormControl, FormGroup, Validators, FormBuilder } from '@angular/forms'; import { CollapseModule } from 'ngx-bootstrap/collapse'; -import { ConfigService, IConfig } from "../services/config.service"; -import { ProjectService, IProject } from "../services/project.service"; -import { XDSAgentService, IAgentStatus, IXDSConfig } from "../services/xdsagent.service"; -import { AlertService } from "../services/alert.service"; -import { ProjectAddModalComponent } from "../projects/projectAddModal.component"; -import { SdkService, ISdk } from "../services/sdk.service"; -import { SdkAddModalComponent } from "../sdks/sdkAddModal.component"; +import { ConfigService, IConfig } from '../services/config.service'; +import { ProjectService, IProject } from '../services/project.service'; +import { XDSAgentService, IAgentStatus, IXDSConfig } from '../services/xdsagent.service'; +import { AlertService } from '../services/alert.service'; +import { ProjectAddModalComponent } from '../projects/projectAddModal.component'; +import { SdkService, ISdk } from '../services/sdk.service'; +import { SdkAddModalComponent } from '../sdks/sdkAddModal.component'; @Component({ - templateUrl: './app/config/config.component.html', - styleUrls: ['./app/config/config.component.css'] + selector: 'app-config', + templateUrl: './config.component.html', + styleUrls: ['./config.component.css'], + encapsulation: ViewEncapsulation.None }) // Inspired from https://embed.plnkr.co/jgDTXknPzAaqcg9XA9zq/ @@ -31,20 +32,20 @@ export class ConfigComponent implements OnInit { curProj: number; curServer: number; curServerID: string; - userEditedLabel: boolean = false; + userEditedLabel = false; - gConfigIsCollapsed: boolean = true; - sdksIsCollapsed: boolean = true; - projectsIsCollapsed: boolean = false; + gConfigIsCollapsed = true; + sdksIsCollapsed = true; + projectsIsCollapsed = false; // TODO replace by reactive FormControl + add validation - xdsServerConnected: boolean = false; + xdsServerConnected = false; xdsServerUrl: string; xdsServerRetry: string; projectsRootDir: string; // FIXME: should be remove when projectAddModal will always return full path showApplyBtn = { // Used to show/hide Apply buttons - "retry": false, - "rootDir": false, + 'retry': false, + 'rootDir': false, }; constructor( @@ -70,7 +71,7 @@ export class ConfigComponent implements OnInit { if (!cfg || cfg.servers.length < 1) { return; } - let svr = cfg.servers[this.curServer]; + const svr = cfg.servers[this.curServer]; this.curServerID = svr.id; this.xdsServerConnected = svr.connected; this.xdsServerUrl = svr.url; @@ -81,16 +82,16 @@ export class ConfigComponent implements OnInit { submitGlobConf(field: string) { switch (field) { - case "retry": - let re = new RegExp('^[0-9]+$'); - let rr = parseInt(this.xdsServerRetry, 10); + case 'retry': + const re = new RegExp('^[0-9]+$'); + const rr = parseInt(this.xdsServerRetry, 10); if (re.test(this.xdsServerRetry) && rr >= 0) { this.xdsAgentSvr.setServerRetry(this.curServerID, rr); } else { - this.alert.warning("Not a valid number", true); + this.alert.warning('Not a valid number', true); } break; - case "rootDir": + case 'rootDir': this.configSvr.projectsRootDir = this.projectsRootDir; break; default: @@ -100,7 +101,7 @@ export class ConfigComponent implements OnInit { } xdsAgentRestartConn() { - let url = this.xdsServerUrl; + const url = this.xdsServerUrl; this.xdsAgentSvr.setServerUrl(this.curServerID, url); } diff --git a/webapp/src/app/config/downloadXdsAgent.component.ts b/webapp/src/app/config/downloadXdsAgent.component.ts index 0b63e50..3901331 100644 --- a/webapp/src/app/config/downloadXdsAgent.component.ts +++ b/webapp/src/app/config/downloadXdsAgent.component.ts @@ -1,7 +1,7 @@ -import { Component, Input, Pipe, PipeTransform } from '@angular/core'; +import { Component } from '@angular/core'; @Component({ - selector: 'dl-xds-agent', + selector: 'xds-dwnl-agent', template: ` <template #popTemplate> <h3>Install xds-agent:</h3> @@ -28,20 +28,8 @@ import { Component, Input, Pipe, PipeTransform } from '@angular/core'; `] }) -export class DlXdsAgentComponent { +export class DwnlAgentComponent { - public url_OS_Linux = "https://en.opensuse.org/LinuxAutomotive#Installation_AGL_XDS"; - public url_OS_Other = "https://github.com/iotbzh/xds-agent#how-to-install-on-other-platform"; -} - -@Pipe({ - name: 'capitalize' -}) -export class CapitalizePipe implements PipeTransform { - transform(value: string): string { - if (value) { - return value.charAt(0).toUpperCase() + value.slice(1); - } - return value; - } + public url_OS_Linux = 'https://en.opensuse.org/LinuxAutomotive#Installation_AGL_XDS'; + public url_OS_Other = 'https://github.com/iotbzh/xds-agent#how-to-install-on-other-platform'; } |