RunOptionsView.js 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192
  1. "use strict";
  2. /*
  3. * Licensed Materials - Property of IBM
  4. *
  5. * IBM Cognos Products: SHARE
  6. *
  7. * (C) Copyright IBM Corp. 2015, 2017
  8. *
  9. * US Government Users Restricted Rights - Use, duplication or disclosure
  10. * restricted by GSA ADP Schedule Contract with IBM Corp.
  11. */
  12. define(['bi/content_apps/authoring/AuthoringHelper', 'bi/glass/app/ContentView', 'bi/schedule/app/appControler', 'jquery', 'bi/commons/utils/Utils', 'bi/sharecommon/utils/translator', 'q', 'bi/sharecommon/utils/simpledoT', 'text!bi/schedule/templates/ScheduleView.html', 'underscore', 'moment-timezone', 'bi/schedule/views/DateTimeRangeCadencePickerView', 'bi/schedule/views/DailyCadencePickerView', 'bi/schedule/views/WeeklyCadencePickerView', 'bi/schedule/views/MonthlyCadencePickerView', 'bi/schedule/views/YearlyCadencePickerView', 'bi/schedule/views/TriggerCadencePickerView', 'bi/schedule/views/FormatPickerView', 'bi/schedule/views/ScheduleDeliveryPickerView', 'bacontentnav/lib/@waca/core-client/js/core-client/ui/properties/DropDown', 'bacontentnav/lib/@waca/core-client/js/core-client/ui/properties/CheckBox', 'ca_portal/features/mypreferences/MyPreferences', 'bi/schedule/views/PdfOptionsView', 'bacontentnav/lib/@waca/core-client/js/core-client/ui/properties/PropertyUIControl', 'bi/content_apps/utils/ContentStoreObject', 'bi/commons/ui/dialogs/ConfirmationDialog', 'bi/content_apps/utils/C10Utils', 'bi/admin/nls/StringResource', 'ba-react-admin/ba-react-admin.min', 'text!bi/admin/job/importOptions.html'], function (AuthoringHelper, View, controler, $, Utils, t, Q, dot, template, _, moment, DateTimeRangeCadencePicker, DailyCadencePicker, WeeklyCadencePicker, MonthlyCadencePicker, YearlyCadencePicker, TriggerCadencePicker, FormatPicker, ScheduleDeliveryPicker, DropDown, CheckBox, MyPreferences, PdfOptionsView, PropertyUIControl, ContentStoreObject, ConfirmationDialog, C10Utils, StringResource, AdminReact, importTemplate) {
  13. var __CHILD_SLIDEOUT_STANDARD_WIDTH = '350px';
  14. var scheduleView = View.extend({
  15. /**
  16. * constructor options can contain:
  17. *
  18. * objectInformation: The CM object being scheduled,
  19. * onCreateOrUpdateCallback: callback to call once a schedule is created or updated
  20. * canBurst: whether this report is burstable,
  21. * glassContext: the glass context
  22. */
  23. init: function init(options) {
  24. scheduleView.inherited('init', this, arguments);
  25. this.showOptions = true;
  26. this.defaultLocale = options.glassContext.services.userProfile.preferences.contentLocale || 'en-us';
  27. this.options = {
  28. delivery: {
  29. save: {
  30. notify: false
  31. }
  32. },
  33. outputLocale: [this.defaultLocale],
  34. pdf: {},
  35. burst: false,
  36. outputFormat: ['HTML']
  37. };
  38. _.extend(this, options); // set defaults
  39. this.canBurst = this.objectInformation.canBurst;
  40. this.currentRenderedCadenceType = 'weekly';
  41. this.outputLocale = [this.defaultLocale];
  42. this.msgs = [];
  43. this.warningMessage = null;
  44. this.parameterValues = [];
  45. this.scheduleTypeSelector = null;
  46. this.uniqueId = _.uniqueId('id_');
  47. this.readOnly = false;
  48. this.deliveryPicker = null;
  49. this.outputFormatPicker = null;
  50. this.pdfOptionsView = null;
  51. this.timezone = this.glassContext.services.userProfile.preferences.timeZoneID;
  52. this.canBurst = this.canBurst && this.glassContext.hasCapability('canUseBursting');
  53. this.showPDFOption = this.glassContext.hasCapability('canGeneratePDFOutput') && this.objectInformation.type !== 'interactiveReport' && this.objectInformation.type !== 'powerPlay8Report' && this.objectInformation.type !== 'powerPlay8ReportView'; // Predefine this to cache data of the existing schedule on the initial render
  54. this.initScheduleDescriptor = {
  55. reportId: null,
  56. reportType: null,
  57. scheduleInfo: {
  58. active: null,
  59. startDate: null,
  60. endDate: null,
  61. endType: null,
  62. timezone: null,
  63. weekly: null,
  64. everyNPeriods: null,
  65. type: null
  66. },
  67. options: {
  68. outputFormat: null,
  69. delivery: null,
  70. outputLocale: null,
  71. pdf: null,
  72. burst: null
  73. },
  74. parameters: null
  75. };
  76. if (this.objectInformation.descriptor) {
  77. this.initScheduleDescriptor.parameters = this.objectInformation.descriptor.parameters;
  78. }
  79. if (this.objectInformation.type === 'jobDefinition') {
  80. this.initScheduleDescriptor.signonUPG = 'true';
  81. this.initScheduleDescriptor.reportUpgrade = 'keep';
  82. this.initScheduleDescriptor.importOptions = false;
  83. if (this.objectInformation.descriptor && this.objectInformation.descriptor.importOptions) {
  84. this.initScheduleDescriptor.signonUPG = this.objectInformation.descriptor.signonUPG;
  85. this.initScheduleDescriptor.reportUpgrade = this.objectInformation.descriptor.reportUpgrade;
  86. this.initScheduleDescriptor.importOptions = true;
  87. }
  88. }
  89. if (!options.objectInformation.descriptor.options.outputLocale) {
  90. options.objectInformation.descriptor.options.outputLocale = [this.defaultLocale];
  91. } else {
  92. this.outputLocale = options.objectInformation.descriptor.options.outputLocale;
  93. }
  94. var initDesc = this._prepareScheduleDescriptor();
  95. delete initDesc.scheduleInfo;
  96. delete initDesc.reportId;
  97. delete initDesc.reportType;
  98. options.selectedStep.setOptionsSnapshot(initDesc);
  99. },
  100. setFocus: function setFocus() {
  101. this.$el.focus();
  102. },
  103. _setEvents: function _setEvents() {
  104. this.$el.find('.schedule_primary_button').on('clicktap', function () {
  105. this._closeOpenChildren().then(function () {
  106. this.setWorking();
  107. this.hideWarningMessage();
  108. var scheduleDescriptor = this._prepareScheduleDescriptor();
  109. if (this.validate(scheduleDescriptor)) {
  110. // Create a new schedule
  111. if (!this.descriptor) {
  112. this._createOrUpdateScheduleRoutine(scheduleDescriptor); // Update an existing schedule
  113. } else {
  114. if (this._hasOnlyTimezoneBeenChanged(this.initScheduleDescriptor, scheduleDescriptor)) {
  115. var updateDialog = new ConfirmationDialog('warning', t.translate('schedule_update_confirm'), t.translate('schedule_update_timezone_difference_confirm_message'));
  116. updateDialog.confirm(function () {
  117. this._createOrUpdateScheduleRoutine(scheduleDescriptor);
  118. }.bind(this), this.setDone.bind(this));
  119. } else {
  120. this._createOrUpdateScheduleRoutine(scheduleDescriptor);
  121. }
  122. }
  123. } else {
  124. this.showWarningMessage();
  125. this.setDone();
  126. }
  127. }.bind(this)).done();
  128. }.bind(this));
  129. this.$el.find('.schedule_language_picker').on('clicktap', function () {
  130. this._closeOpenChildren().then(function () {
  131. this.glassContext.appController.showSlideOut({
  132. parent: this.slideout,
  133. overlay: false,
  134. width: __CHILD_SLIDEOUT_STANDARD_WIDTH,
  135. label: t.translate('schedule_language_picker_name'),
  136. content: {
  137. module: 'bi/content_apps/common/ui/LanguagePickerView',
  138. glassContext: this.glassContext,
  139. supportedContentLocales: this.supportedContentLocales,
  140. enabledLanguages: this.outputLocale,
  141. closeCallback: function (data) {
  142. this.outputLocale = data;
  143. var languageLabel = t.translate('schedule_no_languages_label');
  144. var labelArray = [];
  145. for (var i = 0; i < this.outputLocale.length; i++) {
  146. labelArray.push(this.supportedContentLocales[this.outputLocale[i]]);
  147. }
  148. languageLabel = labelArray.join(', ');
  149. this.$el.find('.output_language_list').text(languageLabel);
  150. this.$el.find('.output_language_list').attr('title', languageLabel);
  151. }.bind(this)
  152. }
  153. });
  154. }.bind(this)).done();
  155. }.bind(this));
  156. var cancelChanges = function () {
  157. this.close();
  158. }.bind(this);
  159. this.$el.find('.schedule_secondary_button').on('clicktap', cancelChanges);
  160. },
  161. _prepareScheduleDescriptor: function _prepareScheduleDescriptor() {
  162. var reportId = this.objectInformation.id;
  163. var reportType = this.objectInformation.type;
  164. var active = true;
  165. var outputFormats = this.options.outputFormat;
  166. if (this.outputFormatPicker !== null) {
  167. outputFormats = this.outputFormatPicker.getOutputFormats();
  168. }
  169. var scheduleInfo = {
  170. active: active,
  171. timezone: this.timezone
  172. }; // grab datetimerangecadencePicker schedinfo
  173. if (this.datetimeRangeCadencePicker) {
  174. scheduleInfo = this.datetimeRangeCadencePicker.toDescriptor(scheduleInfo);
  175. } // grab cadencePicker info
  176. if (this.cadencePicker) {
  177. scheduleInfo = this.cadencePicker.toDescriptor(scheduleInfo);
  178. } // DELIVERY
  179. var deliveryOptions = this.options.delivery;
  180. if (this.deliveryPicker !== null) {
  181. deliveryOptions = this.deliveryPicker.getDeliveryOptions();
  182. } // Languages/ Output Locale
  183. var outputLocale = this.outputLocale || this.options.outputLocale; // PDF Options
  184. var pdfOptions = this.pdfOptionsView ? this.pdfOptionsView.getOptions() : this.options.pdf; // Burst
  185. var burst = this._getBurstValue(); // note: do not send a schedule name. Causes problems with triggers.
  186. var scheduleDescriptor = _.extend({}, {
  187. reportId: reportId,
  188. reportType: reportType,
  189. scheduleInfo: scheduleInfo,
  190. options: {
  191. outputFormat: outputFormats,
  192. delivery: deliveryOptions,
  193. outputLocale: outputLocale,
  194. pdf: pdfOptions,
  195. burst: burst
  196. },
  197. parameters: this.parameterValues
  198. });
  199. return scheduleDescriptor;
  200. },
  201. _updateImportValues: function _updateImportValues(desc) {
  202. var $importOpts = this.$el.find('.importOptionsCheckbox');
  203. if ($importOpts.is(':checked')) {
  204. var $upgradReport = $(this.$el.find('.upgradeReport'));
  205. var $upgradID = $(this.$el.find('.updateID'));
  206. desc.importOptions = {
  207. upgradeReport: $upgradReport.is(':checked'),
  208. updateID: $upgradID.is(':checked')
  209. };
  210. }
  211. },
  212. _hasOnlyTimezoneBeenChanged: function _hasOnlyTimezoneBeenChanged(scheduleDescriptorOld, scheduleDescriptorNew) {
  213. var status = false;
  214. var oldCopy = $.extend(true, {}, scheduleDescriptorOld);
  215. var newCopy = $.extend(true, {}, scheduleDescriptorNew);
  216. var oldTimezone = oldCopy.scheduleInfo.timezone;
  217. var newTimezone = newCopy.scheduleInfo.timezone;
  218. if (oldTimezone !== newTimezone) {
  219. // Undefine these properties in order to compare schedule descriptors
  220. delete oldCopy.scheduleInfo.timezone;
  221. delete newCopy.scheduleInfo.timezone; // remove endDate if indefinite
  222. if (oldCopy.scheduleInfo.endType === 'indefinite') {
  223. delete oldCopy.scheduleInfo.endDate;
  224. }
  225. if (newCopy.scheduleInfo.endType === 'indefinite') {
  226. delete newCopy.scheduleInfo.endDate;
  227. }
  228. status = _.isEqual(oldCopy, newCopy);
  229. }
  230. return status;
  231. },
  232. _closeOpenChildren: function _closeOpenChildren() {
  233. /* var deferred = Q.defer();
  234. // Close any open open child slideouts
  235. if (this.slideout && this.slideout.hasOpenChild()) {
  236. var openChild = this.slideout.child;
  237. openChild.hide().then(function() {
  238. deferred.resolve();
  239. }).done();
  240. } else {
  241. deferred.resolve();
  242. }
  243. return deferred.promise; */
  244. return Promise.resolve();
  245. },
  246. _createOrUpdateSchedule: function _createOrUpdateSchedule(scheduleDescriptor) {
  247. var _self = this;
  248. controler.createSchedule(scheduleDescriptor, _self.glassContext).then(function () {
  249. // call callback if specified
  250. if (_self.onCreateOrUpdateCallback && typeof _self.onCreateOrUpdateCallback === 'function') {
  251. _self.onCreateOrUpdateCallback();
  252. }
  253. var message;
  254. if (_self.isEditMode) {
  255. message = t.translate('sch_update_success_msg');
  256. } else {
  257. message = t.translate('sch_create_success_msg');
  258. }
  259. _self.glassContext.appController.showToast(message, {
  260. newestOnTop: true,
  261. preventDuplicates: false,
  262. timeOut: 6000,
  263. extendedTimeOut: 1000
  264. });
  265. _self.setDone();
  266. _self.close();
  267. }).fail(function () {
  268. _self.setDone();
  269. }).done();
  270. },
  271. _createOrUpdateScheduleRoutine: function _createOrUpdateScheduleRoutine(scheduleDescriptor) {
  272. var _self = this; // Get user Credentials
  273. controler.getUserCredential(this.glassContext).then(function () {
  274. _self._createOrUpdateSchedule(scheduleDescriptor);
  275. }).fail(function () {
  276. // Getting user credentials failed; try creating them
  277. controler.createUserCredential(_self.glassContext).then(function () {
  278. _self._createOrUpdateSchedule(scheduleDescriptor);
  279. }).fail(function (promptInfo) {
  280. if (promptInfo) {
  281. // Creating user credentials failed; ask the user for them
  282. var myPreferences = new MyPreferences({
  283. glassContext: _self.glassContext
  284. });
  285. myPreferences.openCreateCredentialDialog(promptInfo.displayObjects).then(function () {
  286. _self._createOrUpdateSchedule(scheduleDescriptor);
  287. }).fail(function () {
  288. _self.setDone();
  289. });
  290. } else {
  291. // error, set done
  292. _self.setDone();
  293. }
  294. });
  295. });
  296. },
  297. /**
  298. * Render the new schedule view
  299. *
  300. */
  301. render: function render() {
  302. this.$el.closest('.root.flyoutPane').addClass('runOptionsSlideout');
  303. this.descriptor = this.objectInformation.descriptor;
  304. this.isEditMode = typeof this.descriptor !== 'undefined';
  305. this.readOnly = this.isEditMode && this.objectInformation.hasPermission && !this.objectInformation.hasPermission.write && this.objectInformation.hasPermission.read;
  306. var htmlGenerator = dot.simpleTemplate(template);
  307. var objectInformation = this.objectInformation || {};
  308. var canBurst = this.canBurst || false;
  309. var showPDFOption = this.showPDFOption;
  310. objectInformation.defaultName = this.objectInformation.defaultName || '';
  311. this.canShowPrompt = !(C10Utils.isPowerPlay(this.objectInformation.type) || this.objectInformation.type === 'jobDefinition');
  312. if (this.canShowPrompt) {
  313. // For display render the prompt picker
  314. this.parameterValues = this.objectInformation.parameters ? this.objectInformation.parameters : [];
  315. }
  316. var capableSchedType = this.getScheduleType();
  317. var title = this.isEditMode ? t.translate('schedule_panel_title_update_text') : t.translate('schedule_panel_title_text');
  318. var attributes = {
  319. asset_name: _.escape(objectInformation.defaultName),
  320. schedule_panel_back: t.translate('schedule_panel_back_text'),
  321. schedule_panel_title: 'Run options',
  322. schedule_type_label: 'Select run options',
  323. schedule_output_label: t.translate('schedule_output_label'),
  324. schedule_delivery_label: t.translate('schedule_delivery_label'),
  325. schedule_prompts_label: t.translate('schedule_prompts_label'),
  326. schedule_select_text: t.translate('schedule_select_text'),
  327. schedule_create_btn: this.isEditMode ? t.translate('schedule_update_btn_label') : t.translate('schedule_create_btn_label'),
  328. schedule_cancel_btn: t.translate('schedule_cancel_btn_label'),
  329. schedule_period: '',
  330. uniqueid: this.uniqueId,
  331. output_format_select_text: t.translate('output_format_select_text'),
  332. showOptions: this.showOptions,
  333. showPDFOption: showPDFOption,
  334. canBurst: canBurst,
  335. schedule_languages_label: t.translate('schedule_languages_label'),
  336. schedule_pdf_options_label: t.translate('schedule_pdf_options_name'),
  337. canShowPrompt: this.canShowPrompt
  338. };
  339. attributes.schedule_controls_description = t.translate('schedule_controls_description', {
  340. action1: attributes.schedule_create_btn,
  341. action2: attributes.schedule_cancel_btn
  342. });
  343. this.$el.addClass('runOptionsView');
  344. var items = [{
  345. type: 'Banner',
  346. backButton: this.slideout.overlay,
  347. value: StringResource.get('selectRunOptions')
  348. }];
  349. this._propertyUIControl = new PropertyUIControl({
  350. glassContext: this.glassContext,
  351. el: this.$el,
  352. closeCallback: this.close.bind(this),
  353. items: items
  354. });
  355. this._propertyUIControl.render().then(function () {
  356. return this._updateEmailDisplayNames(this.objectInformation.descriptor.options.delivery.email);
  357. }.bind(this)).then(function () {
  358. return this._updateEmailDisplayNames(this.objectInformation.descriptor.options.delivery.mobile);
  359. }.bind(this)).then(function () {
  360. // load the complete template
  361. var $content = $(htmlGenerator(attributes)); // point this.$el to the content section of the slideout, below the header
  362. this.$el = this.$el.find('.propertiesUIControlPageView'); // add each of the three sections, to the correct place
  363. // add type section to above the first divider ('Period')
  364. // this.$el.prepend($content.find('.schedule_type_section'));
  365. // add period section to below the first divider ('Period')
  366. // $content.find('.schedule_period_section').insertAfter(this.$el.find('.sectionLabel:first'));
  367. // add options section to below the second divider ('Options')
  368. this.$el.append($content.find('.schedule_options_section')); // add the progress overlay div
  369. this.$el.append($content.find('.progress-overlay'));
  370. this.$el.addClass('new_schedule_slideout');
  371. return Promise.resolve();
  372. }.bind(this)).then(function () {
  373. if (this.showOptions) {
  374. if (this.objectInformation.type.indexOf('agentDefinition') !== -1) {
  375. var fmEl = this.$el.find('.schedule_output_format_picker');
  376. var deEl = this.$el.find('.schedule_delivery_picker');
  377. var lnEl = this.$el.find('.schedule_language_picker');
  378. var pdfEl = this.$el.find('.schedule_pdf_options_picker');
  379. fmEl.css('display', 'none');
  380. deEl.css('display', 'none');
  381. lnEl.css('display', 'none');
  382. pdfEl.css('display', 'none');
  383. }
  384. this.renderOutputFormatPicker();
  385. var formatRestrictedTypes = ['powerPlay8Report', 'powerPlay8ReportView', 'interactiveReport', 'interactiveReportView'];
  386. var typeForFormat = this.objectInformation.type;
  387. if (this.objectInformation.type === 'reportView') {
  388. typeForFormat = this.objectInformation.base[0].type;
  389. }
  390. if (formatRestrictedTypes.indexOf(typeForFormat) !== -1) {
  391. var formartButton = this.$el.find('.schedule_output_format_picker .schedule_form_input button');
  392. formartButton.css('display', 'none');
  393. var aTog = this.$el.find('.schedule_output_format_picker');
  394. aTog.off('primaryaction');
  395. this.$el.find('.schedule_output_format_picker').removeClass('options_picker');
  396. }
  397. this.renderPromptRow();
  398. this.renderDeliveryPicker();
  399. if (showPDFOption) {
  400. this.renderPdfOptionsView();
  401. }
  402. this.setLanguageLabel(); // checkbox for burst
  403. if (canBurst) {
  404. this.renderBurstCheckBox();
  405. }
  406. } // selector
  407. this._renderTypeSelector(capableSchedType);
  408. if (this.isEditMode) {
  409. this.currentRenderedCadenceType = capableSchedType;
  410. this.scheduleTypeSelector.getHTMLControl().val(this.currentRenderedCadenceType);
  411. }
  412. this.$el.find('.classicViewLink').remove();
  413. this.$el.find('.new_schedule_panel_button').remove();
  414. this._setIcons(); // in update mode the permissions are passed
  415. if (this.readOnly) {
  416. // Update buttons
  417. this.$el.find('.schedule_primary_button').prop('disabled', true);
  418. this.$el.find('.schedule_secondary_button').prop('disabled', true); // Language picker
  419. this.$el.find('.schedule_language_option_toggler').prop('disabled', true); // Pdf option picker
  420. this.$el.find('.schedule_pdf_option_toggler').prop('disabled', true); // All input fields including all pickers
  421. this.$el.find('input').prop('disabled', true);
  422. } // Cache data of the existing schedule
  423. this._saveExistingScheduleInitialState();
  424. this._setEvents();
  425. this._renderResetLink();
  426. return Promise.resolve();
  427. }.bind(this));
  428. },
  429. _renderResetLink: function _renderResetLink() {
  430. if (AdminReact.JobUIStore.isEditJobOptionsDialogOpen && AdminReact.JobObjectStore.hasOptions) {
  431. var $entryPoint = $($.find('.runOptionsView .banner'));
  432. var el = $entryPoint.append("<div tabindex='0' class='resetButton' style='margin-left: auto;><svg focusable='false' class='ba-common-svgIcon is-small' style='vertical-align: bottom;'><use xmlns:xlink='http://www.w3.org/1999/xlink' xlink:href='#" + AdminReact.reset16.id + "'></use></svg><span style='padding-left: 16px'>" + StringResource.get('reset') + '</span></div>');
  433. el.find('.resetButton').on('primaryaction', function (e) {
  434. e.preventDefault();
  435. AdminReact.JobUIStore.clearEditDialog();
  436. this.slideout.hide();
  437. AdminReact.JobObjectStore.clearOptions();
  438. }.bind(this));
  439. }
  440. },
  441. setLanguageLabel: function setLanguageLabel() {
  442. this.glassContext.services.config.getContentLocales().then(function (contentLocales) {
  443. this.supportedContentLocales = contentLocales;
  444. var languageLabel = t.translate('schedule_no_languages_label');
  445. if (this.isEditMode) {
  446. if (this.objectInformation.descriptor.options.outputLocale) {
  447. this.outputLocale = this.objectInformation.descriptor.options.outputLocale;
  448. var languageList = [];
  449. for (var i = 0; i < this.outputLocale.length; i++) {
  450. languageList.push(contentLocales[this.outputLocale[i]]);
  451. }
  452. if (languageList.length > 0) {
  453. languageLabel = languageList.join(', ');
  454. } else {
  455. languageLabel = contentLocales[this.defaultLocale];
  456. }
  457. }
  458. } else {
  459. languageLabel = contentLocales[this.defaultLocale];
  460. }
  461. this.$el.find('.output_language_list').text(languageLabel);
  462. this.$el.find('.output_language_list').attr('title', languageLabel);
  463. }.bind(this)).done();
  464. },
  465. _updateEmailDisplayNames: function _updateEmailDisplayNames(emailSection) {
  466. var mailPromises = [];
  467. var getDisplayNamesForAccount = function (account) {
  468. if (account.address.indexOf('CAMID(') === 0) {
  469. var options = {
  470. dataType: 'json',
  471. type: 'GET',
  472. data: {},
  473. url: 'v1/search_path?searchPath=' + account.address + '&fields=defaultName',
  474. cache: false
  475. };
  476. mailPromises.push(this.glassContext.services.ajax.ajax(options));
  477. }
  478. }.bind(this);
  479. var allRecipients = [];
  480. if (emailSection) {
  481. if (emailSection.to) {
  482. allRecipients = allRecipients.concat(emailSection.to);
  483. }
  484. if (emailSection.cc) {
  485. allRecipients = allRecipients.concat(emailSection.cc);
  486. }
  487. if (emailSection.bcc) {
  488. allRecipients = allRecipients.concat(emailSection.bcc);
  489. }
  490. }
  491. allRecipients.forEach(getDisplayNamesForAccount);
  492. if (mailPromises.length === 0) {
  493. return Promise.resolve();
  494. }
  495. return Promise.all(mailPromises).then(function (result) {
  496. var count = 0;
  497. allRecipients.forEach(function (account) {
  498. if (account.address.indexOf('CAMID(') === 0) {
  499. account.defaultName = result[count].data[0].defaultName;
  500. count += 1;
  501. }
  502. });
  503. return Promise.resolve();
  504. });
  505. },
  506. shouldShowMobile: function shouldShowMobile() {
  507. var mobileTypes = ['interactiveReport', 'report', 'query', 'analysis', 'jobDefinition'];
  508. return mobileTypes.indexOf(this.objectInformation.type) !== -1 || this.objectInformation.type === 'reportView' && mobileTypes.indexOf(this.objectInformation.base[0].type) !== -1;
  509. },
  510. _getRawOptionsForSaveToS3: function _getRawOptionsForSaveToS3() {
  511. var rawOptions = [];
  512. _.find(this.selectedStep.options, function (item) {
  513. if (item.name === 'runOptionEnum#saveToCloud' || item.name === 'runOptionEnum#cloudName') {
  514. rawOptions.push(item);
  515. }
  516. });
  517. return rawOptions;
  518. },
  519. _getReportName: function _getReportName() {
  520. if (this.selectedStep.options) {
  521. _.find(this.selectedStep.options, function (item) {
  522. if (item.name === 'runOptionEnum#cloudName') {
  523. return item.value;
  524. }
  525. });
  526. }
  527. if (this.selectedStep.stepObject) {
  528. return this.selectedStep.stepObject[0].defaultName;
  529. }
  530. return null;
  531. },
  532. renderDeliveryPicker: function renderDeliveryPicker() {
  533. var deliveryOptions = {};
  534. var name = this.objectInformation.defaultName;
  535. if (this.isEditMode) {
  536. if (this.objectInformation.descriptor.options.delivery) {
  537. deliveryOptions = this.objectInformation.descriptor.options.delivery;
  538. }
  539. }
  540. try {
  541. this.deliveryPicker = new ScheduleDeliveryPicker({
  542. $el: this.$el.find('.schedule_delivery_picker'),
  543. $toggler: this.$el.find('.schedule_delivery_picker'),
  544. $activeOptionsContainer: this.$el.find('.delivery_list'),
  545. reportName: this._getReportName() ? this._getReportName() : name,
  546. deliveryOptions: deliveryOptions,
  547. isEditMode: this.isEditMode,
  548. glassContext: this.glassContext,
  549. slideoutparent: this.slideout,
  550. hasPermission: this.objectInformation.hasPermission,
  551. showMobile: this.shouldShowMobile(),
  552. enableAdvancedSettings: true,
  553. allowRecipients: function () {
  554. return !this._getBurstValue();
  555. }.bind(this),
  556. rawOptions: this._getRawOptionsForSaveToS3()
  557. }); // first need to update any email recipeints
  558. this.deliveryPicker.render();
  559. } catch (e) {
  560. console.log('There was an error initializing the DeliveryPicker.', e);
  561. }
  562. },
  563. renderPdfOptionsView: function renderPdfOptionsView() {
  564. var _self = this;
  565. var pdfOptions = {};
  566. if (this.isEditMode) {
  567. if (this.objectInformation.descriptor.options.pdf) {
  568. pdfOptions = this.objectInformation.descriptor.options.pdf;
  569. }
  570. }
  571. this.pdfOptionsView = new PdfOptionsView({
  572. glassContext: _self.glassContext,
  573. $toggler: _self.$el.find('.schedule_pdf_options_picker'),
  574. parentSlideout: _self.slideout,
  575. pdfOptions: pdfOptions
  576. });
  577. this.pdfOptionsView.render();
  578. },
  579. _saveExistingScheduleInitialState: function _saveExistingScheduleInitialState() {
  580. // Cache data of the existing schedule
  581. if (this.isEditMode) {
  582. this.initScheduleDescriptor = this._prepareScheduleDescriptor();
  583. }
  584. },
  585. _renderTypeSelector: function _renderTypeSelector(schType) {
  586. var schOptions = [];
  587. if (this.glassContext.hasCapability('canUseSchedulingByDay')) {
  588. schOptions.push({
  589. label: t.translate('daily_label'),
  590. value: 'daily',
  591. selected: schType == 'daily'
  592. });
  593. }
  594. if (this.glassContext.hasCapability('canUseSchedulingByWeek')) {
  595. schOptions.push({
  596. label: t.translate('weekly_label'),
  597. value: 'weekly',
  598. selected: schType == 'weekly'
  599. });
  600. }
  601. if (this.glassContext.hasCapability('canUseSchedulingByMonth')) {
  602. schOptions.push({
  603. label: t.translate('monthly_label'),
  604. value: 'monthly',
  605. selected: schType == 'monthly'
  606. });
  607. }
  608. if (this.glassContext.hasCapability('canUseSchedulingByYear')) {
  609. schOptions.push({
  610. label: t.translate('yearly_label'),
  611. value: 'yearly',
  612. selected: schType == 'yearly'
  613. });
  614. }
  615. if (this.glassContext.hasCapability('canUseSchedulingByTrigger')) {
  616. schOptions.push({
  617. label: t.translate('trigger_label'),
  618. value: 'trigger',
  619. selected: schType == 'trigger'
  620. });
  621. }
  622. if (schOptions.length === 0) {
  623. // Should not happen. Use default
  624. schOptions.push({
  625. label: t.translate(schType + '_label'),
  626. value: schType,
  627. selected: true
  628. });
  629. }
  630. var scheduleId = 'schedule_type_' + this.uniqueId;
  631. var scheduleName = 'schedule_type_option';
  632. var scheduleDescribedBy = 'schedule_type_describedby_' + this.uniqueId;
  633. this.scheduleTypeSelector = new DropDown({
  634. id: scheduleId,
  635. el: this.$el.find('#schedule_type_selector_container_' + this.uniqueId),
  636. label: t.translate('schedule_type_label'),
  637. name: scheduleName,
  638. responsive: false,
  639. onChange: function (name, value) {
  640. this._toggleCadenceView(name, value);
  641. }.bind(this),
  642. options: schOptions,
  643. readOnly: this.readOnly,
  644. ariaLabel: t.translate('schedule_type_aria_label'),
  645. ariaDescribedby: t.translate('schedule_type_description')
  646. });
  647. this.scheduleTypeSelector.doRender();
  648. },
  649. _renderImportOptions: function _renderImportOptions() {
  650. var $entryEl = $(this.$el.find('.new_schedule_panel_footer'));
  651. var $ioEl = $('<div style="margin: 0px !important; padding: 0px;" class="ImportOptions"/>');
  652. $entryEl.prev().prepend($ioEl);
  653. var htmlGenerator = dot.simpleTemplate(importTemplate);
  654. var attributes = {
  655. descriptor: this.initScheduleDescriptor,
  656. strings: {
  657. importOptions: StringResource.get('importOptions'),
  658. reportSpecification: StringResource.get('reportSpecUpgrade'),
  659. upgradeReport: StringResource.get('upgradeReportLabel'),
  660. keepReport: StringResource.get('doNotUpgradeReportLabel'),
  661. storeID: StringResource.get('importStoreIDLabel'),
  662. assignNew: StringResource.get('assignNewStoreIDLabel'),
  663. keepID: StringResource.get('keepStoreIDLabel')
  664. }
  665. };
  666. var $content = $(htmlGenerator(attributes));
  667. $ioEl.append($content);
  668. $(this.$el.find('.importOptionsCheckbox')).on('click', this._toggleImportOptions.bind(this));
  669. },
  670. _toggleImportOptions: function _toggleImportOptions(evt) {
  671. var $impSec = $(this.$el.find('.importOptionsSection'));
  672. if (evt.currentTarget.checked) {
  673. $impSec.css('display', 'block');
  674. } else {
  675. $impSec.css('display', 'none');
  676. }
  677. },
  678. _toggleCadenceView: function _toggleCadenceView(name, scheduleType) {
  679. // Handle change for different type of cadence view in the schedule pane
  680. var $cadence = this.$el.find('.schedule_cadence_picker');
  681. if (scheduleType != this.currentRenderedCadenceType) {
  682. this.currentRenderedCadenceType = scheduleType;
  683. $cadence.empty();
  684. this.renderCadencePicker(scheduleType);
  685. }
  686. },
  687. renderDateTimeRangeCadencePicker: function renderDateTimeRangeCadencePicker() {
  688. this.datetimeRangeCadencePicker = new DateTimeRangeCadencePicker({
  689. $el: this.$el.find('.schedule_datetime_range_picker'),
  690. objectInformation: {
  691. descriptor: this.objectInformation.descriptor
  692. },
  693. glassContext: this.glassContext
  694. });
  695. return this.datetimeRangeCadencePicker.render();
  696. },
  697. renderCadencePicker: function renderCadencePicker(type) {
  698. var $cadence = this.$el.find('.schedule_cadence_picker');
  699. switch (type) {
  700. case 'daily':
  701. this.cadencePicker = new DailyCadencePicker({
  702. $el: $cadence,
  703. objectInformation: {
  704. descriptor: this.objectInformation.descriptor,
  705. showDailyInterval: true
  706. },
  707. glassContext: this.glassContext,
  708. hasPermission: this.objectInformation.hasPermission
  709. });
  710. break;
  711. case 'weekly':
  712. this.cadencePicker = new WeeklyCadencePicker({
  713. $el: $cadence,
  714. objectInformation: {
  715. descriptor: this.objectInformation.descriptor,
  716. showRunEvery: true,
  717. showDailyInterval: true
  718. },
  719. glassContext: this.glassContext,
  720. hasPermission: this.objectInformation.hasPermission
  721. });
  722. break;
  723. case 'monthly':
  724. this.cadencePicker = new MonthlyCadencePicker({
  725. $el: $cadence,
  726. objectInformation: {
  727. descriptor: this.objectInformation.descriptor,
  728. showDailyInterval: true
  729. },
  730. glassContext: this.glassContext,
  731. hasPermission: this.objectInformation.hasPermission
  732. });
  733. break;
  734. case 'yearly':
  735. this.cadencePicker = new YearlyCadencePicker({
  736. $el: $cadence,
  737. objectInformation: {
  738. descriptor: this.objectInformation.descriptor,
  739. showDailyInterval: true
  740. },
  741. glassContext: this.glassContext,
  742. hasPermission: this.objectInformation.hasPermission
  743. });
  744. break;
  745. case 'trigger':
  746. this.cadencePicker = new TriggerCadencePicker({
  747. $el: $cadence,
  748. objectInformation: {
  749. descriptor: this.objectInformation.descriptor
  750. },
  751. glassContext: this.glassContext
  752. });
  753. break;
  754. default:
  755. console.log('Wrong cadence type.');
  756. }
  757. if (this.cadencePicker) {
  758. this.cadencePicker.render();
  759. }
  760. },
  761. renderOutputFormatPicker: function renderOutputFormatPicker() {
  762. var _self = this;
  763. var formats = [];
  764. if (this.isEditMode) {
  765. if (this.objectInformation.descriptor.options.outputFormat) {
  766. formats = this.objectInformation.descriptor.options.outputFormat.slice();
  767. }
  768. }
  769. var updatedList = _.reject(formats, function (aFormat) {
  770. return !AuthoringHelper.userCanGenerateFormat(this.glassContext, aFormat);
  771. }.bind(this));
  772. if (updatedList.length === 0) {
  773. updatedList.push('HTML');
  774. }
  775. formats = updatedList;
  776. try {
  777. /*
  778. We show all of the formats when it is not an interactive report or it is not a report view of an interactive report.
  779. Otherwise only html format shows
  780. */
  781. var showHtmlOnly = this.objectInformation.type === 'interactiveReport' || this.objectInformation.type === 'reportView' && this.objectInformation.base && this.objectInformation.base[0] && this.objectInformation.base[0].type && this.objectInformation.base[0].type === 'interactiveReport';
  782. var showPdfOnly = this.objectInformation.type === 'powerPlay8Report' || this.objectInformation.type === 'powerPlay8ReportView';
  783. this.outputFormatPicker = new FormatPicker({
  784. $el: this.$el.find('.output_format_list'),
  785. $toggler: this.$el.find('.schedule_output_format_picker'),
  786. outputFormats: formats.slice(),
  787. hasPermission: this.objectInformation.hasPermission,
  788. showHTML: !showPdfOnly,
  789. showPDF: !showHtmlOnly && this.glassContext.hasCapability('canGeneratePDFOutput'),
  790. showExcel: !showHtmlOnly && !showPdfOnly && this.glassContext.hasCapability('canGenerateXLSOutput'),
  791. showCSV: !showHtmlOnly && !showPdfOnly && this.glassContext.hasCapability('canGenerateCSVOutput'),
  792. glassContext: this.glassContext,
  793. slideoutparent: this.slideout,
  794. overlay: false
  795. });
  796. this.outputFormatPicker.render();
  797. } catch (e) {
  798. console.log('There was an error initializing the FormatPicker.', e);
  799. }
  800. },
  801. _renderPromptRowForReport: function _renderPromptRowForReport() {
  802. var _self = this; // content_apps.PromptValuesView uses 'objectInfo' instead of 'objectInformation'
  803. this.objectInfo = this.objectInformation;
  804. if (this.isEditMode) {
  805. if (this.descriptor.parameters) {
  806. this.parameterValues = this.descriptor.parameters;
  807. }
  808. }
  809. this.$el.find('.prompt_picker_target').on('clicktap', function () {
  810. _self._closeOpenChildren().then(function () {
  811. _self.glassContext.appController.showSlideOut({
  812. position: _self.slideout ? null : 'right',
  813. parent: _self.slideout,
  814. width: '350',
  815. enableTabLooping: true,
  816. label: t.translate('schedule_prompt_picker_name'),
  817. content: {
  818. module: 'bi/content_apps/PromptValuesView',
  819. parentView: _self,
  820. glassContext: _self.glassContext,
  821. promptDisplayValues: ContentStoreObject.getPromptsDisplayValues(_self.parameterValues),
  822. parameters: _self.parameterValues,
  823. hasPermission: _self.objectInformation.hasPermission,
  824. clearCallback: function clearCallback() {
  825. if (_self.parameterValues.length > 0) {
  826. _self._updatePromptValueLabel();
  827. }
  828. },
  829. editCallback: _self._updatePromptValueLabel.bind(_self)
  830. }
  831. });
  832. }).done();
  833. });
  834. this._updatePromptValueLabel(this.parameterValues);
  835. },
  836. renderPromptRow: function renderPromptRow() {
  837. if (this.canShowPrompt) {
  838. return this._renderPromptRowForReport();
  839. }
  840. },
  841. _updatePromptValueLabel: function _updatePromptValueLabel(prompts) {
  842. // Reset the parameterValues to empty on Clear callback
  843. // need to copy the values of the prompts otherwise ie will be
  844. // displeased
  845. var promptsCP = JSON.parse(JSON.stringify(prompts));
  846. this.parameterValues = prompts ? promptsCP : [];
  847. var $promptValueLabel = this.$el.find('.currentPromptValues');
  848. $promptValueLabel.text(this._getPromptValueLabel());
  849. },
  850. _getPromptValueLabel: function _getPromptValueLabel() {
  851. var label = t.translate('schedule_prompt_value_label_default');
  852. if (this.parameterValues && this.parameterValues.length > 0) {
  853. if (this.parameterValues.length == 1) {
  854. label = t.translate('schedule_prompt_value_label_single');
  855. } else {
  856. label = t.translate('schedule_prompt_value_label_multiple', {
  857. number: this.parameterValues.length
  858. });
  859. }
  860. }
  861. return label;
  862. },
  863. renderBurstCheckBox: function renderBurstCheckBox() {
  864. var burst = false;
  865. if (this.objectInformation && this.objectInformation.descriptor && this.objectInformation.descriptor.options && this.objectInformation.descriptor.options.burst) {
  866. burst = this.objectInformation.descriptor.options.burst || false;
  867. }
  868. this.burstCheckbox = new CheckBox({
  869. id: 'schedule_burst_checkbox_' + this.uniqueId,
  870. el: this.$el.find('.schedule_burst_option_container'),
  871. name: 'schedule_burst_report',
  872. label: t.translate('schedule_burst_label'),
  873. ariaLabel: t.translate('schedule_burst_label'),
  874. checked: burst,
  875. controlOnLeft: true,
  876. onChange: function onChange() {}
  877. });
  878. this.burstCheckbox.doRender();
  879. },
  880. close: function close() {
  881. // Close off this pane
  882. this.slideout.hide(); // temporary solution before glass overlay is ready
  883. $('.flyoutPane .pane-child').css('z-index', '-1');
  884. },
  885. /**
  886. * mark as in progress
  887. */
  888. setWorking: function setWorking() {
  889. this.$overlay = this.$el.find('.progress-overlay');
  890. this.$overlay.show();
  891. },
  892. /**
  893. * Show the view if hidden
  894. */
  895. setDone: function setDone() {
  896. if (!this.$overlay) return;
  897. this.$overlay.hide();
  898. },
  899. _setIcons: function _setIcons() {
  900. var icons = this.$el.find('.common_schedule_icon');
  901. for (var i = 0; i < icons.length; i++) {
  902. var $icon = $(icons[i]);
  903. Utils.setIcon($icon, 'common-' + $icon.data('icon'), t.translate('svg_expand_icon'));
  904. }
  905. },
  906. getScheduleType: function getScheduleType() {
  907. var capabilityType = this.getCapabilityScheduleType();
  908. if (this.isEditMode) {
  909. return 'weekly';
  910. } else {
  911. return capabilityType;
  912. }
  913. return capabilityType;
  914. },
  915. getCapabilityScheduleType: function getCapabilityScheduleType() {
  916. // Return the proper type according to capabilities for creating new
  917. // default to "weekly" whenever possible
  918. if (this.glassContext.hasCapability('canUseSchedulingByWeek')) {
  919. return 'weekly';
  920. } else {
  921. if (this.glassContext.hasCapability('canUseSchedulingByDay')) {
  922. return 'daily';
  923. } else if (this.glassContext.hasCapability('canUseSchedulingByMonth')) {
  924. return 'monthly';
  925. } else if (this.glassContext.hasCapability('canUseSchedulingByYear')) {
  926. return 'yearly';
  927. } else if (this.glassContext.hasCapability('canUseSchedulingByTrigger')) {
  928. return 'trigger';
  929. }
  930. }
  931. return 'weekly';
  932. },
  933. validate: function validate() {
  934. this.msgs = [];
  935. this.msgs = this.datetimeRangeCadencePicker.validate(this.msgs);
  936. if (this.msgs.length > 0) {
  937. return false;
  938. }
  939. this.msgs = this.cadencePicker.validate(this.msgs);
  940. if (this.msgs.length > 0) {
  941. return false;
  942. } // Burst
  943. var burst = this._getBurstValue(); // Check delivery Options
  944. if (this.deliveryPicker) {
  945. var deliveryOptions = this.deliveryPicker.getDeliveryOptions();
  946. var $deliveryListDiv = this.$el.find('.delivery_list');
  947. $deliveryListDiv.removeAttr('aria-invalid aria-describedby');
  948. if (!burst) {
  949. if (deliveryOptions.email) {
  950. deliveryOptions.email.to = deliveryOptions.email.to ? deliveryOptions.email.to : [];
  951. deliveryOptions.email.cc = deliveryOptions.email.cc ? deliveryOptions.email.cc : [];
  952. deliveryOptions.email.bcc = deliveryOptions.email.bcc ? deliveryOptions.email.bcc : [];
  953. if (deliveryOptions.email.to.length === 0 && deliveryOptions.email.cc.length === 0 && deliveryOptions.email.bcc.length === 0) {
  954. this.msgs.push(t.translate('schedule_delivery_no_email_recipients_error'));
  955. $deliveryListDiv.attr({
  956. 'aria-invalid': 'true',
  957. 'aria-describedby': this.msgs[0]
  958. });
  959. return false;
  960. }
  961. if (!deliveryOptions.email.emailAsAttachment && !deliveryOptions.email.emailAsURL) {
  962. this.msgs.push(t.translate('schedule_delivery_email_require_include'));
  963. $deliveryListDiv.attr({
  964. 'aria-invalid': 'true',
  965. 'aria-describedby': this.msgs[0]
  966. });
  967. return false;
  968. }
  969. }
  970. if (deliveryOptions.mobile) {
  971. if (typeof deliveryOptions.mobile.to === 'undefined' || deliveryOptions.mobile.to.length === 0) {
  972. this.msgs.push(t.translate('schedule_delivery_no_mobile_recipients_error'));
  973. $deliveryListDiv.attr({
  974. 'aria-invalid': 'true',
  975. 'aria-describedby': this.msgs[0]
  976. });
  977. return false;
  978. }
  979. }
  980. }
  981. if (deliveryOptions.print && $.trim(deliveryOptions.print.name) === '') {
  982. this.msgs.push(t.translate('schedule_delivery_printer_empty_error'));
  983. $deliveryListDiv.attr({
  984. 'aria-invalid': 'true',
  985. 'aria-describedby': this.msgs[0]
  986. });
  987. return false;
  988. }
  989. if (deliveryOptions.archive && $.trim(deliveryOptions.archive.filenameStub) === '') {
  990. this.msgs.push(t.translate('schedule_delivery_archive_name_empty_error'));
  991. $deliveryListDiv.attr({
  992. 'aria-invalid': 'true',
  993. 'aria-describedby': this.msgs[0]
  994. });
  995. return false;
  996. }
  997. }
  998. return this.msgs.length === 0;
  999. },
  1000. /**
  1001. * Show warning message for invalid time/date/form input by user
  1002. */
  1003. showWarningMessage: function showWarningMessage() {
  1004. this.warningMessage = this.$el.find('.invalid_input_warning_message');
  1005. if (!this.warningMessage) {
  1006. return;
  1007. } else {
  1008. this.warningMessage.text(this.msgs[0]);
  1009. }
  1010. this.warningMessage.show();
  1011. },
  1012. /**
  1013. * Hide the warning message
  1014. */
  1015. hideWarningMessage: function hideWarningMessage() {
  1016. if (!this.warningMessage) return;
  1017. this.warningMessage.hide();
  1018. },
  1019. /** If this is a burst-enabled report, get whether or not to burst.
  1020. * @return Whether the user wants this report bursted or not.
  1021. * Returns false if the report cannot be bursted.
  1022. */
  1023. _getBurstValue: function _getBurstValue() {
  1024. var burst = false;
  1025. if (this.canBurst && typeof this.burstCheckbox !== 'undefined') {
  1026. burst = this.burstCheckbox.isChecked();
  1027. }
  1028. return burst;
  1029. },
  1030. onHide: function onHide() {
  1031. AdminReact.JobUIStore.editJobOboptionsDialogClosed(this._prepareScheduleDescriptor(), this.glassContext);
  1032. }
  1033. });
  1034. return scheduleView;
  1035. });