12 |
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("mobx-state-tree"),require("underscore"),require("mobx"),require("polyglot"),require("explore-common"),require("gemini/lib/@waca/core-client/js/core-client/ui/core/Class"),require("dashboard-analytics/visualizations/vipr/VIPRConfig"),require("gemini/lib/@waca/core-client/js/core-client/utils/UniqueId"));else if("function"==typeof define&&define.amd)define(["mobx-state-tree","underscore","mobx","polyglot","explore-common","gemini/lib/@waca/core-client/js/core-client/ui/core/Class","dashboard-analytics/visualizations/vipr/VIPRConfig","gemini/lib/@waca/core-client/js/core-client/utils/UniqueId"],t);else{var n="object"==typeof exports?t(require("mobx-state-tree"),require("underscore"),require("mobx"),require("polyglot"),require("explore-common"),require("gemini/lib/@waca/core-client/js/core-client/ui/core/Class"),require("dashboard-analytics/visualizations/vipr/VIPRConfig"),require("gemini/lib/@waca/core-client/js/core-client/utils/UniqueId")):t(e["mobx-state-tree"],e.underscore,e.mobx,e.polyglot,e["explore-common"],e["gemini/lib/@waca/core-client/js/core-client/ui/core/Class"],e["dashboard-analytics/visualizations/vipr/VIPRConfig"],e["gemini/lib/@waca/core-client/js/core-client/utils/UniqueId"]);for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}("undefined"!=typeof self?self:this,function(e,t,n,r,o,i,a,s){return webpackJsonp([3],{11:function(e,t){e.exports=n},115:function(e,t,n){"use strict";function r(e){if(e){return!e.some(function(e){if(-1===(e.tags||[]).indexOf("explore"))return!0;if(-1===["exploration","page_asset"].indexOf(e.type))return!0;var t=["read","execute"];return i.default.intersection(e.permissions,t).length<t.length||!(!e.disabled||"true"!==e.disabled.toString().toLowerCase())})}return!1}t.__esModule=!0,t.isExplore=void 0;var o=n(8),i=function(e){return e&&e.__esModule?e:{default:e}}(o);t.isExplore=r},22:function(e,t){e.exports=r},33:function(e,t){e.exports=o},39:function(e,t){e.exports=i},462:function(e,t,n){n(32),e.exports=n(463)},463:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.ShareActionHandler=t.OpenActionHandler=t.NewActionHandler=void 0;var o=n(464),i=r(o),a=n(466),s=r(a),l=n(467),c=r(l);t.NewActionHandler=i.default,t.OpenActionHandler=s.default,t.ShareActionHandler=c.default},464:function(e,t,n){"use strict";t.__esModule=!0;var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o=n(49),i=n(2),a=function(e){return e&&e.__esModule?e:{default:e}}(i),s=n(39),l=n(8),c=n(465),u=s.extend({canExecute:function(e){return this._isSelectionValid(e)&&(0,o.hasCapability)(e.glassContext)},isItemVisible:function(e){return this.canExecute(e)},doAction:function(e){return this._instrumentationTrack(e),this._openCreateView(e)},_instrumentationTrack:function(e){var t=e.glassContext.getCoreSvc(".Instrumentation");if(t.enabled){var n={type:"Created Object",objectType:"explore",action:"created",milestoneName:"created_explore"},o={};e.options&&(o=this._getDatasourcesInfo(e.options)),t.track(r({},n,o))}},_getDatasourcesInfo:function(e){var t={uploadedFile:"custom.counts.uploadedFile",module:"custom.counts.Module",package:"custom.counts.fmPackage"},n={};return e.forEach(function(e){var r=e.type;n[t[r]]||(n[t[r]]=0),n[t[r]]=n[t[r]]+1}),n},onSelectItem:function(e){this.doAction(e)},_getRestrictTemplate:function(){return"explore"},_openCreateView:function(e){var t=this._getRestrictTemplate(),n=c.get("explore_"),r={id:n,content:{id:n,restrictTemplate:t,boardSpec:null,isAuthoringMode:!0}},o=this._getSources(e);if(o&&o.length>0)return r.content.sources=o,r.content.boardSpec=this._createEmptyBoardSpec(),e.glassContext.appController.openAppView("explore",r).then(function(e){return e.currentContentView.isFeatureEnabled("newStartingPoints","false")?e.currentContentView.openDatasetpane():e.currentContentView.openCardListPane()});this._openDataSourceDialog(e,r)},_openDataSourceDialog:function(e,t){var n=["module","dataSet2","uploadedFile","package","data_asset"],r={glassContext:e.glassContext,typesToOpen:n,multiSelect:!1,dialogTitle:a.default.get("addDatasourceToExploreDialogTitle"),primaryBtnText:a.default.get("addDataSourceDialogButtonLabel"),onOpenCallback:this._onAddDataSource.bind(this,e,t)};return e.glassContext.getSvc(".ContentDialogFactory").then(function(e){e.createOpenDialog(r).open()})},_onAddDataSource:function(e,t,n){var r=n[0],o={assetId:r.id,name:r.defaultName,type:r.type,searchPath:r.searchPath,isOlapPackage:r.userInterfaces&&r.userInterfaces.indexOf("analysisStudio")>=0,modificationTime:r.modificationTime};return t.content.sources=[o],t.content.boardSpec=this._createEmptyBoardSpec(),e.glassContext.appController.openAppView("explore",t).then(function(e){return e.currentContentView.isFeatureEnabled("newStartingPoints","false")?e.currentContentView.openDatasetpane():e.currentContentView.openCardListPane()})},_getSources:function(e){var t=this._isSelectionValid(e,!1),n=null;if(t){if(n=[],!e.target.activeObject)return n;for(var r=e.target.activeObject.aSelectedContext,o=r,i=Array.isArray(o),a=0,o=i?o:o[Symbol.iterator]();;){var s;if(i){if(a>=o.length)break;s=o[a++]}else{if(a=o.next(),a.done)break;s=a.value}var c=s;n.push({assetId:c.id,type:c.type,name:c.defaultName,searchPath:c.searchPath,isOlapPackage:c.userInterfaces&&l.indexOf(c.userInterfaces,"analysisStudio")>=0})}}return n},_isSelectionValid:function(e){var t=e.target&&e.target.activeObject&&e.target.activeObject.aSelectedContext,n=["module","dataSet2","uploadedFile","package","data_asset"];if(t&&Array.isArray(t))for(var r=t,o=Array.isArray(r),i=0,r=o?r:r[Symbol.iterator]();;){var a;if(o){if(i>=r.length)break;a=r[i++]}else{if(i=r.next(),i.done)break;a=i.value}var s=a,c=n;if(l.intersection([s.type],c).length<1)return!1;var u=["read"];if(l.intersection(s.permissions,u).length<u.length)return!1;if(s.disabled&&"true"===s.disabled.toString().toLowerCase())return!1}return!0},_createEmptyBoardSpec:function(){return{name:a.default.get("defaultName"),layout:{type:"exploreContainer",items:[]},widgets:{},_meta:{bundleID:null}}}});t.default=u},465:function(e,t){e.exports=s},466:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0,t.default=void 0;var o=n(49),i=n(115),a=n(35),s=function(){function e(){r(this,e)}return e.prototype.canExecute=function(e){var t=e.target&&e.target.activeObject&&e.target.activeObject.aSelectedContext;return(0,i.isExplore)(t)&&(0,o.hasCapability)(e.glassContext)},e.prototype.isItemVisible=function(e){return this.canExecute(e)},e.prototype.doAction=function(e){var t=e.target.activeObject.aSelectedContext[0].id;return this._instrumentationTrack(t,e.glassContext),this.openExplore(e.glassContext.appController,t)},e.prototype._instrumentationTrack=function(e,t){var n=t.getCoreSvc(".Instrumentation");if(n.enabled){var r={type:"Read Object",objectType:"explore",object:e,action:"edited",milestoneName:"edited_explore"};n.track(r)}},e.prototype.onSelectItem=function(e){return this.doAction(e)},e.prototype.openExplore=function(e,t){return e.openAppView("explore",{id:t,content:{boardId:t,isAuthoringMode:!0,objRef:t}}).then(function(e){var t=e.currentContentView.boardModel.layout.exploreVM.displayedCard,n=!e.currentContentView.isFeatureEnabled("newStartingPoints","false");return t&&t===a.STARTING_POINTS&&!1===n?e.currentContentView.openDatasetpane():e.currentContentView.openCardListPane()})},e}();t.default=s},467:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var o=n(115),i=1e4,a={relationship:".relationshipViewWrapper:visible",card:".explore-content:visible"},s=function(){function e(t){r(this,e),this.vidaMapAnimTimeout=t&&t.vidaMapAnimTimeout||i}return e.prototype.execute=function(e){if(e.urlMap.objRef){var t={perspective:"explore",objRef:e.urlMap.objRef},n=e.glassContext.appController.getCurrentContentView();return"explore"===n.perspective&&"function"==typeof n.boardController.layoutController.getCurrentSubViewId&&(t.subView=n.boardController.layoutController.getCurrentSubViewId()),t}throw new Error("Unable to resolve share context. Missing objRef.")},e.prototype.getShareableItems=function(e){var t=this,n=[],r=e.glassContext.appController.getCurrentContentView(),o=Promise.resolve();if("explore"===r.perspective){var i=r.getExploreApi();o=this._waitForViewLoaded(i).then(function(){var e=t._getCapturedElement(r,i);n.push({el:1===e.length?e.get(0):r.$el.get(0),label:r.getTitle()})})}return o.then(function(){return t.reRenderMaps(r)}).then(function(){return Promise.resolve(n)})},e.prototype._waitForViewLoaded=function(e){return e.isStartingPointsDisplayed()?e.getStartingPointsAPI().whenRelationshipDataReady():Promise.resolve()},e.prototype._getCapturedElement=function(e,t){var n=t.isStartingPointsDisplayed()?"relationship":"card";return e.$el.find(a[n])},e.prototype.reRenderMaps=function(e){if(!e.boardController||!e.boardController.layoutController)return Promise.resolve();var t=e.boardController.layoutController,n=t.getSelectedWidgets(),r=[];if(n&&n.length>0&&(r=n.map(function(e){if("com.ibm.vis.rave2bundletiledmap"===t.getLayoutWidgetModel(e.id).visId){return t.dashboardApi.getCanvas().getWidget(e.id).getVisApi().mapVizRenderForPrint()}}).filter(function(e){return void 0!==e})),r.length>0){return Promise.all(r).then(function(e){return function(t){return new Promise(function(n){setTimeout(function(){return n(t)},e)})}}(this.vidaMapAnimTimeout))}return Promise.resolve({})},e.prototype.isEnabled=function(e){return this.isExplore(e)},e.prototype.isExplore=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.glassContext,n=void 0===t?{}:t,r=e.context,i=n.appController;i=void 0===i?{}:i;var a=i.currentAppView;return a=void 0===a?{}:a,"explore"===a.perspective||(0,o.isExplore)(r)},e.prototype.getInstrumentation=function(e){return e.glassContext.appController.getCurrentContentView().getDashboardApi().getFeature("segment").getInfo({type:"Shared Object"})},e}();t.default=s},7:function(t,n){t.exports=e},76:function(e,t){e.exports=a},8:function(e,n){e.exports=t}},[462])});
- //# sourceMappingURL=action-handlers.min.js.map
|