Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@ The top of each sample's screen says which of the two answered.

```bash
npm install
cds watch # needs @sap/cds-dk (npm i -g @sap/cds-dk) - or: npm run mocked
npm start # cds-serve --with-mocks - or cds watch, with @sap/cds-dk installed
```

`cds watch` prints the address of every sample. Log in as `alice` with an
empty password (CAP's mocked development user), then open
`--with-mocks` is what `cds watch` passes: every remote system without
credentials is mocked. In the production profile CAP ignores the flag, so the
same script serves a deployment. The log prints the address of every sample.
Log in as `alice` with an empty password (CAP's mocked development user), then
open
<http://localhost:4004/sap/bc/z2ui5?app_start=Z2UI5_CL_CAPS_APP_001> or
<http://localhost:4004/sap/bc/z2ui5?app_start=Z2UI5_CL_CAPS_APP_002>.

Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@
"fast-xml-parser": "^5.11.1"
},
"scripts": {
"start": "cds-serve",
"start": "cds-serve --with-mocks",
"watch": "cds watch",
"mocked": "cds-serve --with-mocks",
"test": "node --test test/*.test.mjs",
"lint": "eslint ."
},
Expand Down
3 changes: 2 additions & 1 deletion srv/apps/z2ui5_cl_caps_app_001.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ function source_of(srv) {
if (srv.mocked) return `the mock of ${srv.name} - cds watch serves it while no credentials are configured`;
const { url, destination } = srv.options.credentials ?? {};
if (destination) return `destination ${destination}`;
const u = new URL(url);
let u;
try { u = new URL(url); } catch { return srv.name; } // no url, or not one: the query's error says so
return u.origin + u.pathname;
}
5 changes: 3 additions & 2 deletions srv/apps/z2ui5_cl_caps_app_002.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,8 @@ function dats(value) {
// host and client, and never user or password.
function source_of(srv) {
if (srv.mocked) return `the mock of ${srv.name} - cds watch serves it while no credentials are configured`;
const { destination, ashost, mshost, client } = srv.options.credentials ?? {};
const { destination, ashost, mshost, wshost, client } = srv.options.credentials ?? {};
if (destination) return `destination ${destination}`;
return `${ashost ?? mshost}, client ${client}`;
const host = ashost ?? mshost ?? wshost;
return host ? `${host}, client ${client}` : srv.name; // incomplete credentials: the call's error says so
}
Loading