Skip to content

Commit

Permalink
fix new version uploader parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
DenysVuika committed Aug 2, 2024
1 parent 5534648 commit d8f7e75
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface NewVersionUploaderDialogData {
currentVersion?: Version;
showVersionsOnly?: boolean;
showComments?: boolean;
allowDownload?: true;
allowDownload?: boolean;
}

export type NewVersionUploaderData = VersionManagerUploadData | ViewVersion | RefreshData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,14 @@ export class NewVersionUploaderService {
* @param data data to pass to MatDialog
* @param config allow to override default MatDialogConfig
* @param selectorAutoFocusedOnClose element's selector which should be autofocused after closing modal
* @param showComments enable comments
* @param allowDownload enable version download
* @returns an Observable represents the triggered dialog action or an error in case of an error condition
*/
openUploadNewVersionDialog(
data: NewVersionUploaderDialogData,
config?: MatDialogConfig,
selectorAutoFocusedOnClose?: string,
showComments = true,
allowDownload = true
selectorAutoFocusedOnClose?: string
): Observable<NewVersionUploaderData> {
const { file, node, showVersionsOnly } = data;
const { file, node, showVersionsOnly, showComments, allowDownload } = data;

return new Observable((observer) => {
this.versionsApi.listVersionHistory(node.id).then((versionPaging) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ export class FilePropertiesTableCloudComponent {
mimeTypeIcon;

@Output()
rowClick: EventEmitter<Node> = new EventEmitter<Node>();
rowClick = new EventEmitter<Node>();

@Output()
attachFileClick: EventEmitter<any> = new EventEmitter<any>();
attachFileClick = new EventEmitter<any>();

@Output()
downloadFile: EventEmitter<Node> = new EventEmitter<Node>();
downloadFile = new EventEmitter<Node>();

@Output()
uploadNewFileVersion: EventEmitter<NewVersionUploaderDialogData> = new EventEmitter<NewVersionUploaderDialogData>();
uploadNewFileVersion = new EventEmitter<NewVersionUploaderDialogData>();

@Output()
contentModelFileHandler: EventEmitter<any> = new EventEmitter<Node>();
Expand All @@ -80,10 +80,12 @@ export class FilePropertiesTableCloudComponent {
this.downloadFile.emit(file);
}

onUploadNewFileVersion(customEvent: any, node: Node){
onUploadNewFileVersion(customEvent: any, node: Node) {
const newVersionUploaderDialogData: NewVersionUploaderDialogData = {
file: customEvent.detail.files[0].file,
node
node,
showComments: true,
allowDownload: true
};
this.uploadNewFileVersion.emit(newVersionUploaderDialogData);
}
Expand All @@ -102,12 +104,12 @@ export class FilePropertiesTableCloudComponent {

getColumnValue(file, displayableCMProperty): string {
if (!file.properties[displayableCMProperty.prefixedName]) {
const fieldProperty = this.field.params.displayableCMProperties?.find(property => property.name === displayableCMProperty.name);
return fieldProperty.defaultValue ? this.checkDateTypeAndTransform(displayableCMProperty.dataType, fieldProperty.defaultValue) : '--' ;
const fieldProperty = this.field.params.displayableCMProperties?.find((property) => property.name === displayableCMProperty.name);
return fieldProperty.defaultValue ? this.checkDateTypeAndTransform(displayableCMProperty.dataType, fieldProperty.defaultValue) : '--';
}
return file.properties[displayableCMProperty.prefixedName] ?
this.checkDateTypeAndTransform(displayableCMProperty.dataType, file.properties[displayableCMProperty.prefixedName]) :
'--' ;
return file.properties[displayableCMProperty.prefixedName]
? this.checkDateTypeAndTransform(displayableCMProperty.dataType, file.properties[displayableCMProperty.prefixedName])
: '--';
}

checkDateTypeAndTransform(dataType, value): string {
Expand Down

0 comments on commit d8f7e75

Please sign in to comment.