Skip to content

Commit

Permalink
Merge branch 'main' into doc-ff
Browse files Browse the repository at this point in the history
  • Loading branch information
johannes-vogel authored Nov 6, 2023
2 parents 19862e6 + 86b0443 commit 96920ab
Show file tree
Hide file tree
Showing 28 changed files with 528 additions and 516 deletions.
48 changes: 38 additions & 10 deletions .github/etc/create-review.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,22 @@ module.exports = async ({ github, require, exec, core }) => {
let lintErrorsText = ''
let spellingMistakesText = ''

const result = await github.request('GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews', {
owner: REPO_OWNER,
repo: REPO,
pull_number: PULL_NUMBER
})

const linterErrors = []
const spellingMistakes = []

result.data
.filter(review => review.body.includes('<!-- Linter Review -->'))
.forEach(review => {
spellingMistakes.push(...(review.body.match(/\*(.*) <!--Spelling Mistake-->/g) || []))
linterErrors.push(...(review.body.match(/\*(.*) <!--Linter Error-->/g) || []))
})

if (existsSync(markdownlintLogFile)) {
const matches = readFileSync(markdownlintLogFile, 'utf-8')
.split('\n')
Expand All @@ -67,11 +83,12 @@ module.exports = async ({ github, require, exec, core }) => {
[(test)[link.de]]
*/
for(let [error, path, pointer, rule, description, details, context] of matches) {
for (let [error, path, pointer, rule, description, details, context] of matches) {
let contextText = ''
let comment;

if (rule === 'MD011/no-reversed-links') {
const detailValue = details.slice(1,-1)
const detailValue = details.slice(1, -1)

contextText = `[Context: "${detailValue}"]`

Expand All @@ -87,7 +104,7 @@ module.exports = async ({ github, require, exec, core }) => {

const commentBody = createSuggestionText(suggestion)

comments.push({ path, position, body: commentBody })
comment = { path, position, body: commentBody }
}

if (rule === 'MD042/no-empty-links') {
Expand All @@ -101,7 +118,7 @@ module.exports = async ({ github, require, exec, core }) => {
continue
}

comments.push({ path, position, body: getNoEmptyLinkText() })
comment = { path, position, body: getNoEmptyLinkText() }
}

if (rule === 'MD040/fenced-code-language') {
Expand All @@ -117,7 +134,7 @@ module.exports = async ({ github, require, exec, core }) => {

codeBlockLines[0] = codeBlockLines[0] + 'txt'

comments.push({ path, body: createMissingCodeFencesText(codeBlockLines), start_line: start, line: end })
comment = { path, body: createMissingCodeFencesText(codeBlockLines), position: start }
}

if (rule === 'search-replace') {
Expand All @@ -136,7 +153,7 @@ module.exports = async ({ github, require, exec, core }) => {
continue
}

comments.push({ path, position, body: getInvalidUrlText(text, link.slice(1, -1)) })
comment = { path, position, body: getInvalidUrlText(text, link.slice(1, -1)) }
}

if (ruleName === 'custom-containers-requires-type') {
Expand All @@ -157,11 +174,16 @@ module.exports = async ({ github, require, exec, core }) => {
description = 'container type should be specified'
contextText = `[Context: "${affectedLine}"]`

comments.push({ path, position, body: createSuggestContainerTypeText(correctedLine) })
comment = { path, position, body: createSuggestContainerTypeText(correctedLine) }
}
}

lintErrorsText += `* **${path}**${pointer} ${description} ${contextText}\n`
const text = `* **${path}**${pointer} ${description} ${contextText} <!--Linter Error-->`

if (!linterErrors.find(el => el === text)) {
lintErrorsText += text + '\n'
comments.push(comment)
}
}
}

Expand All @@ -174,7 +196,11 @@ module.exports = async ({ github, require, exec, core }) => {

const wordsWithoutSuggestions = []

for (const [error, path, pointer , word, context, suggestionString] of matches) {
for (const [error, path, pointer, word, context, suggestionString] of matches) {

const text = `* **${path}**${pointer} Unknown word "**${word}**" <!--Spelling Mistake-->`

if (spellingMistakes.find(el => el === text)) continue

// from "[s1, s2, s3]" to [ "s1", "s2", "s3" ]
const suggestions = suggestionString
Expand Down Expand Up @@ -205,7 +231,7 @@ module.exports = async ({ github, require, exec, core }) => {
wordsWithoutSuggestions.push(word)
}

spellingMistakesText += `* **${path}**${pointer} Unknown word "**${word}**"\n`
spellingMistakesText += text + '\n'
}

if (wordsWithoutSuggestions.length > 0 && comments.length > 0) {
Expand All @@ -227,6 +253,8 @@ module.exports = async ({ github, require, exec, core }) => {
}

if (body) {
body = '<!-- Linter Review -->\n' + body

await github.rest.pulls.createReview({
owner: REPO_OWNER,
repo: REPO,
Expand Down
2 changes: 1 addition & 1 deletion .vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const redirectLinks: Record<string, string> = {}

const latestVersions = {
java_services: '2.3.0',
java_cds4j: '2.3.0'
java_cds4j: '2.3.1'
}

const localSearchOptions = {
Expand Down
34 changes: 7 additions & 27 deletions advanced/performance-modeling.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@ Typical examples of calculated fields are:
The following steps show you which option takes precedence over another. Use options one/two as the preferred way and three/four as fallback.

1. Do the calculation on the UI with help of field controls or dedicated custom controls. This applies to all kinds of **String concatenation** and **Formatting**.
2. Pre-calculate on *write* with help of an event handler.
3. Some Calculated Fields are dynamic in nature. Do those calculations on the database layer. For example _kanban_ (scheduling system for lean manufacturing), there you typically have dynamic live calculations.
2. Pre-calculate using CDS [on write](../cds/cdl#on-write) calculated fields.
3. Some calculations are dynamic in nature. If possible, use CDS [on read](../cds/cdl#on-read) calculated fields.
4. As a **very last resort**, use event handlers on *read*.

Hints:
Expand Down Expand Up @@ -312,35 +312,15 @@ entity OrdersItemsView as projection on OrdersItems {
::: code-group
```cds [schema.cds]
extend my.OrdersItems with {
itemCategory: String enum{ Small; Medium; Large;};
// fill itemCategory at runtime in service.js
category: String = case
when quantity > 500 then 'Large'
when quantity > 100 then 'Medium'
else 'Small'
end stored;
}
```
:::

::: code-group
```js [service.js]
...
// fill itemCategory at runtime
this.before (['CREATE', 'UPDATE'], 'my.OrdersItems', async req => {
if (req.data.quantity > 500) {req.data.itemCategory = 'Large'}
else if (req.data.quantity > 100) {req.data.itemCategory = 'Medium'}
else {req.data.itemCategory = 'Small'}
})
...
```
:::

New `OrdersItemsView` without case statement:

::: code-group
```cds [service.cds]
entity OrdersItemsView as projection on OrdersItems {
*,
itemCategory as category
};
```
:::

## Compositions vs Associations
From the performance perspective there are some cases, where you have to check out carefully if the general semantic rules of compositions vs associations should be applied.
Expand Down
1 change: 1 addition & 0 deletions get-started/assets/Logo_TFE.drawio.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added get-started/assets/blogs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added get-started/assets/community.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added get-started/assets/docs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added get-started/assets/features.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added get-started/assets/gear.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions get-started/assets/github.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added get-started/assets/list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added get-started/assets/navi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added get-started/assets/news.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions get-started/assets/stack.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
125 changes: 125 additions & 0 deletions get-started/learning-sources.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Learning Sources

... coming soon ...

[[toc]]



<style>

h3.github::before {
content: "";
background: url(./assets/github.svg) no-repeat 0 0;
background-size: 40px;
height: 40px;
width: 40px;
margin-right: 11px;
vertical-align: middle;
display: inline-block;
}

li._nodejs {
display: inline;
margin-right: 2em;
}
li._nodejs a::before {
content: "";
background: url(../assets/logos/nodejs.svg) no-repeat 0 0;
background-size: 4em;
height: 4em;
width: 4em;
vertical-align: middle;
display: inline-block;
}

li._java {
display: inline;
margin-right: 2em;
}
li._java a::before {
content: "";
background: url(../assets/logos/java.svg) no-repeat 0 0;
background-size: 5.5em;
height: 5.5em;
width: 5.5em;
vertical-align: middle;
display: inline-block;
}

</style>




## Sample Projects

### Bookshop et al... {.github}

The bookshop sample is our original sample provided by the CAP team and featured in the [getting started guides](../get-started/in-a-nutshell).
It is available in both Node.js and Java. The Node.js variant contains additional samples besides bookshop that demonstrate various features of CAP.

Available for:

- [](https://github.com/sap-samples/cloud-cap-samples) {._nodejs}
- [](https://github.com/sap-samples/cloud-cap-samples-java) {._java}




### Incidents Mgmt {.github}

Available for:

- [](https://github.com/cap-js/incidents-app) {._nodejs}



### SFlight Fiori {.github}

Available for:

- [](https://github.com/sap-samples/cap-sflight) {._nodejs}
- [](https://github.com/sap-samples/cap-sflight) {._java}



### Star Wars {.github}



### BTP SaaS App {.github}

- https://github.com/SAP-samples/btp-cap-multitenant-saas



## Tutorials

- By Enablement Teams
- TechEd Hands-Ons



## Videos



## Blogs



## Courses

- OpenSAP
-

## CAP Plugins

- CAP community

- Change Tracking

- Audit Logging

- ...
68 changes: 0 additions & 68 deletions get-started/samples.md

This file was deleted.

Loading

0 comments on commit 96920ab

Please sign in to comment.