linagora / esn-frontend-common-libs

Common ground for OpenPaaS frontend (https://open-paas.org)
Other
4 stars 12 forks source link

material design icons are not displayed in dropdown #109

Closed fabienmoyon closed 4 years ago

fabienmoyon commented 4 years ago

CURRENT

  1. In the sidebar, dropdown settings-overlay component don't display material design icons

Capture d’écran de 2020-08-25 15-25-51

  1. In the header, dropdown profile-menu component don't display material design icons

Capture d’écran de 2020-08-27 11-40-57

EXPECTED

Capture d’écran de 2020-08-26 15-56-53

Capture d’écran de 2020-08-25 15-28-02

TO DO

tuanlc commented 4 years ago

Information: This error appears only on dev platform with production deployment

tuanlc commented 4 years ago

The reason, in the frontend, we setup default icon for angular material:

$mdIconProvider.defaultIconSet('images/mdi/mdi.svg', 24);

And this performs a request to ESN backend to get the mdi.svg resource.

Why does it work on devServer?

Because with Webpack devServer proxy, we forward the request from localhost:9900 to server base URL, then the request is:

https://dev.open-paas.org/images/mdi/mdi.svg

And it works like before in the old code base

Why production deployment on DEV server doesn't work?

Because the base URL of SPA has additional route: https://dev.open-paas.org/contacts/ Then the mdi request becomes:

https://dev.open-paas.org/contacts/images/mdi/mdi.svg

And the request is 404

tuanlc commented 4 years ago

Solution:

We need to make mdi.svg available on any mode of deployment. And we should not send the request to server to get this kind of resource like we did for templates.

And because we have 2 places to set default icon for material at core and inbox

So solution is serving the mdi.svg in frontend and having 1 global config block to set default icon

Steps: