Closed vorburger closed 3 years ago
On further thought, I suggest you really make it a baseApiUrl parameter (like community-app).. hardcoding makes it harder than it should be (because it requires a rebuild) for others to use this on their own servers.
@abhaychawla @karantakalkar @Jov03 Can we prioritize completing this ticket? It would help make the forthcoming QA process before getting this released much easier.
@vorburger We are unable to login on demo.mifos.io
and staging.mifos.io
as auth has been changed to suit dev.mifos.io
, I can add a feature to change baseApiUrl after login , in settings page.
Problem with using dev.mifos.io is lack of data, which means some features are inaccessible because there is no dummy case for it. If auth on demo and staging instances could be updated I can think of adding a dropdown/text for API on login page itself, just like language settings.
I am not sure how things worked in community app, haven't interacted with that code-base (or older angular versions), I have only used deployed instances of community app to refer for web app screens.
@edcable @vorburger Also in context of #1229, are we going to have separate instances of web-app on demo, staging and dev servers hosted? I find discrepancy in API responses (format itself) at some places which breaks the feature on one server.
@karantakalkar actually @vorburger and @edcable wants to change the baseAPIUrl which is present in environment.ts without having to update the url in file and creating a new build of the app every time. In community app they have baseUrl query param. Instead of taking baseUrl from js files they take it from the url itself.
So you can either do it the way its done in community app or add a gear icon on login page which opens a form to input baseUrl of the server you want to connect to. If the user has configured in the setting you can store this url in localStorage of the browser.
Then in environment.ts you will be required to do something like baseApiUrl: localStorage.baseUrl || 'https://dev.mifos.io'
so that when webapp loads if it finds entry in localStorage then it would use that server as baseUrl if not then fallback to whats defined in ts file.
Personally I feel that it would be much better NOT to hardcode ANY back end server into the source code.
Think of an organization wanting to use this in the future. If you want to make it as easy as possible for them to use web-app, then IMHO the default should be No Server. I don't mind (I like) the idea that OPTIONALLY one can change source and rebuild to add a default server, or even hard code it to a single fixed unchangeable server - but not by default.
But it SHOULD be possible to pre-set it by URL, just to be able to easily create direct links and avoid confusion. For example, the README could simply have several links, with a URL parameter for several backends, like mifos.io and fineract.dev. (BTW I would ideally actually like to REMOVE my https://wui.fineract.dev completely, and just use a link; but I cannot do that, until this is issue is addressed.)
PS: There's a security angle here as well... if you deployed web-app unchanged for your use at an MFI, would you like it if by mistake your end users may end up sending their credentials to a hardcoded demo server, if they forgot to change the setting in a gear icon in the login page? 🧐😬😷🤕
@vorburger agreed, In that case no default server sounds good to me too.
+1 to the approach suggested by @vorburger. @karantakalkar for now we can just point to the fineract.dev instance as we can be ensured that has the latest dev branch of Fineract on it deployed.
for now we can just point to the fineract.dev instance as we can be ensured that has the latest dev branch of Fineract on it deployed.
I've proposed this in #1256
I'd love to remove the (outdated) https://wui.fineract.dev if that's merged.
Following up on the discussion on #742 re. demo servers and https://wui.fineract.dev on https://www.fineract.dev : The reason why I did that and patched it like this https://github.com/openMF/web-app/compare/master...vorburger:fineract.dev is because https://openmf.github.io/web-app/, as per https://github.com/openMF/web-app#setting-up-a-local-server, is currently hard-coded to only https://demo.mifos.io in its https://github.com/openMF/web-app/blob/master/src/environments/environment.ts and to https://staging.mifos.io in its https://github.com/openMF/web-app/blob/master/src/environments/environment.prod.ts
This project would be very welcome to use https://www.fineract.dev instead, if you would like to change that hard-coded environment to be fineract.dev instead. The main advantage is that fineract.dev is automatically continuously updated, which could be useful as this projects adds new UIs for new back-end features, or even as we fix bugs there, as announced on https://markmail.org/message/7p32ufkp4wsq6cc5.
Another advantages of "driving" both end-users and developers to use fineract.dev is that, as they use it, errors are automatically reported, and I continuously create new bug reports for errors to be fixed in the back-end; see https://markmail.org/thread/6hkd2yvojngkeb6p and https://issues.apache.org/jira/browse/FINERACT-932.
An alternative could be to support customizing baseApiUrl at run-time instead of build-time to be able to use different demo back-end servers, and offer users an easy choice (without requiring rebuild).