Skip to content
This repository has been archived by the owner on Mar 31, 2022. It is now read-only.

Change the format of default values for collection properties #149

Closed
m-orlova opened this issue Oct 23, 2020 · 0 comments
Closed

Change the format of default values for collection properties #149

m-orlova opened this issue Oct 23, 2020 · 0 comments
Assignees
Labels
type: bug Something isn't working
Milestone

Comments

@m-orlova
Copy link

m-orlova commented Oct 23, 2020

Method WebDownloader#download(DownloadDataProvider, String, DownloadFormat) has incorrect behaviour: HTML document downloads but extenstion 'html' is specified in default value of UiProperties#viewFileExtensions property and that's why HTML document should be shown in new tab.

After insvestigation of problem: current default value of 'viewFileExtensions' property in UiProperties is converting
to the list with one string "htm,html,jpg,png,jpeg,pdf" specified in @DefaultValue annotation.
But for method WebDownloader#download it seems incorrectly: for 'showNewWindow' flag it is checked whether file format contains in list returned by UiProperties#getViewFileExtensions.

QA

Check that documents with extension from the uiProperties#getViewFileExtensions property open in a new browser tab and are not downloaded to the computer.

The default value of uiProperties#getViewFileExtensions() property is htm, html, jpg, png, jpeg, pdf.

Try to change the uiProperties#getViewFileExtensions() property value:

  • application.properties file
    jmix.ui.viewFileExtensions = htm, html, jpg
    
  • application.yml file
    jmix:
      ui:
        viewFileExtensions: html, htm, jpg
    

Test case

@UiController("demo_NewScreen")
@UiDescriptor("new-screen.xml")
public class NewScreen extends Screen {

    @Autowired
    protected Downloader downloader;
    @Autowired
    protected UiProperties uiProperties;
    @Autowired
    protected CoreProperties coreProperties;

    @Subscribe("button")
    protected void onButtonClick(Button.ClickEvent event) {
        String html = "<html><head title='Test'></head><body><h1>Test</h1></body></html>";
        downloader.download(new ByteArrayDataProvider(html.getBytes(StandardCharsets.UTF_8),
                        uiProperties.getSaveExportedByteArrayDataThresholdBytes(),
                        coreProperties.getTempDir()),
                "test.html",
                DownloadFormat.HTML);
    }
}
  1. Click on the button
  • Actual behavior
    The test.html file is downloaded to the computer

  • Expected behavior
    The test.html file will open in a new browser tab

@glebfox glebfox added this to the 1.0.0 milestone Feb 2, 2021
@glebfox glebfox assigned GlebDurygin and unassigned glebfox Feb 19, 2021
@glebfox glebfox added the type: bug Something isn't working label Mar 2, 2021
@GlebDurygin GlebDurygin changed the title Downloader does not show HTML document in new tab Change the format of default values for collection properties Mar 4, 2021
GlebDurygin pushed a commit to jmix-projects/jmix-reports that referenced this issue Mar 4, 2021
@natfirst natfirst assigned lovtsovaik and unassigned natfirst Mar 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants