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