zinkee 0.1.20 → 0.1.21
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/index.js +98 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/displays.ts +2 -2
- package/src/utils/examples.ts +99 -6
package/dist/index.js
CHANGED
|
@@ -3387,8 +3387,38 @@ var specificExamples = {
|
|
|
3387
3387
|
}`
|
|
3388
3388
|
},
|
|
3389
3389
|
{
|
|
3390
|
-
description: "Create a
|
|
3391
|
-
command: `zinkee --json displays widgets create 0f6f062f-1478-4df2-96a1-c495d037d260 --type CHART --name "Revenue by
|
|
3390
|
+
description: "Create a CHART widget with a daily time-serie x-axis.",
|
|
3391
|
+
command: `zinkee --json displays widgets create 0f6f062f-1478-4df2-96a1-c495d037d260 --type CHART --name "Revenue by day" --origin-resource 2eb8bdcf-6d9c-4fbb-9018-7fa8180f4c5e --layout '{"x":0,"y":0,"w":8,"h":6}' --chart-type lines --x-axis-field due-date --x-axis-date-format DATE --x-axis-time-series --y-axis-serie '{"typeCalc":"SUM","fieldCalc":"amount","color":"#4B9CD3","axisType":"PRIMARY"}' --legend '{"position":"bottom"}'`,
|
|
3392
|
+
raw: `{
|
|
3393
|
+
"type": "CHART",
|
|
3394
|
+
"source": {
|
|
3395
|
+
"originResourceId": "2eb8bdcf-6d9c-4fbb-9018-7fa8180f4c5e",
|
|
3396
|
+
"isOriginSubSchema": false
|
|
3397
|
+
},
|
|
3398
|
+
"placement": {
|
|
3399
|
+
"layout": { "x": 0, "y": 0, "w": 8, "h": 6 }
|
|
3400
|
+
},
|
|
3401
|
+
"presentation": { "name": "Revenue by day" },
|
|
3402
|
+
"chart": {
|
|
3403
|
+
"chartType": "lines",
|
|
3404
|
+
"xAxisFieldId": "due-date",
|
|
3405
|
+
"xAxisDateFormat": "DATE",
|
|
3406
|
+
"xAxisAsTimeSerie": true,
|
|
3407
|
+
"yAxisSeries": [
|
|
3408
|
+
{
|
|
3409
|
+
"typeCalc": "SUM",
|
|
3410
|
+
"fieldCalc": "amount",
|
|
3411
|
+
"color": "#4B9CD3",
|
|
3412
|
+
"axisType": "PRIMARY"
|
|
3413
|
+
}
|
|
3414
|
+
],
|
|
3415
|
+
"legend": { "position": "bottom" }
|
|
3416
|
+
}
|
|
3417
|
+
}`
|
|
3418
|
+
},
|
|
3419
|
+
{
|
|
3420
|
+
description: "Create a bars CHART widget with a monthly time-serie x-axis and two y-axis series.",
|
|
3421
|
+
command: `zinkee --json displays widgets create 0f6f062f-1478-4df2-96a1-c495d037d260 --type CHART --name "Revenue by month" --origin-resource 2eb8bdcf-6d9c-4fbb-9018-7fa8180f4c5e --layout '{"x":0,"y":0,"w":8,"h":6}' --chart-type bars --x-axis-field due-date --x-axis-date-format MONTH_YEAR --x-axis-time-series --y-axis-serie '{"typeCalc":"SUM","fieldCalc":"amount","color":"#4B9CD3","axisType":"PRIMARY"}' --y-axis-serie '{"typeCalc":"COUNT","fieldCalc":"id","color":"#E57373","axisType":"SECONDARY"}' --legend '{"position":"bottom"}'`,
|
|
3392
3422
|
raw: `{
|
|
3393
3423
|
"type": "CHART",
|
|
3394
3424
|
"source": {
|
|
@@ -3402,7 +3432,7 @@ var specificExamples = {
|
|
|
3402
3432
|
"chart": {
|
|
3403
3433
|
"chartType": "bars",
|
|
3404
3434
|
"xAxisFieldId": "due-date",
|
|
3405
|
-
"xAxisDateFormat": "
|
|
3435
|
+
"xAxisDateFormat": "MONTH_YEAR",
|
|
3406
3436
|
"xAxisAsTimeSerie": true,
|
|
3407
3437
|
"yAxisSeries": [
|
|
3408
3438
|
{
|
|
@@ -3420,6 +3450,66 @@ var specificExamples = {
|
|
|
3420
3450
|
],
|
|
3421
3451
|
"legend": { "position": "bottom" }
|
|
3422
3452
|
}
|
|
3453
|
+
}`
|
|
3454
|
+
},
|
|
3455
|
+
{
|
|
3456
|
+
description: "Create a bars CHART widget with a quarterly time-serie x-axis.",
|
|
3457
|
+
command: `zinkee --json displays widgets create 0f6f062f-1478-4df2-96a1-c495d037d260 --type CHART --name "Revenue by quarter" --origin-resource 2eb8bdcf-6d9c-4fbb-9018-7fa8180f4c5e --layout '{"x":0,"y":0,"w":8,"h":6}' --chart-type bars --x-axis-field due-date --x-axis-date-format QUARTER_YEAR --x-axis-time-series --y-axis-serie '{"typeCalc":"SUM","fieldCalc":"amount","color":"#4B9CD3","axisType":"PRIMARY"}' --legend '{"position":"bottom"}'`,
|
|
3458
|
+
raw: `{
|
|
3459
|
+
"type": "CHART",
|
|
3460
|
+
"source": {
|
|
3461
|
+
"originResourceId": "2eb8bdcf-6d9c-4fbb-9018-7fa8180f4c5e",
|
|
3462
|
+
"isOriginSubSchema": false
|
|
3463
|
+
},
|
|
3464
|
+
"placement": {
|
|
3465
|
+
"layout": { "x": 0, "y": 0, "w": 8, "h": 6 }
|
|
3466
|
+
},
|
|
3467
|
+
"presentation": { "name": "Revenue by quarter" },
|
|
3468
|
+
"chart": {
|
|
3469
|
+
"chartType": "bars",
|
|
3470
|
+
"xAxisFieldId": "due-date",
|
|
3471
|
+
"xAxisDateFormat": "QUARTER_YEAR",
|
|
3472
|
+
"xAxisAsTimeSerie": true,
|
|
3473
|
+
"yAxisSeries": [
|
|
3474
|
+
{
|
|
3475
|
+
"typeCalc": "SUM",
|
|
3476
|
+
"fieldCalc": "amount",
|
|
3477
|
+
"color": "#4B9CD3",
|
|
3478
|
+
"axisType": "PRIMARY"
|
|
3479
|
+
}
|
|
3480
|
+
],
|
|
3481
|
+
"legend": { "position": "bottom" }
|
|
3482
|
+
}
|
|
3483
|
+
}`
|
|
3484
|
+
},
|
|
3485
|
+
{
|
|
3486
|
+
description: "Create a CHART widget with a yearly time-serie x-axis.",
|
|
3487
|
+
command: `zinkee --json displays widgets create 0f6f062f-1478-4df2-96a1-c495d037d260 --type CHART --name "Revenue by year" --origin-resource 2eb8bdcf-6d9c-4fbb-9018-7fa8180f4c5e --layout '{"x":0,"y":0,"w":8,"h":6}' --chart-type lines --x-axis-field due-date --x-axis-date-format YEAR --x-axis-time-series --y-axis-serie '{"typeCalc":"SUM","fieldCalc":"amount","color":"#4B9CD3","axisType":"PRIMARY"}' --legend '{"position":"bottom"}'`,
|
|
3488
|
+
raw: `{
|
|
3489
|
+
"type": "CHART",
|
|
3490
|
+
"source": {
|
|
3491
|
+
"originResourceId": "2eb8bdcf-6d9c-4fbb-9018-7fa8180f4c5e",
|
|
3492
|
+
"isOriginSubSchema": false
|
|
3493
|
+
},
|
|
3494
|
+
"placement": {
|
|
3495
|
+
"layout": { "x": 0, "y": 0, "w": 8, "h": 6 }
|
|
3496
|
+
},
|
|
3497
|
+
"presentation": { "name": "Revenue by year" },
|
|
3498
|
+
"chart": {
|
|
3499
|
+
"chartType": "lines",
|
|
3500
|
+
"xAxisFieldId": "due-date",
|
|
3501
|
+
"xAxisDateFormat": "YEAR",
|
|
3502
|
+
"xAxisAsTimeSerie": true,
|
|
3503
|
+
"yAxisSeries": [
|
|
3504
|
+
{
|
|
3505
|
+
"typeCalc": "SUM",
|
|
3506
|
+
"fieldCalc": "amount",
|
|
3507
|
+
"color": "#4B9CD3",
|
|
3508
|
+
"axisType": "PRIMARY"
|
|
3509
|
+
}
|
|
3510
|
+
],
|
|
3511
|
+
"legend": { "position": "bottom" }
|
|
3512
|
+
}
|
|
3423
3513
|
}`
|
|
3424
3514
|
},
|
|
3425
3515
|
{
|
|
@@ -3570,13 +3660,13 @@ var specificExamples = {
|
|
|
3570
3660
|
}`
|
|
3571
3661
|
},
|
|
3572
3662
|
{
|
|
3573
|
-
description: "Replace the chart series with
|
|
3574
|
-
command: `zinkee --json displays widgets update 0f6f062f-1478-4df2-96a1-c495d037d260 22222222-2222-4222-a222-222222222222 --chart-type lines --x-axis-field due-date --x-axis-date-format
|
|
3663
|
+
description: "Replace the chart series with quarterly lines.",
|
|
3664
|
+
command: `zinkee --json displays widgets update 0f6f062f-1478-4df2-96a1-c495d037d260 22222222-2222-4222-a222-222222222222 --chart-type lines --x-axis-field due-date --x-axis-date-format QUARTER_YEAR --x-axis-time-series --y-axis-serie '{"typeCalc":"SUM","fieldCalc":"amount","color":"#2E7D32","axisType":"PRIMARY"}'`,
|
|
3575
3665
|
raw: `{
|
|
3576
3666
|
"chart": {
|
|
3577
3667
|
"chartType": "lines",
|
|
3578
3668
|
"xAxisFieldId": "due-date",
|
|
3579
|
-
"xAxisDateFormat": "
|
|
3669
|
+
"xAxisDateFormat": "QUARTER_YEAR",
|
|
3580
3670
|
"xAxisAsTimeSerie": true,
|
|
3581
3671
|
"yAxisSeries": [
|
|
3582
3672
|
{
|
|
@@ -8462,7 +8552,7 @@ function registerDisplaysCommands(program, options = {}) {
|
|
|
8462
8552
|
}
|
|
8463
8553
|
printTable([data], void 0, stdout);
|
|
8464
8554
|
});
|
|
8465
|
-
widgets.command("create").description("Create widget").argument("<display>", "display uuid or slug", parseUuidOrSlugSelector3).requiredOption("--type <type>", "widget type").option("--name <name>").option("--description <text>").option("--icon <icon>").option("--color <color>").option("--origin-resource <uuid>").option("--origin-subschema").option("--tab <tabId>").option("--slot <slotId>").option("--layout <json>").option("--layout-file <path>").option("--field <field>", "repeatable field", (v, p = []) => [...p, v], []).option("--sort <sort>", "repeatable sort", (v, p = []) => [...p, v], []).option("--filter <expr>", "repeatable filter", collectFilters, []).option("--widget-read-only").option("--hide-add-button").option("--hide-delete-button").option("--hide-sort-button").option("--hide-filter-button").option("--hide-see-button").option("--calc <type>").option("--calc-field <uuid>").option("--kpi-config <json>").option("--chart-type <type>").option("--x-axis-field <uuid>").option("--x-axis-date-format <granularity>").option("--x-axis-time-series").option("--y-axis-serie <json>", "repeatable y axis serie", (v, p = []) => [...p, v], []).option("--legend <json>").option("--raw <json>").option("--raw-file <path>").action(async function action(display, commandOptions) {
|
|
8555
|
+
widgets.command("create").description("Create widget").argument("<display>", "display uuid or slug", parseUuidOrSlugSelector3).requiredOption("--type <type>", "widget type").option("--name <name>").option("--description <text>").option("--icon <icon>").option("--color <color>").option("--origin-resource <uuid>").option("--origin-subschema").option("--tab <tabId>").option("--slot <slotId>").option("--layout <json>").option("--layout-file <path>").option("--field <field>", "repeatable field", (v, p = []) => [...p, v], []).option("--sort <sort>", "repeatable sort", (v, p = []) => [...p, v], []).option("--filter <expr>", "repeatable filter", collectFilters, []).option("--widget-read-only").option("--hide-add-button").option("--hide-delete-button").option("--hide-sort-button").option("--hide-filter-button").option("--hide-see-button").option("--calc <type>").option("--calc-field <uuid>").option("--kpi-config <json>").option("--chart-type <type>", "chart type (lines, bars, stackedBars, combined)").option("--x-axis-field <uuid>").option("--x-axis-date-format <granularity>", "time granularity (DATE, MONTH_YEAR, QUARTER_YEAR, YEAR)").option("--x-axis-time-series").option("--y-axis-serie <json>", "repeatable y axis serie", (v, p = []) => [...p, v], []).option("--legend <json>").option("--raw <json>").option("--raw-file <path>").action(async function action(display, commandOptions) {
|
|
8466
8556
|
const { api, json, readOnly } = createDisplaysApi(this, filePath);
|
|
8467
8557
|
ensureWritable3("displays widgets create", readOnly, "write");
|
|
8468
8558
|
const data = await api.createWidget(display, buildWidgetBody(commandOptions));
|
|
@@ -8472,7 +8562,7 @@ function registerDisplaysCommands(program, options = {}) {
|
|
|
8472
8562
|
}
|
|
8473
8563
|
writeLine4(stdout, `Created widget on display "${display.value}".`);
|
|
8474
8564
|
});
|
|
8475
|
-
widgets.command("update").description("Update widget").argument("<display>", "display uuid or slug", parseUuidOrSlugSelector3).argument("<widget>", "widget id").option("--type <type>").option("--name <name>").option("--description <text>").option("--icon <icon>").option("--color <color>").option("--origin-resource <uuid>").option("--origin-subschema").option("--tab <tabId>").option("--slot <slotId>").option("--layout <json>").option("--layout-file <path>").option("--field <field>", "repeatable field", (v, p = []) => [...p, v], []).option("--sort <sort>", "repeatable sort", (v, p = []) => [...p, v], []).option("--filter <expr>", "repeatable filter", collectFilters, []).option("--widget-read-only").option("--hide-add-button").option("--hide-delete-button").option("--hide-sort-button").option("--hide-filter-button").option("--hide-see-button").option("--calc <type>").option("--calc-field <uuid>").option("--kpi-config <json>").option("--chart-type <type>").option("--x-axis-field <uuid>").option("--x-axis-date-format <granularity>").option("--x-axis-time-series").option("--y-axis-serie <json>", "repeatable y axis serie", (v, p = []) => [...p, v], []).option("--legend <json>").option("--raw <json>").option("--raw-file <path>").action(async function action(display, widgetId, commandOptions) {
|
|
8565
|
+
widgets.command("update").description("Update widget").argument("<display>", "display uuid or slug", parseUuidOrSlugSelector3).argument("<widget>", "widget id").option("--type <type>").option("--name <name>").option("--description <text>").option("--icon <icon>").option("--color <color>").option("--origin-resource <uuid>").option("--origin-subschema").option("--tab <tabId>").option("--slot <slotId>").option("--layout <json>").option("--layout-file <path>").option("--field <field>", "repeatable field", (v, p = []) => [...p, v], []).option("--sort <sort>", "repeatable sort", (v, p = []) => [...p, v], []).option("--filter <expr>", "repeatable filter", collectFilters, []).option("--widget-read-only").option("--hide-add-button").option("--hide-delete-button").option("--hide-sort-button").option("--hide-filter-button").option("--hide-see-button").option("--calc <type>").option("--calc-field <uuid>").option("--kpi-config <json>").option("--chart-type <type>", "chart type (lines, bars, stackedBars, combined)").option("--x-axis-field <uuid>").option("--x-axis-date-format <granularity>", "time granularity (DATE, MONTH_YEAR, QUARTER_YEAR, YEAR)").option("--x-axis-time-series").option("--y-axis-serie <json>", "repeatable y axis serie", (v, p = []) => [...p, v], []).option("--legend <json>").option("--raw <json>").option("--raw-file <path>").action(async function action(display, widgetId, commandOptions) {
|
|
8476
8566
|
const { api, json, readOnly } = createDisplaysApi(this, filePath);
|
|
8477
8567
|
ensureWritable3("displays widgets update", readOnly, "write");
|
|
8478
8568
|
const data = await api.updateWidget(display, widgetId, buildWidgetBody(commandOptions));
|