alfresco-ng2-components/demo-shell/src/app/components/app-layout/cloud/start-task-cloud-demo.component.ts
2019-02-12 01:18:43 +00:00

60 lines
1.9 KiB
TypeScript

/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { NotificationService } from '@alfresco/adf-core';
import { CloudLayoutService } from './services/cloud-layout.service';
@Component({
templateUrl: './start-task-cloud-demo.component.html',
styleUrls: ['./start-task-cloud-demo.component.scss']
})
export class StartTaskCloudDemoComponent implements OnInit {
applicationName;
constructor(
private cloudLayoutService: CloudLayoutService,
private route: ActivatedRoute,
private notificationService: NotificationService,
private router: Router) {
}
ngOnInit() {
this.route.parent.params.subscribe((params) => {
this.applicationName = params.applicationName;
});
}
onStartTaskSuccess() {
this.cloudLayoutService.setCurrentTaskFilterParam({key: 'my-tasks'});
this.router.navigate([`/cloud/${this.applicationName}/tasks`]);
}
onCancelStartTask() {
this.cloudLayoutService.setCurrentTaskFilterParam({key: 'my-tasks'});
this.router.navigate([`/cloud/${this.applicationName}/tasks`]);
}
openSnackMessage(event: any) {
this.notificationService.openSnackMessage(
event.response.body.message,
4000
);
}
}