Loading modules in angular2 application on the fly - module

In my current angular 2 (ionic) project I'm trying to achieve the following. I have a base application which authenticates a user to a known backend. When this is done, the user receives a number of modules he can use. These modules are separate bundles that are fetched from the server at runtime.
The logical view is something like this:
So, there is an application server that holds the server side of the application, and there is a device side of the application that is installed. Only the green parts are always there. The blue parts (the modules) are deployed separately and are loaded only then a user has access to it.
The modules use a shared services API (networking, authentication, access to device specific features via Cordova etc.) and have their own, also seperately deployable webservices on the appserver/backend.
I would like to give a module programmer the opportunity to create an angular component that consumes a webservice and use the shared API. How can I load a component from the appserver into my app running on the device?
[edit]
Q: Can you give an example of a loaded module?
A: Basically it can be anything that consumes a webservice deployed on the appserver. In a normal case it would consist of a combination of html and javascript (perhaps with some additional css).
Let's say we have a list of persons in the database, and a webservice that queries it, then the device gets a angular component with templates (I was thinking of the Ng2 version of a templatecache js file) which it should 'inject' into the running application.
It should be remarked that a restart of the application on the device is not out of the question.

Related

Tendermint web application - customize

I am new to blockchain development and to tendermint as well.
I already have a blockchain running locally.
Using this command starport scaffold vue I could mount a local web application. Inspecting a bit I could replicate some network requests (localhost) and I can get the ballance of current wallet (hard-coded on the request), get the current wallet from the localstorage. I'm struggling on authentication (mnemonic, wallet name and password).
However I also would like to costumize it according to my needs and I thought I could start a web application from scratch. I can see that the generated web project is importing this project https://github.com/tendermint/vue which is making a lot of "magic behind the scenes" and importing UI elements as well and I would like to have my own elements.
I don't want to re-invent the wheel and I can make some imports to help me on connection to wallet, validate authentication (mnemonic, wallet name and password), create wallet and so on.
I am trying to build a web application to connect to wallet, make transations.... but I would like to control the styles and the connections (and if possible using reactjs instead of vuejs, otherwise I dont mind learn vuejs as well).
Is this possible or reasonable? Where I can find good documentation or tutorial to guide me on customize a web application using tendermint. Honestly I searched but I am kind of lost.
Thanks
UPDATE: I found good examples and here and here. It helped me to validate mnemonics and make transactions, with my stack tech.
Because Starport generates both plain Javascript and VUE controllers, you have few options:
Create your own site re-using VUE components
Take plain JS part and build a website using whatever technology you like
Use a plain JS client for standard cosmos modules you can find on GitHub
Use Protobuf generator to generate light client code yourself
If you only need wallet functionality, #2 and #3 may work best for you because the bank module is stable and hasn't changed much in a long time.
You can find plain JS file for bank in your project:
vue/src/store/generated/cosmos/cosmos-sdk/cosmos.bank.v1beta1/module/index.ts
There is a link to starport discord channel related to frontend: https://discord.gg/CvbdYh9AWQ

Access application-saved data from a web browser

We have a desktop application for which the user enters some registration details (e.g. support code), and can then use the application.
We would like to be able to automatically fill our support website ticket form with this information, even if the desktop application is not running.
So far we've considered:
InternetSetCookie - but it only works for Windows+IE
use Selenium to create cookies for all major browsers (seems an overkill, and required us to distribute Selenium along with our app)
have a JS service always run in the background
Are there better alternatives?

Can you run an Angular Universal application without a server?

There's a feature in Angular Universal that allows you to pre-render pages at build-time. Can this be used to pre-render all your pages and run Angular Universal without a server?
Once html pages have been pre-rendered using angular universal (using nodejs server or asp.net core server), you can use any CDN to serve the pre-generated html.
See https://universal.angular.io/overview/
Edit: have a look at the starer kit
https://github.com/angular/universal-starter
Basically, you can reuse the prerender.js file which will write the rendered html files (for specified static routes) to the dist/browser folder, or wherever you want to. This is that folder that you deploy to a static host after
Well, you're always going to need to have a server somewhere in the equation: the only question is how much you have to set it up yourself versus how much can the current crop of tools and technologies do it for you.
In this talk from Node Summit Steven Fluin from Google talks about Firebase at the end. Pay attention to the bit about 'cloud functions' (at about 20 mins). Your Angular app will be rendered on the server using Firebase cloud functions. When a user interacts with your app, some JS is run to figure out what to send down (from the Firebase server) to the user. "You don't need to set up a server at all; everything is running in Firebase."
I haven't used Firebase myself - I'm using Angular Universal, which has a Node.js server as you know - but this sounds very nice. I found setting up Angular Universal really tricky (but got there in the end).

Social Business Toolkit: Sametime chat only with local installed Sametime Client possible?

I'm using SBT SDK on a XPage.
After mastering a few traps at the beginning it works fine.
Livenames are properly displayed.
But now a got another problem.
If you click on a available person, a context menu is displayed, where you can choose 'CHAT' or 'VCARD'.
If I click on CHAT a URL like this ist called:
http://localhost:59449/stwebapi/loggedin?jsonp=stproxy.connect.callback.setAvailable&wait=true&time=1407834968761&fqdn=sametime.lotus.com
I found out that you have to install Sametime Connect Client locally at every computer, because it is providing a small webserver at port 59449.
That's impossible because I want to use Sametime on a public website.
I'm pretty sure that there is another way.
Somebody an idea?
thanks
Marcus
#user2776693 - There are two ways:
1 - using the Sametime Local Web API
The local web api uses a configurable port (the default is mentioned above), to communicate back and forth from a web site which embeds or calls the configurable port using jsonp, meaning the javascript of the site wraps the sametime calls.
2 - using the Sametime Web Chat/Web Proxy
It means that the Sametime Web Chat is embedded as JavaScript on the page, and loaded using the appropriate JS libraries, and can have some pretty advanced features. There is a demo site off of greenhouse.lotus.com, and you can sign up for an account on that site.
you can download the sdk, and find many examples of using the local web api and web chat.
http://www14.software.ibm.com/webapp/download/nochargesearch.jsp?q0=&k=ALL&S_TACT=104CBW71&status=Active&b=Lotus&sr=1&q=sametime+sdk&ibm-search=Search
Download Version 9.0 IFR1
Extract with Zip
Go to Examples and samples

How do I register a controller that has been created in an AREA

I am using MVC4's WEB API to expose a controller.
Initially I created created a MVC4 WEBAPI project, set the project not to open any web page, wait for an external app to call the URL (WEB API). The project in VS2010 is set to run from IIS7 Express, not VS2010's Dev Server. This works OK, the browser prompts me to down load a file. Which is OK for me, as the browser does not know what to do with the returned data (RAW TEXT).
Next, I created an AREA in the MVC4 project area, then added a controller (WEB API type).
Then I once again ran the project and in a browser entered the the URL (WEB API). And it fails.
Ed.
The DefaultHttpControllerFactory doesn't work with Areas by default. To get this functionality you have to write your custom HttpControllerFactory.
You can find how to do this at the post How to create HttpControllerFactory to support Areas
While it is possible to place WebApi Controllers in different Areas, ASP.NET MVC 4 RC will still treat these ApiControllers as if they all reside in the same namespace. This is a limitation of the DefaultHttpControllerSelector, which is responsible for selecting the appropriate ApiController.
Fortunately, you can inject your own implementation of this class. In fact, I've already encountered this very issue and written an "area aware" HttpControllerSelector. You can find a blog post of mine about this issue and its solution here:
http://blogs.infosupport.com/asp-net-mvc-4-rc-getting-webapi-and-areas-to-play-nicely/