mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
[ACA-213] Edit Offline - permissions (#911)
* edit offline action rules * unlock node error message * update extensions rules * lock unlock evaluators * LockNodeDirective over EditOfflineDirective * disable tests failing cause of unrelated bug * isUserWriteLockOwner over isUserWriteLock
This commit is contained in:
committed by
Denys Vuika
parent
f7ed576847
commit
913685eb14
@@ -24,7 +24,7 @@
|
||||
*/
|
||||
|
||||
import { ToggleEditOfflineComponent } from './toggle-edit-offline.component';
|
||||
import { EditOfflineDirective } from '../../../directives/edit-offline.directive';
|
||||
import { LockNodeDirective } from '../../../directives/lock-node.directive';
|
||||
import { setupTestBed, CoreModule } from '@alfresco/adf-core';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { of } from 'rxjs';
|
||||
@@ -44,7 +44,7 @@ describe('ToggleEditOfflineComponent', () => {
|
||||
|
||||
setupTestBed({
|
||||
imports: [CoreModule],
|
||||
declarations: [ToggleEditOfflineComponent, EditOfflineDirective],
|
||||
declarations: [ToggleEditOfflineComponent, LockNodeDirective],
|
||||
providers: [
|
||||
{
|
||||
provide: Store,
|
||||
@@ -115,12 +115,12 @@ describe('ToggleEditOfflineComponent', () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it('should raise notification on error', () => {
|
||||
it('should raise notification on lock error', () => {
|
||||
component.selection = {
|
||||
entry: { name: 'test' }
|
||||
};
|
||||
|
||||
component.onError();
|
||||
component.onLockError();
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(dispatchSpy.calls.argsFor(0)).toEqual([
|
||||
@@ -129,4 +129,19 @@ describe('ToggleEditOfflineComponent', () => {
|
||||
})
|
||||
]);
|
||||
});
|
||||
|
||||
it('should raise notification on unlock error', () => {
|
||||
component.selection = {
|
||||
entry: { name: 'test' }
|
||||
};
|
||||
|
||||
component.onUnlockLockError();
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(dispatchSpy.calls.argsFor(0)).toEqual([
|
||||
new SnackbarErrorAction('APP.MESSAGES.ERRORS.UNLOCK_NODE', {
|
||||
fileName: 'test'
|
||||
})
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
@@ -38,23 +38,24 @@ import { MinimalNodeEntity } from '@alfresco/js-api';
|
||||
selector: 'app-toggle-edit-offline',
|
||||
template: `
|
||||
<button
|
||||
#editOffline="editOffline"
|
||||
#lock="lockNode"
|
||||
mat-menu-item
|
||||
(toggle)="onToggleEvent($event)"
|
||||
(error)="onError()"
|
||||
[acaEditOffline]="selection"
|
||||
(lockError)="onLockError()"
|
||||
(unlockError)="onUnlockLockError()"
|
||||
[acaLockNode]="selection"
|
||||
[attr.title]="
|
||||
editOffline.isNodeLocked()
|
||||
lock.isNodeLocked()
|
||||
? ('APP.ACTIONS.EDIT_OFFLINE_CANCEL' | translate)
|
||||
: ('APP.ACTIONS.EDIT_OFFLINE' | translate)
|
||||
"
|
||||
>
|
||||
<ng-container *ngIf="editOffline.isNodeLocked()">
|
||||
<ng-container *ngIf="lock.isNodeLocked()">
|
||||
<mat-icon>cancel</mat-icon>
|
||||
<span>{{ 'APP.ACTIONS.EDIT_OFFLINE_CANCEL' | translate }}</span>
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngIf="!editOffline.isNodeLocked()">
|
||||
<ng-container *ngIf="!lock.isNodeLocked()">
|
||||
<mat-icon>edit</mat-icon>
|
||||
<span>{{ 'APP.ACTIONS.EDIT_OFFLINE' | translate }}</span>
|
||||
</ng-container>
|
||||
@@ -81,11 +82,19 @@ export class ToggleEditOfflineComponent implements OnInit {
|
||||
this.store.dispatch(new EditOfflineAction(this.selection));
|
||||
}
|
||||
|
||||
onError() {
|
||||
onLockError() {
|
||||
this.store.dispatch(
|
||||
new SnackbarErrorAction('APP.MESSAGES.ERRORS.LOCK_NODE', {
|
||||
fileName: this.selection.entry.name
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
onUnlockLockError() {
|
||||
this.store.dispatch(
|
||||
new SnackbarErrorAction('APP.MESSAGES.ERRORS.UNLOCK_NODE', {
|
||||
fileName: this.selection.entry.name
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user