sap-samples / ui5-cap-event-app Goto Github PK
View Code? Open in Web Editor NEWShowcase of SAP Cloud Application Programming Model and OData V4 with draft mode in a freestyle SAPUI5 app and an SAP Fiori elements app.
License: Apache License 2.0
Showcase of SAP Cloud Application Programming Model and OData V4 with draft mode in a freestyle SAPUI5 app and an SAP Fiori elements app.
License: Apache License 2.0
Hi,
First of all it's a wonderful app to learn SAP CAP, I have created the fiori elements app using wizard and consuming SAP CAP LOCAL SERVICE and i see two simple issues here.
Hi all,
I noticed some differences in the TS types for other UI5 versions. Can we generate the types for other versions as well?
One more thing, I noticed that the names of the controllers also contain "Controller" at the end while this is not added in the controllername defined in the view. Does the framework excludes "Controller" when connecting the view to the controller?
Thank you in advance!
Kr, Wouter
["ERROR" - 9:00:55 AM] Error formatting document.
["ERROR" - 9:00:55 AM] Unexpected token, expected "{" (109:12)
107 | }
108 | }
> 109 | export BaseController
| ^
110 | }
111 | )
112 |
A violation against the OSS Rules of Play has been detected.
Rule ID: rl-assigned_teams-1
Explanation: Does it have enough teams on GitHub? No
Find more information at: https://sap.github.io/fosstars-rating-core/oss_rules_of_play_rating.html
Hi All,
First thank you very much for the typescript branch. I am really super excited about the progress made here. I think the overall developments in this direction will be a giantic step for the UI5 development generally. After developing a year with typescript I really don't want to go back - It is fantastic that my day-to-day framework now makes that step too..
Regarding typescript the most "urgent" open point was mentioned in PR #5.
There are however two more open points, which I'd like to address, which might be a big help for application developers. Both can be easily implemented by customers, so are therefore no blockers at all, but imo would be great inside the core product / framework.
I am not sure if that is the right place (probably more the typescript or the openui5 repo?), but still I want to give you short feedback also regarding the sample, as maybe (if this here should be a best practice typescript application) you might add sth. of the examples below inside your code.
Typescript and JSON-Model is a small "no-no" when using the "normal API". Using setProperty("long/long/1/path/without/typing", some_unknown_value)
inside typescript is very sad.
In out project we have build a sub-class of the JSON Model, which:
For that however both "oData" && checkUpdate should be opened and made public (we are working with "any" atm, to workaround that restriction).
Example-Code: State
export class DetailControllerState {
busy: boolean;
public setBusy(bBusy: boolean) {
this.busy = bBusy;
}
}
export type DetailControllerStateRO = { +readonly [P in keyof DetailControllerState]: DetailControllerState[P] };
and Usage inside a controller..
Using that "State" approach you can mostly avoid using formatter by using "getters" instead (ofc not "perfect", as the change detection is not working here, but still nice). Example of a state method:
get getAmountOfData(): string {
return this.data.filter((e) => e.type=== ENUM_DATA.MY_TYPE && e.change_indicator !== "D").length.toString();
}
JSONModel:
export default class GenericJSONModel<T> extends JSONModel {
public _setData(oData: T, bMerge?: boolean): void {
this.setData(oData, bMerge);
this._observeFunctions();
}
private _observeFunctions() {
Object.getOwnPropertyNames(Object.getPrototypeOf(this.oData)).forEach((sAttr) => {
const sVal = allData[sAttr];
if ( typeof sVal === "function" ) {
const funcBefore: Function = sVal;
const funcApply = this._checkUpdate.bind(this);
allData[sAttr] = function(...args: any[]) {
const ret = funcBefore.apply(this,args);
funcApply();
return ret;
};
}
});
}
}
Using transpiler / babel we can finally use await/async - but the scope of it is somewhat limited without the use of promise based APIs. UI5 still has a lot of places where callback based APIs are published. As ofc breaking changes are not really possible, i'd suggest the creation of some reusable classes build on top of the existing APIs.
I want to give you two short examples of our current project, where we have build promisified versions of the ODataModel handler and the MessageBox method.
protected async _confirmNavBack() {
if(!this._isDirty()) { return true; }
const answer = await AsyncMessageBoxDef.confirm(this.getText("confirmCancelMsg"), {
title: this.getText("confirmCancelTitle"),
});
return answer === Action.OK;
}
protected async _onNavBack() {
const allowNavBack = await this._confirmNavBack();
if ( allowNavBack === false ) { return; }
this.getRouter().navTo("Master");
}
try {
const headData = await this._oModel.read(sNormalizedPath);
//access all elements, headData is statically typed using DTOs etc..
if (headData.status === "2") {
return;
}
} catch (e) {
return;
}
Regards,
Timo
A violation against the OSS Rules of Play has been detected.
Rule ID: rl-assigned_teams-1
Explanation: Does it have enough teams on GitHub? No
Find more information at: https://sap.github.io/fosstars-rating-core/oss_rules_of_play_rating.html
The OSPO bot created this issue by mistake - It did not have enough priviledge to check the vulnerability alerts, So I am closing this issue now. Sorry for any inconvenience.
eventregistration-service-annotations.cds refers to i18n element Familienmitglieder. This element does not exist. Based upon i18n files, it should rather reference element Familymembers
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.