mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-3775] APS 2 Process and Task view in the ADF Demo Application (#4035)
* [ADF-3775] Created breadcrumb component for layout demo * [ADF-3775] Created filter demo component * [ADF-3775] Created apps demo component * [ADF-3775] Created tasks list cloud demo component * [ADF-3775] Created tasks process cloud demo component * [ADF-3775] Created new cloud layout component * [ADF-3775] Improved translation * [ADF-3775] Fixed translation * [ADF-3775] Improved layout * Use the EditTaskFilters TaskFilterCloud should have a stream of filter Fix integration issues * Remove useless route Enable start task cloud button * Remove useless pages and handle start task error event * Fix wrong unit test * Use the Process Cloud menu name
This commit is contained in:
committed by
Eugenio Romano
parent
4302cfbd04
commit
ced1901c89
@@ -273,7 +273,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"PROCESS_LIST_CLOUD": {
|
"PROCESS_LIST_CLOUD_DEMO": {
|
||||||
"TITLE": "PROCESS LIST CLOUD DEMO"
|
"TITLE": "PROCESS LIST CLOUD DEMO",
|
||||||
|
"CUSTOMIZE_FILTERS": "Customise your filter"
|
||||||
|
},
|
||||||
|
"TASK_LIST_CLOUD_DEMO": {
|
||||||
|
"CUSTOMIZE_FILTERS": "Customise your filter"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -64,11 +64,16 @@ import { InsightsModule } from '@alfresco/adf-insights';
|
|||||||
import { ProcessModule } from '@alfresco/adf-process-services';
|
import { ProcessModule } from '@alfresco/adf-process-services';
|
||||||
import { AuthBearerInterceptor } from './services';
|
import { AuthBearerInterceptor } from './services';
|
||||||
import { ProcessServicesCloudModule } from '@alfresco/adf-process-services-cloud';
|
import { ProcessServicesCloudModule } from '@alfresco/adf-process-services-cloud';
|
||||||
import { CloudComponent } from './components/cloud/cloud.component';
|
|
||||||
import { TaskListCloudDemoComponent } from './components/task-list-cloud-demo/task-list-cloud-demo.component';
|
|
||||||
import { ProcessListCloudExampleComponent } from './components/cloud/process-list-cloud-example.component';
|
|
||||||
import { TreeViewSampleComponent } from './components/tree-view/tree-view-sample.component';
|
import { TreeViewSampleComponent } from './components/tree-view/tree-view-sample.component';
|
||||||
import { AppExtensionsModule } from './extensions/extensions.module';
|
import { AppExtensionsModule } from './extensions/extensions.module';
|
||||||
|
import { CloudLayoutComponent } from './components/app-layout/cloud/cloud-layout.component';
|
||||||
|
import { AppsCloudDemoComponent } from './components/app-layout/cloud/apps-cloud-demo.component';
|
||||||
|
import { ProcessesCloudDemoComponent } from './components/app-layout/cloud/processes-cloud-demo.component';
|
||||||
|
import { StartTaskCloudDemoComponent } from './components/app-layout/cloud/start-task-cloud-demo.component';
|
||||||
|
import { CloudBreadcrumbsComponent } from './components/app-layout/cloud/cloud-breadcrumb-component';
|
||||||
|
import { TasksCloudDemoComponent } from './components/app-layout/cloud/tasks-cloud-demo.component';
|
||||||
|
import { CloudFiltersDemoComponent } from './components/app-layout/cloud/cloud-filters-demo.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
@@ -92,7 +97,6 @@ import { AppExtensionsModule } from './extensions/extensions.module';
|
|||||||
declarations: [
|
declarations: [
|
||||||
AppComponent,
|
AppComponent,
|
||||||
LoginComponent,
|
LoginComponent,
|
||||||
CloudComponent,
|
|
||||||
LogoutComponent,
|
LogoutComponent,
|
||||||
AppLayoutComponent,
|
AppLayoutComponent,
|
||||||
HomeComponent,
|
HomeComponent,
|
||||||
@@ -118,10 +122,14 @@ import { AppExtensionsModule } from './extensions/extensions.module';
|
|||||||
DemoPermissionComponent,
|
DemoPermissionComponent,
|
||||||
FormLoadingComponent,
|
FormLoadingComponent,
|
||||||
ReportIssueComponent,
|
ReportIssueComponent,
|
||||||
TaskListCloudDemoComponent,
|
|
||||||
ProcessListCloudExampleComponent,
|
|
||||||
TreeViewSampleComponent,
|
TreeViewSampleComponent,
|
||||||
TaskListCloudDemoComponent
|
CloudLayoutComponent,
|
||||||
|
AppsCloudDemoComponent,
|
||||||
|
TasksCloudDemoComponent,
|
||||||
|
ProcessesCloudDemoComponent,
|
||||||
|
StartTaskCloudDemoComponent,
|
||||||
|
CloudBreadcrumbsComponent,
|
||||||
|
CloudFiltersDemoComponent
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
{
|
{
|
||||||
|
@@ -40,10 +40,12 @@ import { FormLoadingComponent } from './components/form/form-loading.component';
|
|||||||
import { DemoPermissionComponent } from './components/permissions/demo-permissions.component';
|
import { DemoPermissionComponent } from './components/permissions/demo-permissions.component';
|
||||||
import { ReportIssueComponent } from './components/report-issue/report-issue.component';
|
import { ReportIssueComponent } from './components/report-issue/report-issue.component';
|
||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
import { CloudComponent } from './components/cloud/cloud.component';
|
|
||||||
import { TaskListCloudDemoComponent } from './components/task-list-cloud-demo/task-list-cloud-demo.component';
|
|
||||||
import { ProcessListCloudExampleComponent } from './components/cloud/process-list-cloud-example.component';
|
|
||||||
import { TreeViewSampleComponent } from './components/tree-view/tree-view-sample.component';
|
import { TreeViewSampleComponent } from './components/tree-view/tree-view-sample.component';
|
||||||
|
import { CloudLayoutComponent } from './components/app-layout/cloud/cloud-layout.component';
|
||||||
|
import { ProcessesCloudDemoComponent } from './components/app-layout/cloud/processes-cloud-demo.component';
|
||||||
|
import { AppsCloudDemoComponent } from './components/app-layout/cloud/apps-cloud-demo.component';
|
||||||
|
import { TasksCloudDemoComponent } from './components/app-layout/cloud/tasks-cloud-demo.component';
|
||||||
|
import { StartTaskCloudDemoComponent } from './components/app-layout/cloud/start-task-cloud-demo.component';
|
||||||
|
|
||||||
export const appRoutes: Routes = [
|
export const appRoutes: Routes = [
|
||||||
{ path: 'login', component: LoginComponent },
|
{ path: 'login', component: LoginComponent },
|
||||||
@@ -141,19 +143,32 @@ export const appRoutes: Routes = [
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
component: CloudComponent,
|
component: AppsCloudDemoComponent
|
||||||
canActivate: [AuthGuard]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ':applicationName/tasks',
|
path: ':applicationName',
|
||||||
component: TaskListCloudDemoComponent,
|
children: [
|
||||||
canActivate: [AuthGuard]
|
{
|
||||||
|
path: '',
|
||||||
|
component: CloudLayoutComponent,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: 'tasks',
|
||||||
|
component: TasksCloudDemoComponent
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'processes',
|
||||||
|
component: ProcessesCloudDemoComponent
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'process-list-cloud',
|
path: 'start-task',
|
||||||
component: ProcessListCloudExampleComponent
|
component: StartTaskCloudDemoComponent
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'node-selector',
|
path: 'node-selector',
|
||||||
|
@@ -103,4 +103,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@media screen and ($mat-xsmall) {}
|
@media screen and ($mat-xsmall) {}
|
||||||
|
|
||||||
|
mat-sidenav-content > div {
|
||||||
|
display: flex;
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
|
> div {
|
||||||
|
flex: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -41,7 +41,6 @@ export class AppLayoutComponent implements OnInit {
|
|||||||
{ href: '/task-list', icon: 'assignment', title: 'APP_LAYOUT.TASK_LIST' },
|
{ href: '/task-list', icon: 'assignment', title: 'APP_LAYOUT.TASK_LIST' },
|
||||||
{ href: '/process-list', icon: 'assignment', title: 'APP_LAYOUT.PROCESS_LIST' },
|
{ href: '/process-list', icon: 'assignment', title: 'APP_LAYOUT.PROCESS_LIST' },
|
||||||
{ href: '/cloud', icon: 'cloud', title: 'APP_LAYOUT.PROCESS_CLOUD' },
|
{ href: '/cloud', icon: 'cloud', title: 'APP_LAYOUT.PROCESS_CLOUD' },
|
||||||
{ href: '/process-list-cloud', icon: 'cloud', title: 'APP_LAYOUT.PROCESS_LIST_CLOUD' },
|
|
||||||
{ href: '/activiti', icon: 'device_hub', title: 'APP_LAYOUT.PROCESS_SERVICES' },
|
{ href: '/activiti', icon: 'device_hub', title: 'APP_LAYOUT.PROCESS_SERVICES' },
|
||||||
{ href: '/login', icon: 'vpn_key', title: 'APP_LAYOUT.LOGIN' },
|
{ href: '/login', icon: 'vpn_key', title: 'APP_LAYOUT.LOGIN' },
|
||||||
{ href: '/trashcan', icon: 'delete', title: 'APP_LAYOUT.TRASHCAN' },
|
{ href: '/trashcan', icon: 'delete', title: 'APP_LAYOUT.TRASHCAN' },
|
||||||
|
@@ -1,2 +1 @@
|
|||||||
|
|
||||||
<adf-cloud-app-list (appClick)="onAppClick($event)"></adf-cloud-app-list>
|
<adf-cloud-app-list (appClick)="onAppClick($event)"></adf-cloud-app-list>
|
@@ -17,17 +17,17 @@
|
|||||||
|
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-cloud',
|
templateUrl: './apps-cloud-demo.component.html'
|
||||||
templateUrl: './cloud.component.html',
|
|
||||||
styleUrls: ['./cloud.component.scss']
|
|
||||||
})
|
})
|
||||||
export class CloudComponent {
|
|
||||||
|
export class AppsCloudDemoComponent {
|
||||||
|
|
||||||
constructor(private router: Router) {
|
constructor(private router: Router) {
|
||||||
}
|
}
|
||||||
|
|
||||||
onAppClick(app) {
|
onAppClick(app) {
|
||||||
this.router.navigate([`/cloud/${app.name}/tasks/`]);
|
this.router.navigate([`/cloud/${app.name}`]);
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -0,0 +1,7 @@
|
|||||||
|
<adf-toolbar>
|
||||||
|
<div fxLayout="column" fxLayoutAlign="center" >
|
||||||
|
<div fxLayout="row">
|
||||||
|
<div class="adf-app-crumb">{{applicationName + ' >'}} </div> <div class="adf-filter-crumb"> {{filterName | translate}}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</adf-toolbar>
|
@@ -0,0 +1,8 @@
|
|||||||
|
.adf-app-crumb {
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.adf-filter-crumb {
|
||||||
|
opacity: 0.8;
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
@@ -0,0 +1,44 @@
|
|||||||
|
/*!
|
||||||
|
* @license
|
||||||
|
* Copyright 2016 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 } from '@angular/router';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-cloud-breadcrumbs',
|
||||||
|
templateUrl: './cloud-breadcrumb-component.html',
|
||||||
|
styleUrls: ['cloud-breadcrumb-component.scss']
|
||||||
|
})
|
||||||
|
export class CloudBreadcrumbsComponent implements OnInit {
|
||||||
|
|
||||||
|
applicationName: string;
|
||||||
|
filterName: string;
|
||||||
|
|
||||||
|
constructor(private route: ActivatedRoute) { }
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.route.parent.params.subscribe((
|
||||||
|
params) => {
|
||||||
|
this.applicationName = params.applicationName;
|
||||||
|
});
|
||||||
|
this.route.queryParams.subscribe((params) => {
|
||||||
|
if (params.filterName) {
|
||||||
|
this.filterName = params.filterName;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,21 @@
|
|||||||
|
<mat-accordion>
|
||||||
|
<mat-expansion-panel [expanded]="true" (opened)="panelOpenStateTask = true" (closed)="panelOpenStateTask = false">
|
||||||
|
<mat-expansion-panel-header>
|
||||||
|
<mat-panel-title>
|
||||||
|
Task Filters
|
||||||
|
</mat-panel-title>
|
||||||
|
</mat-expansion-panel-header>
|
||||||
|
<adf-cloud-task-filters *ngIf="panelOpenStateTask" [appName]="appName" [showIcons]="true" (filterClick)="onTaskFilterSelected($event)">
|
||||||
|
</adf-cloud-task-filters>
|
||||||
|
</mat-expansion-panel>
|
||||||
|
|
||||||
|
<mat-expansion-panel (opened)="panelOpenStateProcess = true" (closed)="panelOpenStateProcess = false">
|
||||||
|
<mat-expansion-panel-header>
|
||||||
|
<mat-panel-title>
|
||||||
|
Process Filters
|
||||||
|
</mat-panel-title>
|
||||||
|
</mat-expansion-panel-header>
|
||||||
|
<adf-cloud-process-filters *ngIf="panelOpenStateProcess" [appName]="appName" [showIcons]="true" (filterClick)="onProcessFilterSelected($event)">
|
||||||
|
</adf-cloud-process-filters>
|
||||||
|
</mat-expansion-panel>
|
||||||
|
</mat-accordion>
|
@@ -0,0 +1,3 @@
|
|||||||
|
adf-cloud-task-filters .adf-filters__entry, adf-cloud-process-filters .adf-filters__entry {
|
||||||
|
padding-left: 0 !important;
|
||||||
|
}
|
@@ -0,0 +1,48 @@
|
|||||||
|
/*!
|
||||||
|
* @license
|
||||||
|
* Copyright 2016 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, EventEmitter, ViewEncapsulation, Output, Input } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-cloud-fillters-demo',
|
||||||
|
templateUrl: './cloud-filters-demo.component.html',
|
||||||
|
styleUrls: ['cloud-filters-demo.component.scss'],
|
||||||
|
encapsulation: ViewEncapsulation.None
|
||||||
|
})
|
||||||
|
export class CloudFiltersDemoComponent {
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
appName: string;
|
||||||
|
|
||||||
|
@Output()
|
||||||
|
taskFilterSelect: EventEmitter<any> = new EventEmitter<any>();
|
||||||
|
|
||||||
|
@Output()
|
||||||
|
processFilterSelect: EventEmitter<any> = new EventEmitter<any>();
|
||||||
|
|
||||||
|
panelOpenStateTask: boolean;
|
||||||
|
panelOpenStateProcess: boolean;
|
||||||
|
|
||||||
|
onTaskFilterSelected(filter) {
|
||||||
|
this.taskFilterSelect.emit(filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
onProcessFilterSelected(filter) {
|
||||||
|
this.processFilterSelect.emit(filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,29 @@
|
|||||||
|
<div fxFill fxLayout>
|
||||||
|
<adf-sidenav-layout fxFlex [sidenavMin]="70" [sidenavMax]="270" [stepOver]="780">
|
||||||
|
<adf-sidenav-layout-header>
|
||||||
|
<ng-template>
|
||||||
|
<app-cloud-breadcrumbs></app-cloud-breadcrumbs>
|
||||||
|
</ng-template>
|
||||||
|
</adf-sidenav-layout-header>
|
||||||
|
<adf-sidenav-layout-navigation>
|
||||||
|
<ng-template>
|
||||||
|
<adf-sidebar-action-menu [expanded]="true" [width]="205"
|
||||||
|
title="{{'ADF_SIDEBAR_ACTION_MENU.BUTTON.CREATE' | translate}}">
|
||||||
|
<mat-icon sidebar-menu-title-icon>arrow_drop_down</mat-icon>
|
||||||
|
<div sidebar-menu-options>
|
||||||
|
<button mat-menu-item data-automation-id="btn-start-task" (click)="onStartTask()">
|
||||||
|
<mat-icon>assessment</mat-icon>
|
||||||
|
<span>{{'ADF_SIDEBAR_ACTION_MENU.BUTTON.NEW_TASK' | translate}}</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</adf-sidebar-action-menu>
|
||||||
|
<app-cloud-fillters-demo [appName]="applicationName" (taskFilterSelect)="onTaskFilterSelected($event)" (processFilterSelect)="onProcessFilterSelected($event)"></app-cloud-fillters-demo>
|
||||||
|
</ng-template>
|
||||||
|
</adf-sidenav-layout-navigation>
|
||||||
|
<adf-sidenav-layout-content>
|
||||||
|
<ng-template>
|
||||||
|
<router-outlet></router-outlet>
|
||||||
|
</ng-template>
|
||||||
|
</adf-sidenav-layout-content>
|
||||||
|
</adf-sidenav-layout>
|
||||||
|
</div>
|
@@ -0,0 +1,3 @@
|
|||||||
|
.adf-cloud-layout-overflow {
|
||||||
|
overflow: auto;
|
||||||
|
}
|
@@ -0,0 +1,57 @@
|
|||||||
|
/*!
|
||||||
|
* @license
|
||||||
|
* Copyright 2016 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, ViewEncapsulation } from '@angular/core';
|
||||||
|
import { Router, ActivatedRoute } from '@angular/router';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-cloud-layout',
|
||||||
|
templateUrl: './cloud-layout.component.html',
|
||||||
|
styleUrls: ['./cloud-layout.component.scss'],
|
||||||
|
encapsulation: ViewEncapsulation.None
|
||||||
|
})
|
||||||
|
export class CloudLayoutComponent implements OnInit {
|
||||||
|
displayMenu = true;
|
||||||
|
applicationName: string;
|
||||||
|
|
||||||
|
constructor(private router: Router, private route: ActivatedRoute) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.route.params.subscribe((params) => {
|
||||||
|
this.applicationName = params.applicationName;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onTaskFilterSelected(filter) {
|
||||||
|
const currentFilter = Object.assign({}, filter);
|
||||||
|
this.router.navigate([`/cloud/${this.applicationName}/tasks/`], { queryParams: currentFilter });
|
||||||
|
}
|
||||||
|
|
||||||
|
onStartTask() {
|
||||||
|
this.router.navigate([`/cloud/${this.applicationName}/start-task/`]);
|
||||||
|
}
|
||||||
|
|
||||||
|
onProcessFilterSelected(filter) {
|
||||||
|
const queryParams = {
|
||||||
|
status: filter.query.state,
|
||||||
|
filterName: filter.name,
|
||||||
|
sort: filter.query.sort,
|
||||||
|
order: filter.query.order
|
||||||
|
};
|
||||||
|
this.router.navigate([`/cloud/${this.applicationName}/processes/`], { queryParams: queryParams });
|
||||||
|
}
|
||||||
|
}
|
@@ -1,14 +1,4 @@
|
|||||||
<h3>{{'PROCESS_LIST_CLOUD.TITLE' | translate}}</h3>
|
<div fxLayout="column" fxFill fxLayoutGap="2px">
|
||||||
<adf-cloud-process-filters
|
|
||||||
[appName]="currentAppName"
|
|
||||||
[showIcons]="true"
|
|
||||||
(filterClick)="onFilterSelected($event)"
|
|
||||||
*ngIf="currentAppName">
|
|
||||||
</adf-cloud-process-filters>
|
|
||||||
|
|
||||||
<adf-cloud-app-list *ngIf="!currentAppName"
|
|
||||||
(appClick)="onAppClick($event)"></adf-cloud-app-list>
|
|
||||||
<div *ngIf="currentAppName">
|
|
||||||
<mat-accordion>
|
<mat-accordion>
|
||||||
<mat-expansion-panel>
|
<mat-expansion-panel>
|
||||||
<mat-expansion-panel-header>
|
<mat-expansion-panel-header>
|
||||||
@@ -16,10 +6,10 @@
|
|||||||
{{filterName | translate}}
|
{{filterName | translate}}
|
||||||
</mat-panel-title>
|
</mat-panel-title>
|
||||||
<mat-panel-description>
|
<mat-panel-description>
|
||||||
Customise your filter
|
{{ 'PROCESS_LIST_CLOUD_DEMO.CUSTOMIZE_FILTERS' | translate}}
|
||||||
</mat-panel-description>
|
</mat-panel-description>
|
||||||
</mat-expansion-panel-header>
|
</mat-expansion-panel-header>
|
||||||
<div>
|
<div fxLayout="row" fxLayoutGap="10px">
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-select placeholder="Status" [(ngModel)]="status">
|
<mat-select placeholder="Status" [(ngModel)]="status">
|
||||||
<mat-option value="">
|
<mat-option value="">
|
||||||
@@ -53,21 +43,25 @@
|
|||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</mat-expansion-panel>
|
</mat-expansion-panel>
|
||||||
</mat-accordion>
|
</mat-accordion>
|
||||||
<adf-cloud-process-list
|
<div fxLayout="column" fxFlex fxLayoutAlign="space-between">
|
||||||
[applicationName]="currentAppName"
|
<adf-cloud-process-list fxFlex class="adf-cloud-layout-overflow"
|
||||||
|
[applicationName]="applicationName"
|
||||||
[status]="status"
|
[status]="status"
|
||||||
[sorting]="sortArray"
|
[sorting]="sortArray"
|
||||||
[id]="filterId"
|
[id]="filterId"
|
||||||
|
(rowClick)="onRowClick($event)"
|
||||||
#processCloud>
|
#processCloud>
|
||||||
<data-columns>
|
<data-columns>
|
||||||
<data-column key="entry.id" title="Id"></data-column>
|
<data-column key="entry.id" title="Id"></data-column>
|
||||||
<data-column key="entry.appName" title="Name"></data-column>
|
<data-column key="entry.name" title="Name"></data-column>
|
||||||
<data-column key="entry.status" title="Status"></data-column>
|
<data-column key="entry.status" title="Status"></data-column>
|
||||||
|
<data-column key="entry.startDate" title="Start Date" type="date" format="timeAgo"></data-column>
|
||||||
</data-columns>
|
</data-columns>
|
||||||
</adf-cloud-process-list>
|
</adf-cloud-process-list>
|
||||||
<adf-pagination [target]="processCloud" (changePageSize)="onChangePageSize($event)">
|
<adf-pagination [target]="processCloud" (changePageSize)="onChangePageSize($event)">
|
||||||
</adf-pagination>
|
</adf-pagination>
|
||||||
<button mat-fab class="adf-process-list-cloud-button" color="primary" (click)="onClick()">Back</button>
|
</div>
|
||||||
</div>
|
</div>
|
@@ -16,16 +16,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, ViewChild, OnInit } from '@angular/core';
|
import { Component, ViewChild, OnInit } from '@angular/core';
|
||||||
import { UserPreferencesService } from '@alfresco/adf-core';
|
|
||||||
import { ProcessListCloudComponent } from '@alfresco/adf-process-services-cloud';
|
import { ProcessListCloudComponent } from '@alfresco/adf-process-services-cloud';
|
||||||
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { FormControl } from '@angular/forms';
|
import { FormControl } from '@angular/forms';
|
||||||
|
import { UserPreferencesService } from '@alfresco/adf-core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-process-list-example',
|
templateUrl: './processes-cloud-demo.component.html',
|
||||||
templateUrl: './process-list-cloud-example.component.html',
|
styleUrls: ['./processes-cloud-demo.component.scss']
|
||||||
styleUrls: ['./process-list-cloud-example.component.scss']
|
|
||||||
})
|
})
|
||||||
export class ProcessListCloudExampleComponent implements OnInit {
|
export class ProcessesCloudDemoComponent implements OnInit {
|
||||||
|
|
||||||
@ViewChild('processCloud')
|
@ViewChild('processCloud')
|
||||||
processCloud: ProcessListCloudComponent;
|
processCloud: ProcessListCloudComponent;
|
||||||
@@ -33,14 +33,17 @@ export class ProcessListCloudExampleComponent implements OnInit {
|
|||||||
sortFormControl: FormControl;
|
sortFormControl: FormControl;
|
||||||
sortDirectionFormControl: FormControl;
|
sortDirectionFormControl: FormControl;
|
||||||
|
|
||||||
currentAppName: string = '';
|
applicationName: string = '';
|
||||||
filterName: string = '';
|
isFilterLoaded: boolean;
|
||||||
|
|
||||||
status: string = '';
|
status: string = '';
|
||||||
|
filterName: string;
|
||||||
filterId: string = '';
|
filterId: string = '';
|
||||||
sort: string = '';
|
sort: string = '';
|
||||||
sortArray: any[];
|
sortArray: any = [];
|
||||||
sortField: string;
|
sortField: string;
|
||||||
sortDirection: string;
|
sortDirection: string;
|
||||||
|
selectedRow: any;
|
||||||
|
|
||||||
columns = [
|
columns = [
|
||||||
{key: 'id', label: 'ID'},
|
{key: 'id', label: 'ID'},
|
||||||
@@ -49,10 +52,16 @@ export class ProcessListCloudExampleComponent implements OnInit {
|
|||||||
{key: 'startDate', label: 'START DATE'}
|
{key: 'startDate', label: 'START DATE'}
|
||||||
];
|
];
|
||||||
|
|
||||||
constructor(private userPreference: UserPreferencesService) {
|
constructor(private route: ActivatedRoute,
|
||||||
|
private userPreference: UserPreferencesService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
this.isFilterLoaded = false;
|
||||||
|
this.route.parent.params.subscribe((params) => {
|
||||||
|
this.applicationName = params.applicationName;
|
||||||
|
});
|
||||||
|
|
||||||
this.sortFormControl = new FormControl('');
|
this.sortFormControl = new FormControl('');
|
||||||
|
|
||||||
this.sortFormControl.valueChanges.subscribe(
|
this.sortFormControl.valueChanges.subscribe(
|
||||||
@@ -77,30 +86,26 @@ export class ProcessListCloudExampleComponent implements OnInit {
|
|||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
onAppClick(appClicked: any) {
|
this.route.queryParams
|
||||||
this.currentAppName = appClicked.name;
|
.subscribe((params) => {
|
||||||
|
if (params.filterName) {
|
||||||
|
this.status = params.status ? params.status : '';
|
||||||
|
this.sort = params.sort;
|
||||||
|
this.sortDirection = params.order;
|
||||||
|
this.filterName = params.filterName;
|
||||||
|
this.isFilterLoaded = true;
|
||||||
|
this.sortDirectionFormControl.setValue(this.sortDirection);
|
||||||
|
this.sortFormControl.setValue(this.sort);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
onClick() {
|
|
||||||
this.currentAppName = '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onChangePageSize(event) {
|
onChangePageSize(event) {
|
||||||
this.userPreference.paginationSize = event.maxItems;
|
this.userPreference.paginationSize = event.maxItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
onClearFilters() {
|
onRowClick($event) {
|
||||||
this.processCloud.reload();
|
this.selectedRow = $event;
|
||||||
}
|
|
||||||
|
|
||||||
onFilterSelected(filter) {
|
|
||||||
this.status = filter.query.state || '';
|
|
||||||
this.sort = filter.query.sort;
|
|
||||||
this.sortDirection = filter.query.order;
|
|
||||||
this.filterName = filter.name;
|
|
||||||
this.sortDirectionFormControl.setValue(this.sortDirection);
|
|
||||||
this.sortFormControl.setValue(this.sort);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -0,0 +1,6 @@
|
|||||||
|
<adf-cloud-start-task
|
||||||
|
[appName]="applicationName"
|
||||||
|
(error)="openSnackMessage($event)"
|
||||||
|
(success)="onStartTaskSuccess()"
|
||||||
|
(cancel)="onCancelStartTask()">
|
||||||
|
</adf-cloud-start-task>
|
@@ -0,0 +1,56 @@
|
|||||||
|
/*!
|
||||||
|
* @license
|
||||||
|
* Copyright 2016 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';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
templateUrl: './start-task-cloud-demo.component.html',
|
||||||
|
styleUrls: ['./start-task-cloud-demo.component.scss']
|
||||||
|
})
|
||||||
|
export class StartTaskCloudDemoComponent implements OnInit {
|
||||||
|
|
||||||
|
applicationName;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private route: ActivatedRoute,
|
||||||
|
private notificationService: NotificationService,
|
||||||
|
private router: Router) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.route.parent.params.subscribe((params) => {
|
||||||
|
this.applicationName = params.applicationName;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onStartTaskSuccess() {
|
||||||
|
this.router.navigate([`/cloud/${this.applicationName}`]);
|
||||||
|
}
|
||||||
|
|
||||||
|
onCancelStartTask() {
|
||||||
|
this.router.navigate([`/cloud/${this.applicationName}`]);
|
||||||
|
}
|
||||||
|
|
||||||
|
openSnackMessage(event: any) {
|
||||||
|
this.notificationService.openSnackMessage(
|
||||||
|
event.response.body.message,
|
||||||
|
4000
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,28 @@
|
|||||||
|
<div fxLayout="column" fxFill fxLayoutGap="2px">
|
||||||
|
<adf-cloud-edit-task-filter
|
||||||
|
[appName]="applicationName"
|
||||||
|
[id]="filterId"
|
||||||
|
(filterChange)="onFilterChange($event)">
|
||||||
|
</adf-cloud-edit-task-filter>
|
||||||
|
|
||||||
|
<div fxLayout="column" fxFlex fxLayoutAlign="space-between" *ngIf="editedFilter">
|
||||||
|
<adf-cloud-task-list #taskCloud
|
||||||
|
[applicationName]="editedFilter.appName"
|
||||||
|
[status]="editedFilter.state"
|
||||||
|
[assignee]="editedFilter.assignment"
|
||||||
|
[sorting]="sortArray"
|
||||||
|
(rowClick)="onRowClick($event)">
|
||||||
|
<data-columns>
|
||||||
|
<data-column key="entry.id" title="Id"></data-column>
|
||||||
|
<data-column key="entry.name" title="Name" class="full-width name-column ellipsis-cell"></data-column>
|
||||||
|
<data-column key="entry.status" title="Status"></data-column>
|
||||||
|
<data-column key="entry.processDefinitionId" title="Process Definition Id"></data-column>
|
||||||
|
<data-column key="entry.priority" title="Priority"></data-column>
|
||||||
|
<data-column key="entry.createdDate" type="date" title="Created Date" [format]="'timeAgo'"></data-column>
|
||||||
|
</data-columns>
|
||||||
|
</adf-cloud-task-list>
|
||||||
|
<adf-pagination [target]="taskCloud"
|
||||||
|
(changePageSize)="onChangePageSize($event)">
|
||||||
|
</adf-pagination>
|
||||||
|
</div>
|
||||||
|
</div>
|
@@ -0,0 +1,73 @@
|
|||||||
|
/*!
|
||||||
|
* @license
|
||||||
|
* Copyright 2016 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, ViewChild, OnInit } from '@angular/core';
|
||||||
|
import { TaskListCloudComponent, TaskListCloudSortingModel, TaskFilterCloudModel } from '@alfresco/adf-process-services-cloud';
|
||||||
|
import { UserPreferencesService } from '@alfresco/adf-core';
|
||||||
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
templateUrl: 'tasks-cloud-demo.component.html',
|
||||||
|
styleUrls: ['tasks-cloud-demo.component.scss']
|
||||||
|
})
|
||||||
|
export class TasksCloudDemoComponent implements OnInit {
|
||||||
|
|
||||||
|
@ViewChild('taskCloud')
|
||||||
|
taskCloud: TaskListCloudComponent;
|
||||||
|
|
||||||
|
applicationName: string = '';
|
||||||
|
|
||||||
|
isFilterLoaded = false;
|
||||||
|
|
||||||
|
selectedRow: any;
|
||||||
|
|
||||||
|
sortArray: TaskListCloudSortingModel[];
|
||||||
|
editedFilter: TaskFilterCloudModel;
|
||||||
|
|
||||||
|
filterId;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private route: ActivatedRoute,
|
||||||
|
private userPreference: UserPreferencesService) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.isFilterLoaded = false;
|
||||||
|
this.route.parent.params.subscribe((params) => {
|
||||||
|
this.applicationName = params.applicationName;
|
||||||
|
});
|
||||||
|
|
||||||
|
this.route.queryParams.subscribe((params) => {
|
||||||
|
this.isFilterLoaded = true;
|
||||||
|
this.onFilterChange(params);
|
||||||
|
this.filterId = params.id;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onChangePageSize(event) {
|
||||||
|
this.userPreference.paginationSize = event.maxItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
onRowClick($event) {
|
||||||
|
this.selectedRow = $event;
|
||||||
|
}
|
||||||
|
|
||||||
|
onFilterChange(filter: any) {
|
||||||
|
this.editedFilter = Object.assign({}, filter);
|
||||||
|
this.sortArray = [new TaskListCloudSortingModel({ orderBy: this.editedFilter.sort, direction: this.editedFilter.order})];
|
||||||
|
}
|
||||||
|
}
|
@@ -1,11 +0,0 @@
|
|||||||
.adf-process-list-cloud-button {
|
|
||||||
margin: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.adf-process-cloud-spacing {
|
|
||||||
margin: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
mat-form-field {
|
|
||||||
margin-left: 10px;
|
|
||||||
}
|
|
@@ -1,54 +0,0 @@
|
|||||||
<h2>TASK LIST CLOUD DEMO</h2>
|
|
||||||
<div fxLayout="row" fxLayout.xs="column">
|
|
||||||
<div fxFlexOrder="1" fxFlex="15%">
|
|
||||||
<adf-sidebar-action-menu [expanded]="true" [width]="205" title="{{'ADF_SIDEBAR_ACTION_MENU.BUTTON.CREATE' | translate}}">
|
|
||||||
<mat-icon sidebar-menu-title-icon>arrow_drop_down</mat-icon>
|
|
||||||
<div sidebar-menu-options>
|
|
||||||
<button mat-menu-item data-automation-id="btn-start-task" (click)="onStartTask()">
|
|
||||||
<mat-icon>assessment</mat-icon>
|
|
||||||
<span>{{'ADF_SIDEBAR_ACTION_MENU.BUTTON.NEW_TASK' | translate}}</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</adf-sidebar-action-menu>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div *ngIf="showStartTask">
|
|
||||||
<adf-cloud-start-task [appName]="applicationName" (success)="onStartTaskSuccess()" (cancel)="onCancelStartTask()">
|
|
||||||
</adf-cloud-start-task>
|
|
||||||
</div>
|
|
||||||
<div *ngIf="!showStartTask">
|
|
||||||
<adf-cloud-task-filters #taskFiltersCloud
|
|
||||||
[appName]="applicationName"
|
|
||||||
[filterParam]="filterTaskParam"
|
|
||||||
[showIcons]="true"
|
|
||||||
(filterClick)="onFilterSelected($event)">
|
|
||||||
</adf-cloud-task-filters>
|
|
||||||
|
|
||||||
<adf-cloud-edit-task-filter
|
|
||||||
[appName]="applicationName"
|
|
||||||
[id]="currentFilter.id"
|
|
||||||
(filterChange)="onFilterChange($event)"
|
|
||||||
(action)="onEditActions($event)">
|
|
||||||
</adf-cloud-edit-task-filter>
|
|
||||||
|
|
||||||
<div *ngIf="editedFilter">
|
|
||||||
<adf-cloud-task-list #taskCloud
|
|
||||||
[applicationName]="editedFilter.appName"
|
|
||||||
[status]="editedFilter.state"
|
|
||||||
[assignee]="editedFilter.assignment"
|
|
||||||
[sorting]="sortArray"
|
|
||||||
(rowClick)="onRowClick($event)">
|
|
||||||
<data-columns>
|
|
||||||
<data-column key="entry.id" title="Id"></data-column>
|
|
||||||
<data-column key="entry.name" title="Name" class="full-width name-column ellipsis-cell"></data-column>
|
|
||||||
<data-column key="entry.status" title="Status"></data-column>
|
|
||||||
<data-column key="entry.processDefinitionId" title="Process Definition Id"></data-column>
|
|
||||||
<data-column key="entry.priority" title="Priority"></data-column>
|
|
||||||
<data-column key="entry.createdDate" type="date" title="Created Date" [format]="'timeAgo'"></data-column>
|
|
||||||
</data-columns>
|
|
||||||
</adf-cloud-task-list>
|
|
||||||
<adf-pagination [target]="taskCloud" (changePageSize)="onChangePageSize($event)">
|
|
||||||
</adf-pagination>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
@@ -1,15 +0,0 @@
|
|||||||
.adf-task-cloud-demo-select {
|
|
||||||
padding: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.adf-task-cloud-demo-select .mat-expansion-panel-body {
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.adf-app-task-list-cloud-demo-selection {
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.adf-task-row-clicked {
|
|
||||||
align-self: center;
|
|
||||||
}
|
|
@@ -1,128 +0,0 @@
|
|||||||
/*!
|
|
||||||
* @license
|
|
||||||
* Copyright 2016 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, ViewChild, OnInit } from '@angular/core';
|
|
||||||
import {
|
|
||||||
TaskListCloudComponent,
|
|
||||||
TaskFiltersCloudComponent,
|
|
||||||
TaskListCloudSortingModel,
|
|
||||||
TaskFilterCloudModel,
|
|
||||||
EditTaskFilterCloudComponent
|
|
||||||
} from '@alfresco/adf-process-services-cloud';
|
|
||||||
import { UserPreferencesService } from '@alfresco/adf-core';
|
|
||||||
import { Observable } from 'rxjs';
|
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-task-list-cloud-demo',
|
|
||||||
templateUrl: 'task-list-cloud-demo.component.html',
|
|
||||||
styleUrls: ['task-list-cloud-demo.component.scss']
|
|
||||||
})
|
|
||||||
export class TaskListCloudDemoComponent implements OnInit {
|
|
||||||
|
|
||||||
@ViewChild('taskCloud')
|
|
||||||
taskCloud: TaskListCloudComponent;
|
|
||||||
|
|
||||||
@ViewChild('taskFiltersCloud')
|
|
||||||
taskFiltersCloud: TaskFiltersCloudComponent;
|
|
||||||
|
|
||||||
appDefinitionList: Observable<any>;
|
|
||||||
applicationName;
|
|
||||||
status: string = '';
|
|
||||||
showStartTask = false;
|
|
||||||
clickedRow: string = '';
|
|
||||||
filterTaskParam;
|
|
||||||
sortArray: TaskListCloudSortingModel[];
|
|
||||||
editedFilter: TaskFilterCloudModel;
|
|
||||||
|
|
||||||
currentFilter: TaskFilterCloudModel;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
private route: ActivatedRoute,
|
|
||||||
private router: Router,
|
|
||||||
private userPreference: UserPreferencesService
|
|
||||||
) {}
|
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
this.route.params.subscribe((params) => {
|
|
||||||
this.applicationName = params.applicationName;
|
|
||||||
});
|
|
||||||
|
|
||||||
this.route.queryParams.subscribe( (params) => {
|
|
||||||
this.onFilterChange(params);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
onFilterSelected(filter: TaskFilterCloudModel) {
|
|
||||||
this.currentFilter = Object.assign({}, filter);
|
|
||||||
this.sortArray = [new TaskListCloudSortingModel({ orderBy: this.currentFilter.sort, direction: this.currentFilter.order})];
|
|
||||||
|
|
||||||
this.router.navigate([`/cloud/${this.applicationName}/tasks/`], {
|
|
||||||
queryParams: this.currentFilter
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
onFilterChange(filter: any) {
|
|
||||||
this.editedFilter = Object.assign({}, this.currentFilter, filter);
|
|
||||||
this.sortArray = [new TaskListCloudSortingModel({ orderBy: this.editedFilter.sort, direction: this.editedFilter.order})];
|
|
||||||
}
|
|
||||||
|
|
||||||
onStartTask() {
|
|
||||||
this.showStartTask = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
onStartTaskSuccess() {
|
|
||||||
this.showStartTask = false;
|
|
||||||
this.filterTaskParam = { name: 'My tasks'};
|
|
||||||
}
|
|
||||||
|
|
||||||
onCancelStartTask() {
|
|
||||||
this.showStartTask = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
onChangePageSize(event) {
|
|
||||||
this.userPreference.paginationSize = event.maxItems;
|
|
||||||
}
|
|
||||||
|
|
||||||
onRowClick($event) {
|
|
||||||
this.clickedRow = $event;
|
|
||||||
}
|
|
||||||
|
|
||||||
onEditActions(event: any) {
|
|
||||||
if (event.actionType === EditTaskFilterCloudComponent.ACTION_SAVE) {
|
|
||||||
this.save(event.id);
|
|
||||||
} else if (event.actionType === EditTaskFilterCloudComponent.ACTION_SAVE_AS) {
|
|
||||||
this.saveAs(event.id);
|
|
||||||
} else if (event.actionType === EditTaskFilterCloudComponent.ACTION_DELETE) {
|
|
||||||
this.deleteFilter();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
saveAs(filterId) {
|
|
||||||
this.taskFiltersCloud.filterParam = <any> {id : filterId};
|
|
||||||
this.taskFiltersCloud.getFilters(this.applicationName);
|
|
||||||
}
|
|
||||||
|
|
||||||
save(filterId) {
|
|
||||||
this.taskFiltersCloud.filterParam = <any> {id : filterId};
|
|
||||||
this.taskFiltersCloud.getFilters(this.applicationName);
|
|
||||||
}
|
|
||||||
|
|
||||||
deleteFilter() {
|
|
||||||
this.taskFiltersCloud.getFilters(this.applicationName);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -17,13 +17,17 @@
|
|||||||
|
|
||||||
import { StorageService, JwtHelperService } from '@alfresco/adf-core';
|
import { StorageService, JwtHelperService } from '@alfresco/adf-core';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable, BehaviorSubject } from 'rxjs';
|
||||||
import { TaskFilterCloudModel } from '../models/filter-cloud.model';
|
import { TaskFilterCloudModel } from '../models/filter-cloud.model';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class TaskFilterCloudService {
|
export class TaskFilterCloudService {
|
||||||
|
|
||||||
|
private filtersSubject: BehaviorSubject<TaskFilterCloudModel[]>;
|
||||||
|
filters$: Observable<TaskFilterCloudModel[]>;
|
||||||
|
|
||||||
constructor(private storage: StorageService, private jwtService: JwtHelperService) {
|
constructor(private storage: StorageService, private jwtService: JwtHelperService) {
|
||||||
|
this.filtersSubject = new BehaviorSubject([]);
|
||||||
|
this.filters$ = this.filtersSubject.asObservable();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,14 +35,12 @@ export class TaskFilterCloudService {
|
|||||||
* @param appName Name of the target app
|
* @param appName Name of the target app
|
||||||
* @returns Observable of default filters just created
|
* @returns Observable of default filters just created
|
||||||
*/
|
*/
|
||||||
public createDefaultFilters(appName: string): Observable<TaskFilterCloudModel[]> {
|
public createDefaultFilters(appName: string) {
|
||||||
let myTasksFilter = this.getMyTasksFilterInstance(appName);
|
let myTasksFilter = this.getMyTasksFilterInstance(appName);
|
||||||
this.addFilter(myTasksFilter);
|
this.addFilter(myTasksFilter);
|
||||||
|
|
||||||
let completedTasksFilter = this.getCompletedTasksFilterInstance(appName);
|
let completedTasksFilter = this.getCompletedTasksFilterInstance(appName);
|
||||||
this.addFilter(completedTasksFilter);
|
this.addFilter(completedTasksFilter);
|
||||||
|
|
||||||
return this.getTaskListFilters(appName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -50,10 +52,13 @@ export class TaskFilterCloudService {
|
|||||||
const username = this.getUsername();
|
const username = this.getUsername();
|
||||||
let key = `task-filters-${appName}-${username}`;
|
let key = `task-filters-${appName}-${username}`;
|
||||||
const filters = JSON.parse(this.storage.getItem(key) || '[]');
|
const filters = JSON.parse(this.storage.getItem(key) || '[]');
|
||||||
return new Observable(function(observer) {
|
|
||||||
observer.next(filters);
|
if (filters.length === 0) {
|
||||||
observer.complete();
|
this.createDefaultFilters(appName);
|
||||||
});
|
} else {
|
||||||
|
this.addFiltersToStream(filters);
|
||||||
|
}
|
||||||
|
return this.filters$;
|
||||||
}
|
}
|
||||||
|
|
||||||
getTaskFilterById(appName: string, id: string): TaskFilterCloudModel {
|
getTaskFilterById(appName: string, id: string): TaskFilterCloudModel {
|
||||||
@@ -69,7 +74,7 @@ export class TaskFilterCloudService {
|
|||||||
* @param filter The new filter to add
|
* @param filter The new filter to add
|
||||||
* @returns Details of task filter just added
|
* @returns Details of task filter just added
|
||||||
*/
|
*/
|
||||||
addFilter(filter: TaskFilterCloudModel): Observable<TaskFilterCloudModel> {
|
addFilter(filter: TaskFilterCloudModel) {
|
||||||
const username = this.getUsername();
|
const username = this.getUsername();
|
||||||
const key = `task-filters-${filter.appName}-${username}`;
|
const key = `task-filters-${filter.appName}-${username}`;
|
||||||
let filters = JSON.parse(this.storage.getItem(key) || '[]');
|
let filters = JSON.parse(this.storage.getItem(key) || '[]');
|
||||||
@@ -78,10 +83,11 @@ export class TaskFilterCloudService {
|
|||||||
|
|
||||||
this.storage.setItem(key, JSON.stringify(filters));
|
this.storage.setItem(key, JSON.stringify(filters));
|
||||||
|
|
||||||
return new Observable(function(observer) {
|
this.addFiltersToStream(filters);
|
||||||
observer.next(filter);
|
}
|
||||||
observer.complete();
|
|
||||||
});
|
private addFiltersToStream(filters: TaskFilterCloudModel []) {
|
||||||
|
this.filtersSubject.next(filters);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -107,9 +113,14 @@ export class TaskFilterCloudService {
|
|||||||
const username = this.getUsername();
|
const username = this.getUsername();
|
||||||
const key = `task-filters-${filter.appName}-${username}`;
|
const key = `task-filters-${filter.appName}-${username}`;
|
||||||
if (key) {
|
if (key) {
|
||||||
let filters = JSON.parse(this.storage.getItem(key) || '[]');
|
let filters: TaskFilterCloudModel[] = JSON.parse(this.storage.getItem(key) || '[]');
|
||||||
filters = filters.filter((item) => item.id !== filter.id);
|
filters = filters.filter((item) => item.id !== filter.id);
|
||||||
this.storage.setItem(key, JSON.stringify(filters));
|
this.storage.setItem(key, JSON.stringify(filters));
|
||||||
|
if (filters.length === 0) {
|
||||||
|
this.createDefaultFilters(filter.appName);
|
||||||
|
} else {
|
||||||
|
this.addFiltersToStream(filters);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -67,14 +67,6 @@ describe('TaskFiltersCloudComponent', () => {
|
|||||||
resolve(fakeGlobalFilter);
|
resolve(fakeGlobalFilter);
|
||||||
});
|
});
|
||||||
|
|
||||||
let fakeGlobalEmptyFilter = {
|
|
||||||
message: 'invalid data'
|
|
||||||
};
|
|
||||||
|
|
||||||
let fakeGlobalEmptyFilterPromise = new Promise(function (resolve, reject) {
|
|
||||||
resolve(fakeGlobalEmptyFilter);
|
|
||||||
});
|
|
||||||
|
|
||||||
let mockErrorFilterList = {
|
let mockErrorFilterList = {
|
||||||
error: 'wrong request'
|
error: 'wrong request'
|
||||||
};
|
};
|
||||||
@@ -206,21 +198,6 @@ describe('TaskFiltersCloudComponent', () => {
|
|||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should be able to fetch and select the default filters if the input filter is not valid', (done) => {
|
|
||||||
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(from(fakeGlobalEmptyFilterPromise));
|
|
||||||
spyOn(component, 'createFilters').and.callThrough();
|
|
||||||
|
|
||||||
const appName = 'my-app-1';
|
|
||||||
let change = new SimpleChange(null, appName, true);
|
|
||||||
component.ngOnChanges({ 'appName': change });
|
|
||||||
|
|
||||||
component.success.subscribe((res) => {
|
|
||||||
expect(res).toBeDefined();
|
|
||||||
expect(component.createFilters).not.toHaveBeenCalled();
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should select the task filter based on the input by name param', async(() => {
|
it('should select the task filter based on the input by name param', async(() => {
|
||||||
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(fakeGlobalFilterObservable);
|
spyOn(taskFilterService, 'getTaskListFilters').and.returnValue(fakeGlobalFilterObservable);
|
||||||
|
|
||||||
|
@@ -80,12 +80,8 @@ export class TaskFiltersCloudComponent implements OnChanges {
|
|||||||
|
|
||||||
this.filters$.subscribe(
|
this.filters$.subscribe(
|
||||||
(res: TaskFilterCloudModel[]) => {
|
(res: TaskFilterCloudModel[]) => {
|
||||||
if (res.length === 0) {
|
|
||||||
this.createFilters(appName);
|
|
||||||
} else {
|
|
||||||
this.resetFilter();
|
this.resetFilter();
|
||||||
this.filters = res;
|
this.filters = Object.assign([], res);
|
||||||
}
|
|
||||||
this.selectFilterAndEmit(this.filterParam);
|
this.selectFilterAndEmit(this.filterParam);
|
||||||
this.success.emit(res);
|
this.success.emit(res);
|
||||||
},
|
},
|
||||||
@@ -95,23 +91,6 @@ export class TaskFiltersCloudComponent implements OnChanges {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Create default filters by appId
|
|
||||||
*/
|
|
||||||
createFilters(appName?: string) {
|
|
||||||
this.filters$ = this.taskFilterCloudService.createDefaultFilters(appName);
|
|
||||||
|
|
||||||
this.filters$.subscribe(
|
|
||||||
(resDefault: TaskFilterCloudModel[]) => {
|
|
||||||
this.resetFilter();
|
|
||||||
this.filters = resDefault;
|
|
||||||
},
|
|
||||||
(errDefault: any) => {
|
|
||||||
this.error.emit(errDefault);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public selectFilter(newFilter: TaskFilterCloudModel) {
|
public selectFilter(newFilter: TaskFilterCloudModel) {
|
||||||
if (newFilter) {
|
if (newFilter) {
|
||||||
this.currentFilter = this.filters.find( (filter: TaskFilterCloudModel, index) =>
|
this.currentFilter = this.filters.find( (filter: TaskFilterCloudModel, index) =>
|
||||||
|
Reference in New Issue
Block a user