Created
November 19, 2018 13:17
-
-
Save oops-wrong/30c7f55367666e6c42120dd4c9c9b9d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; | |
import { BehaviorSubject } from 'rxjs'; | |
import { DispatcherWorkload } from '~/shared/models/work-dispatcher.model'; | |
@Component({ | |
selector: 'workload-list-comp', | |
styleUrls: ['./workload-list.scss'], | |
templateUrl: './workload-list.html', | |
}) | |
export class WorkloadListComponent implements OnInit { | |
public showPopup = false; | |
@Input() | |
public dragOperation: boolean; | |
@Input() | |
public listOfWorkloads = new BehaviorSubject<DispatcherWorkload[]>([]); | |
@Input() | |
public shouldHideZeros = false; | |
@Output() | |
public disableWorkload = new EventEmitter<DispatcherWorkload>(); | |
public ngOnInit() {} | |
public onDisableWorkload(dispatcherWorkload: DispatcherWorkload) { | |
this.disableWorkload.emit({ ...dispatcherWorkload, active: !dispatcherWorkload.active }); | |
} | |
public toggleList(elem: any) { | |
elem.parentElement.parentElement.classList.toggle('active'); | |
} | |
public moveToTop(idx: number): void { | |
const res: DispatcherWorkload[] = this.listOfWorkloads.getValue(); | |
res.unshift(res.splice(idx, 1)[0]); | |
this.listOfWorkloads.next(res); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment