Skip to content
Merged
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
104 changes: 44 additions & 60 deletions modules/ROOT/pages/code-based-custom-actions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,15 @@ Custom Actions can be embedded through the Visual Embed SDK in the following two
* `liveboardIds`: __Array of Strings.__ Applicable Liveboard ids. Unique identifier (GUID) for the Liveboard.
* `vizIds`: __Array of Strings.__ Applicable Viz ids. Unique identifier (GUID) for the Visualization.
|`dataModelIds` a|__Array of Strings.__ Unique identifier (GUID) for the data Model `modelIds` or column names `modelColumnNames`. Column names are represented in the array as : [`modelIds::columnName`].
|`orgIds`|__Array of Strings.__ Restrict visibility to specific Orgs. Unique identifier for the org(s).
|`groupIds`|__Array of Strings.__ Restrict visibility to specific groups. Unique identifier for the group(s).

Example: `modelColumnNames`: ['cd252e5c-b552-49a8-821d-3eadaa049cca::state']
|`orgIds`|__Array of Strings.__ Restrict visibility to specific Orgs. Unique identifier (GUID) for the org(s).
|`groupIds`|__Array of Strings.__ Restrict visibility to specific groups. Unique identifier (GUID) for the group(s).
|===

[NOTE]
Code based custom actions currently do not support Object IDs.

=== Code based custom action for Liveboards

[NOTE]
Expand Down Expand Up @@ -94,7 +99,7 @@ const customActions = [{
position: CustomActionPosition.PRIMARY,
target: CustomActionTarget.LIVEBOARD,
metadataIds: {
liveboardIds: ['lb1'],
liveboardIds: ['lb1-GUID'],
},
}, ];
----
Expand All @@ -109,10 +114,10 @@ const customActions = [{
position: CustomActionPosition.PRIMARY,
target: CustomActionTarget.LIVEBOARD,
metadataIds: {
liveboardId: ['lb1'],
liveboardId: ['lb1-GUID'],
},
groupId: ['grp1'],
orgId: ['org1'],
groupId: ['grp1-GUID'],
orgId: ['org1-GUID'],
}, ];
----

Expand Down Expand Up @@ -141,7 +146,7 @@ const customActions = [{
position: CustomActionPosition.PRIMARY,
target: CustomActionTarget.VIZ,
metadataIds: {
liveboardIds: ['lb1']
liveboardIds: ['lb1-GUID']
},
}, ];
----
Expand All @@ -157,7 +162,7 @@ const customActions = [{
position: CustomActionPosition.PRIMARY,
target: CustomActionTarget.VIZ,
metadataIds: {
vizIds: ['viz1']
vizIds: ['viz1-GUID']
},
}, ];
----
Expand All @@ -179,8 +184,8 @@ const customActions = [{
position: CustomActionPosition.PRIMARY,
target: CustomActionTarget.VIZ,
metadataIds: {
liveboardIds: ['lb2'],
vizIds: ['viz21', 'viz11']
liveboardIds: ['lb2-GUID'],
vizIds: ['viz21-GUID', 'viz11-GUID']
},
}, ];
----
Expand All @@ -201,41 +206,15 @@ const customActions = [{
position: CustomActionPosition.PRIMARY,
target: CustomActionTarget.VIZ,
metadataIds: {
liveboardIds: ['lb2'],
vizIds: ['viz21', 'viz11']
liveboardIds: ['lb2-GUID'],
vizIds: ['viz21-GUID', 'viz11-GUID']
},
groupId: ['grp1'],
orgId: ['org1']
groupId: ['grp1-GUID'],
orgId: ['org1-GUID']
}, ];
----


////
When the answerId parameter is provided, the system displays custom actions only on the visualization(s) that use the specified underlying answerId.

In this example, consider a Liveboard (lb1) with three visualizations: viz1 (based on ans1), viz2 (based on ans2), and viz3 (based on ans3).

* The custom action will be displayed on all visualizations of Liveboard lb2, since the liveboardId is present.

* The custom action will also be shown for viz1 and viz 3, as viz1 is explicitly included by vizId, and viz3 uses the specified answerId (ans3) as its underlying data source.

[source,javascript]
----
const customActions = [{
name: 'CA1',
id: 'ca1',
position: 'CustomActionPosition.PRIMARY,
target: CustomActionTarget.VIZ,
metadataIds: {
liveboardIds: ['lb2'],
vizIds: ['viz1'],
answerIds: ['ans3']
},
}, ];

