Skip to content

Commit

Permalink
* Removed unwanted css
Browse files Browse the repository at this point in the history
  • Loading branch information
sivakumar414ram committed May 14, 2020
1 parent d6580a7 commit ea6ee2a
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@
<adf-start-process
#activitiStartProcess
[appId]="appId"
[showApplications]="showApplications"
[showSelectApplicationDropdown]="showApplications"
[title]="'ADF_PROCESS_LIST.START_PROCESS.FORM.TITLE'"
[name]="defaultProcessName"
[processDefinitionName]="defaultProcessDefinitionName"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Starts a process.
| processDefinitionName | `string` | | (optional) Definition name of the process to start. |
| processFilterSelector | `boolean` | true | (optional) Parameter to enable selection of process when filtering. |
| showSelectProcessDropdown | `boolean` | true | Hide or show the process selection dropdown. |
| showSelectApplicationDropdown | `boolean` | false | application selection dropdown. |
| title | `string` | | (optional) Define the header of the component. |
| values | [`FormValues`](../../../lib/core/form/components/widgets/core/form-values.ts) | | Parameter to pass form field values in the start form if one is associated. |
| variables | [`ProcessInstanceVariable`](../../../lib/process-services/src/lib/process-list/models/process-instance-variable.model.ts)`[]` | | Variables in the input to the process [`RestVariable`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/activiti-rest-api/docs/RestVariable.md). |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
@mixin adf-cloud-start-service-theme($theme) {
.adf {
&-start-process {
.mat-select-trigger {
font-size: 14px !important;
}

mat-form-field {
width: 100%;
}

mat-select {
width: 100%;
padding: 16px 0 0;
}

.mat-form-field-label {
color: mat-color($mat-grey, A400);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{{errorMessageId|translate}}
</div>
<div class="adf-start-process-definition-container">
<mat-form-field *ngIf="showApplications" [floatLabel]="'always'" class="adf-start-process-app-list">
<mat-form-field *ngIf="showSelectApplicationDropdown" [floatLabel]="'always'" class="adf-start-process-app-list">
<mat-select
placeholder="{{'ADF_PROCESS_LIST.START_PROCESS.FORM.LABEL.APPLICATIONS' | translate}}"
(selectionChange)="onAppSelectionChange($event)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ describe('StartFormComponent', () => {
beforeEach(() => {
fixture.detectChanges();
component.name = 'My new process';
component.showApplications = true;
component.showSelectApplicationDropdown = true;
const change = new SimpleChange(null, 3, true);
getDefinitionsSpy.and.returnValue(of(testMultipleProcessDefs));
getDeployedApplicationsSpy = spyOn(appsProcessService, 'getDeployedApplications').and.returnValue(of(deployedApps));
Expand All @@ -610,7 +610,7 @@ describe('StartFormComponent', () => {
});

it('Should not be able to show application drop-down if showApplications set to false', () => {
component.showApplications = false;
component.showSelectApplicationDropdown = false;
fixture.detectChanges();
const appsSelector = fixture.nativeElement.querySelector('[data-automation-id="adf-start-process-apps-drop-down"]');
expect(appsSelector).toBeNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit, OnDestr
@Input()
title: string;

/** (optional) Hide or show application selection drop-down. */
@Input()
showApplications: boolean = false;

/** (optional) Definition name of the process to start. */
@Input()
processDefinitionName: string;
Expand All @@ -83,6 +79,10 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit, OnDestr
@Input()
showSelectProcessDropdown: boolean = true;

/** (optional) Hide or show application selection dropdown. */
@Input()
showSelectApplicationDropdown: boolean = false;

/** (optional) Parameter to enable selection of process when filtering. */
@Input()
processFilterSelector: boolean = true;
Expand Down Expand Up @@ -117,13 +117,10 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit, OnDestr
filteredProcesses: Observable<ProcessDefinitionRepresentation[]>;
maxProcessNameLength: number = this.MAX_LENGTH;
alfrescoRepositoryName: string;
applications: AppDefinitionRepresentationModel[] = [];
selectedApplication: AppDefinitionRepresentationModel;

private onDestroy$ = new Subject<boolean>();

applications: any[];
selectedApplication: any;

isLoading = true;
constructor(private activitiProcess: ProcessService,
private activitiContentService: ActivitiContentService,
private appsProcessService: AppsProcessService,
Expand All @@ -134,7 +131,7 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit, OnDestr
this.processNameInput = new FormControl(this.name, [Validators.required, Validators.maxLength(this.maxProcessNameLength), Validators.pattern('^[^\\s]+(\\s+[^\\s]+)*$')]);
this.processDefinitionInput = new FormControl();

if (this.showApplications) {
if (this.showSelectApplicationDropdown) {
this.loadAppsAndStartProcess();
} else {
this.loadStartProcess(this.appId);
Expand Down Expand Up @@ -172,7 +169,7 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit, OnDestr
this.appId = changes['appId'].currentValue;
}

if (this.showApplications) {
if (this.showSelectApplicationDropdown) {
this.loadAppsAndStartProcess();
} else {
this.loadStartProcess(this.appId);
Expand Down Expand Up @@ -227,40 +224,52 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit, OnDestr

this.processDefinitionInput.setValue(this.selectedProcessDef.name);
}
this.isLoading = false;
},
() => {
this.errorMessageId = 'ADF_PROCESS_LIST.START_PROCESS.ERROR.LOAD_PROCESS_DEFS';
this.isLoading = false;
});
}

private loadAppsAndStartProcess() {
this.appsProcessService.getDeployedApplications()
.subscribe(
(deployedApplications: AppDefinitionRepresentationModel[]) => {
let currentApplication: any;
this.applications = deployedApplications.filter((app) => app.id);
if (this.applications && this.applications.length > 0) {
currentApplication = this.applications[0];
if (this.appId) {
const filteredApp = this.applications.find((app) => app.id === this.appId);
currentApplication = filteredApp ? filteredApp : this.applications[0];
loadAppsAndStartProcess() {
this.appsProcessService
.getDeployedApplications()
.pipe(map((response: AppDefinitionRepresentationModel[]) => {
let currentApplication: AppDefinitionRepresentationModel;
let applications: AppDefinitionRepresentationModel[] = [];

applications = this.removeDefaultApps(response);

if (applications && applications.length > 0) {
currentApplication = applications[0];
if (this.appId) {
const filteredApp = applications.find( app => app.id === this.appId );
currentApplication = filteredApp ? filteredApp : applications[0];
}
}
this.selectedApplication = currentApplication;
this.loadStartProcess(this.selectedApplication.id);

return { currentApplication, applications };
})
)
.subscribe((filteredApps) => {
this.applications = filteredApps.applications;
this.selectedApplication = filteredApps.currentApplication;
this.loadStartProcess(this.selectedApplication ? this.selectedApplication.id : null);
},
err => {
this.error.emit(err);
}
);

},
(err) => {
this.error.emit(err);
}
);
}

onAppSelectionChange(selectedApplication: any) {
this.selectedApplication = selectedApplication.value;
this.loadStartProcess(this.selectedApplication.value.id);
this.loadStartProcess(this.selectedApplication.id);
}

private removeDefaultApps(apps: AppDefinitionRepresentationModel []): AppDefinitionRepresentationModel[] {
return apps.filter((app) => app.id);

}

isProcessDefinitionsEmpty(): boolean {
Expand Down

0 comments on commit ea6ee2a

Please sign in to comment.