summaryrefslogtreecommitdiffstats
path: root/webapp/src/app/config/downloadXdsAgent.component.ts
blob: b35a17fd8196fd18ad53af0a87bc22c76032e6c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import { Component, Input, Pipe, PipeTransform } from '@angular/core';

import { IxdsAgentPackage } from "../services/config.service";

@Component({
    selector: 'dl-xds-agent',
    /* XXX - cleanup
    template: `
        <template #popTemplate>
            <h3>Download xds-agent packages:</h3>
            <ul>
                <li *ngFor="let p of packageUrls">
                    <a href="{{p.url}}">{{p.os | capitalize}} - {{p.arch}} ({{p.version}}) </a>
                </li>
            </ul>
            <button type="button" class="btn btn-sm" (click)="pop.hide()"> Cancel </button>
        </template>
        <button type="button" class="btn btn-link fa fa-download fa-size-x2"
            [popover]="popTemplate"
            #pop="bs-popover"
            placement="left">
        </button>
    `,
*/
    template: `
        <template #popTemplate>
            <h3>Install xds-agent:</h3>
            <ul>
                <li>On Linux machine <a href="{{url_OS_Linux}}" target="_blank">
                <span class="fa fa-external-link"></span></a></li>

                <li>On Windows machine <a href="{{url_OS_Other}}" target="_blank"><span class="fa fa-external-link"></span></a></li>

                <li>On MacOS machine <a href="{{url_OS_Other}}" target="_blank"><span class="fa fa-external-link"></span></a></li>
            </ul>
            <button type="button" class="btn btn-sm" (click)="pop.hide()"> Cancel </button>
        </template>
        <button type="button" class="btn btn-link fa fa-download fa-size-x2"
            [popover]="popTemplate"
            #pop="bs-popover"
            placement="left">
        </button>
        `,
    styles: [`
        .fa-size-x2 {
            font-size: 20px;
        }
    `]
})

export class DlXdsAgentComponent {

    @Input() packageUrls: IxdsAgentPackage[];

    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;
    }
}