mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-10 15:20:56 +00:00
toggle status lists
This commit is contained in:
parent
61b4de581d
commit
cf3de8cf35
@ -1,3 +1,3 @@
|
|||||||
<app-status-toggle></app-status-toggle>
|
<app-status-toggle (statusEvent)="onToggle($event)"></app-status-toggle>
|
||||||
<app-folder-list></app-folder-list>
|
<app-folder-list *ngIf="currentStatus===status.Folders"></app-folder-list>
|
||||||
<app-device-list></app-device-list>
|
<app-device-list *ngIf="currentStatus===status.Devices"></app-device-list>
|
@ -1,4 +1,6 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { Status } from '../status';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-status-list',
|
selector: 'app-status-list',
|
||||||
@ -6,10 +8,16 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
styleUrls: ['./status-list.component.scss']
|
styleUrls: ['./status-list.component.scss']
|
||||||
})
|
})
|
||||||
export class StatusListComponent implements OnInit {
|
export class StatusListComponent implements OnInit {
|
||||||
|
public currentStatus: Status = Status.Folders;
|
||||||
|
public status = Status;
|
||||||
|
|
||||||
constructor() { }
|
constructor() { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onToggle(s: Status) {
|
||||||
|
console.log("holy moly", s);
|
||||||
|
this.currentStatus = s;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<mat-button-toggle-group name="fontStyle" aria-label="Font Style">
|
<mat-button-toggle-group name="fontStyle" aria-label="Font Style" value="folders">
|
||||||
<mat-button-toggle value="folders" (click)="onSelect(toggleAction.Folders)">Folders</mat-button-toggle>
|
<mat-button-toggle value="folders" (click)="onSelect(status.Folders)">Folders</mat-button-toggle>
|
||||||
<mat-button-toggle value=" devices" (click)="onSelect(toggleAction.Devices)">Devices</mat-button-toggle>
|
<mat-button-toggle value="devices" (click)="onSelect(status.Devices)">Devices</mat-button-toggle>
|
||||||
</mat-button-toggle-group>
|
</mat-button-toggle-group>
|
@ -1,9 +1,7 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
|
||||||
|
import { Status } from '../status';
|
||||||
|
|
||||||
|
|
||||||
export enum ToggleAction {
|
|
||||||
Folders = 1,
|
|
||||||
Devices,
|
|
||||||
}
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-status-toggle',
|
selector: 'app-status-toggle',
|
||||||
@ -12,20 +10,20 @@ export enum ToggleAction {
|
|||||||
})
|
})
|
||||||
|
|
||||||
export class StatusToggleComponent implements OnInit {
|
export class StatusToggleComponent implements OnInit {
|
||||||
public toggleAction = ToggleAction
|
public status = Status
|
||||||
constructor() { }
|
@Output() statusEvent = new EventEmitter<Status>();
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
onSelect(label: ToggleAction): void {
|
onSelect(s: Status): void {
|
||||||
|
this.statusEvent.emit(s);
|
||||||
console.log("here?");
|
switch (s) {
|
||||||
switch (label) {
|
case Status.Folders:
|
||||||
case ToggleAction.Folders:
|
|
||||||
console.log("folder action");
|
console.log("folder action");
|
||||||
break;
|
break;
|
||||||
case ToggleAction.Devices:
|
case Status.Devices:
|
||||||
console.log("Device action");
|
console.log("Device action");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
4
src/app/status.ts
Normal file
4
src/app/status.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export enum Status {
|
||||||
|
Folders = 1,
|
||||||
|
Devices,
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user