summaryrefslogtreecommitdiffstats
path: root/webapp/src/app/projects/projectCard.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/src/app/projects/projectCard.component.ts')
-rw-r--r--webapp/src/app/projects/projectCard.component.ts63
1 files changed, 63 insertions, 0 deletions
diff --git a/webapp/src/app/projects/projectCard.component.ts b/webapp/src/app/projects/projectCard.component.ts
new file mode 100644
index 0000000..010b476
--- /dev/null
+++ b/webapp/src/app/projects/projectCard.component.ts
@@ -0,0 +1,63 @@
+import { Component, Input, Pipe, PipeTransform } from '@angular/core';
+import { ConfigService, IProject, ProjectType } from "../common/config.service";
+
+@Component({
+ selector: 'project-card',
+ template: `
+ <div class="row">
+ <div class="col-xs-12">
+ <div class="text-right" role="group">
+ <button class="btn btn-link" (click)="delete(project)"><span class="fa fa-trash fa-size-x2"></span></button>
+ </div>
+ </div>
+ </div>
+
+ <table class="table table-striped">
+ <tbody>
+ <tr>
+ <th><span class="fa fa-fw fa-id-badge"></span>&nbsp;<span>Project ID</span></th>
+ <td>{{ project.id }}</td>
+ </tr>
+ <tr>
+ <th><span class="fa fa-fw fa-folder-open-o"></span>&nbsp;<span>Folder path</span></th>
+ <td>{{ project.path}}</td>
+ </tr>
+ <tr>
+ <th><span class="fa fa-fw fa-exchange"></span>&nbsp;<span>Synchronization type</span></th>
+ <td>{{ project.type | readableType }}</td>
+ </tr>
+
+ </tbody>
+ </table >
+ `,
+ 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);
+ }
+ }
+} \ No newline at end of file