外部ソースからの複数のサイトを表示する公開処理
recordContextを現在のボウ・サー・タブ・アクティブ・レコードとみなして、インサイトを表示するTypescriptの例を次に示します:
let recordContext: IRecordContext = await uiEventsFrameworkInstance.getCurrentBrowserTabContext().getActiveRecord();
let insightContext: IInsightContext = await recordContext.getInsightsContext();
let dataFromExternalSource = [
{
'id': 'insights1',
'title': 'custom title 1',
'message': 'custom message 1',
'header': 'category 1',
'actionName': 'Action 1',
'actionId': 'act1'
},
{
'id': 'insights2',
'title': 'custom title 2',
'message': 'custom message 2',
'header': 'category 2',
'actionName': 'Action 2',
'actionId': 'act2',
}
];
dataFromExternalSource.forEach( (element: any) => {
const payload: IShowInsightsRequest = uiEventsFrameworkInstance.requestHelper.createPublishRequest('ShowInsights');
payload.setId(element.id);
payload.setTitle(element.title);
payload.setMessage(element.message);
payload.setHeader(element.header);
(payload.action() as IInsightsActionRequest).setActionDetails(element.actionName, element.actionId);
insightContext.publish(payload).then((response: IInsightsOperationResponse) => {
console.log((response.getResponseData() as IInsightsOperationResponseData).getInsightsId());
});
});
recordContextを現在のバウサ・タブ・アクティブ・レコードとみなして、インサイトを表示するJavaScriptの例を次に示します:
let recordContext = await uiEventsFrameworkInstance.getCurrentBrowserTabContext().getActiveRecord();
let insightContext = await recordContext.getInsightsContext();
let dataFromExternalSource: any = [
{
'id': 'insights1',
'title': 'custom title 1',
'message': 'custom message 1',
'header': 'category 1',
'actionName': 'Action 1',
'actionId': 'act1'
},
{
'id': 'insights2',
'title': 'custom title 2',
'message': 'custom message 2',
'header': 'category 2',
'actionName': 'Action 2',
'actionId': 'act2',
}
];
dataFromExternalSource.forEach( (element) => {
const payload = uiEventsFrameworkInstance.requestHelper.createPublishRequest('ShowInsights');
payload.setId(element.id);
payload.setTitle(element.title);
payload.setMessage(element.message);
payload.setHeader(element.header);
payload.action().setActionDetails(element.actionName, element.actionId);
insightContext.publish(payload).then((response) => {
console.log(response.getResponseData().getInsightsId());
});
});