/** * Run shell commands * @param {*} options * @param {*} callback */ const runCommand = (options, callback) => { const { cmd, ...rest } = options; // create an array of observables const combine = () => cmd.map((command, idx) => { const runner = manager[command]; const result$ = runner(rest, idx); return result$.pipe(catchError(error => log.error(error))); }); // subscribe to observables in order as previous completes concat(...combine()).subscribe(result => callback(result)); }
getMe() { this._userService.getMe().subscribe(me => { this.me = me; this.name = this.me.name; this.username = this.me.username; this.profile_picture = this.me.profile_picture; }); }
setLayout(layout: LayoutSettings) { this.projectData.hmi.layout = layout; if (environment.serverEnabled) { this.setServerProjectData(ProjectDataCmdType.HmiLayout, layout).subscribe(result => { }, err => { console.log(err); this.notifySaveError(err); }); } }
ngOnInit() { // load the initial bank list this.filteredBanks.next(this.banks.slice()); // listen for search field value changes this.bankFilterCtrl.valueChanges .pipe(takeUntil(this._onDestroy)) .subscribe(() => { this.filterBanks(); }); }
startDemo() { this.stopDemo(); let sourcetimer = timer(2000, 1500); this.subscription = sourcetimer.subscribe(t => { this.demoValue(); }); }
public deleteSelectedCustomer(): void { if (!this.selectedCustomer) { return; } this._customerApiService.remove(this.selectedCustomer.id) .subscribe(() => this.refresh()); }
ngOnInit() { Object.keys(this.statusText).forEach(key => { this.translateService.get(this.statusText[key]).subscribe((txt: string) => { this.statusText[key] = txt }); }); Object.keys(this.priorityText).forEach(key => { this.translateService.get(this.priorityText[key]).subscribe((txt: string) => { this.priorityText[key] = txt }); }); }
ngOnInit() { if (this.link) { // input this.urlSafe = this.sanitizer.bypassSecurityTrustResourceUrl(this.link); } else { this.subscription = this.activeroute.params.subscribe(params => { // routing this.link = params['url']; this.urlSafe = this.sanitizer.bypassSecurityTrustResourceUrl(this.link); }); } }
//#region Project Events onNewProject() { try { let msg = ''; this.translateService.get('msg.project-save-ask').subscribe((txt: string) => { msg = txt }); if (window.confirm(msg)) { this.projectService.saveProject(); this.projectService.setNewProject(); } } catch (e) { } }
private securityModeToString(mode): string { let secMode = MessageSecurityMode; let result = ''; if (mode === secMode.NONE) { this.translateService.get('device.security-none').subscribe((txt: string) => { result = txt }); } else if (mode === secMode.SIGN) { this.translateService.get('device.security-sign').subscribe((txt: string) => { result = txt }); } else if (mode === secMode.SIGNANDENCRYPT) { this.translateService.get('device.security-signandencrypt').subscribe((txt: string) => { result = txt }); } return result; }
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen, public keyboard: Keyboard ) { platform.ready().then(() => { console.log = function(){}; statusBar.styleDefault(); splashScreen.hide(); timer(1000).subscribe(() => this.showSplash = false) // <-- hide animation after 3s }); }
this.projectService.getDeviceSecurity(this.data.device.name).subscribe(result => { this.setSecurity(result.value); }, err => { console.log('get Device Security err: ' + err); });
private notifyServerError() { let msg = ''; this.translateService.get('msg.server-connection-error').subscribe((txt: string) => { msg = txt }); this.toastr.error(msg, '', { timeOut: 3000, closeButton: true, disableTimeOut: true }); }
//#region Notify private notifySaveError() { let msg = ''; this.translateService.get('msg.users-save-error').subscribe((txt: string) => { msg = txt }); this.toastr.error(msg, '', { timeOut: 3000, closeButton: true, disableTimeOut: true }); }