Git Product home page Git Product logo

sap-samples / cap-sflight Goto Github PK

View Code? Open in Web Editor NEW
163.0 15.0 114.0 11.11 MB

Using SAP Cloud Application Programming Model and SAP Fiori elements to build a simple travel management app, both with Node.js and Java.

Home Page: https://cap.cloud.sap

License: Apache License 2.0

JavaScript 35.68% HTML 6.09% Java 17.79% CAP CDS 36.04% Shell 4.01% Dockerfile 0.38%
sample sample-code sap-cap sap-fiori sap-fiori-elements

cap-sflight's Introduction

Welcome to the CAP SFLIGHT App

This is a sample app for the travel reference scenario, built with the SAP Cloud Application Programming Model (CAP) and SAP Fiori Elements.

The purpose of this sample app is to:

  • Demonstrate SAP Fiori annotations
  • Demonstrate and compare SAP Fiori features on various stacks (CAP Node.js, CAP Java SDK, ABAP)
  • Run UI test suites on various stacks

Process Travels Page

The app still contains some workarounds that are going to be addressed over time. In some cases, the model and the handlers can be improved or simplified once further planned CAP features become available. In other cases, the app itself could be improved. For example, calculation of the total price for a travel currently simply sums up the single prices ignoring the currencies.

For enabling all features of the Analytical List Page (ALP) in the Node.js runtime, we have switched on the new OData parser (odata_new_parser: true in package.json), which is still in an experimental state. Early adopters may use this feature in own projects on their own risk. You can also use the ALP with the standard OData parser, but then some features like grouping in the table are not available.

REUSE status

Run locally

Build and Run - Node.js Backend

In the root folder of your project, run

npm ci
cds watch

Build and Run - Java Backend

In the root folder of your project, run

npm ci
mvn spring-boot:run

Accessing the SAP Fiori Apps

Open these links in your browser:

Log in with user amy and empty password.

Integration Tests

To start OPA tests, open this link in your browser: http://localhost:4004/travel_processor/webapp/test/integration/Opa.qunit.html

Test documentation is available at: https://ui5.sap.com/#/api/sap.fe.test

Deployment to SAP Business Technology Platform

The project contains a configuration for deploying the CAP services and the SAP Fiori app to the SAP Business Technology Platform (SAP BTP) using a managed application router. The app then becomes visible in the content manager of the SAP Launchpad service.

The configuration file mta.yaml is for the Node.js backend of the app. If you want to deploy the Java backend, copy mta-java.yaml to mta.yaml.

Prerequisites

SAP Business Technology Platform

Local Machine

  • Install the Cloud Foundry command line interface (CLI). See this tutorial for more details.

  • Install the MultiApps CF CLI Plugin:

    cf add-plugin-repo CF-Community https://plugins.cloudfoundry.org
    cf install-plugin multiapps
  • Install the Cloud MTA Build Tool globally:

    npm install -g mbt

Build the Project

Build the project from the command line:

mbt build

The build results will be stored in the directory mta_archives.

Deploy

  1. Log in to the target space.
  2. Deploy the MTA archive using the CF CLI: cf deploy mta_archives/capire.sflight_1.0.0.mtar

Assign Role Collection

Any authorized user has read access to the app. For further authorization, assign a role collection to your user in the SAP BTP Cockpit:

  • sflight-reviewer-{spacename} for executing actions Accept Travel, Reject Travel, and Deduct Discount
  • sflight-processor-{spacename} for full write access

Integrate SFlight with SAP Build Workzone, Standard Edition

CAP SFlight uses the managed AppRouter, which in case of a trial account, is provided by the Launchpad Service in SAP Build Workzone, Standard Edition. Please consult this tutorial to make sure that your Launchpad Service is configured correctly to serve the CAP SFlight Frontend.

Local Development with a HANA Cloud Instance

You need to have access to a HANA Cloud instance and SAP BTP.

  1. Deploy the HDI content to a HANA HDI container (which is newly created on first call): cds deploy --to hana.
  2. Start the application with the Spring Profile cloud.
    1. From Maven: mvn spring-boot:run -Dspring-boot.run.profiles=cloud
    2. From your IDE with the JVM argument -Dspring.profiles.active=cloud or env variable spring.profiles.active=cloud

The running application is now connected to its own HDI container/schema. Please keep in mind that the credentials for that HDI container are stored locally on your filesystem (default-env.json).

Deployment to SAP Business Technology Platform - Kyma Runtime

The deployment to Kyma Runtime is explained in file README-Kyma-Runtime.md.

Creating an SAP Fiori App from Scratch

If you want to implement an SAP Fiori app, follow these tutorials:

Get Support

