SAPUI5 - HTML5 Application - Use function in manifest.json - sapui5

I have this really basic SAPUI5 application created from the template available in SAP Business Application Studio.
I have defined a custom resource in the manifest.json which executes a javascript function:
{
"sap.ui5": {
"resources": {
"js": [
{
"uri": "lib/myFunction.js"
}
],
"css": [
{
"uri": "css/style.css"
}
]
}
},
"...": "..."
}
Is there a way to dynamically define the resource to be used in the application bootstrap?
For example, in my "lib" folder, I have different *.js files:
Is there a way to choose a single *.js to be used?

Related

VS Code Extension: Is it possible to access View items using JS?

Your package.json creates a View in the Explorer, say "Test"...
"views": {
"explorer": [
{
"id": "Test",
"name": "Test"
}
]
}
... is it possible in the extension's JS to access that View?
Something like this...
ThisView=vscode.window.getViewById("Test");

How to avoid additional request for model data assigned to "dataSources"? (Component-preload.js)

I'm defining a JSON data source in my manifest.json as follows (only relevant parts shown):
{
"_version": "1.8.0",
"sap.app": {
"id": "myAppID",
"dataSources": {
"application_datasource": {
"uri": "/model/application.json",
"type": "JSON"
}
}
}
},
"sap.ui5": {
"models": {
"application": {
"type": "sap.ui.model.json.JSONModel",
"dataSource": "application_datasource"
}
}
}
This works quite well; the JSON is loaded from the webserver.
When using the UI5-Tooling to build the app, I can see that the /model/application.json is actually included in the Component-preload.js under the key "/myAppID/model/application.json".
When loading the application from the dist-folder, the app still hits the webserver for the /model/application.json and is not pulling it from the Component-preload.js.
What am I missing here to make it use the already in memory existing data? As far as I can see, the manifest.json itself is already pulled from the Component-preload.js.

Drawing an image from a cloudformation template

Is the any drawing / export tool that I can use to turn a cloudformation template into a diagram.
In need to export my cloudformation stack into an image, or a graphviz file.
Regards,
You can use the latest version of the cfn-lint tool to get a graph of resources from your template.
Use it like this:
pip3 install cfn-lint pydot
cfn-lint template.json -g
For example, it will generate a DOT file that renders like this:
Which corresponds to this template:
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Sample template that demonstrates Fn::GetAtt",
"Resources": {
"DetectTextInImage": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Role": {
"Fn::GetAtt": [
"DetectTextInImageRole",
"Arn"
]
}
}
},
"DetectTextInImageBucketEvent1Permission": {
"Type": "AWS::Lambda::Permission",
"Properties": {}
},
"DetectTextInImageRole": {
"Type": "AWS::IAM::Role",
"Properties": {}
},
"ResultsTable": {
"Type": "AWS::DynamoDB::Table",
"Properties": {}
},
"SourceImageBucket": {
"Type": "AWS::S3::Bucket",
"Properties": {
"NotificationConfiguration": {
"LambdaConfigurations": [
{
"Function": {
"Fn::GetAtt": [
"DetectTextInImage",
"Arn"
]
}
}
]
}
}
}
}
}
The CloudFormation Linter Visual Studio Code extension also has a resource dependency graph preview button in the top right while editing CloudFormation templates:
You can use the AWS CloudFormation designer. Click on Open, then upload your template. Finally take a screenshot of the result to have it in an image format.
Here's an exemple of what the result might look like:
For more information, have a look at the doc.

How do I add SAP Gateway services to an existing SAP WEB IDE Project?

I've imported a SAP WEB IDE project from SAP Build....
All looks great, but now I need to add in my Gateway services to handle oData etc.
I've setup my SAP Cloud Connector to and Destinations.
How specifically do I add these as all tutorials seems to start by including the service as part of a template.
You have to do some steps to make this work:
implement the service definition in your manifest.json file:
"sap.app": {
[...],
"dataSources": {
"mainService": {
"uri": "/your/path/to/service",
"type": "OData",
"settings": {
"odataVersion": "2.0",
"localUri": "localService/metadata.xml"
}
}
},
[...]
},
implement the model definition in your manifest.json file:
"models": {
[...],
"": {
"dataSource": "mainService",
"settings": {
"metadataUrlParams": {
"sap-documentation": "heading"
},
"defaultBindingMode": "TwoWay"
}
}
},
You can go to the New>oData service menu from the project and create it that way too.

How to use a library on SAPWebIDE

i am trying to use the openui5-googlemaps library, but the WebIDE looks at a different path than my SAP-System then the app is deployed.
libs: ["sap.m", "sap.ui.layout", "sap.ushell", "openui5.googlemaps"],
my SAP-System looks at path resources/openui5/googlemaps.
However this does not work in the WebIDE.
Any ideas why and how i can fix it?
Thanks
Either change the path, or load via your index.
API With Example
In Index
~ update may 2017 ~
You can now use the manifest to add libraries:
"resources": {
"css": [
{
"uri": "css/style.css"
},
{
"uri": "css/croppie.css"
}
],
"js": [
{
"uri": "library/croppie.min.js"
}
]