X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=webapp%2Fsrc%2Fapp%2Fpages%2Fsdks%2Fsdk-management%2Fsdk-management.component.ts;h=20932d366d43fe3458e71f86c7a9a9926aece203;hb=6d14032f41c785bb397509f17764eb29b087ff0f;hp=6e9b81b8e20eb2645c4415d6fc81a15f74cfe8b1;hpb=6865cb1795a44e56c04fab9404dc60b8db7d6103;p=src%2Fxds%2Fxds-agent.git diff --git a/webapp/src/app/pages/sdks/sdk-management/sdk-management.component.ts b/webapp/src/app/pages/sdks/sdk-management/sdk-management.component.ts index 6e9b81b..20932d3 100644 --- a/webapp/src/app/pages/sdks/sdk-management/sdk-management.component.ts +++ b/webapp/src/app/pages/sdks/sdk-management/sdk-management.component.ts @@ -48,7 +48,6 @@ interface ISdkMgt extends ISdk { export class SdkManagementComponent implements OnInit { - sdks$: Observable; sdks: ISdkMgt[]; source: LocalDataSource = new LocalDataSource(); @@ -58,8 +57,9 @@ export class SdkManagementComponent implements OnInit { add: false, edit: false, delete: false, // TODO, add delete == uninstall + position: 'right', custom: [ - { name: 'install', title: '' }, + { name: 'install', title: '' }, ], }, delete: { @@ -68,8 +68,8 @@ export class SdkManagementComponent implements OnInit { }, columns: { name: { title: 'Name', editable: false }, - profile: { title: 'Profile', editable: false, filter: {} }, - arch: { title: 'Architecture', editable: false, filter: {} }, + profile: { title: 'Profile', editable: false, filter: { type: 'list', config: {} } }, + arch: { title: 'Architecture', editable: false, filter: { type: 'list', config: {} } }, version: { title: 'Version', editable: false }, // TODO: add status when delete supported: // status: { title: 'Status', editable: false }, @@ -84,10 +84,16 @@ export class SdkManagementComponent implements OnInit { ) { } ngOnInit() { + this.sdkSvr.Sdks$.subscribe(sdks => { const profMap = {}; const archMap = {}; this.sdks = []; + + if (sdks.length === 0) { + return; + } + sdks.forEach(s => { // only display not installed SDK if (s.status !== StatusType.NOT_INSTALLED) { @@ -105,14 +111,22 @@ export class SdkManagementComponent implements OnInit { }); + // Create new reference of settings object to trig ngOnChanges event in ng2-smart-table + // and consequently rebuild settings grid + this.settings = Object.assign({}, this.settings); + // Add text box filter for Profile and Arch columns - const profList = []; Object.keys(profMap).forEach(a => profList.push({ value: a, title: a })); + const profList = []; + Object.keys(profMap).forEach(a => profList.push({ value: a, title: a })); + this.settings.columns.profile.filter = { type: 'list', config: { selectText: 'Select...', list: profList }, }; - const archList = []; Object.keys(archMap).forEach(a => archList.push({ value: a, title: a })); + const archList = []; + Object.keys(archMap).forEach(a => archList.push({ value: a, title: a })); + this.settings.columns.arch.filter = { type: 'list', config: { selectText: 'Select...', list: archList },