mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
Apply PR changes
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
.material-icons:hover {
|
||||
.material-icons.people-search__icon:hover {
|
||||
color: rgb(255, 152, 0);
|
||||
}
|
||||
|
||||
|
@@ -7,8 +7,8 @@
|
||||
<li class="mdl-list__item fix-element-user-list" *ngFor="let user of userList">
|
||||
<span class="mdl-list__item-primary-content mdl-button mdl-js-button mdl-js-ripple-effect"
|
||||
(click)="onRowClick(user)" id="user-{{user.id}}">
|
||||
<i class="material-icons md-light">face</i>
|
||||
{{ user.firstName }} - {{ user.lastName }}
|
||||
<i class="material-icons md-light people-search__icon">face</i>
|
||||
{{getDisplayUser(user)}}
|
||||
</span>
|
||||
</li>
|
||||
<div *ngIf="userList?.length === 0" id="no-user-found">
|
||||
|
@@ -107,7 +107,7 @@ describe('Activiti People Search', () => {
|
||||
});
|
||||
|
||||
it('should send an event when an user is clicked', async(() => {
|
||||
activitiPeopleSearchComponent.onModalRowClicked.subscribe((user) => {
|
||||
activitiPeopleSearchComponent.onRowClicked.subscribe((user) => {
|
||||
expect(user).toBeDefined();
|
||||
expect(user.firstName).toBe('fake-name');
|
||||
});
|
||||
|
@@ -39,7 +39,7 @@ export class ActivitiPeopleSearch implements OnInit, AfterViewInit {
|
||||
onSearch: EventEmitter<any> = new EventEmitter();
|
||||
|
||||
@Output()
|
||||
onModalRowClicked: EventEmitter<any> = new EventEmitter();
|
||||
onRowClicked: EventEmitter<any> = new EventEmitter();
|
||||
|
||||
searchUser: FormControl = new FormControl();
|
||||
|
||||
@@ -79,9 +79,15 @@ export class ActivitiPeopleSearch implements OnInit, AfterViewInit {
|
||||
}
|
||||
|
||||
onRowClick(userClicked: User) {
|
||||
this.onModalRowClicked.emit(userClicked);
|
||||
this.onRowClicked.emit(userClicked);
|
||||
this.userList = this.userList.filter((user) => {
|
||||
return user.id !== userClicked.id;
|
||||
});
|
||||
}
|
||||
|
||||
getDisplayUser(user: User): string {
|
||||
let firstName = user.firstName && user.firstName !== 'null' ? user.firstName : 'N/A';
|
||||
let lastName = user.lastName && user.lastName !== 'null' ? user.lastName : 'N/A';
|
||||
return firstName + ' - ' + lastName;
|
||||
}
|
||||
}
|
||||
|
@@ -6,10 +6,10 @@
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
.material-icons:hover {
|
||||
.material-icons.people__icon:hover {
|
||||
color: rgb(255, 152, 0);
|
||||
}
|
||||
|
||||
.involve-user-padding {
|
||||
.add-people-dialog__content {
|
||||
padding: 20px 24px 2px;
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<span class="activiti-label mdl-badge" id="people-title"
|
||||
[attr.data-badge]="people?.length">{{ 'TASK_DETAILS.LABELS.PEOPLE' | translate }}</span>
|
||||
<div *ngIf="!readOnly" id="addPeople" (click)="showDialog()" class="icon material-icons">add</div>
|
||||
<div *ngIf="!readOnly" id="addPeople" (click)="showDialog()" class="icon material-icons people__icon">add</div>
|
||||
<div *ngIf="!readOnly" class="mdl-tooltip" data-mdl-for="addPeople">
|
||||
Add a person
|
||||
</div>
|
||||
@@ -9,10 +9,10 @@
|
||||
<li class="mdl-list__item" *ngFor="let user of people">
|
||||
<span class="mdl-list__item-primary-content">
|
||||
<i class="material-icons mdl-list__item-icon">face</i>
|
||||
<span id="user-{{user.id}}">{{user.firstName}} {{user.lastName}}</span>
|
||||
<span id="user-{{user.id}}">{{getDisplayUser(user)}}</span>
|
||||
</span>
|
||||
<a *ngIf="!readOnly" class="mdl-list__item-secondary-action">
|
||||
<i id="remove" class="material-icons"
|
||||
<i id="remove" class="material-icons people__icon"
|
||||
(click)="removeInvolvedUser(user)">delete</i>
|
||||
</a>
|
||||
</li>
|
||||
@@ -24,10 +24,10 @@
|
||||
|
||||
<dialog class="mdl-dialog" id="add-people-dialog" #dialog>
|
||||
<h4 class="mdl-dialog__title" id="add-people-dialog-title">Involve User</h4>
|
||||
<div class="mdl-dialog__content involve-user-padding">
|
||||
<div class="mdl-dialog__content add-people-dialog__content">
|
||||
<activiti-people-search (onSearch)="searchUser($event)"
|
||||
(onModalRowClicked)="involveUser($event)"
|
||||
[results]="people$">
|
||||
(onRowClicked)="involveUser($event)"
|
||||
[results]="peopleSearch$">
|
||||
</activiti-people-search>
|
||||
</div>
|
||||
<div class="mdl-dialog__actions">
|
||||
|
@@ -157,7 +157,7 @@ describe('Activiti People Component', () => {
|
||||
}));
|
||||
|
||||
it('should return an observable with user search results', (done) => {
|
||||
activitiPeopleComponent.people$.subscribe((users) => {
|
||||
activitiPeopleComponent.peopleSearch$.subscribe((users) => {
|
||||
expect(users.length).toBe(2);
|
||||
expect(users[0].firstName).toBe('fake-test-1');
|
||||
expect(users[0].lastName).toBe('fake-last-1');
|
||||
@@ -186,7 +186,7 @@ describe('Activiti People Component', () => {
|
||||
});
|
||||
|
||||
it('should return an empty list for not valid search', (done) => {
|
||||
activitiPeopleComponent.people$.subscribe((users) => {
|
||||
activitiPeopleComponent.peopleSearch$.subscribe((users) => {
|
||||
expect(users.length).toBe(0);
|
||||
done();
|
||||
});
|
||||
@@ -211,7 +211,7 @@ describe('Activiti People Component', () => {
|
||||
|
||||
it('should log error message when search fails', async(() => {
|
||||
console.log = jasmine.createSpy('log');
|
||||
activitiPeopleComponent.people$.subscribe(() => {
|
||||
activitiPeopleComponent.peopleSearch$.subscribe(() => {
|
||||
expect(console.log).toHaveBeenCalledWith('Could not load users');
|
||||
});
|
||||
activitiPeopleComponent.searchUser('fake-search');
|
||||
|
@@ -41,8 +41,8 @@ export class ActivitiPeople {
|
||||
@ViewChild('dialog')
|
||||
dialog: any;
|
||||
|
||||
private peopleObserver: Observer<User[]>;
|
||||
people$: Observable<User[]>;
|
||||
private peopleSearchObserver: Observer<User[]>;
|
||||
peopleSearch$: Observable<User[]>;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -54,7 +54,7 @@ export class ActivitiPeople {
|
||||
if (translate) {
|
||||
translate.addTranslationFolder('node_modules/ng2-activiti-tasklist/src');
|
||||
}
|
||||
this.people$ = new Observable<User[]>(observer => this.peopleObserver = observer).share();
|
||||
this.peopleSearch$ = new Observable<User[]>(observer => this.peopleSearchObserver = observer).share();
|
||||
}
|
||||
|
||||
public showDialog() {
|
||||
@@ -69,14 +69,14 @@ export class ActivitiPeople {
|
||||
public cancel() {
|
||||
if (this.dialog) {
|
||||
this.dialog.nativeElement.close();
|
||||
this.peopleObserver.next([]);
|
||||
this.peopleSearchObserver.next([]);
|
||||
}
|
||||
}
|
||||
|
||||
searchUser(searchedWord: string) {
|
||||
this.peopleService.getWorkflowUsers(this.taskId, searchedWord)
|
||||
.subscribe((users) => {
|
||||
this.peopleObserver.next(users);
|
||||
this.peopleSearchObserver.next(users);
|
||||
}, error => console.log('Could not load users'));
|
||||
}
|
||||
|
||||
@@ -96,4 +96,10 @@ export class ActivitiPeople {
|
||||
}, error => console.error('Impossible to remove involved user from task'));
|
||||
}
|
||||
|
||||
getDisplayUser(user: User): string {
|
||||
let firstName = user.firstName && user.firstName !== 'null' ? user.firstName : 'N/A';
|
||||
let lastName = user.lastName && user.lastName !== 'null' ? user.lastName : 'N/A';
|
||||
return firstName + ' ' + lastName;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user