@gooddata/typings
Advanced tools
Comparing version 2.24.5 to 2.24.6-alpha-khanh.le-kl-SD-889-update-2020-05-26T09-19-09-402Z
@@ -40,5 +40,13 @@ import { IGdcMessageEvent, GdcProductName, IGdcMessageEnvelope, IDrillableItemsCommandBody } from './common'; | ||
/** | ||
* The command drill performed | ||
* The command add widget to dashboard. | ||
*/ | ||
Drill = "drill" | ||
AddWidget = "addWidget", | ||
/** | ||
* The command add filter to dashboard. | ||
*/ | ||
AddFilter = "addFilter", | ||
/** | ||
* The command export a dashboard. | ||
*/ | ||
ExportToPdf = "exportToPdf" | ||
} | ||
@@ -103,3 +111,21 @@ /** | ||
*/ | ||
Platform = "platform" | ||
Platform = "platform", | ||
/** | ||
* Type represent that the widget is added to dashboard. | ||
* | ||
*/ | ||
WidgetAdded = "widgetAdded", | ||
/** | ||
* Type represent that the filter is added to dashboard. | ||
* | ||
*/ | ||
FilterAdded = "filterAdded", | ||
/** | ||
* Type represent that the export action is finished. | ||
*/ | ||
ExportedToPdf = "exportedToPdf", | ||
/** | ||
* Type represent that the drill performed | ||
*/ | ||
Drill = "drill" | ||
} | ||
@@ -139,4 +165,2 @@ /** | ||
* Note: sending Save command with different title means dashboard will be saved with that new title. | ||
* | ||
* @remarks use {@link SaveDashboardCommand} factory function to instantiate | ||
*/ | ||
@@ -160,4 +184,2 @@ type SaveDashboardCommand = IGdcKdMessageEvent<GdcKdCommandType.Save, IKdSaveCommandBody>; | ||
* - if KD is not currently showing any dashboard, CommandFailed is posted | ||
* | ||
* @remarks use {@link CancelEditCommand} factory function to instantiate | ||
*/ | ||
@@ -182,4 +204,2 @@ type CancelEditCommand = IGdcKdMessageEvent<GdcKdCommandType.CancelEdit, null>; | ||
* be posted | ||
* | ||
* @remarks use {@link DeleteDashboardCommand} factory function to instantiate | ||
*/ | ||
@@ -198,4 +218,2 @@ type DeleteDashboardCommand = IGdcKdMessageEvent<GdcKdCommandType.Delete, null>; | ||
* - if no dashboard currently displayed, posts CommandFailed | ||
* | ||
* @remarks use {@link SwitchToEditCommand} factory function to instantiate | ||
*/ | ||
@@ -245,2 +263,95 @@ type SwitchToEditCommand = IGdcKdMessageEvent<GdcKdCommandType.SwitchToEdit, null>; | ||
function isSetSizeCommandData(obj: any): obj is SetSizeCommandData; | ||
interface IKpiWidget { | ||
type: 'kpi'; | ||
} | ||
interface IIdentifierInsightRef { | ||
identifier: string; | ||
} | ||
interface IUriInsightRef { | ||
uri: string; | ||
} | ||
interface IInsightWidget { | ||
type: 'insight'; | ||
ref: IIdentifierInsightRef | IUriInsightRef; | ||
} | ||
interface IAddWidgetBody { | ||
widget: IKpiWidget | IInsightWidget; | ||
} | ||
/** | ||
* Type-guard checking whether object is an instance of {@link IdentifierInsightRef}. | ||
* | ||
* @param obj - object to test | ||
*/ | ||
function isIdentifierInsight(obj: any): obj is IIdentifierInsightRef; | ||
/** | ||
* Type-guard checking whether object is an instance of {@link UriInsightRef}. | ||
* | ||
* @param obj - object to test | ||
*/ | ||
function isUriInsight(obj: any): obj is IUriInsightRef; | ||
/** | ||
* Adds new widget onto dashboard. New row will be created on top of the dashboard, the widget | ||
* will be placed into its first column. | ||
* | ||
* It is currently possible to add either a KPI or an Insight. When adding either of these, KD will | ||
* scroll to top so that the newly added widget is visible. | ||
* | ||
* For KPI, the KD will start the KPI customization flow right after the KPI is placed. | ||
* Insights are placed without need for further customization | ||
* | ||
* Contract: | ||
* | ||
* - if KD is currently editing a dashboard, then depending on widget type: | ||
* - KPI is added to dashboard, customization flow is started, WidgetAdded will be posted | ||
* - Insight is added to dashboard, WidgetAdded will be posted | ||
* | ||
* - if insight reference included in command payload does not refer to a valid insight, CommandFailed | ||
* will be posted | ||
* | ||
* - if KD is in view mode or not showing any dashboard, then CommandFailed will be posted | ||
*/ | ||
type AddWidgetCommand = IGdcKdMessageEvent<GdcKdCommandType.AddWidget, IAddWidgetBody>; | ||
type AddWidgetCommandData = IGdcKdMessageEnvelope<GdcKdCommandType.AddWidget, IAddWidgetBody>; | ||
/** | ||
* Type-guard checking whether object is an instance of {@link AddWidgetCommandData}. | ||
* | ||
* @param obj - object to test | ||
*/ | ||
function isAddWidgetCommandData(obj: any): obj is AddWidgetCommandData; | ||
/** | ||
* Adds new attribute filter to filter bar and starts the filter customization flow. | ||
* | ||
* Contract: | ||
* | ||
* - if KD is currently editing a dashboard, adds new attribute filter, starts customization flow; FilterAdded | ||
* will be posted right after customization starts | ||
* | ||
* - if KD is currently in view mode or does not show any dashboard, will post CommandFailed | ||
*/ | ||
type AddFilterCommand = IGdcKdMessageEvent<GdcKdCommandType.AddFilter, null>; | ||
type AddFilterCommandData = IGdcKdMessageEnvelope<GdcKdCommandType.AddFilter, null>; | ||
/** | ||
* Type-guard checking whether object is an instance of {@link AddFilterCommandData}. | ||
* | ||
* @param obj - object to test | ||
*/ | ||
function isAddFilterCommandData(obj: any): obj is AddFilterCommandData; | ||
/** | ||
* Exports dashboard to PDF. | ||
* | ||
* Contract: | ||
* | ||
* - if KD shows dashboard in view mode, will export dashboard to PDF and post ExportFinished once ready for | ||
* exporting | ||
* - if KD shwows dashboard in edit mode or not not showing any dashboard, CommandFailed will | ||
* be posted | ||
*/ | ||
type ExportToPdfCommand = IGdcKdMessageEvent<GdcKdCommandType.ExportToPdf, null>; | ||
type ExportToPdfCommandData = IGdcKdMessageEnvelope<GdcKdCommandType.ExportToPdf, null>; | ||
/** | ||
* Type-guard checking whether object is an instance of {@link ExportToPdfCommandData}. | ||
* | ||
* @param obj - object to test | ||
*/ | ||
function isExportToPdfCommandData(obj: any): obj is ExportToPdfCommandData; | ||
interface INoPermissionsBody { | ||
@@ -323,2 +434,39 @@ /** | ||
type PlaformData = IGdcKdMessageEnvelope<GdcKdEventType.Platform, IPlaformBody>; | ||
interface IInsightWidgetBody { | ||
widgetCategory: 'kpi' | 'visualization'; | ||
identifier?: string; | ||
uri?: string; | ||
title?: string; | ||
} | ||
interface IAddedWidgetBody { | ||
insight?: IInsightWidgetBody; | ||
} | ||
/** | ||
* This event is emitted after KD added a new widget to a dashboard. If the widget is | ||
* an insight, then meta information about the insight will be returned. | ||
* | ||
* Note: when this event is added for a KPI widget, it means the customization flow for the KPI has | ||
* started. The user may still 'just' click somewhere outside of the KPI configuration and the KPI will | ||
* be discarded. | ||
*/ | ||
type WidgetAddedData = IGdcKdMessageEnvelope<GdcKdEventType.WidgetAdded, IAddedWidgetBody>; | ||
type FilterAddedBody = IKdAvailableCommands; | ||
/** | ||
* This event is emitted after KD added a new filter to dashboard's filter bar and started its | ||
* customization flow. | ||
* | ||
* Note: users can still cancel the filter customization flow meaning no new attribute filter | ||
* will end on the filter bar. | ||
*/ | ||
type FilterAddedData = IGdcKdMessageEnvelope<GdcKdEventType.FilterAdded, FilterAddedBody>; | ||
type ExportToPdfFinishedBody = IKdAvailableCommands & { | ||
/** | ||
* Link to the file containing exported data. | ||
*/ | ||
link: string; | ||
}; | ||
/** | ||
* This event is emitted after dashboard has been exported to PDF | ||
*/ | ||
type ExportToPdfFinishedData = IGdcKdMessageEnvelope<GdcKdEventType.ExportedToPdf, ExportToPdfFinishedBody>; | ||
} |
@@ -37,5 +37,13 @@ "use strict"; | ||
/** | ||
* The command drill performed | ||
* The command add widget to dashboard. | ||
*/ | ||
GdcKdCommandType["Drill"] = "drill"; | ||
GdcKdCommandType["AddWidget"] = "addWidget"; | ||
/** | ||
* The command add filter to dashboard. | ||
*/ | ||
GdcKdCommandType["AddFilter"] = "addFilter"; | ||
/** | ||
* The command export a dashboard. | ||
*/ | ||
GdcKdCommandType["ExportToPdf"] = "exportToPdf"; | ||
})(GdcKdCommandType = EmbeddedKpiDashboard.GdcKdCommandType || (EmbeddedKpiDashboard.GdcKdCommandType = {})); | ||
@@ -102,2 +110,20 @@ /** | ||
GdcKdEventType["Platform"] = "platform"; | ||
/** | ||
* Type represent that the widget is added to dashboard. | ||
* | ||
*/ | ||
GdcKdEventType["WidgetAdded"] = "widgetAdded"; | ||
/** | ||
* Type represent that the filter is added to dashboard. | ||
* | ||
*/ | ||
GdcKdEventType["FilterAdded"] = "filterAdded"; | ||
/** | ||
* Type represent that the export action is finished. | ||
*/ | ||
GdcKdEventType["ExportedToPdf"] = "exportedToPdf"; | ||
/** | ||
* Type represent that the drill performed | ||
*/ | ||
GdcKdEventType["Drill"] = "drill"; | ||
})(GdcKdEventType = EmbeddedKpiDashboard.GdcKdEventType || (EmbeddedKpiDashboard.GdcKdEventType = {})); | ||
@@ -149,3 +175,48 @@ /** | ||
EmbeddedKpiDashboard.isSetSizeCommandData = isSetSizeCommandData; | ||
/** | ||
* Type-guard checking whether object is an instance of {@link IdentifierInsightRef}. | ||
* | ||
* @param obj - object to test | ||
*/ | ||
function isIdentifierInsight(obj) { | ||
return obj.identifier; | ||
} | ||
EmbeddedKpiDashboard.isIdentifierInsight = isIdentifierInsight; | ||
/** | ||
* Type-guard checking whether object is an instance of {@link UriInsightRef}. | ||
* | ||
* @param obj - object to test | ||
*/ | ||
function isUriInsight(obj) { | ||
return obj.uri; | ||
} | ||
EmbeddedKpiDashboard.isUriInsight = isUriInsight; | ||
/** | ||
* Type-guard checking whether object is an instance of {@link AddWidgetCommandData}. | ||
* | ||
* @param obj - object to test | ||
*/ | ||
function isAddWidgetCommandData(obj) { | ||
return common_1.getEventType(obj) === GdcKdCommandType.AddWidget; | ||
} | ||
EmbeddedKpiDashboard.isAddWidgetCommandData = isAddWidgetCommandData; | ||
/** | ||
* Type-guard checking whether object is an instance of {@link AddFilterCommandData}. | ||
* | ||
* @param obj - object to test | ||
*/ | ||
function isAddFilterCommandData(obj) { | ||
return common_1.getEventType(obj) === GdcKdCommandType.AddFilter; | ||
} | ||
EmbeddedKpiDashboard.isAddFilterCommandData = isAddFilterCommandData; | ||
/** | ||
* Type-guard checking whether object is an instance of {@link ExportToPdfCommandData}. | ||
* | ||
* @param obj - object to test | ||
*/ | ||
function isExportToPdfCommandData(obj) { | ||
return common_1.getEventType(obj) === GdcKdCommandType.ExportToPdf; | ||
} | ||
EmbeddedKpiDashboard.isExportToPdfCommandData = isExportToPdfCommandData; | ||
})(EmbeddedKpiDashboard = exports.EmbeddedKpiDashboard || (exports.EmbeddedKpiDashboard = {})); | ||
//# sourceMappingURL=kd.js.map |
{ | ||
"name": "@gooddata/typings", | ||
"version": "2.24.5", | ||
"version": "2.24.6-alpha-khanh.le-kl-SD-889-update-2020-05-26T09-19-09-402Z", | ||
"description": "TypeScript definition files for GoodData platform", | ||
@@ -5,0 +5,0 @@ "typings": "dist/index.d.ts", |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
336679
5753
1