Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import {Component, OnDestroy, OnInit} from '@angular/core';
- import {Response} from '@angular/http';
- import {JhiAlertService, JhiEventManager, JhiParseLinks} from 'ng-jhipster';
- import {NgProgressService} from 'ng2-progressbar';
- import {ITEMS_PER_PAGE} from '../../../shared/constants/pagination.constants';
- import {ActivatedRoute, Router} from '@angular/router';
- import {fadeInAnimation, slideDownAnimation} from '../../../shared/animation/custom.animation';
- import {SelectItem} from 'primeng/primeng';
- import {Principal} from '../../../shared/auth/principal.service';
- import {Account} from '../../../shared/user/account.model';
- import {TranslateService} from '@ngx-translate/core';
- import {DictService} from '../../../shared/services/dict.service';
- import {DictItem} from '../../../shared/services/dictitem.model';
- import {Subscription} from 'rxjs/Subscription';
- import {BaseListComponent} from '../../../shared/components/baselist.component';
- import {Scheduler} from '../model/scheduler.model';
- import {SchedulerService} from '../service/scheduler.service';
- @Component({
- templateUrl: './scheduler.component.html',
- animations: [
- slideDownAnimation,
- fadeInAnimation
- ],
- providers: [DictService]
- })
- export class SchedulerComponent extends BaseListComponent<Scheduler> implements OnInit, OnDestroy {
- private selectedItems: any[] = [];
- private manualChangeOptions: SelectItem[];
- constructor(private schedulerService: SchedulerService,
- protected translateService: TranslateService,
- protected alertService: JhiAlertService,
- protected router: Router,
- protected principal: Principal,
- protected parseLinks: JhiParseLinks,
- protected activatedRoute: ActivatedRoute,
- protected pbService: NgProgressService,
- private dictService: DictService) {
- super('admin/scheduler', alertService, router, principal, parseLinks, activatedRoute, pbService, translateService);
- }
- ngOnInit() {
- this.manualChangeOptions = [];
- this.translateService.get('hamsterApp.scheduler.buttons.stop').subscribe((itemLabel) => {
- this.manualChangeOptions.push({value: '0', label: itemLabel});
- });
- this.translateService.get('hamsterApp.scheduler.buttons.resume').subscribe((itemLabel) => {
- this.manualChangeOptions.push({value: '1', label: itemLabel});
- });
- this.loadAll();
- }
- // Funkcja powinna ładować listę
- loadAll() {
- this.pbService.start();
- this.selectedItems = [];
- this.schedulerService.getSchedulers().subscribe(
- res => this.onSuccess(res.json(), null),
- err => this.onError(err)
- );
- }
- // Inicjalizujemy filtr (w schedulerach nie bedzie potrzebne)
- initFilter(): void {
- this.filter = null
- }
- stopScheduler(name: string) {
- this.schedulerService.stopScheduler(name).subscribe(
- res => this.loadAll(),
- err => this.onError(err)
- );
- }
- resumeScheduler(name: string) {
- this.schedulerService.resumeScheduler(name).subscribe(
- res => this.loadAll(),
- err => this.onError(err)
- );
- }
- ngOnDestroy() {}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement