UNPKG

reveal-sdk-node

Version:

RevealBI Node.js SDK

93 lines (92 loc) 3.18 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RVDashboardDataSource = void 0; /** * The base class representing a data source used in a dashboard, you can * RVDataSourceItem for more information about the relationship between data source and data source items. */ class RVDashboardDataSource { /** @hidden */ constructor(json) { var _a; this._id = null; this._defaultRefreshRate = null; this._title = null; this._subtitle = null; if (json) { this._id = json["Id"]; this._title = json["Description"]; this._subtitle = json["Subtitle"]; this._defaultRefreshRate = (_a = json.Settings) === null || _a === void 0 ? void 0 : _a['DefaultRefreshRate']; } } /** * The ID of the data source */ get id() { return this._id; } set id(value) { this._id = value; } /** * The title of the data source as displayed to users. */ get title() { return this._title; } set title(value) { this._title = value; } /** * The subtitle of the data source, if not null will be displayed to users instead of connection information like host and database name. */ get subtitle() { return this._subtitle; } set subtitle(value) { this._subtitle = value; } get defaultRefreshRate() { return this._defaultRefreshRate; } /** * Default value to use for "Refresh Data" setting for visualizations created using this item, expressed in minutes (e.g. 1440 = 1 day). * A value of N means that whenever the visualization requests data, the engine will return data found in the cache if it's not older than N minutes -this means, if the engine fetched it from the datasource no more than N minutes before-. Set it to override the widget editor default behavior. */ set defaultRefreshRate(v) { this._defaultRefreshRate = v; } /** @hidden */ toJson() { var json = { 'Id': this._id, '_type': 'DataSourceType', 'Provider': this.getProviderKey(), 'Description': this._title, 'Subtitle': this._subtitle, 'Properties': {} }; if (this._defaultRefreshRate != null) { var settings = json['Settings'] = {}; settings['DefaultRefreshRate'] = this._defaultRefreshRate; } return json; } /** @hidden */ _createWrapperInstance() { return eval(`new $.ig.${this.getType()}Internal();`); } /** @hidden */ _getWrapper() { let wrapper = this._createWrapperInstance(); wrapper.id(this.id); wrapper.title(this.title); wrapper.subtitle(this.subtitle); if (this.defaultRefreshRate != null) { wrapper.defaultRefreshRate($.ig.NativeDataLayerUtility.prototype.wrapInt(this.defaultRefreshRate)); } return wrapper; } } exports.RVDashboardDataSource = RVDashboardDataSource;