In case you've a question, find a bug, or otherwise need support, use the SAP Community to get more visibility.

License

Copyright (c) 2022 SAP SE or an SAP affiliate company. All rights reserved. This project is licensed under the Apache Software License, version 2.0 except as noted otherwise in the LICENSE file.

cap-sflight's People

Contributors

agoerler avatar ajinkyapatil8190 avatar beckermarc avatar bobdenos avatar btbernard avatar bugwelle avatar c-kobo avatar chgeo avatar danjoa avatar danschlachter avatar david-kunz avatar davidhunglam avatar dependabot[bot] avatar drktfl avatar gregorwolf avatar iwonahahn avatar johannes-vogel avatar mattschur avatar mikhailgoncharov avatar petermuessig avatar pierrefritsch avatar rafaelhoff avatar rbrechter avatar rjayasinghe avatar schwma avatar stefan0816 avatar stewsk avatar theplenkov avatar uwe-klinger avatar vmikhailenko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cap-sflight's Issues

CF DEPLOYMENT NEVER WORKS

app gets deployed to cf but not at all in working conditon : {"statusCode":401,"code":"401","message":"Unauthorized"}
can someone please share why am I getting this error?

A technical error has occurred with the now default SAPUI5 1.95.0

Hello SAP CAP Team,

yesterday SAPUI5 1.95.0 was made the default in the CDN. when Starting the sample app the following error occurs:

A technical error has occurred.
this._oAppComponent.getRootControl(...).getController(...).getPlaceholder is not a function

Best Regards
Gregor

Internal Server Error after deployed to HANA DB

dear experts, I tried many times but still have no clue why there is an internal server error issue as screenshot shows.
Screenshot 2024-04-26 at 16 51 09
Once I click "Go" (sorry for Chinese) and the error will come.
The same will come if I click "Create".
I already granted myself the required roles.

When deployment actions will be back?

From your comment in .github/workflows/node.js.yml about "temporarily switch off deployment as it consistently fails" , When deployment actions example will be back? Thank you.

Unauthorized error on BTP/CF

After cf deploy mta_archives/capire.sflight_1.0.0.mtar when I run the service in BTP, and click any entity it gives a 401 Unauthorized error.

401 Unauthorized

Am I missing some details? Kindly advice.

@rbrechter @stewsk

Deploy to Kyma - Configuration global.domain

Hello CAP Team,

I've just went through the Deployment to SAP Business Technology Platform - Kyma Runtime. One step that I've struggled with was in the configuration step. Where I'm asked to "Change value of global.domain key to your cluster domain.". As the in the file is:

global:
  domain: <your own domain>

a beginner will have trouble to find it. Because searching for global.domain doesn't give any result. Also a good tip would be that the domain can be found at https://dashboard.kyma.cloud.sap/clusters where the part after https://api. is the value that needs to be inserted:

image

Best Regards
Gregor

As this project doesn't provide a standalone approuter you have to subscribe to one of the mentioned services. The cheapest or even free one is the Launchpad Service. You might create a new issue in this project and suggest the addition of a standalone approuter.

    As this project doesn't provide a standalone approuter you have to subscribe to one of the mentioned services. The cheapest or even free one is the Launchpad Service. You might create a new issue in this project and suggest the addition of a standalone approuter.

Originally posted by @gregorwolf in #360 (comment)

Travel Analytics UI freezes upon table selection

  1. npm run start
  2. Open travel_analytics FE preview
  3. In the Bookings Table
  • Click on the first-level group header (Airline)
  • Click on the second-hierarchy group header (Booking Status)
    -> Observe that the UI becomes unresponsive and an error is thrown
Log-dbg.js:499  2024-01-05 07:49:55.917800 Unexpected element - Error: Unexpected element
    at Object.beforeOverwritePlaceholder (https://ui5.sap.com/1.120.1/resources/sap/ui/core/library-preload.js:2262:1381)
    at c (https://ui5.sap.com/1.120.1/resources/sap/ui/core/library-preload.js:2256:2922)
    at Array.forEach (<anonymous>)
    at l.addElements (https://ui5.sap.com/1.120.1/resources/sap/ui/core/library-preload.js:2256:3588)
    at https://ui5.sap.com/1.120.1/resources/sap/ui/core/library-preload.js:2256:9542 sap.ui.model.odata.v4.ODataModel

CAP SFlight breaks with SAP UI 5 Version 120

When you run SFlight locally or with the current CI you see that UI (tests) don't work anymore. This is due to a bug in UI5 that we can't actively detect as we only have defined a minimum version for UI5. This is OK since we want to always use the latest and greatest. ;)

We should, however, have a regular CI run that would then detect such breakage. โ˜๐Ÿฝ

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.