pptb-standard-sample-tool 1.4.1 → 1.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +17 -14
- package/dist/index.html +37 -4
- package/package.json +1 -1
- package/pptb.config.json +3 -0
package/dist/app.js
CHANGED
|
@@ -26,6 +26,7 @@ let securitySuites = null;
|
|
|
26
26
|
let terminalFeature = null;
|
|
27
27
|
let fileSystemFeature = null;
|
|
28
28
|
let inputEntityName = null;
|
|
29
|
+
let fetchXmlFromLaunchContext = null;
|
|
29
30
|
const powerPlatformNamespaces = [
|
|
30
31
|
"Analytics",
|
|
31
32
|
"AppManagement",
|
|
@@ -102,7 +103,8 @@ async function identifyLaunchContext() {
|
|
|
102
103
|
log(`Launch context: ${ctx}`, "info");
|
|
103
104
|
if (ctx !== null) {
|
|
104
105
|
// Tool was launched via inter-tool invocation
|
|
105
|
-
inputEntityName = ctx.entityName;
|
|
106
|
+
inputEntityName = ctx.entityName ?? null;
|
|
107
|
+
fetchXmlFromLaunchContext = ctx.fetchXml ?? null;
|
|
106
108
|
currentLaunchContext = ctx;
|
|
107
109
|
log(`Launched with context for entity: ${inputEntityName}`, "success");
|
|
108
110
|
// Set iti-entity-name value with the entity name from the launch context
|
|
@@ -113,12 +115,12 @@ async function identifyLaunchContext() {
|
|
|
113
115
|
// Set default fetchXML to query the launched entity
|
|
114
116
|
const defaultFetchOutput = document.getElementById("iti-default-fetch-output");
|
|
115
117
|
if (defaultFetchOutput) {
|
|
116
|
-
defaultFetchOutput.textContent =
|
|
117
|
-
|
|
118
|
+
defaultFetchOutput.textContent =
|
|
119
|
+
fetchXmlFromLaunchContext ||
|
|
120
|
+
`<fetch top="10">
|
|
118
121
|
<entity name="${inputEntityName}">
|
|
119
122
|
<attribute name="name" />
|
|
120
123
|
<attribute name="${inputEntityName}id" />
|
|
121
|
-
<order attribute="name" />
|
|
122
124
|
</entity>
|
|
123
125
|
</fetch>`;
|
|
124
126
|
}
|
|
@@ -299,19 +301,20 @@ function setupEventHandlers() {
|
|
|
299
301
|
document.getElementById("load-setting-btn")?.addEventListener("click", loadToolSetting);
|
|
300
302
|
document.getElementById("save-setting-btn")?.addEventListener("click", saveToolSetting);
|
|
301
303
|
// Inter-tool invocation buttons
|
|
302
|
-
document.getElementById("iti-return-value-btn")?.addEventListener("click", async () => {
|
|
303
|
-
const fetchXML = document.getElementById("iti-default-fetch-output")?.textContent;
|
|
304
|
-
await toolbox.invocation.returnData({
|
|
305
|
-
fetchXml: fetchXML,
|
|
306
|
-
});
|
|
307
|
-
log(`Returned data to caller: ${fetchXML}`, "info");
|
|
308
|
-
// PPTB automatically closes this window after delivering the result.
|
|
309
|
-
});
|
|
310
304
|
document.getElementById("iti-launch-fetchxml-btn")?.addEventListener("click", async () => {
|
|
311
305
|
const entityName = document.getElementById("iti-entity-logical-name").value;
|
|
312
306
|
const result = await toolbox.invocation.launchTool("@mohsinonxrm/pptb-fetchxml-studio", // npm package name of the target tool
|
|
313
|
-
{
|
|
314
|
-
|
|
307
|
+
{ entityLogicalName: entityName });
|
|
308
|
+
const fetchXml = result?.fetchXml ?? "No FetchXML returned";
|
|
309
|
+
document.getElementById("iti-returned-fetch-output").textContent = JSON.stringify(fetchXml, null, 2);
|
|
310
|
+
log(`Launched FXS with result: ${JSON.stringify(result)}`, "info");
|
|
311
|
+
});
|
|
312
|
+
document.getElementById("iti-launch-iti-tool-btn")?.addEventListener("click", async () => {
|
|
313
|
+
const packageName = document.getElementById("iti-tool-package-name").value;
|
|
314
|
+
const prefillData = document.getElementById("iti-tool-prefill-data").value;
|
|
315
|
+
const result = await toolbox.invocation.launchTool(packageName, JSON.parse(prefillData));
|
|
316
|
+
document.getElementById("iti-returned-iti-tool-output").textContent = JSON.stringify(result, null, 2);
|
|
317
|
+
log(`Launched tool ${packageName} with result: ${JSON.stringify(result)}`, "info");
|
|
315
318
|
});
|
|
316
319
|
}
|
|
317
320
|
/**
|
package/dist/index.html
CHANGED
|
@@ -331,17 +331,26 @@
|
|
|
331
331
|
|
|
332
332
|
<div class="example-group">
|
|
333
333
|
<h3>Tool Launched by Another Tool or Agent</h3>
|
|
334
|
+
<p>
|
|
335
|
+
To test this, open another tool that uses <i>FindToolsByCapabilities</i>
|
|
336
|
+
and launch this tool with the <code>entityName</code> and/or <code>fetchXml</code> prefill values.
|
|
337
|
+
The values will be displayed below.
|
|
338
|
+
</p>
|
|
334
339
|
<div class="input-group">
|
|
335
340
|
<label for="iti-entity-name">Entity Name:</label>
|
|
336
|
-
<
|
|
341
|
+
<div id="iti-entity-name" class="output"></div>
|
|
337
342
|
</div>
|
|
338
|
-
<div class="
|
|
339
|
-
<
|
|
343
|
+
<div class="input-group">
|
|
344
|
+
<label for="iti-fetch-output">FetchXML Output:</label>
|
|
345
|
+
<div id="iti-default-fetch-output" class="output"></div>
|
|
340
346
|
</div>
|
|
341
|
-
<div id="iti-default-fetch-output" class="output"></div>
|
|
342
347
|
</div>
|
|
343
348
|
<div class="example-group">
|
|
344
349
|
<h3>Launch Fetch XML Studio</h3>
|
|
350
|
+
<p>
|
|
351
|
+
Enter an entity logical name and click the button below to launch the <code>Fetch XML Studio</code>
|
|
352
|
+
tool with the entity prefilled. The returned FetchXML will be displayed below.
|
|
353
|
+
</p>
|
|
345
354
|
<div class="input-group">
|
|
346
355
|
<label for="iti-entity-logical-name">Entity Logical Name:</label>
|
|
347
356
|
<input type="text" id="iti-entity-logical-name" placeholder="account" />
|
|
@@ -352,6 +361,30 @@
|
|
|
352
361
|
<h4>Returned FetchXML:</h4>
|
|
353
362
|
<div id="iti-returned-fetch-output" class="output"></div>
|
|
354
363
|
</div>
|
|
364
|
+
<div class="example-group">
|
|
365
|
+
<h3>Test any Inter-Invocation Tool</h3>
|
|
366
|
+
<p>
|
|
367
|
+
Enter the package name of any tool that supports inter-tool invocation and click the button below to launch it.
|
|
368
|
+
The returned data will be displayed below.
|
|
369
|
+
</p>
|
|
370
|
+
<div class="input-group">
|
|
371
|
+
<label for="iti-tool-package-name">Tool Package Name:</label>
|
|
372
|
+
<input type="text" id="iti-tool-package-name" placeholder="@mohsinonxrm/pptb-fetchxml-studio" />
|
|
373
|
+
</div>
|
|
374
|
+
<div class="input-group">
|
|
375
|
+
<label for="iti-tool-prefill-data">Prefill Data (JSON):</label>
|
|
376
|
+
<textarea
|
|
377
|
+
id="iti-tool-prefill-data"
|
|
378
|
+
style="width: 100%; min-height: 110px; padding: 10px; border: 2px solid #e0e0e0; border-radius: 6px; font-family: monospace; font-size: 12px; line-height: 1.4"
|
|
379
|
+
placeholder="{\n \"entityLogicalName\": \"account\"\n}"
|
|
380
|
+
></textarea>
|
|
381
|
+
</div>
|
|
382
|
+
<div class="button-group">
|
|
383
|
+
<button id="iti-launch-iti-tool-btn" class="btn">Launch Tool</button>
|
|
384
|
+
</div>
|
|
385
|
+
<h4>Returned Data:</h4>
|
|
386
|
+
<div id="iti-returned-iti-tool-output" class="output"></div>
|
|
387
|
+
</div>
|
|
355
388
|
</section>
|
|
356
389
|
|
|
357
390
|
<!-- Event Log -->
|
package/package.json
CHANGED