Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metadata display modes - Switch to Full View doesn't work when metadata record is called in Simple View from external web application #4511

Closed
josegar74 opened this issue Mar 9, 2020 · 13 comments
Milestone

Comments

@josegar74
Copy link
Member

Test:

  1. Access the detail page of a metadata using the permalink, for example: https://vanilla.geocat.net/geonetwork/srv/eng/catalog.search#/metadata/da165110-88fd-11da-a88f-000d939bc5d8

  2. Switch to the full view: an empty content is displayed, no javascript errors, seem not even executed the request to retrieve the formatter full view.

  3. Search for the metadata uuid da165110-88fd-11da-a88f-000d939bc5d8 and in the metadata detail page switch to Full view --> it works.

@josegar74 josegar74 added this to the 3.10.2 milestone Mar 9, 2020
@juanluisrp
Copy link
Contributor

@fxprunayre
Copy link
Member

fxprunayre commented Mar 11, 2020

Probably related to https://github.com/geonetwork/core-geonetwork/pull/3909/files

So it works fine when you run a search first.
It works if you start the app using a formatter https://vanilla.geocat.net/geonetwork/srv/eng/catalog.search#/metadata/da165110-88fd-11da-a88f-000d939bc5d8/formatters/xsl-view?root=div&view=advanced
It does not when you jump in the app with the angular view.

@fxprunayre
Copy link
Member

After analyzing this with Jose, it is an issue related to the order of operations execute when the app starts which explains that it also may happens randomly - the search (made to retrieve record info) may not complete before the record view is initialized.

Records info when loading a formatter are mainly required to know if a draft version exist or not. And the formatter load is not made if the current record is not set.

An option to fix that is https://github.com/geonetwork/core-geonetwork/blob/master/web-ui/src/main/resources/catalog/components/search/mdview/mdviewModule.js#L124-L129

        // if ($scope.mdView.current.record == null) {
        //   return;
        // }
        var showApproved = $scope.mdView.current.record == null ? true : $scope.mdView.current.record.draft != 'y';

This would affect a direct link to a draft version (but I'm not sure we have such a link). At least it could be a good workaround for the majority of users currently not using the draft mode.

Testing, feedback and ideas welcomed.

@ZhuoyueZhou-USDA
Copy link

// if ($scope.mdView.current.record == null) {
// return;
// }
var showApproved = $scope.mdView.current.record == null ? true : $scope.mdView.current.record.draft != 'y';

Hey, I still get an empty content when I directly access the url, such as refreshing the page. If I first access the page in default view (click through the home page), then change to full view it will work. But if I refresh the page or if I copy and past the link to another browser or another tab, this issue still exists.

@josegar74
Copy link
Member Author

I have tested in a new code checkout and with incognito window in the browser and works fine for me.

Please @zhuoyuezhou can you cleanup the WRO4J Javascript & CSS cache in http://localhost:8080/geonetwork/srv/eng/admin.console#/tools with the button Clean JS & CSS cache and try after that in an incognito window, to avoid also any browser cache?

@ZhuoyueZhou-USDA
Copy link

@josegar74 Hi, I tested. It works! But I find another thing strange. If I click one record from the home page, change it to full view. Then go back to home page, click another record, change it to full view, it‘ll first show the information from the previous metadata record and then change to the current one. That happens occasionally, not sure if you'd replicate that.

@josegar74
Copy link
Member Author

@zhuoyuezhou indeed I can confirm that behaviour, I have created another issue to track it: #4526

@fnicollet
Copy link

Hello @josegar74 ,

it seems like I am running into the same issue: If I access the URL with the custom formatter in it, geonetwork will show the banner and then an empty space. If I add anything in the URL and type Enter, the metadata is displayed.
In your comment, you say that you got it fixed but how exactly?
Did you comment the code:
https://github.com/geonetwork/core-geonetwork/blob/master/web-ui/src/main/resources/catalog/components/search/mdview/mdviewModule.js#L124-L129
and made your own release of geonetwork?

@fxprunayre Tried your patch and I can confirm that it fixes the issue. Do you think it will be merged in a future geonetwork version?

Thanks!

@fnicollet
Copy link

Also, while on the subject of formatters, is there a way to change the "defaultView" formatter?
In the geonetwork Settings UI (/settings/ui), I can add a formatter to the list, but it seems like I can never change the default formatter (the one used when you click on a result in the search page).

Can you do it from the settings UI or do you have to change the source and make your own build?

From what I can read here:
https://geonetwork-opensource.org/manuals/trunk/eng/users/customizing-application/creating-custom-view.html?highlight=formatter

After having created a new formatter you will have to update your application code, so the new formatter-output can be visualised from your application. If the goal of the formatter is to introduce a new html view on metadata, then you can add a reference to it in source file web-ui/src/main/resources/catalog/views/default/config.js (searchSettings.formatter.list).

But I would rather not have to recompile geonetwork just for this (not really sure the formatter.list will change the default formatter either ...)

Thanks!

josegar74 added a commit to GeoCat/core-geonetwork that referenced this issue Mar 17, 2020
…ta record is called in Simple View from external web application geonetwork#4511
fxprunayre pushed a commit that referenced this issue Mar 19, 2020
…ta record is called in Simple View from external web application #4511
@fxprunayre
Copy link
Member

Can you do it from the settings UI or do you have to change the source and make your own build?

Should have been covered by #3909. Let us know in another ticket if you have issue on this.

@fnicollet
Copy link

@fxprunayre Thanks for your answer! I am using current master, so I guess this is not fixed, I cannot see a way to set the default formatter (when clicking on a search results for instance) with the Settings UI.

I'll create another ticket

@fxprunayre
Copy link
Member

@fxprunayre Thanks for your answer! I am using current master, so I guess this is not fixed, I cannot see a way to set the default formatter (when clicking on a search results for instance) with the Settings UI.

The first formatter in your UI config will be the default.

@fnicollet
Copy link

Ok, but it says "Milestone 3.8.0" and I am running "master" (3.11-SNAPSHOT), so it means that It has an issue? Or the milestone in the github issue is not correct?

fxprunayre pushed a commit that referenced this issue Mar 27, 2020
…ta record is called in Simple View from external web application #4511
pvgenuchten pushed a commit to pvgenuchten/core-geonetwork that referenced this issue Apr 29, 2020
…ta record is called in Simple View from external web application geonetwork#4511
pmauduit pushed a commit to pmauduit/core-geonetwork that referenced this issue Sep 29, 2020
…ta record is called in Simple View from external web application geonetwork#4511
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

No branches or pull requests

5 participants