How to generate ready-for-web-server source? - qooxdoo

I'm trying to find a way to generate (with generate.py source-all) application code that is ready for running from web server (eg. Tomcat).
The only thing that prevents me from doing this is the fact that myapp.js contains filesystem URIs in libinfo object:
var libinfo = {
"__out__":{"sourceUri":"script"},
"myapp":{"resourceUri":"../source/resource","sourceUri":"../source/class"},
"qx":{
"resourceUri":"file:///C:/dev/qooxdoo-5.0.1-sdk/framework/source/resource",
"sourceUri":"file:///C:/dev/qooxdoo-5.0.1-sdk/framework/source/class",
"sourceViewUri":"https://github.com/qooxdoo/qooxdoo/blob/%{qxGitBranch}/framework/source/class/%{classFilePath}#L%{lineNumber}"
}
};
When I manually change resourceUri & sourceUri from
file:///C:/dev/qooxdoo-5.0.1-sdk/framework/source/...
to
/myapp/qooxdoo-5.0.1-sdk/framework/source/...
application page successfully loads in the browser with all the dependencies (generated sources are already in document root, and "qooxdoo-5.0.1-sdk" framework content loads due to the mapping /myapp/qooxdoo-5.0.1-sdk => C:\Dev\qooxdoo-5.0.1-sdk set up on the server).
Is there a way to tell generate.py that my SDK framework files should be accessed through an URL (/myapp/qooxdoo-5.0.1-sdk/...) instead of filesystem URI?
(I can see there are a number of "compile-options" that can be specified in config.json (qooxdoo Documentation Release 5.1: chapter 11.3.3 - Generator Config Keys), but looks like none of them solves the problem)

