defaultActionBundle.js 2.1 KB

12345678910
  1. /**
  2. * IBM Confidential OCO Source Materials IBM Business Platform: CA Share
  3. * (C) Copyright IBM Corp. 2017, 2018
  4. *
  5. * The source code for this program is not published or otherwise divested of
  6. * its trade secrets, irrespective of what has been deposited with the U.S.
  7. * Copyright Office
  8. */
  9. define("bi/defaultaction/views/DefaultActionView",["bi/glass/app/ContentView","jquery","q","bi/sharecommon/utils/translator"],function(e,t,n,i){var r=e.extend({init:function(e){r.inherited("init",this,arguments),t.extend(this,e)},render:function(){var e=t.Deferred();return this.id?this._getObjectProperties(this.id).then(function(t){this._openObject(t).done(function(){this.glassContext.appController.closeAppView("defaultaction",this.id)}.bind(this)),e.resolve(this)}.bind(this)).fail(function(){this.glassContext.appController.closeAppView("defaultaction",this.id),e.resolve(this)}.bind(this)):e.reject(),e.promise()},getContent:function(){return{id:this.id}},getTitle:function(){return""},_openObject:function(e){var t=n.defer(),i="com.ibm.bi.contentApps.defaultAction."+e.type;return this.glassContext.appController.performAction(i,{glassContext:this.glassContext,target:{itemId:i,activeObject:{aSelectedContext:[e]}}}).then(function(){t.resolve()}).fail(function(){t.reject()}),t.promise},_getObjectProperties:function(e){return this.glassContext.getSvc(".Content").then(function(t){var r=n.defer(),o={},s=t.getBaseObjectsURL()+"/"+e+"?fields=id,defaultName,owner.defaultName,type,runAsOwner,runWithOwnerCapabilities,options,executionPrompt,parameters,disabled,hidden,modificationTime,runInAdvancedViewer,permissions";return t.get(s,{}).then(function(e,t,n){e.data[0]?(o=e.data[0],r.resolve(o)):(this.glassContext.appController.showToast(i.translate("error_get_object_properties"),{type:"error",newestOnTop:!0,preventDuplicates:!1,timeOut:6e3,extendedTimeOut:1e3}),r.reject())}.bind(this)).fail(function(e){this.glassContext.appController.showToast(i.translate("error_get_object_properties"),{type:"error",newestOnTop:!0,preventDuplicates:!1,timeOut:6e3,extendedTimeOut:1e3}),r.reject()}.bind(this)),r.promise}.bind(this))}});return r}),define("js/defaultaction/defaultActionBundle",function(){});