alfresco-ng2-components/demo-shell/src/app/components/files/version-manager-dialog-adapter.component.ts
Denys Vuika ef551a9c71
Improved ESLint configuration, integrated spellcheck and error fixes (#8931)
* integrate cspell with eslint, improved configuration

* core: fix linting errors

* core: fix lint warnings

* content: lint fixes

* process service lint fixes

* lint: process services cloud

* lint: insights

* lint: extensions

* [ci:force] lint: cli fixes

* [ci:force] comment out dead code

* [ci:force] exclude dead code

* fix code and tests

* rollback some changes

* fix testing lib

* fix demo shell

* minor lint warning fixes

* minor lint fixes

* fix process services
2023-09-26 13:46:53 +01:00

69 lines
2.5 KiB
TypeScript

/*!
* @license
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Component, Inject, ViewEncapsulation } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { Node } from '@alfresco/js-api';
import { PreviewService } from '../../services/preview.service';
import { NotificationService } from '@alfresco/adf-core';
import { FileUploadErrorEvent } from '@alfresco/adf-content-services';
@Component({
templateUrl: './version-manager-dialog-adapter.component.html',
encapsulation: ViewEncapsulation.None
})
export class VersionManagerDialogAdapterComponent {
contentEntry: Node;
newFileVersion: File;
showComments = true;
allowDownload = true;
readOnly = false;
showVersionComparison = false;
constructor(
private previewService: PreviewService,
private notificationService: NotificationService,
@Inject(MAT_DIALOG_DATA) data: any,
private containingDialog?: MatDialogRef<VersionManagerDialogAdapterComponent>
) {
this.contentEntry = data.contentEntry;
this.newFileVersion = Object.prototype.hasOwnProperty.call(data, 'newFileVersion') ? data.newFileVersion : this.newFileVersion;
this.showComments = Object.prototype.hasOwnProperty.call(data, 'showComments') ? data.showComments : this.showComments;
this.allowDownload = Object.prototype.hasOwnProperty.call(data, 'allowDownload') ? data.allowDownload : this.allowDownload;
}
uploadError(event: FileUploadErrorEvent) {
this.notificationService.showError(event.error);
}
close() {
this.containingDialog.close();
}
onViewVersion(versionId: string) {
this.previewService.showResource(this.contentEntry.id, versionId);
this.close();
}
hideVersionComparison(isCancelled: any) {
if (isCancelled) {
this.showVersionComparison = false;
this.newFileVersion = null;
}
}
}