12345678910 |
- /**
- * IBM Confidential OCO Source Materials IBM Business Platform: Content Apps
- * (C) Copyright IBM Corp. 2016, 2018
- *
- * The source code for this program is not published or otherwise divested of
- * its trade secrets, irrespective of what has been deposited with the U.S.
- * Copyright Office
- */
- define("bacontentnav/common/ui/LanguagePickerView",["../../lib/@waca/baglass/js/baglass/app/ContentView","../../utils/GlassContextHelper","../../nls/StringResource","../../lib/@waca/core-client/js/core-client/ui/properties/PropertyUIControl","jquery","underscore"],function(t,e,n,i,o,s){"use strict";var r=t.extend({init:function(t){if(r.inherited("init",this,arguments),s.extend(this,t),!this.glassContext)throw"glassContext is not specified";this._modifiedValues={},this._userContentLocale=e.getUserPreference(this.glassContext,"contentLocale"),this.enabledLanguages&&0!==this.enabledLanguages.length||(this.enabledLanguages=[this._userContentLocale],this._modifiedValues[this._userContentLocale]=!0),this.enabledLanguages.forEach(function(t){this._modifiedValues[t]=!0}.bind(this))},render:function(){return this._getContentLocales().then(this._doRender.bind(this))},_doRender:function(t){var e=this._getSpec(t,this.enabledLanguages);return this._propertyUIControl=new i({glassContext:this.glassContext,el:this.$el,closeCallback:this._onClose.bind(this),items:[{type:"Banner",centerLabel:!0,backButton:this.slideout.overlay,value:n.get("languages")}].concat(e)}),this._propertyUIControl.render()},_getContentLocales:function(){return this.supportedContentLocales?Promise.resolve(this.supportedContentLocales):e.getContentLocales(this.glassContext).then(function(t){return this.supportedContentLocales=t,this.supportedContentLocales}.bind(this))},_getSpec:function(t,e){var n=[];for(var i in t)t.hasOwnProperty(i)&&n.push({type:"CheckBox",name:i,label:t[i],value:i,controlOnLeft:!0,checked:-1!==e.indexOf(i),onChange:this._onChange.bind(this)});return n},setFocus:function(){var t=s.find(this._propertyUIControl.items,function(t){return-1!==this.enabledLanguages.indexOf(t.name)}.bind(this));null!==t&&this._propertyUIControl.setFocus(t.name)},_onChange:function(t,e){this._modifiedValues[t]=e},_onClose:function(){this.slideout.hide(),this.closeCallback&&this.closeCallback(this.getLanguages())},getLanguages:function(){var t=[];for(var e in this._modifiedValues)this._modifiedValues.hasOwnProperty(e)&&this._modifiedValues[e]&&t.push(e);return t},getModifiedProperties:function(){return{languages:this.getLanguages()}},remove:function(){this._onClose()}});return r}),define("bi/content_apps/ui/CA_DateTimePicker",["bi/commons/ui/widgets/DatePicker","bi/commons/ui/widgets/TimePicker","bi/commons/utils/DateTimeUtils","bacontentnav/lib/@waca/core-client/js/core-client/ui/properties/BaseProperty","bacontentnav/utils/GlassContextHelper","bacontentnav/utils/UIHelper","underscore"],function(n,i,o,e,s,t,r){"use strict";return e.extend({init:function(t){e.inherited("init",this,arguments),r.extend(this,t),this._time={}},doRender:function(){this._container=$("<div>",{class:"ca_timeDatePickerContainer"});var t=$("<div/>");this._container.append(t),this.$el.append(this._container);var e={attributes:{firstDay:1},drawNoEndDate:!1,$el:t,timezone:s.getUserPreference(this.glassContext,"timeZoneID"),locale:s.getUserPreference(this.glassContext,"contentLocale")};return this._datePicker=new n(e),this._datePicker.render().then(function(){var t=new Date;this._datePicker.setDateFormat("yy-mm-dd"),this._datePicker.setDate(t);var e=$("<div/>");this._container.append(e),this._timePicker=new i({$el:e,timezone:s.getUserPreference(this.glassContext,"timeZoneID"),attributes:{showMeridian:!o.is24HrFormat(s.getUserPreference(this.glassContext,"contentLocale"))}}),this._timePicker.render(),this._container.hide()}.bind(this))},getModifiedProperties:function(){return this._time[this.name]=this._timePicker.getDateTimeUTC(this._datePicker.getDateObj()),this._time},show:function(){this._container.slideDown(t.SLIDE_DURATION)},hide:function(){this._container.slideUp(t.SLIDE_DURATION)}})}),define("bi/content_apps/ui/CA_DeliveryPickerView",["bi/schedule/views/DeliveryPickerView","bi/content_apps/nls/StringResource","bi/schedule/views/OptionsSlideoutView"],function(n,e,t){"use strict";var i=t.extend({init:function(t){t.title=e.get("delivery"),i.inherited("init",this,arguments)},render:function(){return this._renderContent(),i.inherited("render",this,arguments)},shouldShowMobile:function(){var t=["interactiveReport","report","query","analysis"];return-1!==t.indexOf(this.objectInformation.type)||"reportView"===this.objectInformation.type&&-1!==t.indexOf(this.objectInformation.base[0].type)},_renderContent:function(){if(!this.content){var t={reportName:this.objectInformation.defaultName,showMobile:this.shouldShowMobile(),enableAdvancedSettings:!0,glassContext:this.glassContext,deliveryOptions:this.deliveryOptions||{},$toggler:$("<div></div>"),slideout:this.slideout,hasPermission:this.objectInformation.permissions,rawOptions:this.objectInformation.rawOptions};this._deliveryPickerView=new n(t),this._deliveryPickerView.render();var e=this._deliveryPickerView.getDeliveryContent(!this.burstSelected);this.content=$(e)}},_close:function(){this.remove(),this.slideout.hide({hideOnly:!0})},remove:function(){this.closeCallback&&"function"==typeof this.closeCallback&&this.closeCallback(this._deliveryPickerView.getDeliveryOptions())},setUpCallback:function(t){this._deliveryPickerView.setDeliveryOptions(t,null)}});return i}),define("text!bi/content_apps/ui/templates/PowerPlayPromptPickerView.html",[],function(){return'\x3c!-- Licensed Materials - Property of IBM\n \n IBM Cognos Products: Content Explorer\n \n (C) Copyright IBM Corp. 2017\n \n US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.\n--\x3e\n<form id="ppForm" name="ppForm" action="v1/disp" method="post" >\n\t\t\t<input type="hidden" name="b_action" value="xts.run"/>\n\t\t\t{{?it.runNow}}\n\t\t\t\t<input type="hidden" name="m" value="portal/launch.xts"/>\n\t\t\t\t<input type="hidden" name="ui.tool" value="PowerplayStudio"/>\n\t\t\t\t<input type="hidden" name="ui.crnfrm" value="PDF"/>\n\t\t\t\t<input type="hidden" name="ui.crnp" value="true"/>\n\t\t\t\t<input type="hidden" name="ui.object" value="storeID(\'{{=it.reportId}}\')"/>\n\t\t\t\t<input type="hidden" name="launch.openJSStudioInFrame" value="true"/>\n\t\t\t\t<input type="hidden" name="ui.gateway" value="disp"/>\n\t\t\t\t<input type="hidden" name="ui.action" value="run"/>\n\t\t\t{{?}}\n\t\t\t{{?it.runBackground}}\n\t\t\t\t<input type="hidden" name="backgroundRun" value="{{=it.backgroundTime}}"/>\n\t\t\t\t<input type="hidden" name="m" value="portal/runWithOptions/report_confirm.xts"/>\n\t\t\t\t<input type="hidden" name="m_pp8ro_prompt" value="true"/>\n\t\t\t\t<input type="hidden" name="m_ro_saveOutput" value="true"/>\n\t\t\t\t<input type="hidden" name="m_class" value="powerPlay8Report"/>\n\t\t\t\t<input type="hidden" name="m_obj" value="storeID(\'{{=it.reportId}}\')"/>\n\t\t\t\t<input type="hidden" name="method" value="edit"/>\n\t\t\t\t<input type="hidden" name="showSummary" value="y"/>\n\t\t\t\t<input type="hidden" name="fromCA" value="true"/>\n\t\t\t\t<input type="hidden" name="backURL" value="disp?b_action=xts.run&m=portal/close.xts&ui.compid=ca"/>\n\t\t\t\t<input type="hidden" name="m_pp8ro_outputFormat" value="PDF"/>\n\t\t\t\t{{?it.languageOptions}}\n\t\t\t\t\t{{~it.languageOptions :lang:index}}\n\t\t\t\t\t\t<input type="hidden" name="language" value="{{=lang}}"/>\n\t\t\t\t\t\t<input type="hidden" name="m_ro_outputLocale" value="{{=lang}}"/>\n\t\t\t\t\t{{~}}\n\t\t\t\t{{?}}\n\t\t\t\t{{?it.executionDate}}\n\t\t\t\t\t<input type="hidden" name="p_runDate" value="{{=it.executionDate}}"/>\n\t\t\t\t\t<input type="hidden" name="p_runTime" value="{{=it.executionTime}}"/>\n\t\t\t\t\t<input type="hidden" name="txtDatedateFrom" value="{{=it.executionDate}}"/>\n\t\t\t\t\t<input type="hidden" name="minutestimeFrom" value="{{=it.displayMinutes}}"/>\n\t\t\t\t\t<input type="hidden" name="hourstimeFrom" value="{{=it.displayHours}}"/>\n\t\t\t\t\t<input type="hidden" name="AMPMtimeFrom" value="{{=it.amPM}}"/>\n\t\t\t\t\n\t\t\t\t{{?}}\n\t\t\t\t{{?it.ca_deliveryOptions}}\n\t\t\t\t\t<input type="hidden" name="m_ro_email" value=\'true\'/>\t\n\t\t\t\t\t<input type="hidden" name="m_sp_credential" value="CAMID(\'LDAP:u:uid=user0,ou=ottawa\')/credential[@name=\'Credential\']"/>\t\n\t\t\t\t\t<input type="hidden" name="ca_deliveryOptions" value=\'{{=it.ca_deliveryOptions}}\'/>\t\n\t\t\t\t\t<input type="hidden" name="hasRecipients" value=\'true\'/>\n\t\t\t\t\t<input type="hidden" name="emailDescription" value=\'{{=it.emailRecipients}}\'/>\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t<input type="hidden" name="deliverySection" value=\'true\'/>\t\n\t\t\t\t\t<input type="hidden" name="hasRecipients" value=\'true\'/>\t\n\t\t\t\t\t\n\t\t\t\t\t{{?it.emailAsAttachment}}\n\t\t\t\t\t\t<input type="hidden" name="m_ro_emailAsAttachment" value=\'true\'/>\t\n\t\t\t\t\t\t<input type="hidden" name="run_with_options_allowEmailAsAttachment" value=\'true\'/>\n\t\t\t\t\t{{?}}\n\t\t\t\t\t{{?it.emailAsURL}}\n\t\t\t\t\t\t<input type="hidden" name="m_ro_emailAsURL" value=\'true\'/>\t\n\t\t\t\t\t{{?}}\n\t\t\t\t\t{{?it.printer}}\n\t\t\t\t\t\t<input type="hidden" name="ro_printer_kw" value=\'printer\'/>\n\t\t\t\t\t\t<input type="hidden" name="select_printerName" value=\'{{=it.printer}}\'/>\n\t\t\t\t\t\t<input type="hidden" name="select_printerNameAddress" value=\'CAMID(":")/printer[@name="{{=it.printer}}"]\'/>\n\t\t\t\t\t\t<input type="hidden" name="m_ro_printer" value=\'CAMID(":")/printer[@name="{{=it.printer}}"]\'/>\n\t\t\t\t\t\t<input type="hidden" name="printeritem" value=\'CAMID(":")/printer[@name="{{=it.printer}}"]\'/>\n\t\t\t\t\t\t<input type="hidden" name="m_ro_printerAddress" value=\'{{=it.printer}}\'/>\n\t\t\t\t\t\t<input type="hidden" name="m_ro_print" value=\'true\'/>\n\t\t\t\t\t{{?}}\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t{{?}}\n\t\t\t{{?}}\n\t\t</form>\n'}),define("bi/content_apps/ui/PowerPlayPromptPickerView",["bi/schedule/views/PromptPickerView","jquery","q","doT","text!bi/content_apps/ui/templates/PowerPlayPromptPickerView.html"],function(t,r,a,l,u){var e=t.extend({init:function(t){e.inherited("init",this,arguments)},_updateForSubmit:function(t){t.find(".prompt-iframe").contents().find('form[name="ppForm"]').submit()},showPromptOverlay:function(){var t=a.defer(),e=r("<div class='prompt-overlay'><iframe title='{{=it.prompt_title}}' class='prompt-iframe'></iframe></div>"),n=l.simpleTemplate(u),i={reportId:this.reportId,backgroundTime:"now"};if(this.ca_deliveryOptions&&(i.ca_deliveryOptions=this.ca_deliveryOptions,i.emailRecipients=this.deliveryOptions.email.to.length+this.deliveryOptions.email.bcc.length+this.deliveryOptions.email.cc.length,i.emailAsAttachment=!0===this.deliveryOptions.email.emailAsAttachment,i.emailAsURL=!0===this.deliveryOptions.email.emailAsURL,this.deliveryOptions.print&&(i.printer=this.deliveryOptions.print.name)),this.languageOptions&&(i.languageOptions=this.languageOptions),this.executionTime){var o=this.executionTime.split("T");i.executionDate=o[0];var s=o[1].split("-")[0].split(":");i.displayHours=s[0],i.displayMinutes=s[1],i.executionTime=i.displayHours+":"+i.displayMinutes+":00.000",i.amPM=12<parseInt(i.displayHours)?"PM":"AM",i.backgroundTime="later"}return r("body").append(e),this.openInTab?i.runNow=!0:i.runBackground=!0,e.find(".prompt-iframe").contents().find("html").html(n(i)),this.openInTab?r(e.find(".prompt-iframe").contents().find('form[name="ppForm"]')).attr("target","_blank"):window.ccModalCallBack=function(){delete window.ccModalCallBack,e.remove()},this._updateForSubmit(e),this.$promptOverlay=r("body").find(".prompt-overlay"),this.openInTab&&e.remove(),t.resolve(),t.promise}});return e}),define("bi/content_apps/RunAsOptionsView",["underscore","bi/glass/app/ContentView","bacontentnav/lib/@waca/core-client/js/core-client/ui/properties/PropertyUIControl","bi/content_apps/nls/StringResource","bacontentnav/utils/ContentStoreObject","bi/commons/ui/Button","bacontentnav/utils/GlassContextHelper","bi/schedule/views/PromptPickerView","bacontentnav/common/ui/LanguagePickerView","bi/content_apps/ui/CA_DateTimePicker","bi/content_apps/ui/CA_DeliveryPickerView","bi/content_apps/PdfOptionsView","bi/content_apps/ui/PowerPlayPromptPickerView","bi/content_apps/utils/C10Utils","bacontentnav/utils/UIHelper","bi/content_apps/authoring/AuthoringHelper"],function(i,t,o,s,n,r,e,a,l,u,c,p,h,d,m,g){"use strict";var _=t.extend({_getReportOutputFormat:function(t){var e=n.getOption(t,n.OPTION_OUTPUT_FORMAT);return g.userCanGenerateFormat(this.glassContext,e)||(e="HTML"),e},init:function(t){_.inherited("init",this,arguments),i.extend(this,t),this._userPermissions=t.objectInformation.permissions,this._supportedFormats=g.getSupportedFormats(this.objectInformation),this._userContentLocale=e.getUserPreference(this.glassContext,"contentLocale"),this._userFormat=e.getUserPreference(this.glassContext,"format"),this._outputFormat=this._getReportOutputFormat(t.objectInformation)?this._getReportOutputFormat(t.objectInformation):this._userFormat,this._selections={},this._selections.formats={},this._selections.formats[this._outputFormat]=!0,this._requestParams={},this._requestParams.options={},g.setReportType(this._requestParams,this.objectInformation),this._appController=this.glassContext.appController,this._promptValue=n.getExecutionPrompt(this.objectInformation)},setFocus:function(){this.$el.find("button.primary").focus()},render:function(){this.$el.addClass("runAsOptionsView");var t=i.contains(this._userPermissions,"write")||i.contains(this._userPermissions,"execute"),e=this._getRunAsItemsSpec(t),n=i.compact(e);return this._runOptionsControl=new o({el:this.$el,items:n,glassContext:this.glassContext,readOnly:!m.isValid(this.objectInformation)}),this._runOptionsControl.render().then(function(){this._runInBackgroundOptionsControl=this._runOptionsControl.getProperty("runInBackgroundOptions"),this._runAsOptionsControl=this._runOptionsControl.getProperty("runAsOptions");var t=$('<a style="padding-left:10px;cursor:pointer;">'+s.get("classicView")+"</a>");if(t.on("primaryaction",function(){var t="jobDefinition"===this.objectInformation.type?"portal/runWithOptions/jobDefinition.xts":"portal/runWithOptions/report.xts";d.openC10Morphlet(t,this.objectInformation.type,this.objectInformation.id,[{m_name:this.objectInformation.defaultName}])}.bind(this)),$(this.$el.find(".l_delivery").parent().parent()).append(t),!m.isValid(this.objectInformation)){var e=this._runOptionsControl.getProperty("runAsFooter");if(e){var n=e.getProperty("okButton");n&&n.disable()}}}.bind(this))},_getRunAsItemsSpec:function(t){return[this._getBannerSpec(),this._getSeparatorSpec(),t&&this._getRunInBackgroundToggleSpec(),this._getSeparatorSpec(),this._getRunInBackgroundOptionsSpec(),this._getRunAsOptionsSpec(),this._getFooterSpec()]},_getFooterSpec:function(){return{type:"Footer",name:"runAsFooter",items:[{type:"Button",name:"okButton",label:s.get("run"),onSelect:this._onRun.bind(this),primary:!0}]}},_getBannerSpec:function(){return{type:"Banner",name:"runAsBanner",value:s.get("runAs"),editable:!1}},_renderButtons:function(){var t=$("<div>",{class:"buttonRow"});this.$el.append(t);var e=new r({buttonSpec:{label:s.get("run"),onSelect:this._onRun.bind(this)}});return e.render(),t.append(e.$el),Promise.resolve(!0)},_getSeparatorSpec:function(){return{type:"Separator"}},_getRunInBackgroundToggleSpec:function(){return{name:_.OPTION.RUN_IN_BG,checked:!1,label:s.get("runInBackgroundOption"),type:"ToggleButton",onChange:this._toggleOptionsControl.bind(this)}},_toggleOptionsControl:function(){this._runInBackgroundOptionsControl.toggleCollapsibleSection(),this._runAsOptionsControl.toggleCollapsibleSection(),this._copySelectionForRunInBackgroundToggle(),this._copyPromptForValuesOnRunInBackgroundChange()},_copyPromptForValuesOnRunInBackgroundChange:function(){var t=this._runOptionsControl.getModifiedProperties()[_.OPTION.RUN_IN_BG],e=this._runAsOptionsControl.getProperty(_.OPTION.PROMPT),n=this._runInBackgroundOptionsControl.getProperty(_.OPTION.PROMPT),i=t?n:e;(t?e.checked:n.checked)?i.checked||i.check():i.checked&&i.uncheck()},_copySelectionForRunInBackgroundToggle:function(){if(1!==this._supportedFormats.length){var n=this._runOptionsControl.getModifiedProperties();if(n[_.OPTION.RUN_IN_BG])$.each(this._supportedFormats,function(t,e){g.userCanGenerateFormat(this.glassContext,e)&&this._runOptionsControl.getProperty(e).uncheck()}.bind(this)),this._runOptionsControl.getProperty(n[_.OPTION.RUNFORMAT]||this._outputFormat).check();else{var i=null;$.each(this._supportedFormats,function(t,e){if(n[e])return i=e,!1}.bind(this)),this._runOptionsControl.getProperty(_.OPTION.RUNFORMAT).setValue(i||this._outputFormat)}}},_getRunInBackgroundOptionsSpec:function(){return{type:"CollapsibleSection",name:"runInBackgroundOptions",hideSectionTitle:!0,items:this._getRunInBackgroundFormatsSpec().concat(this._getSeparatorSpec(),this._getPromptForValuesOptionSpec(),this._getPromptGenerationHintText(this._promptValue),this._getAdvancedSectionSpec())}},_getRunAsOptionsSpec:function(){return{type:"CollapsibleSection",name:"runAsOptions",hideSectionTitle:!0,items:[this._getRunAsFormatsSpec(),this._getSeparatorSpec(),this._getPromptForValuesOptionSpec(),this._getSeparatorSpec()],open:!0}},_getRunInBackgroundFormatsSpec:function(){if(1===this._supportedFormats.length)return[this._getSingleFormatSpec(this._supportedFormats[0])];var e=[];return this._supportedFormats.forEach(function(t){g.userCanGenerateFormat(this.glassContext,t)&&e.push({type:"CheckBox",name:t,label:s.get(g.FORMAT_MESSAGE_KEY_MAP[t]),value:t,controlOnLeft:!0,checked:this._outputFormat===t,onChange:this._updateSelectedFormat.bind(this)})}.bind(this)),[{type:"CollapsibleSection",hideSectionTitle:!0,open:!0,name:_.OPTION.OUTPUTFORMAT,ariaLabel:s.get("formatOptions"),items:e}]},_getRunAsFormatsSpec:function(){if(1===this._supportedFormats.length)return this._getSingleFormatSpec(this._supportedFormats[0]);var e=[];return this._supportedFormats.forEach(function(t){g.userCanGenerateFormat(this.glassContext,t)&&e.push({name:t,label:s.get(g.FORMAT_MESSAGE_KEY_MAP[t]),value:t})}.bind(this)),{type:"RadioButtonGroup",ariaLabel:s.get("formatOptions"),name:_.OPTION.RUNFORMAT,value:this._outputFormat,controlOnLeft:!0,separator:!1,items:e}},_getSingleFormatSpec:function(t){return{type:"SingleLineValue",name:t,label:s.get(t),value:""}},_getPromptForValuesOptionSpec:function(){return{type:"CheckBox",name:_.OPTION.PROMPT,label:s.get("promptForValues"),controlOnLeft:!0,checked:n.getExecutionPrompt(this.objectInformation),onChange:this._togglePromptValue.bind(this)}},_getPromptGenerationHintText:function(t){return{type:"HintText",name:"promptGenerationHintText",label:s.get("promptGenerationHint"),visibility:this._getCssVisibility(t)}},_togglePromptValue:function(t,e){this._promptValue=e,this._showHidePromptGenerationHintText(this._promptValue)},_showHidePromptGenerationHintText:function(t){var e=this._getCssVisibility(t);this._runOptionsControl.getProperty("promptGenerationHintText").visibility=e,this.$el.find(".l_promptGenerationHintText").css("visibility",e)},_getCssVisibility:function(t){return t?"visible":"hidden"},_getAdvancedSectionSpec:function(){var t=[this._getRunNowOrLaterOptions(),this._getExecutionTimePicker(),this._getBurstOptionSpec(),this._getPDFOptionsSpec(),this._getLanguagesOptionSpec(),this._getDeliveryOptionsSpec()].filter(function(t){return!!t});return{type:"CollapsibleSection",name:"advancedProperties",label:s.get("advancedProperties"),items:t}},_getRunNowOrLaterOptions:function(){return{type:"HorizontalRadioButtonGroup",name:_.OPTION.RUN_NOW_OR_LATER,value:"now",controlOnLeft:!0,ariaLabel:s.get("nowOrLaterRadioOptions"),onChange:this._toggleDatetimePicker.bind(this),items:[{name:_.OPTION.RUN_NOW,value:_.OPTION.RUN_NOW,label:s.get("now")},{label:s.get("later"),name:_.OPTION.RUN_LATER,value:_.OPTION.RUN_LATER}]}},_toggleDatetimePicker:function(t,e){this._lastRunNowOrLaterOption!==e&&(this._datetimePicker||(this._datetimePicker=this._runOptionsControl.getProperty(_.OPTION.EXECUTIONTIME)),e===_.OPTION.RUN_LATER?this._datetimePicker.show():this._datetimePicker.hide(),this._lastRunNowOrLaterOption=e)},_getExecutionTimePicker:function(){return{module:u,name:_.OPTION.EXECUTIONTIME,glassContext:this.glassContext}},_getBurstOptionSpec:function(){if(n.canBurst(this.objectInformation)&&this.glassContext.hasCapability("canUseBursting"))return{type:"CheckBox",name:_.OPTION.BURST,label:s.get("burst"),value:_.OPTION.BURST,onChange:this._updateBurstSelected.bind(this)}},_getPDFOptionsSpec:function(){if(1!==this._supportedFormats.length&&g.userCanGenerateFormat(this.glassContext,"PDF"))return{type:"SingleLineValue",name:_.OPTION.ADVANCED_PDF,label:s.get("pdf"),editCallback:this._showMoreOptionsPane.bind(this,this._getMorePDFOptionsSpec.bind(this)),hidden:!0}},_getLanguagesOptionSpec:function(){return{type:"SingleLineValue",name:_.OPTION.LANGUAGES,label:s.get("languages"),editCallback:this._showMoreOptionsPane.bind(this,this._getMoreLanguageOptionsSpec.bind(this))}},_getDeliveryOptionsSpec:function(){return{type:"SingleLineValue",name:_.OPTION.DELIVERY,label:s.get("delivery"),editCallback:this._showMoreOptionsPane.bind(this,this._getMoreDeliveryOptionsSpec.bind(this))}},_showMoreOptionsPane:function(t){"function"!=typeof t&&this.logger.debug("getContentSpecFunc is not a function");var e=this.slideout;t().then(function(t){this._slideout=this._appController.showSlideOut({position:"left",parent:e,width:"400",enableTabLooping:!0,overlay:void 0===t.overlay||t.overlay,content:t.slideoutContent,label:t.slideoutLabel})}.bind(this))},_getMoreDeliveryOptionsSpec:function(){var t={overlay:!0,slideoutContent:{module:c,closeCallback:this._closeMoreDeliveryOptionsSlideout.bind(this),objectInformation:this.objectInformation,glassContext:this.glassContext,deliveryOptions:this._selections.delivery,burstSelected:!!this._selections[_.OPTION.BURST]},slideoutLabel:s.get("delivery")};return Promise.resolve(t)},_getMoreLanguageOptionsSpec:function(){var t={module:"bi/content_apps/common/ui/LanguagePickerView",closeCallback:this._closeMoreLanguageOptionsSlideout.bind(this)};this._selections.languages&&(t.enabledLanguages=this._selections.languages);var e={slideoutContent:t,slideoutLabel:s.get("languages")};return Promise.resolve(e)},_closeMoreLanguageOptionsSlideout:function(t){this._selections.languages=t},_closeMoreDeliveryOptionsSlideout:function(t){this._selections.delivery=t},_getDefaultPDFOptionValues:function(){if(this._selections.pdf)return Promise.resolve({pdfOptions:this._selections.pdf});if(this._defaultPDFOptionsValues)return Promise.resolve(this._defaultPDFOptionsValues);var t={dataType:"json",type:"GET",url:n.getSelfLink(this.objectInformation)+"?fields=options"};return this.glassContext.getCoreSvc(".Ajax").ajax(t).then(function(t){var e=t.data.data[0].options;if(e){var n=e.filter(function(t){return-1!==_.PDF_OPTIONS.indexOf(t.name)});return this._defaultPDFOptionsValues={pdfOptions:n},this._defaultPDFOptionsValues}}.bind(this)).catch(this._handleRunError.bind(this))},_getMorePDFOptionsSpec:function(){var e={module:p,closeCallback:this._closeMorePDFOptionsSlideout.bind(this)};return this._getDefaultPDFOptionValues().then(function(t){return t&&i.extend(e,t),{slideoutContent:e,slideoutLabel:s.get("pdfOptions")}})},_closeMorePDFOptionsSlideout:function(t){this._selections.pdf=t},_onRun:function(){i.extend(this._selections,this._runOptionsControl.getModifiedProperties()),this.logger.debug("RunAsOptionsView._onRun",this._selections),this._selections[_.OPTION.RUN_IN_BG]?this._doRunInBackground():this._doRunAs()},_doRunAs:function(){this._appController.performAction(this._getActionId(),this._buildPayload()),this._appController.hideSlideOut()},_getSelectedFormats:function(t){var e;if(t)if(1===this._supportedFormats.length)e=this._supportedFormats;else{var n=[];for(var i in this._selections.formats)this._selections.formats.hasOwnProperty(i)&&this._selections.formats[i]&&n.push(i);e=n}else e=1===this._supportedFormats.length?this._supportedFormats[0]:this._selections[_.OPTION.RUNFORMAT]||this._outputFormat;return e},_updateBurstSelected:function(t,e){this._selections[_.OPTION.BURST]=e},_updateSelectedFormat:function(t,e){if(this._selections.formats[t]=e,"PDF"===t&&g.userCanGenerateFormat(this.glassContext,t)){var n=this._runOptionsControl.getProperty(_.OPTION.ADVANCED_PDF);e?n.show():n.hide()}},_setOutputLocaleRequestParams:function(){this._selections.languages&&(this._requestParams.options.outputLocale=this._selections.languages)},_setDeliveryOptionsRequestParams:function(){this._selections.delivery?this._requestParams.options.delivery=this._selections.delivery:this._requestParams.options.delivery={save:{notify:!1}}},_setOutputFormatRequestParams:function(){var t=this._getSelectedFormats(!0);this._requestParams.options.outputFormat=t},_setSaveToCloudRequestParams:function(){this._selections.delivery&&this._selections.delivery.cloudLocation&&""!==this._selections.delivery.cloudLocation&&(this._requestParams.options.saveToCloud=this._selections.delivery.cloudLocation,this._selections.delivery.cloudName&&""!==this._selections.delivery.cloudName&&(this._requestParams.options.cloudName=this._selections.delivery.cloudName))},_setExecutionTimeRequestParams:function(){if(this._selections[_.OPTION.RUN_NOW_OR_LATER]===_.OPTION.RUN_LATER&&this._selections.executionTime){if(!(Date.now()<Date.parse(this._selections.executionTime)))throw e.displayToast(this.glassContext,s.get("invalidTime")),"Invalid time selected";this._requestParams.executionTime=this._selections.executionTime}},_setBurstOptionRequestParams:function(){this._selections[_.OPTION.BURST]&&(this._requestParams.options.burst=!0)},_setParametersRequestParams:function(t){t&&(this._requestParams.parameters=t)},_setPDFOptionsRequestParams:function(){this._selections&&this._selections.pdf&&(this._requestParams.options.pdf={},this._selections.pdf.forEach(function(t){var e=t.value;if(-1!==t.name.indexOf("Password")&&t.value.length){var n=$.parseXML(t.value),i=$(n).find("password");i.text().length&&(e=i.text())}e&&(this._requestParams.options.pdf[t.name]=e)}.bind(this)))},_doRunInBackground:function(){if(!this._getSelectedFormats(!0).length)throw e.displayToast(this.glassContext,s.get("selectAFormat"),{type:"warning"}),"No format selected";if(this._promptValue)return this._showPromptPicker(),void this._appController.hideSlideOut();this._executeRequest()},_onPromptFinish:function(){this._executeRequest()},_updateRunOptionsForPowerPlayPrompt:function(t){this._selections&&this._selections.delivery&&this._selections.delivery.email&&(t.ca_deliveryOptions=d.getPowerPlayC10DeliveryOptions(this._selections.delivery.email))},_showPromptPicker:function(t){var e=$("<div>",{class:"ca_promptpicker"}),n={reportId:this.objectInformation.id,glassContext:this.glassContext,onFinish:this._onPromptFinish.bind(this),$toggler:e,deliveryOptions:this._selections.delivery,languageOptions:this._selections.languages};t&&(n.openInTab=!0),d.isPowerPlay(this.objectInformation.type)?("later"===this._selections.runNowOrLater&&(n.executionTime=this._selections.executionTime),this._updateRunOptionsForPowerPlayPrompt(n),this._promptPickerControl=new h(n)):this._promptPickerControl=new a(n),this._promptPickerControl.showPromptOverlay()},_getRequestParams:function(){return this._appController.hideSlideOut().then(function(){this._setOutputFormatRequestParams(),this._setSaveToCloudRequestParams(),this._setExecutionTimeRequestParams(),this._setDeliveryOptionsRequestParams(),this._setBurstOptionRequestParams(),this._setPDFOptionsRequestParams(),this._setOutputLocaleRequestParams(),this._promptValue&&this._setParametersRequestParams(this._promptPickerControl.getParameterValues())}.bind(this))},_validRequestParamsOptions:function(){var t=this._requestParams.options;if(null!=t){var e=[];for(var n in t)null!=t[n]&&e.push(t[n]);0===e.length&&delete this._requestParams.options}},_executeRequest:function(){this._getRequestParams().then(function(){this._validRequestParamsOptions();var t=JSON.stringify(this._requestParams),e={headers:{"Content-Type":"application/vnd.ibm.bi.platform.execution+json; charset=UTF-8",Accept:"application/json"},datatype:"json",type:"post",url:"v1/reports/"+this.objectInformation.id+"/executions",data:t};return this.glassContext.getCoreSvc(".Ajax").ajax(e).catch(this._handleRunError.bind(this))}.bind(this))},_handleRunError:function(t){e.showAjaxServiceError(this.glassContext,t)},_buildPayload:function(){return{glassContext:this.glassContext,target:{objectInformation:this.objectInformation,itemId:this._getActionId(),runOptions:{prompt:this._promptValue,format:this._getSelectedFormats()},activeObject:{oListControl:this.listControl,aSelectedContext:[this.objectInformation]}}}},_getActionId:function(){var t=_.ACTION_ID;return-1!==this.objectInformation.type.indexOf("powerPlay8Report")&&(t="com.ibm.bi.contentApps.defaultAction."+this.objectInformation.type),t}});return _.ACTION_ID="com.ibm.bi.contentApps.action.runAs",_.SUPPORTED_FORMATS={all:["spreadsheetML","xlsxData","PDF","HTML","CSV","XML"],interactiveReport:["HTML"],powerPlay8Report:["PDF"]},_.OPTION={PROMPT:"promptForValues",RUNFORMAT:"runFormat",OUTPUTFORMAT:"outputFormat",DELIVERY:"delivery",EXECUTIONTIME:"executionTime",LANGUAGES:"languages",RUN_IN_BG:"runInBackgroundChecked",RUN_LATER:"later",RUN_NOW:"now",RUN_NOW_OR_LATER:"runNowOrLater",BURST:"burst",ADVANCED_PDF:"advancedPDF"},_.PDF_OPTIONS=["outputPageDefinition","outputPageOrientation","userPassword","ownerPassword","allowPrintQuality","allowModifications","allowAnnotations","allowFieldCompletion","allowAssembly","allowContentCopy","allowAccessibilitySupport"],_}),define("bi/content_apps/common/ui/list_actions/ViewReportAction",["bacontentnav/common/ui/list_actions/ListAction","bacontentnav/utils/ContentStoreObject","bi/commons/utils/Downloader","underscore"],function(t,u,e,i){"use strict";return t.extend({canExecute:function(t){var e=t.target.activeObject.aSelectedContext;return!(!e||1<e.length)&&u.hasPermissions(e[0],["traverse","read"])},doAction:function(a){var t=a.target.activeObject.aSelectedContext;if(!t||1<t.length)return Promise.reject(new Error("No objects selected"));var l=t[0];return u.getBaseObjectType(l).then(function(r){if(this._isSupportedType(r)){var t={url:u.getSelfLink(l),type:"GET",dataType:"json",data:{fields:"defaultOutputFormat"}};return a.glassContext.getCoreSvc(".Ajax").ajax(t).then(function(t){if((t=t&&t.data).data[0].defaultOutputFormat){var e,n=a.target.activeObject.outputId,i=a.target.activeObject.download,o=i?"/content?download=true":this._getSuffix(r);if(e=n?"v1/disp/repository/sid/cm/oid/"+n+o:"v1/disp/repository/sid/cm/rid/"+l.id+"/oid/default"+o,i){this._getDownloader({url:e,logger:a.glassContext.appController.logger}).doDownload()}else{if(-1!==r.indexOf("powerPlay8Report")){var s=u.getName(l);e=this._getPP8ReportViewerUrl(n,s)}this._openWindow(e)}return Promise.resolve()}return Promise.reject(new Error("No saved output"))}.bind(this))}return Promise.reject(new Error("Not supported type"))}.bind(this))},_getDownloader:function(t){return new e(t)},_openWindow:function(t){window.open(t)},_getSuffix:function(t){var e;switch(t){case"interactiveReport":e="/content/mht/content";break;case"powerPlay8Report":case"powerPlay8ReportView":e="/content?cv.id=_THIS_";break;default:e=""}return e},_isSupportedType:function(t){var e=!1;switch(t){case"interactiveReport":case"powerPlay8Report":case"powerPlay8ReportView":e=!0}return e},_getPP8ReportViewerUrl:function(t,e){var n="v1/disp?b_action=cognosViewer&ui.action=view&ui.format=PDF&ui.object=storeID(%22"+t+"%22)&ui.name="+i.escape(e);return n+="&cv.header=false&ui.backURL=%2fcps4%2fportlets%2fcommon%2fclose.html"}})}),define("bi/content_apps/VersionsTab",["require","jquery","bi/glass/app/ContentView","bi/commons/ui/Slideout","bi/content_apps/nls/StringResource","bacontentnav/utils/UIHelper","bacontentnav/utils/ContentStoreObject","bacontentnav/lib/@waca/core-client/js/core-client/ui/properties/PropertyUIControl","bacontentnav/utils/GlassContextHelper","bi/content_apps/common/ui/list_actions/ViewReportAction","bi/commons/ui/dialogs/ConfirmationDialog","bi/commons/utils/BidiUtil","underscore"],function(n,s,t,o,a,i,l,r,u,e,c,p,h){"use strict";var d={PDF:!0,HTML:!0,CSV:!0,spreadsheetML:!0,xlsxData:!0,XHTML:!0,XLWA:!0,XML:!0,HTMLFragment:!0},m={xlsxdata:"common-excel_icon",spreadsheetml:"common-excel_icon",xlwa:"common-excel_icon",xhtml:"common-html_icon",html:"common-html_icon",csv:"common-csv_icon",pdf:"common-pdf_icon",xml:"common-xml_icon",default:"common-savedoutput_report"},g=t.extend({init:function(t){g.inherited("init",this,arguments),h.extend(this,t),this.noBurstKey="secretIBMNoBurstKey",this.mockableViewInteractiveReportAction=e,this.batchSize=Math.floor(window.innerHeight/18),this.initialEndIndex=this.batchSize,this.renderIndex=this.batchSize},render:function(){return this._id=h.uniqueId("prop_"),this._queryHistoriesVersions().then(function(t){if(t.historiesInfo||t.versionsInfo){this.$el.addClass("versionsTab");var e=this._mergeVersionAndHistory(t.historiesInfo,t.versionsInfo);return e.sort(function(t,e){return t=new Date(l.getRequestedTime(t)),(e=new Date(l.getRequestedTime(e)))<t?-1:t<e?1:0}),this.items=this._getItems(e),this.initialEndIndex>this.items.length&&(this.initialEndIndex=this.items.length),this._oPropertyUIControl=new r({el:this.$el,items:[{name:"showAllHistory",label:a.get("showAllHistory"),checked:!1,type:"CheckBox",onChange:this._showAllHistoryChange.bind(this)},{type:"Separator"}].concat(this.items.slice(0,this.initialEndIndex))}),this._oPropertyUIControl.render()}i.renderInfoMessage(this.$el,a.get("noVersions"))}.bind(this)).then(function(){this._showAllHistoryChange(),this.batchSize*=3,this._scrollNode=this.$el.find(".containerUIControl"),s(this._scrollNode).on("scroll",this._onScroll.bind(this))}.bind(this))},_render:function(t,e){return this.renderIndex=e,this._oPropertyUIControl.renderItems(this.items.slice(t,e))},_onScroll:function(t){if(!0===this._bScrollToBottom(t)){if(this.renderIndex>=this.items.length)return;var e=this.renderIndex+this.batchSize;return e<this.items.length?this._render(this.renderIndex,e):this._render(this.renderIndex,this.items.length)}},_bScrollToBottom:function(t){var e=s(t.target);return e.scrollTop()+e.innerHeight()>=e[0].scrollHeight-20},_queryHistoriesVersions:function(){var t=[];return this.objectInfo&&(t.push(l.getHistories(this.objectInfo,"output")),t.push(l.getVersions(this.objectInfo,"creationTime"))),Promise.all(t).then(function(t){return{historiesInfo:t[0],versionsInfo:t[1]}})},_handleGetOutputsSuccess:function(t){var e=t.data,n=t.index,o=[];return e&&e.forEach(function(t){if(d[t.format]){var e={id:l.getObjectId(t),format:l.getFormat(t),content:l.getOutputContentLink(t),modificationTime:l.getModificationTime(t,!0,"short")};if(e.format&&e.content){var n=l.getBurstKey(t),i=l.getLocale(t);n?(o[n]||(o[n]=[]),o[n][i]||(o[n][i]=[]),o[n][i].push(e)):(o[this.noBurstKey]||(o[this.noBurstKey]=[]),o[this.noBurstKey][i]||(o[this.noBurstKey][i]=[]),o[this.noBurstKey][i].push(e))}}}.bind(this)),{outputsInfo:o,index:n}},_mergeVersionAndHistory:function(e,o){return e=e||[],o=o||[],s.each(o,function(t,n){var i=!1;s.each(e,function(t,e){if(e.output&&e.output.id===n.id)return!(i=!0)}),i||(n[l.REQUESTED_TIME]=l.getCreationDate(n),delete n[l.CREATION_TIME],n[l.STATUS]="succeeded",e.push(n))}),s.each(e,function(t,e){if(e.output&&e.output.id){var n=e.output.id,i=!1;s.each(o,function(t,e){if(e.id===n)return!(i=!0)}),i||(e.output=null)}}),e},_getItems:function(t){this.mergedInfo=t;var r=[];return this.mergedInfo.forEach(function(t,e){var n=l.getRequestedTime(t,!0,"medium"),i="succeeded"===l.getStatus(t),o=null!==l.getDetailsLink(this.mergedInfo[e]),s=null!==this._getOutputsLinkFromIndex(e);r.push({type:"SingleLineLinks",name:e+"_versions",role:"group",items:[{align:"left",items:[{type:"icon",class:i?"versionReport":"versionStatusFailed",svgIcon:i?s?"common-savedoutput_report":"common-savedoutput_reporthistory":"common-failed",value:i?a.get("successful"):a.get("failed"),iconTooltip:a.get("report")},{type:"text",value:n,class:"versionText"+(s?"":" hasNoOutput"),clickCallback:s?this._toggleOutputsSection.bind(this,e):null}]},{align:"right",items:[{type:"icon",class:"versionDetailsLinks"+(o?"":" disabled"),svgIcon:"common-info-moreinfo",clickCallback:o?this._openDetails.bind(this,e):null,iconTooltip:a.get("showDetails"),showRightArrow:!0}]}]}),r.push({type:"CollapsibleSection",name:e+"_outputs",label:n,styleAsSimpleRow:!0,hideSectionTitle:!0,indent:3.3,items:[],onOpenChange:this._openOutputsSection.bind(this,e)}),r.push({type:"Separator"})}.bind(this)),r},_toggleOutputsSection:function(t,e){this._getOutputSection(t).toggleCollapsibleSection()},_showAllHistoryRefresh:function(){var t=this._oPropertyUIControl.getProperty("showAllHistory").isChecked();this._showAllHistoryChange(null,t)},_showItem:function(t,e){s(e).removeClass("hidden")},_selectItem:function(t){var e=s(t).closest(".propertyRow").nextUntil(".separator").addBack();return e=e.add(e.last().next())},_hideItem:function(t,e){this._selectItem(e).addClass("hidden")},_removeItem:function(t){this._selectItem(t).remove()},_showAllHistoryChange:function(t,e){e?s(".itemContainerUIControl > div",this.$el).each(this._showItem.bind(this)):s(".itemContainerUIControl .hasNoOutput",this.$el).each(this._hideItem.bind(this))},_getOutputFromIndex:function(t){var e=this.mergedInfo[t],n={};return h.isObject(e.output)?n[l.OUTPUT]=[e.output]:n[l.OUTPUT]=[e],n},_getOutputsLinkFromIndex:function(t){var e=this._getOutputFromIndex(t);return l.getOutputsLink(e)},_getVersionLinkFromIndex:function(t){var e=this._getOutputFromIndex(t);return l.getVersionLink(e)},_openOutputsSection:function(n,t,e){if(e){var i=this._getOutputsLinkFromIndex(n);this._getOutputs(i,n).then(this._handleGetOutputsSuccess.bind(this)).then(this._getOutputsSectionPayload.bind(this)).done(function(t){var e=this._getItemsSpec(t.outputsInfo,n,t.items);this._getOutputSection(n).refreshProperties(e)}.bind(this))}},_getVersionSection:function(t){var e=t+"_versions";return this._oPropertyUIControl.getProperty(e)},_getOutputSection:function(t){var e=t+"_outputs";return this._oPropertyUIControl.getProperty(e)},_openDetails:function(i){this._getDetails(i).then(function(t){var e=s("<div>");this.parentEl.append(e);var n=new o({glassContext:this.glassContext,position:this.slideout.position,el:e,width:"400",content:{module:"bi/content_apps/VersionsDetailsView",parentView:this,objectInfo:this.objectInfo,historyInfo:this.mergedInfo[i],detailsInfo:t,glassContext:this.glassContext}});n.render().then(n.show())}.bind(this))},_getOutputsSectionPayload:function(t){var i=t.outputsInfo,e=t.index,o=[];return this._canDelete()&&o.push({type:"SingleLineLinks",items:[{align:"left",items:[{type:"text",value:a.get("deleteReportVersion"),class:"versionText",clickCallback:function(){this._onClickDelete(e)}.bind(this)}]}]}),u.getContentLocales(this.glassContext).then(function(t){var e;if(i&&0<Object.keys(i).length){for(var n in i)if(i.hasOwnProperty(n)){for(e in n!==this.noBurstKey&&o.push({type:"SingleLineLinks",items:[{align:"left",items:[{type:"text",class:"wraptext versionText",value:n}]}]}),i[n])i[n].hasOwnProperty(e)&&(o=o.concat(this._getLocaleSectionPayload(e,t[e],i[n][e])));o.push({type:"Separator"})}}else o.push({type:"SingleLineLinks",items:[{align:"left",items:[{type:"text",class:"versionText",value:a.get("noSavedOutputs")}]}]});return Promise.resolve({items:o,outputsInfo:i})}.bind(this))},_getLocaleSectionPayload:function(e,t,n){var i=[],o=[];return o.push({type:"text",class:"versionsLocale",value:e.toUpperCase()}),o.push({type:"text",class:"versionsLocale",value:t,name:e,hidden:!0}),n.forEach(function(t){o.push({type:"icon",class:"versionsOutput",name:"outputlink",svgIcon:this._getOutputIconString(t.format),clickCallback:this._openOutput.bind(this,t,!1),iconTooltip:a.get(t.format),ariaLabelledby:e}),"interactive"===this._getOutputDefaultAction(t.format)&&o.push({type:"icon",class:"versionsOutput",name:"outputlink",svgIcon:"common-download",clickCallback:this._openOutput.bind(this,t,!0),iconTooltip:a.get("download"),ariaLabelledby:e})}.bind(this)),i.push({type:"SingleLineLinks",items:[{align:"left",items:o}]}),i},_getOutputIconString:function(t){return m[t.toLowerCase()]||m.default},_getOutputDefaultAction:function(t){var e;switch(t.toLowerCase()){case"xhtml":e="interactive";break;default:e="view"}return e},_getDetails:function(t){if(this.mergedInfo&&this.mergedInfo[t]){var e={dataType:"json",type:"GET",url:l.getDetailsLink(this.mergedInfo[t])};return this.glassContext.getCoreSvc(".Ajax").ajax(e).then(function(t){return t&&t.data?Promise.resolve(t.data.data):Promise.reject(new Error("No details data"))})}return Promise.reject(new Error("No details"))},_getOutputs:function(t,e){if(t){var n={dataType:"json",type:"GET",url:t};return this.glassContext.getCoreSvc(".Ajax").ajax(n).then(function(t){return t&&t.data?Promise.resolve({data:t.data.data,index:e}):Promise.reject(new Error("No outputs data"))})}return Promise.resolve({})},_openOutput:function(a,l){return this._handleOutput({output:a,report:this.objectInfo,glassContext:this.glassContext,download:l}).then(function(t){if(!t){var e,n,i=a.id,o=a.modificationTime,s=a.format,r=a.content;switch(this._getOutputDefaultAction(s)){case"interactive":e=new this.mockableViewInteractiveReportAction,n={glassContext:this.glassContext,target:{activeObject:{aSelectedContext:[this.objectInfo],outputId:i,download:!!l},itemId:"com.ibm.bi.contentApps.defaultAction.interactiveReport"}},e.doAction(n);break;case"view":this.objectInfo.type&&-1<this.objectInfo.type.indexOf("powerPlay8Report")?(e=new this.mockableViewInteractiveReportAction,n={glassContext:this.glassContext,target:{activeObject:{aSelectedContext:[this.objectInfo],outputId:i,download:!!l},runOptions:{prompt:!0},itemId:"com.ibm.bi.contentApps.defaultAction.powerPlay8Report"}},e.doAction(n)):this.glassContext.appController.openAppView("savedoutput",this._getReportPayload(i,o,s,r)),this._addToMRU(this.objectInfo);break;default:this.glassContext.appController.openAppView("savedoutput",this._getReportPayload(i,o,s,r)),this._addToMRU(this.objectInfo)}}return Promise.resolve()}.bind(this))},_addToMRU:function(e){return this.glassContext.getSvc(".Content").then(function(t){t.addToMRU(e)})},_getReportPayload:function(t,e,n,i){return{content:{path:i,title:this.objectInfo.defaultName+" - "+e+" - "+n.toUpperCase(),id:t,reportId:l.getObjectId(this.objectInfo),type:l.getType(this.objectInfo),permissions:l.getPermissions(this.objectInfo),runInAdvancedViewer:l.getRunInAdvancedViewer(this.objectInfo)}}},_getItemsSpec:function(t,e,n){if(t&&0<Object.keys(t).length){return[{type:"Split",label:"Split",name:"Split"+this.id,items:[{align:"left",items:n},{align:"right",items:[{type:"SingleLineLinks",name:"sectionRunHistory",items:[]}]}]}]}return n},_canDelete:function(){return!this.objectInfo||!this.objectInfo.permissions||l.hasPermissions(this.objectInfo,["write"])},_onClickDelete:function(t){var e=new c("confirmDelete",a.get("confirmDelete"),a.get("confirmDeleteMessage"));e.confirm(function(){this._deleteVersion(t),this.hasReportVersion=!1}.bind(this)),e.renderContent(s("<div>")),e._container().addClass("contentDeleteConfirmDialog")},_handleDeleteVersionSuccess:function(t){var e=this._getVersionSection(t).getPropertyNode(),n=this._getOutputSection(t);s(".versionText",e).removeClass("clickable").addClass("hasNoOutput"),this._showAllHistoryRefresh(),s(".versionDetailsLinks",e).hasClass("disabled")&&this._removeItem(e),s(".versionReport .svgIcon use",e).attr("xlink:href","#common-savedoutput_reporthistory"),n.getPropertyNode().remove();var i=a.get("toastDoneDeletingSingular",{nameOfItem:p.enforceTextDirection(a.get("reportOutputVersion"))});this.glassContext.appController.showToast(i)},_deleteVersion:function(t){var e=this._getVersionLinkFromIndex(t);if(e){var n={dataType:"json",type:"DELETE",url:e+"?force=true&recursive=true"};return this.glassContext.getCoreSvc(".Ajax").ajax(n).then(this._handleDeleteVersionSuccess.bind(this,t)).catch(function(t){u.showAjaxServiceError(this.glassContext,t)}.bind(this))}return Promise.resolve()},_initOutputHandlers:function(){return this._outputHandlers?Promise.resolve():this.glassContext.appController.findCollection("com.ibm.bi.contentApps.authoring.outputHandlers").then(function(t){this._outputHandlers=[];var e=[];return h.each(t,function(t){e.push(new Promise(function(e){n([t.outputHandler],function(t){this._outputHandlers.push(new t),e()}.bind(this))}.bind(this)))}.bind(this)),Promise.all(e)}.bind(this))},_handleOutput:function(o){return this._initOutputHandlers().then(function(){if("interactive"===this._getOutputDefaultAction(o.output.format)&&o.download)return Promise.resolve(!1);var n,i=-1;return h.each(this._outputHandlers||[],function(t){var e=t.getPriority();i<e&&t.canExecute(o)&&(n=t,i=e)}),n?(n.execute(o),Promise.resolve(!0)):Promise.resolve(!1)}.bind(this))}});return g}),define("bi/content_apps/ArchivesTab",["q","bi/glass/app/ContentView","bi/content_apps/nls/StringResource","bi/content_apps/utils/C10Utils","bacontentnav/lib/@waca/core-client/js/core-client/ui/properties/PropertyUIControl","underscore"],function(e,t,n,i,o,s){"use strict";var r=t.extend({init:function(t){r.inherited("init",this,arguments),s.extend(this,t)},_viewArchivedVersion:function(){i.openC10Morphlet(i.morphletMap.archive,this.objectInfo.type,this.objectInfo.id,[{output_tab:"arch"},{m_name:this.objectInfo.defaultName}])},render:function(){var t=e.defer();return this._id=s.uniqueId("prop_"),this._oPropertyUIControl=new o({el:this.$el,glassContext:this.glassContext,items:[{name:"viewArchivedVersions",type:"SingleLineLinks",items:[{align:"left",items:[{type:"text",value:n.get("viewRunHistory")}]},{align:"right",items:[{type:"text",value:n.get("viewArchivedVersions"),clickCallback:this._viewArchivedVersion.bind(this)}]}]}]}),this._oPropertyUIControl.render().then(function(){t.resolve(this)}.bind(this)),t.promise}});return r}),define("bi/content_apps/VersionsView",["bi/glass/app/ContentView","bi/content_apps/nls/StringResource","bacontentnav/utils/ContentStoreObject","bacontentnav/lib/@waca/core-client/js/core-client/ui/properties/PropertyUIControl","bi/content_apps/VersionsTab","bi/content_apps/ArchivesTab","underscore"],function(t,e,n,i,o,s,r){"use strict";var a=t.extend({init:function(t){a.inherited("init",this,arguments),r.extend(this,t)},render:function(){return this._containerElement=$("<div>",{class:"propertyUIControl versionsView"}),this.$el.append(this._containerElement),this._getAdditionalInfo().then(function(){return this._oPropertyUIControl=this._getPropertyUIControl({el:this.$el,glassContext:this.glassContext,slideout:this.slideout,animatedSpinner:!0,items:[{name:"versions",value:e.get("versions"),type:"Banner"},{type:"TabControl",items:[{name:e.get("versions"),module:o,objectInfo:this.objectInformation,glassContext:this.glassContext,slideout:this.slideout,parentEl:this.$el},{name:e.get("archives"),module:s,objectInfo:this.objectInformation,glassContext:this.glassContext,slideout:this.slideout}]}]}),this._oPropertyUIControl.render()}.bind(this))},_getPropertyUIControl:function(t){return new i(t)},_getAdditionalInfo:function(){return this.glassContext.getCoreSvc(".Ajax").ajax({dataType:"json",type:"GET",url:n.getSelfLink(this.objectInformation),data:{fields:"permissions,"+n.RUN_IN_ADVANCED_VIEWER}}).then(function(t){var e=t.data&&t.data.data;if(!e)return Promise.reject(new Error("No additional information"));r.extend(this.objectInformation,e[0])}.bind(this))}});return a}),define("bi/content_apps/VersionsDetailsView",["q","jquery","bi/glass/app/ContentView","bi/content_apps/nls/StringResource","bacontentnav/utils/ContentStoreObject","bacontentnav/lib/@waca/core-client/js/core-client/ui/properties/PropertyUIControl","bacontentnav/utils/GlassContextHelper","bi/content_apps/utils/C10Utils","underscore"],function(e,i,t,a,l,n,s,o,r){"use strict";var u=t.extend({init:function(t){u.inherited("init",this,arguments),r.extend(this,t)},render:function(){var t=e.defer();return this._getItems().then(function(t){return this.$el.addClass("versionsDetails"),this._oPropertyUIControl=new n({el:this.$el,glassContext:this.glassContext,slideout:this.slideout,items:t}),this._oPropertyUIControl.render()}.bind(this)).done(t.resolve),t.promise},_getItems:function(){var n=e.defer(),t="succeeded"===l.getStatus(this.historyInfo),i=[{type:"Banner",name:"detailsBanner",value:l.getRequestedTime(this.historyInfo,!0,"medium"),centerLabel:!0,backButton:!0,editable:!1,readOnly:!0,onClose:function(){this.slideout.hide()}.bind(this)},{type:"Separator"},{type:"SingleLineLinks",name:"actionbar",items:[{align:"left",items:[{type:"icon",class:t?"versionStatusSuccessful":"versionStatusFailed",svgIcon:t?"common-successful":"common-failed",value:t?a.get("successful"):a.get("failed"),iconTooltip:t?a.get("successful"):a.get("failed")},{type:"text",class:"versionStatusText",role:"status",value:t?a.get("successful"):a.get("failed")}]}]},{type:"SingleLineLinks",name:"historydetails",items:[{align:"right",items:[{type:"text",value:a.get("runHistoryDetails"),class:"historydetailsText",clickCallback:this._viewRunHistory.bind(this),showRightArrow:!0}]}]}];return l.getMessages(this.detailsInfo)&&i.push({type:"CollapsibleSection",name:"errorMessages",open:!0,label:a.get("errorMessages"),items:this._getMessageItems()}),this._getOptionsItems().then(function(t){i=i.concat([{type:"CollapsibleSection",name:"runTime",open:!0,label:a.get("runTime"),items:[{type:"SingleLineValue",name:"requestTime",label:a.get("requestTime"),value:l.getRequestedTime(this.historyInfo,!0,"medium")},{type:"Separator"},{type:"SingleLineValue",name:"startTime",label:a.get("startTime"),value:l.getExecutionTime(this.historyInfo,!0,"medium")},{type:"Separator"},{type:"SingleLineValue",name:"endTime",label:a.get("endTime"),value:l.getCompletionTime(this.historyInfo,!0,"medium")}]}]),"jupyterNotebook"!==this.objectInfo.type&&i.push({type:"CollapsibleSection",name:"options",open:!0,label:"jobDefinition"===this.objectInfo.type?a.get("job"):a.get("report"),items:t});var e=l.getDetailsReportVersionParameters(this.detailsInfo);e&&(i=i.concat([{type:"CollapsibleSection",name:"promptValues",label:a.get("promptValues"),items:this._getPromptValuesItems(e)}])),n.resolve(i)}.bind(this)),n.promise},_getMessageItems:function(){var o=[],s="versionMessageIcon ",r="";return l.getMessages(this.detailsInfo).forEach(function(t,e){var n=l.getMessageSeverity(t),i="";switch(n){case"error":case"fatal":i=s+"versionErrorIcon",r="common-close-cancel-error";break;case"warn":i=s+"versionWarningIcon",r="common-warning-hollow";break;case"debug":i=s+"versionDebugIcon",r="common-debug";break;case"info":i=s+"versionInfoIcon",r="common-information"}o.push({type:"SingleLineLinks",name:"messages_"+e,items:[{align:"left",items:[{type:"icon",class:i,svgIcon:r,value:a.get(n),iconTooltip:a.get(n)},{type:"text",class:"wraptext textSelectable",value:l.getMessageDetail(t)}]}]})}),o},_getOptionsItems:function(){var i=l.getDetailsReportVersionOptions(this.detailsInfo),o=e.defer();return i?this._getReportLanguages(i).then(function(t){var e=[];"jobDefinition"!==this.objectInfo.type&&e.push({type:"TextArea",name:"formats",label:a.get("formats"),value:this._getReportFormats(i),editable:!1,multiline:!1},{type:"Separator"}),e.push({type:"TextArea",name:"languages",label:a.get("languages"),value:t,editable:!1,multiline:!1});var n=l.getLocation(this.objectInfo);n&&(e=e.concat([{type:"Separator"},{type:"SingleLineValue",name:"location",label:a.get("location"),value:n}])),o.resolve(e)}.bind(this)):o.resolve([{type:"SingleLineLinks",items:[{align:"left",items:[{type:"text",class:"wraptext",value:a.get("noReportOptionsAvailable")}]}]}]),o.promise},_getReportFormats:function(t){var e=this._getReportVersionOption(t,"outputFormat"),n=[];return e?(r.isArray(e)?e.forEach(function(t){n.push(a.get(t))}):n.push(a.get(e)),this._getDelimitedStringFromArray(n)):a.get("unavailable")},_getReportLanguages:function(t){var i=this._getReportVersionOption(t,"outputLocale"),o=e.defer();return i?s.getContentLocales(this.glassContext).then(function(e){var n=[];e=e||{},i.forEach(function(t){n.push(e[t])}),o.resolve(this._getDelimitedStringFromArray(n))}.bind(this)):o.resolve(a.get("unavailable")),o.promise},_getDelimitedStringFromArray:function(t){return t?t.join(", "):null},_getReportVersionOption:function(t,e){var n=i.grep(t,function(t){return t.name===e});return 1===n.length&&n[0].value?n[0].value:null},_getPromptValuesItems:function(t){var e=[];return l.getPromptsDisplayValues(t,!0).forEach(function(t){e.push({type:"SingleLineLinks",items:[{align:"left",items:[{type:"text",class:"promptNameText textSelectable",value:r.escape(t.name+":")}]}]},{type:"SingleLineLinks",items:[{align:"left",items:[{type:"text",class:"wraptext textSelectable",value:r.escape(t.display)}]}]},{type:"Separator"})}),e},_viewRunHistory:function(){var t=[{m_name:this.objectInfo.defaultName}];o.openC10Morphlet(o.morphletMap.viewHistory,this.objectInfo.type,this.historyInfo.id,t)}});return u}),define("js/content_apps/versionBundle",function(){});
|