import { Component, Input, Pipe, PipeTransform } from '@angular/core';
import { ConfigService, IProject, ProjectType } from "../services/config.service";
@Component({
selector: 'project-card',
template: `
Project ID |
{{ project.id }} |
Folder path |
{{ project.path}} |
Synchronization type |
{{ project.type | readableType }} |
`,
styleUrls: ['./app/config/config.component.css']
})
export class ProjectCardComponent {
@Input() project: IProject;
constructor(private configSvr: ConfigService) {
}
delete(prj: IProject) {
this.configSvr.deleteProject(prj);
}
}
// Remove APPS. prefix if translate has failed
@Pipe({
name: 'readableType'
})
export class ProjectReadableTypePipe implements PipeTransform {
transform(type: ProjectType): string {
switch (+type) {
case ProjectType.NATIVE: return "Native";
case ProjectType.SYNCTHING: return "Cloud (Syncthing)";
default: return String(type);
}
}
}