blob: 4ee50b3a872919e64d52b4c62f060dc01fd4b2ac [file] [log] [blame]
/********************************************************************************
* Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
********************************************************************************/
import { Component, OnInit, Input } from '@angular/core';
import { MenuItem, DialogService} from 'primeng/api';
import { Attribute, Node, ContextGroup } from '@navigator/node';
import { FileExplorerDialogComponent } from 'src/app/file-explorer/components/file-explorer-dialog/file-explorer-dialog.component';
@Component({
selector: 'mdm5-file-attribute-display',
templateUrl: './file-attribute-display.component.html'
})
export class FileAttributeDisplayComponent implements OnInit {
@Input() attribute: Attribute;
@Input() contextDescribable: Node;
@Input() contextComponent: Node;
@Input() contextGroup?: ContextGroup;
@Input() contextType?: string;
@Input() readOnly: boolean;
// public link: MDMLink;
// public links: MDMLink[];
public menuItems: MenuItem[];
constructor(private dialogService: DialogService) { }
ngOnInit() {
// if (this.attribute != undefined && this.attribute.value != undefined) {
// if (this.attribute.dataType === 'FILE_LINK') {
// this.link = Object.assign(new MDMLink(), this.getValue<MDMLink>());
// }
// if (this.attribute.dataType === 'FILE_LINK_SEQUENCE' && this.getValues() != undefined) {
// this.links = (this.getValues<MDMLink[]>()).map(l => Object.assign(new MDMLink(), l));
// }
// }
}
// private getValue<T>() {
// if (this.attribute != undefined && this.attribute.value != undefined) {
// return <T> (this.contextGroup != undefined ? this.attribute.value[this.contextGroup] : this.attribute.value);
// }
// }
// private getValues<T>() {
// if (this.attribute != undefined && this.attribute.value != undefined) {
// const tmp = this.contextGroup != undefined ? this.attribute.value[this.contextGroup] : this.attribute.value;
// return tmp !== '' ? tmp : undefined;
// }
// }
public onShowFileExplorerDialog() {
const ref = this.dialogService.open(FileExplorerDialogComponent, {
data: {
contextDescribable: this.contextDescribable,
contextComponent: this.contextComponent,
attribute: this.attribute,
contextGroup: this.contextGroup,
contextType: this.contextType,
readOnly: this.readOnly
},
header: 'File upload wizard for ' + this.contextComponent.name,
width: '70%'
});
// ref.onClose.subscribe(linkObs => this.handleUploadDialogResponse(linkObs));
}
// private handleUploadDialogResponse(linkObs: Observable<MDMLink>) {
// if (linkObs != undefined) {
// linkObs.subscribe(link => console.log(link));
// }
// }
}