123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- 'use strict';
- /**
- * Licensed Materials - Property of IBM
- *
- * IBM Cognos Products: BI Dashboard
- *
- * Copyright IBM Corp. 2016, 2020
- *
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define(['../../lib/@waca/bacontentnav/public/js/bacontentnav/ui/dialogs/OpenDialog', '../nls/StringResources'], function (BaseDialog, resources) {
- 'use strict';
- var RelinkDialog = BaseDialog.extend({
- oDataSource: null,
- /**
- * @param options {object} Options to initialize the dialog object
- * */
- init: function init(options) {
- this.dashboardApi = options.dashboardApi;
- this.setDataSource(options.dataSource);
- RelinkDialog.inherited('init', this, [this.getRelinkDlgOptions(options)]);
- this.logger = this.dashboardApi.getGlassCoreSvc('.Logger');
- },
- /**
- * Populate the options used to initialize data source relink dialog
- * @param {object} options:{context:<object>, dataSource:<object>, dataSourceName:<string>}
- *
- * @returns {object}
- */
- getRelinkDlgOptions: function getRelinkDlgOptions(options) {
- var supportedTypes = ['module', 'dataSet2', 'uploadedFile', 'package'];
- var filtersByType = ['folder|package|module|dataSet2|uploadedFile'];
- var oResult = {
- 'primaryBtnText': resources.get('dlg_use'),
- 'typesToOpen': supportedTypes,
- 'dialogTitle': resources.get('dlg_RelinkDataSourceTitle', {
- 'dataSourceName': options.dataSourceName
- }),
- 'filtersByTypes': filtersByType,
- 'multiSelect': false,
- 'onOpenCallback': this.onOpenCallback.bind(this)
- };
- // We are opening a glass dialog. Prepare the options to contain a glass context (needed by the dialog)
- this.dashboardApi.prepareGlassOptions(oResult);
- return oResult;
- },
- /**
- * @return {object} Data source object that is to be relinked
- * */
- getDataSource: function getDataSource() {
- return this.oDataSource;
- },
- setDataSource: function setDataSource(dataSource) {
- this.oDataSource = dataSource;
- },
- /**
- * Callback hander after user clicks 'use' button to do data source relink
- * @param {object} item selected from dialog
- * */
- onOpenCallback: function onOpenCallback(selectedItem) {
- if (selectedItem && selectedItem.length > 0) {
- var item = selectedItem[0];
- var oNewDataSourceObj = {
- 'assetId': item.id,
- 'name': item.defaultName,
- 'type': item.type,
- 'searchPath': item.searchPath
- };
- var dataSourcesSvc = this.dashboardApi.getFeature('dataSources.deprecated');
- dataSourcesSvc.relink(this.oDataSource, oNewDataSourceObj);
- }
- }
- });
- return RelinkDialog;
- });
- //# sourceMappingURL=RelinkDialog.js.map
|