1 import { Component, Input, Pipe, PipeTransform } from '@angular/core';
2 import { ConfigService, IProject, ProjectType } from "../services/config.service";
3 import { AlertService } from "../services/alert.service";
6 selector: 'project-card',
9 <div class="col-xs-12">
10 <div class="text-right" role="group">
11 <button class="btn btn-link" (click)="delete(project)"><span class="fa fa-trash fa-size-x2"></span></button>
16 <table class="table table-striped">
19 <th><span class="fa fa-fw fa-id-badge"></span> <span>Project ID</span></th>
20 <td>{{ project.id }}</td>
23 <th><span class="fa fa-fw fa-exchange"></span> <span>Sharing type</span></th>
24 <td>{{ project.type | readableType }}</td>
27 <th><span class="fa fa-fw fa-folder-open-o"></span> <span>Local path</span></th>
28 <td>{{ project.pathClient }}</td>
30 <tr *ngIf="project.pathServer != ''">
31 <th><span class="fa fa-fw fa-folder-open-o"></span> <span>Server path</span></th>
32 <td>{{ project.pathServer }}</td>
36 <th><span class="fa fa-fw fa-status"></span> <span>Status</span></th>
37 <td>{{ project.remotePrjDef.status }}</td>
43 styleUrls: ['./app/config/config.component.css']
46 export class ProjectCardComponent {
48 @Input() project: IProject;
51 private alert: AlertService,
52 private configSvr: ConfigService
57 delete(prj: IProject) {
58 this.configSvr.deleteProject(prj)
61 this.alert.error("Delete local ERROR: " + err);
67 // Remove APPS. prefix if translate has failed
72 export class ProjectReadableTypePipe implements PipeTransform {
73 transform(type: ProjectType): string {
75 case ProjectType.NATIVE_PATHMAP: return "Native (path mapping)";
76 case ProjectType.SYNCTHING: return "Cloud (Syncthing)";
77 default: return String(type);