linagora / esn-frontend-common-libs Goto Github PK
View Code? Open in Web Editor NEWCommon ground for OpenPaaS frontend (https://open-paas.org)
License: Other
Common ground for OpenPaaS frontend (https://open-paas.org)
License: Other
To get the most of webpack require fucntionality and after the explicit dependency work, we have to separate:
Clicking on the domain logo doesn't correctly redirect to the "home" page.
Clicking on the domain logo should redirect to the "home" page that is defined in the user's settings or in the domain's settings.
The div responsible for loading animation in src/app/app-loading.pug
has a misspelling id. It should be splash
instead of spash
List of SPAs:
We need to have a common place to avoid initializing esnApiClient mutiple times in our code. Something like this will be cool:
const Client = require('esn-api-client/src/Client').default;
angular.module('esn.api-client', [])
.factory('esnApiClient', function($q, $window) {
return new Client({ baseURL: $window.location.origin, customPromise: $q });
});
And then in our AngularJS code we just use it as a normal AngularJS dependency, without having to constructing Client
multiple times.
Those templates are requiring when we do a lokpu on an "auto complete" style field. Seen it:
You can try to replicate this issue by running npm run build:prod
and serve the dist
folder using a custom webserver (maybe Nginx or https://chrome.google.com/webstore/detail/web-server-for-chrome/ofhbbkphhbklhfoeikjpcbhemlocgigb)
Don't use npm run serve:prod
because it will use webpack-dev-server
. The webpack server has a proxy to our backend so that it can get the .svg)
It causes the UI to be broken.
This image needs to be fetched from backend because if a user changes theme, it will also be updated
When the project was started 3 weeks ago, the webpack configuration has been adapted to be compatible with the codebase.
Now, the codebase can be modified to circumvent some webpack tricks, and use native require()
calls. In particular, the following webpack configuration lines:
/*
for esn-frontend-common-libs
can be removed after using a require for emailAddresses instead of a global $window.emailAddresses
angular.module('esn.email-addresses-wrapper', [])
.factory('emailAddresses', function($window) {
return $window.emailAddresses;
});
*/
{
test: require.resolve('email-addresses'),
loader: 'expose-loader',
options: {
exposes: 'emailAddresses',
},
},
/*
for esn-frontend-common-libs
can be removed after using a require for autosize instead of a global $window.autosize
angular.module('esn.form.helper')
.factory('autosize', function($window) {
return $window.autosize;
})
*/
{
test: require.resolve('autosize'),
loader: 'expose-loader',
options: {
exposes: 'autosize',
},
},
/*
for esn-frontend-common-libs
can be removed after using a require for Autolinker instead of a global $window.Autolinker
angular.module('esn.autolinker-wrapper', [])
.factory('autolinker', function($window) {
return $window.Autolinker;
});
*/
{
test: require.resolve(commonLibsPath + '/src/frontend/components/Autolinker.js/dist/Autolinker.js'),
loader: 'expose-loader',
options: {
exposes: 'Autolinker',
},
},
/*
for angular-jstz in esn-frontend-common-libs
*/
{
test: require.resolve(commonLibsPath + '/src/frontend/components/jstzdetect/jstz.js'),
loader: 'expose-loader',
options: {
exposes: [
"jstz"
],
},
},
could be removed by setting up proper requires at the javascript code level.
Since there are a lot of places we need to use 'watchDynamicTranslatedValue', implement it inside common-libs would be more reasonable.
Details here : [i18n Translation] %s is the result of a function
and this is useless.
esn.template
templates are not bundledThe task is explained here.
This issue is for the subtree /src/modules
Reproduction steps
Use esn-frontend-inbox
Click on the "new mail" FAB icon
Actual
The template is loaded from the server (example) https://dev.open-paas.org/views/modules/box-overlay/box-overlay.html
Expected
No template is loaded from the server
No module is using chart.js
details here
There are some recent code which uses Promise
instead of $q
. From https://caniuse.com/#feat=promises, this will not work on IE until we use the Promise polyfill.
There are several solutions:
Promise
is $q
with DefinePlugin
The aim is to make unit tests runnable
Topic: linagora/esn#11
Sample PR: linagora/esn-frontend-calendar#25
templateUrl: require('./user-status-bubble.pug'),
As explained here:
the main branch should be deployed on the dev.open-paas.org server.
This template is used through:
This is the very first commit of an effort to upgrade lodash to the latest version.
Lodash had an alias for the includes()
function, that was called contains()
. They removed the alias in the latest versions.
Restangular used contains (mgonto/restangular#1298) , and updated their code in version 1.5.2.
To fix translation for templates, we updated translations to:
Address book %s will be deleted along with its contacts.: "Address book {{ addressbookDisplayShell.displayName }} will be deleted along with its contacts."
and we updated template to use: p {{ 'Address book %s will be deleted along with its contacts.' | translate:$ctrl }}
To do this, we do not use i18nInterpolator that detects %s
and replace them with proper values.
Without i18nInterpolator
, our syntax for example esnI18nService.translate('%s items', $dragData.length);
does not work because translator does not understand %s
anymore.
We use this syntax in a ton of places in SPAs.
Consistent the input of esnI18nService.translate and angular translate filter, the second param (if present) is an object that contains pairs of key + value
There used to be *.spec.js files alongside the JS files. Now I can't find a single one. We need to bring them back.
add template cache for accounts view
Topic: #83
Reference PR: linagora/esn-frontend-inbox#54
Details: https://ci.linagora.com/linagora/lgs/openpaas/esn/-/wikis/Week-by-Week-Activity#theming-css-variables
Ask @RomaricMourgues to woth with him
Application is loading...
text is displayed in English and then after a few seconds it flashes to your selected language.We can have a loading effect together with the SPA's icon, and there'll be no need for the Application is loading...
text anymore.
Details here
The file esn-frontend-common-libs/src/frontend/js/modules/file.js exports an await
function in strict
mode: Uglifying source does not work as is.
Several solutions:
Tests on dev.open-paas.org with Chrome & Firefox:
Sometimes the application do not switch from splashscreen to main app screen.
Debugging showed that when the bug appear, the session template is updated but AngularJs doesn't detect the change.
Here is the list of AngularJs modules we want to remove:
frontend/js/modules/activitystream.js frontend/js/modules/activitystream/* frontend/js/modules/activitystreams-tracker.js
frontend/js/modules/easyrtc.js
frontend/js/modules/feedback.js
frontend/js/modules/like.js
frontend/js/modules/message.js
frontend/js/modules/poll.js
frontend/js/modules/resource-link.js
frontend/js/modules/twitter.js
frontend/js/modules/follow
frontend/js/modules/invitation.js
modules/linagora.esn.signup
modules/linagora.esn.signup.local
modules/linagora.esn.contact.import.twitter
modules/linagora.esn.digest.daily
For each of those modules:
Warning: there is activitystream related routing in src/frontend/js/esn/app.js
.
Before the split, the global search was able to provide a search provider per module on the platform.
Now each module is displayed on this own tab so we don't need anymore to be able to chosse the search provider. We can only search in to the module displayed.
Remove All
search provider
Remove on each module the dropdown provider
Language of a user now is always English regardless of his configuration
Move Webpack common config of every SPA to esn-frontend-common-libs
.
List of SPAs:
Due to this issue, we need to remove the old esnI18nInterpolator
in order to make the new one, angularjs translate style works.
The task is explained here.
This issue is for the subtree /src/frontend/js/modules
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.