In your config.json you will have a "jobs" section containing a "libraries" section, containing a "library" array - your application is a library, as is Qooxdoo, as is any contribs so it will look something like this:
"jobs" : {
"libraries" : {
"=library" : [ {
"manifest" : "${QOOXDOO_PATH}/framework/Manifest.json"
}, {
"manifest" : "Manifest.json"
}
},
Each "library" object can have a "uri" property, so for your example you probably want something like this:
"jobs" : {
"libraries" : {
"=library" : [ {
"manifest" : "${QOOXDOO_PATH}/framework/Manifest.json",
"uri" : "/some/other/uri/qooxdoo-5.0.1-sdk"
}, {
"manifest" : "Manifest.json"
}
},
and then on your web server, either position the qooxdoo-5.0.1-sdk directory appropriately or create a mapping to it.

Related

Recover Vsphere VMs by folder with postman request?

I try to recover each VM by folder by using request from postman.
With this request, I'm able to list each folder in my vsphere :
GET https://SERVER/rest/vcenter/folder
With this second command, I'm able to list each VM in my vpshere :
GET https://SERVER/rest/vcenter/vm
I want to know if there is a way to get a folder and each VMS inside it ?
Something like :
GET https://SERVER/rest/vcenter/folder/my_folder
With an output like :
"value": [
{
"folder": "XXX",
"VMs" : {
VM1
VM2
...
Or someting like that ?
Thanks a lot !
http://vmware.github.io/vsphere-automation-sdk-rest/6.5/operations/com/vmware/vcenter/folder.list-operation.html
&filter.parent_folders.1=obj-103
it supports query parameter parent_folders , so the url will be like
GET https://SERVER/rest/vcenter/folder?filters.filter.parent_folders.1=obj-103
Even VM supports the filter called folder:
http://vmware.github.io/vsphere-automation-sdk-rest/6.5/operations/com/vmware/vcenter/vm.list-operation.html

Delete and Rename events in google drive

I am working on a feature for our webapp where we create google drive files from our server
Drive service = getServiceForLoginUser();
com.google.api.services.drive.model.File fileMetadata = new com.google.api.services.drive.model.File();
fileMetadata.setTitle(getDefaultName());
fileMetadata.setMimeType(APPLICATION_VND_GOOGLE_APPS_DRIVE_SDK);
com.google.api.services.drive.model.File.Thumbnail thumbnail = buildThumbnail(driveType);
fileMetadata.setThumbnail(thumbnail);
com.google.api.services.drive.model.File googleFile = service.files().insert(fileMetadata)
.setFields("id")
.execute();
I have configured Drive UI Integration to trigger New and Open URL flows from google drive.I have also published a chrome app with following manifest.
"name" : "classflowtest",
"version" : "3.5",
"manifest_version" : 2,
"icons": {
"128": "icon_128.png"
},
"description" : "description_text",
"container" : "GOOGLE_DRIVE",
"api_console_project_id" : "146081768739",
"gdrive_mime_types": {
"http://drive.google.com/intents/opendrivedoc": [
{
"type": ["image/png", "image/jpeg", "image/gif", "html","application/vnd.google.drive.ext-type.png",
"application/vnd.google.drive.ext-type.jpg","application/vnd.google.drive.ext-type.gif","application/vnd.google.drive.ext-type.html"],
"href": "https://mywebappurl",
"title" : "Open",
"disposition" : "window"
}
]
},
"app" : {
"launch" : {
"web_url" : "mywebappurl"
}
}
So now I can trigger New and Open flows in drive successfully. In New flow I create first a resource in our db and then I create a file in google drive from my application server. So every entry I create in google drive has a representation in our db as well. My issue is now if I rename or delete the file in google drive how do I get those events so that I can make the necessary changes in our DB ?
Check the Changes: list if it can help you. It will lists all the changes in your drive. But is is difficult to filter the results. To get the deleted files, you must specify the includeRemoved parameter to true. So it is easier to get the files if you know its fileID before you rename or delete it.
I found in this SO question that someone use Apps Activity API to solve this problem.
For more information, check this thread.

Dynamically Load Extjs Modular application

I am in to developing a large client side app with very complex views on each modules using Extjs5. I have developed apps in Extjs but they all compile to a single app.js file. So based on the complexity of the views in all the app mockups I am estimating the size of the app will be around 20MB to 25MB even after compiled.
I was thinking to split the modules as separate applications and create a master app with tabs or something, which triggered will be loading individual apps in a iFrame within the master app. But I doubt if the iframe behaviors are altered in different browsers or deprecated in any future browser releases, that will be another big problem.
So is there any way in sencha cmd, which compiles app in separate files based on modules and load them on demand out of the box ?
If not what is the advisable solution I should be going ahead with.
Starting with Sencha Cmd 6.5 you can split your code into multiple files. To achieve this, you have to split your code into exjts packages if it’s not already done:
In the end, you should have a similar folder structure to this:
workspaceDir
|
+->appA
+->appB
+->packages
|
+-> local
|
+->CoreComponents
+->ProcurementModule
+->ForumModule
+->BOMModule
+->ReportModule
In your app.json file you could add/move your packages from requires to uses. As a last step you have to add the new package-loader to the requires array in app.json.
You end up with something like that:
{
// [...]
"uses": [
"ProcurementModule",
"ForumModule",
"BOMModule",
"ReportModule"
],
"requires": [
"CoreComponents",
"package-loader"
]
// [...]
}
Next you need to start your Sencha Cmd build with the additional flag -uses.
If you do this, Sencha Cmd will build your optional packages first and add them to the resource folder in your build output directory.
sencha app build -uses production
It is important, that you don't have any references to classes in optional packages from your main application. Otherwise your build will fail.
Since your optional packages are not loaded automatically on page startup you need to trigger the loading process manually. I do it usually within the routing process of my AppControllers.
Here an example:
Ext.define('MyApp.view.main.MainController', {
extend: 'Ext.app.ViewController',
requires: [
'Ext.Package'
],
routes: {
'forum': {
before: 'loadForum',
action: 'showView'
}
},
loadForum(action) {
if (Ext.Package.isLoaded('ForumModule')) {
action.resume();
} else {
//Loading mask code here [...]
Ext.defer(() => { // it needs some time to show up the loading mask
Ext.Package.load('ForumModule').then(() => {
//Remove loading mask code here [...]
action.resume(); //proceed router process; all package files loaded
});
}, 500);
}
},
showView() {
this.getView().add({xclass: 'ForumModule.view.MainView'});
}
});
More information on this topic:
http://docs.sencha.com/cmd/guides/whats_new_cmd65.html#whats_new_cmd65_-_dynamic_package_loading

Where to store settings in Sencha Touch?

i would like to consolidate the url base for my RESTFul API in a single place in my app built with Sencha Touch. Where is the best place i can put it?
There is a obvious option to store it in localStorage, but is this a good practice ?
When I want to support MVC structure I create file Config.js and put it in application tree in the following place:
in Config.js:
Ext.define('MyApp.config.Config', {
singleton: true,
config: { /** here you can put any objects of your choice that will be accessible globally**/
baseURL : Ext.os.is.Android ? 'http://live_url_here.com' : 'http://localhost/testing_locally',
topBannerUrl : 'http://some_url/banner.png',
anotherGlobalParam : true
},
constructor: function(config) {
this.initConfig(config);
return this;
}
});
Those config parameters will be visible in the whole application.
You may get them:
MyApp.config.Config.getBaseImgURL(); /* returns 'http://some_url/banner.png' */
MyApp.config.Config.getAnotherGlobalParam(); /* returns true */
or set:
MyApp.config.Config.setBaseImgURL('new_url');
MyApp.config.Config.setAnotherGlobalParam(false);
This solution may be especially handy when your project requires many configuration parameters.
I hope it will work for you as well.
Always keep your url base in a seperate file like util.js(utility.js). Your file path should be app > util > Util.js. You can keep your common functions like animateItem, showLoading/hideLoading, custom functions, etc over here so that you can use the same function throughout the app. To load this file in your app do this:
app.js
Ext.application({
name: 'HelloWorld',
requires: [
'HelloWorld.util.Util'
],
view: []
})
For best practices in sencha touch you can see this: Sencha Touch Blog
+1 for Anubis recommendation.
Something like this:
Ext.define('MyApp.Const', {
statics:{
url1:'....',
url2:'....'
}
})
Then you can access your urls with:
MyApp.Const.url1
Of course you must require Const class but you don't need to instantiate it.

How to use JSON without json file?

I need to use dynamically JSON with data.TreeStore.
With this component, there is proxy "config", it need a path to JSON file.
My problem is, i can't write Json file in my application.
I would know, if i can generated JSON dynamically and pass it to url config into proxy?
For example :
Var trStore = Ext.create('Ext.Data.TreeStore',{
... // config
proxy {
type : 'ajax',
url : { id : 'id0', task :'task0', value : 'val0', ..... }
}
});
My URL is not a file url but is JSON generated with my own method !
How to build JSON for use it with TreeStore and without make file !?
I hope you understand my problem :)
Thanks a lot to help !
Your example looks like you want to pass static "inline data" to the TreeStore.
As far as I can see this is not possible with a bare TreeStore, since it does not have a data config option as the "normal" Store has. However, it is possible with a Treepanel.
You can pass your inline data to the TreeStore using the root config option of the Treepanel (not the TreeStore). It works in a very similar manner as the data config option of a "normal" Store:
Ext.create('Ext.tree.Panel', {
root: { id : 'id0', task :'task0', value : 'val0', children: [...], ... }
// ...
});
There are two caveats related to this:
The beta3 docs say root is boolean, that's wrong.
Because of a bug in beta3 you cannot use this together with rootVisible: false.
Remember that a "json file" is really just a text string, so you can generate that with PHP or your preferred server software.
For the url in the proxy, simply put in the url you use to run that function. Eg in my web app I have http://example.org/controller/getTree?output=json
This runs the getTree() function on my controller, and the function knows to return json.

Resources