Skip to content

[ENG-9958] Files in draft registrations cannot be previewed#957

Draft
mkovalua wants to merge 3 commits intoCenterForOpenScience:feature/pbs-26-6from
mkovalua:fix/ENG-9958
Draft

[ENG-9958] Files in draft registrations cannot be previewed#957
mkovalua wants to merge 3 commits intoCenterForOpenScience:feature/pbs-26-6from
mkovalua:fix/ENG-9958

Conversation

@mkovalua
Copy link
Copy Markdown
Contributor

Purpose

Prior to the Angular release, files attached to draft registrations could be previewed directly within the registration. This functionality no longer exists in Angular.

Summary of Changes

open preview url on draft registry file click

Screenshot(s)

Side Effects

QA Notes

Comment on lines +163 to +168
if (this.draftId() && file.guid) {
const url = this.router.serializeUrl(
this.router.createUrlTree(['registries', 'drafts', this.draftId(), 'files', file.guid])
);
window.open(url, '_blank');
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to move in custom-step.component.ts.

projectId = input.required<string>();
provider = input.required<string>();
filesViewOnly = input<boolean>(false);
draftId = input<string>('');
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove it.

});
}

private readonly router = inject(Router);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove it.

[filesLink]="filesLink()"
[projectId]="projectId()"
[provider]="provider()"
[draftId]="draftId()"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove it.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait for mockups.

Comment on lines +36 to +39
MockProvider(ViewOnlyLinkHelperService, {
hasViewOnlyParam: () => false,
getViewOnlyParam: () => null,
}),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use ViewOnlyLinkHelperMock.simple()

],
}),
],
}).compileComponents();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}).compileComponents();
});


it('should set safeLink when getIframeLink is called with a valid render link', () => {
const mfrUrl = 'https://mfr.osf.io/render?url=https%3A%2F%2Fosf.io%2Fdownload%2Fch7jz%2F';
component.file = signal({ links: { render: mfrUrl } }) as any;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use any.

});

it('should not set safeLink when file has no render link', () => {
component.file = signal({ links: {} }) as any;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use any.

});

it('should return null from getMfrUrlWithVersion when file has no render link', () => {
component.file = signal({ links: {} }) as any;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use any.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants