Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ACS-5686] add reselect to edit offline, shorten template #3433

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/

import { AppStore, DownloadNodesAction, EditOfflineAction, SnackbarErrorAction, getAppSelection } from '@alfresco/aca-shared/store';
import {
AppStore,
DownloadNodesAction,
EditOfflineAction,
SetSelectedNodesAction,
SnackbarErrorAction,
getAppSelection
} from '@alfresco/aca-shared/store';
import { NodeEntry, SharedLinkEntry, Node, NodesApi } from '@alfresco/js-api';
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { Store } from '@ngrx/store';
Expand All @@ -39,15 +46,8 @@ import { MatIconModule } from '@angular/material/icon';
selector: 'app-toggle-edit-offline',
template: `
<button mat-menu-item [attr.title]="nodeTitle | translate" (click)="onClick()">
<ng-container *ngIf="isNodeLocked">
<mat-icon>cancel</mat-icon>
<span>{{ 'APP.ACTIONS.EDIT_OFFLINE_CANCEL' | translate }}</span>
</ng-container>

<ng-container *ngIf="!isNodeLocked">
<mat-icon>edit</mat-icon>
<span>{{ 'APP.ACTIONS.EDIT_OFFLINE' | translate }}</span>
</ng-container>
<mat-icon>{{ isNodeLocked ? 'cancel' : 'edit' }}</mat-icon>
<span>{{ (isNodeLocked ? 'APP.ACTIONS.EDIT_OFFLINE_CANCEL' : 'APP.ACTIONS.EDIT_OFFLINE') | translate }}</span>
</button>
`,
encapsulation: ViewEncapsulation.None,
Expand Down Expand Up @@ -84,6 +84,7 @@ export class ToggleEditOfflineComponent implements OnInit {

this.update(response?.entry);
this.store.dispatch(new EditOfflineAction(this.selection));
this.store.dispatch(new SetSelectedNodesAction([this.selection]));
} catch {
this.onUnlockError();
}
Expand All @@ -94,6 +95,7 @@ export class ToggleEditOfflineComponent implements OnInit {
this.update(response?.entry);
this.store.dispatch(new DownloadNodesAction([this.selection]));
this.store.dispatch(new EditOfflineAction(this.selection));
this.store.dispatch(new SetSelectedNodesAction([this.selection]));
swapnil-verma-gl marked this conversation as resolved.
Show resolved Hide resolved
} catch {
this.onLockError();
}
Expand Down Expand Up @@ -128,7 +130,7 @@ export class ToggleEditOfflineComponent implements OnInit {
}

private update(data: Node) {
if (data && data.properties) {
if (data?.properties) {
const properties = this.selection.entry.properties || {};

properties['cm:lockLifetime'] = data.properties['cm:lockLifetime'];
Expand Down
Loading