----
////


When `modelIds` is passed in the `dataModelIds`, then the custom action is show for all visualization which are using the columns of the specified model.

Expand All @@ -253,10 +232,10 @@ const customActions = [{
position: 'CustomActionPosition.PRIMARY,
target: CustomActionTarget.VIZ,
metadataIds: {
liveboardIds: ['lb2'],
liveboardIds: ['lb2-GUID'],
},
dataModelIds: {
modelIds: ['model1']
modelIds: ['model1-GUID']
}
}, ];

Expand All @@ -269,7 +248,9 @@ In this example:

* The custom action will be displayed on all visualizations of Liveboard lb2, since the liveboardId is present.

* The custom action will also be shown for all visualizations built using the col1 of model1.
* The custom action will be displayed on all visualizations built using the column(s) of model1.

* The custom action will also be shown for all visualizations built using the col1 of model2.


[source,javascript]
Expand All @@ -280,10 +261,11 @@ const customActions = [{
position: 'CustomActionPosition.PRIMARY,
target: CustomActionTarget.VIZ,
metadataIds: {
liveboardIds: ['lb2'],
liveboardIds: ['lb2-GUID'],
},
dataModelIds: {
modelColumnNames: ["model1::col1"]
modelIds: ['model1-GUID']
modelColumnNames: ["model2-GUID::col1"]
},
}, ];
----
Expand All @@ -305,10 +287,10 @@ const customActions = [{
position: 'CustomActionPosition.PRIMARY,
target: CustomActionTarget.VIZ,
metadataIds: {
liveboardIds: ['lb2'],
liveboardIds: ['lb2-GUID'],
},
dataModelIds: {
modelIds: ["model1"::"col2"],
modelIds: ["model1-GUID"::"col2"],
},
}, ];

Expand Down Expand Up @@ -339,7 +321,7 @@ const customActions = [{
position: CustomActionsPosition.PRIMARY,
target: CustomActionTarget.ANSWER,
metadataIds: {
answerIds: ['ans1'],
answerIds: ['ans1-GUID'],
},
}, ];

Expand All @@ -361,10 +343,10 @@ const customActions = [{
position: CustomActionsPosition.PRIMARY,
target: CustomActionTarget.ANSWER,
metadataIds: {
answerIds: ['ans1'],
answerIds: ['ans1-GUID'],
},
dataModelIds: {
modelIds: [model1],
modelIds: [model1-GUID],
},
}, ];
----
Expand All @@ -374,8 +356,9 @@ When a `modelColumnNames` is specified, the custom action will be displayed for
In this example:

* The custom action will be displayed for ans1, since the answerId is present.
* The custom action will be displayed on all visualizations built using the column(s) of model1.

* The custom action will also be shown for all answers using col1 from model1.
* The custom action will also be shown for all answers using col1 from model2.

[source,javascript]
----
Expand All @@ -385,10 +368,11 @@ const customActions = [{
position: CustomActionsPosition.PRIMARY,
target: CustomActionTarget.ANSWER,
metadataIds: {
answerIds: ['ans1'],
answerIds: ['ans1-GUID'],
},
dataModelIds: {
modelColumnNames: ["model1::col1"],
modelIds: ['model1-GUID'],
modelColumnNames: ["model2-GUID::col1"],
},
}, ];
----
Expand All @@ -405,10 +389,10 @@ const customActions = [{
position: CustomActionsPosition.PRIMARY,
target: CustomActionTarget.ANSWER,
metadataIds: {
answerIds: ['ans1'],
answerIds: ['ans1-GUID'],
},
groupId: ['grp1'],
orgId: ['org1'],
groupId: ['grp1-GUID'],
orgId: ['org1-GUID'],
}, ];

----
Expand All @@ -425,7 +409,7 @@ const customActions = [{
position: CustomActionPosition.MENU,
target: CustomActionTarget.SPOTTER,
dataModelIds: {
modelIds: ['model1']
modelIds: ['model1-GUID']
},
}, ];
----
Expand All @@ -450,10 +434,10 @@ const customActions = [{
position: CustomActionPosition.MENU,
target: CustomActionTarget.SPOTTER,
dataModelIds: {
modelIds: ['model1']
modelIds: ['model1-GUID']
},
groupId: ['grp1'],
orgId: ['org1']
groupId: ['grp1-GUID'],
orgId: ['org1-GUID']
}, ];
----

Expand Down
Loading