Skip to content

Commit cf2dc1f

Browse files
authored
Merge pull request #13 from cap-js/demo/services-in-cds-plugin
using services from cds-plugin.js
2 parents 403e4e4 + 129cbba commit cf2dc1f

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

cds-plugin.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,19 @@ cds.once("served", async () => {
4444
// Track the action parameters holding print configurations
4545
await getAnnotatedParamsOfAction(boundAction);
4646
const sourceentity = getQueueValueHelpEntity(boundAction.params);
47+
const printer = await cds.connect.to("print");
4748
if(sourceentity && !queueValueHelpHandlerRegistered) {
48-
srv.after('READ', sourceentity, populateQueueValueHelp);
49+
srv.after('READ', sourceentity, async (_, req) => {
50+
// TODO: make sure the format of all services are the same
51+
const q = await printer.getQueues();
52+
53+
q.forEach((item, index) => {
54+
req.results[index] = { ID: item.ID };
55+
});
56+
req.results.$count = q.length;
57+
return;
58+
59+
});
4960
}
5061
const actionName = boundAction.name.split('.').pop();
5162

@@ -56,4 +67,4 @@ cds.once("served", async () => {
5667
}
5768
}
5869
}
59-
});
70+
});

0 commit comments

Comments
 (0)