1 import { Component, Input, Pipe, PipeTransform } from '@angular/core';
2 import { ProjectService, IProject, ProjectType, ProjectTypeEnum } from '../../../@core-xds/services/project.service';
3 import { AlertService } from '../../../@core-xds/services/alert.service';
7 selector: 'xds-project-card',
8 styleUrls: ['./project-card.component.scss'],
9 templateUrl: './project-card.component.html',
11 export class ProjectCardComponent {
13 // FIXME workaround of https://github.com/angular/angular-cli/issues/2034
14 // should be removed with angular 5
15 // @Input() project: IProject;
16 @Input() project = <IProject>null;
19 private alert: AlertService,
20 private projectSvr: ProjectService,
24 delete(prj: IProject) {
25 this.projectSvr.delete(prj).subscribe(
27 err => this.alert.error('ERROR delete: ' + err),
32 this.projectSvr.sync(prj).subscribe(
34 err => this.alert.error('ERROR: ' + err),
39 // Make Project type human readable
44 export class ProjectReadableTypePipe implements PipeTransform {
45 transform(type: ProjectTypeEnum): string {
47 case ProjectType.NATIVE_PATHMAP: return 'Native (path mapping)';
48 case ProjectType.SYNCTHING: return 'Cloud (Syncthing)';
49 default: return String(type);