From e81706cf9c6a63a2e47a715f3d7d62931f7e003f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lukas=20Mau=C3=9F?= <lukas.mauss@mni.thm.de>
Date: Mon, 8 Oct 2018 19:41:51 +0200
Subject: [PATCH] Remove unused components

---
 src/app/app.module.ts                         |  4 +-
 ...collection-select-component.component.html |  3 -
 ...collection-select-component.component.scss |  0
 ...lection-select-component.component.spec.ts | 25 ------
 .../collection-select-component.component.ts  | 15 ----
 .../collection-select.component.html          | 19 -----
 .../collection-select.component.scss          |  0
 .../collection-select.component.spec.ts       | 25 ------
 .../collection-select.component.ts            | 78 -------------------
 .../content-list/content-list.component.ts    |  2 +-
 10 files changed, 2 insertions(+), 169 deletions(-)
 delete mode 100644 src/app/components/dialogs/collection-select-component/collection-select-component.component.html
 delete mode 100644 src/app/components/dialogs/collection-select-component/collection-select-component.component.scss
 delete mode 100644 src/app/components/dialogs/collection-select-component/collection-select-component.component.spec.ts
 delete mode 100644 src/app/components/dialogs/collection-select-component/collection-select-component.component.ts
 delete mode 100644 src/app/components/dialogs/collection-select/collection-select.component.html
 delete mode 100644 src/app/components/dialogs/collection-select/collection-select.component.scss
 delete mode 100644 src/app/components/dialogs/collection-select/collection-select.component.spec.ts
 delete mode 100644 src/app/components/dialogs/collection-select/collection-select.component.ts

diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 3d7a3b456..33af09b4b 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -146,7 +146,6 @@ export function dialogClose(dialogResult: any) {
     FooterComponent,
     FooterLoginDialogComponent,
     FooterImprintComponent,
-    CollectionSelectComponent,
   ],
   entryComponents: [
     RegisterComponent,
@@ -163,8 +162,7 @@ export function dialogClose(dialogResult: any) {
     ContentDeleteComponent,
     MarkdownHelpDialogComponent,
     GenericDataDialogComponent,
-    FooterLoginDialogComponent,
-    CollectionSelectComponent,
+    FooterLoginDialogComponent
   ],
   imports: [
     AppRoutingModule,
diff --git a/src/app/components/dialogs/collection-select-component/collection-select-component.component.html b/src/app/components/dialogs/collection-select-component/collection-select-component.component.html
deleted file mode 100644
index 8eb205d14..000000000
--- a/src/app/components/dialogs/collection-select-component/collection-select-component.component.html
+++ /dev/null
@@ -1,3 +0,0 @@
-<p>
-  collection-select-component works!
-</p>
diff --git a/src/app/components/dialogs/collection-select-component/collection-select-component.component.scss b/src/app/components/dialogs/collection-select-component/collection-select-component.component.scss
deleted file mode 100644
index e69de29bb..000000000
diff --git a/src/app/components/dialogs/collection-select-component/collection-select-component.component.spec.ts b/src/app/components/dialogs/collection-select-component/collection-select-component.component.spec.ts
deleted file mode 100644
index 763f10321..000000000
--- a/src/app/components/dialogs/collection-select-component/collection-select-component.component.spec.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { CollectionSelectComponentComponent } from './collection-select-component.component';
-
-describe('CollectionSelectComponentComponent', () => {
-  let component: CollectionSelectComponentComponent;
-  let fixture: ComponentFixture<CollectionSelectComponentComponent>;
-
-  beforeEach(async(() => {
-    TestBed.configureTestingModule({
-      declarations: [ CollectionSelectComponentComponent ]
-    })
-    .compileComponents();
-  }));
-
-  beforeEach(() => {
-    fixture = TestBed.createComponent(CollectionSelectComponentComponent);
-    component = fixture.componentInstance;
-    fixture.detectChanges();
-  });
-
-  it('should create', () => {
-    expect(component).toBeTruthy();
-  });
-});
diff --git a/src/app/components/dialogs/collection-select-component/collection-select-component.component.ts b/src/app/components/dialogs/collection-select-component/collection-select-component.component.ts
deleted file mode 100644
index 570dc1caa..000000000
--- a/src/app/components/dialogs/collection-select-component/collection-select-component.component.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { Component, OnInit } from '@angular/core';
-
-@Component({
-  selector: 'app-collection-select-component',
-  templateUrl: './collection-select-component.component.html',
-  styleUrls: ['./collection-select-component.component.scss']
-})
-export class CollectionSelectComponentComponent implements OnInit {
-
-  constructor() { }
-
-  ngOnInit() {
-  }
-
-}
diff --git a/src/app/components/dialogs/collection-select/collection-select.component.html b/src/app/components/dialogs/collection-select/collection-select.component.html
deleted file mode 100644
index e0cc61ffb..000000000
--- a/src/app/components/dialogs/collection-select/collection-select.component.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<form>
-  <div fxLayout="column" fxLayoutAlign="center" fxLayoutGap="10px">
-    <h3>
-      Please select a collection or enter a new one!
-    </h3>
-      <mat-form-field>
-        <input type="text" matInput [formControl]="myControl" [matAutocomplete]="auto"
-               placeholder="Collection name"/>
-        <mat-autocomplete #auto="matAutocomplete">
-          <mat-option *ngFor="let collection of filteredOptions | async" [value]="collection">
-            {{collection}}
-          </mat-option>
-        </mat-autocomplete>
-      </mat-form-field>
-    <button mat-raised-button color="primary" (click)="onNoClick()">
-      Done
-    </button>
-  </div>
-</form>
diff --git a/src/app/components/dialogs/collection-select/collection-select.component.scss b/src/app/components/dialogs/collection-select/collection-select.component.scss
deleted file mode 100644
index e69de29bb..000000000
diff --git a/src/app/components/dialogs/collection-select/collection-select.component.spec.ts b/src/app/components/dialogs/collection-select/collection-select.component.spec.ts
deleted file mode 100644
index cc4ea9286..000000000
--- a/src/app/components/dialogs/collection-select/collection-select.component.spec.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { CollectionSelectComponent } from './collection-select.component';
-
-describe('CollectionSelectComponent', () => {
-  let component: CollectionSelectComponent;
-  let fixture: ComponentFixture<CollectionSelectComponent>;
-
-  beforeEach(async(() => {
-    TestBed.configureTestingModule({
-      declarations: [ CollectionSelectComponent ]
-    })
-    .compileComponents();
-  }));
-
-  beforeEach(() => {
-    fixture = TestBed.createComponent(CollectionSelectComponent);
-    component = fixture.componentInstance;
-    fixture.detectChanges();
-  });
-
-  it('should create', () => {
-    expect(component).toBeTruthy();
-  });
-});
diff --git a/src/app/components/dialogs/collection-select/collection-select.component.ts b/src/app/components/dialogs/collection-select/collection-select.component.ts
deleted file mode 100644
index 5c93d4389..000000000
--- a/src/app/components/dialogs/collection-select/collection-select.component.ts
+++ /dev/null
@@ -1,78 +0,0 @@
-import { Component, Inject, OnInit } from '@angular/core';
-import { RoomService } from '../../../services/http/room.service';
-import { Room } from '../../../models/room';
-import { Router } from '@angular/router';
-import { NotificationService } from '../../../services/util/notification.service';
-import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
-import { FormControl } from '@angular/forms';
-import { map, startWith } from 'rxjs/operators';
-import { Observable } from 'rxjs';
-import { ContentText } from '../../../models/content-text';
-import { ContentService } from '../../../services/http/content.service';
-
-@Component({
-  selector: 'app-collection-select',
-  templateUrl: './collection-select.component.html',
-  styleUrls: ['./collection-select.component.scss']
-})
-export class CollectionSelectComponent implements OnInit {
-
-  name: string;
-  room: Room;
-  content: ContentText;
-  roomId: string;
-  collections: string[] = ['ARSnova', 'Angular', 'HTML', 'TypeScript' ];
-  myControl = new FormControl();
-  filteredOptions: Observable<string[]>;
-
-  constructor(private roomService: RoomService,
-              private contentService: ContentService,
-              private router: Router,
-              private notificationService: NotificationService,
-              public dialogRef: MatDialogRef<CollectionSelectComponent>,
-              @Inject(MAT_DIALOG_DATA) public data: any) {
-  }
-
-  onNoClick(): void {
-    this.dialogRef.close();
-  }
-
-  ngOnInit() {
-    this.filteredOptions = this.myControl.valueChanges
-      .pipe(
-        startWith(''),
-        map(value => this._filter(value))
-      );
-  }
-
-
-  private _filter(value: string): string[] {
-    const filterValue = value.toLowerCase();
-
-    return this.collections.filter(collection => collection.toLowerCase().includes(filterValue));
-  }
-
-  resetAfterSubmit() {
-    this.content.subject = '';
-    this.content.body = '';
-    this.notificationService.show('Content submitted. Ready for creation of new content.');
-  }
-
-  submitContent(subject: string, body: string) {
-    this.contentService.addContent(new ContentText(
-      '1',
-      '1',
-      this.roomId,
-      subject,
-      body,
-      1,
-      [],
-    )).subscribe();
-    if (this.content.body.valueOf() === '' || this.content.body.valueOf() === '') {
-      this.notificationService.show('No empty fields allowed. Please check subject and body.');
-      return;
-    }
-    this.notificationService.show('Content submitted.');
-    this.resetAfterSubmit();
-  }
-}
diff --git a/src/app/components/fragments/content-list/content-list.component.ts b/src/app/components/fragments/content-list/content-list.component.ts
index f30699b91..62806aa2d 100644
--- a/src/app/components/fragments/content-list/content-list.component.ts
+++ b/src/app/components/fragments/content-list/content-list.component.ts
@@ -176,7 +176,7 @@ export class ContentListComponent implements OnInit {
     } else {
       if (action.valueOf() === 'delete') {
         this.notificationService.show('Content "' + this.contents[index].subject + '" deleted.');
-        this.contentService.deleteContent(this.contents[index].contentId);
+        this.contentService.deleteContent(this.contents[index].id);
         this.contents.splice(index, 1);
       }
       if (action.valueOf() === 'edit') {
-- 
GitLab