ScheduleRunAsView.js 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. "use strict";
  2. /**
  3. * Licensed Materials - Property of IBM
  4. * IBM Cognos Products: admin
  5. * Copyright IBM Corp. 2018
  6. * US Government Users Restricted Rights
  7. * Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  8. */
  9. define(['bi/content_apps/RunAsOptionsView', 'bi/content_apps/authoring/AuthoringHelper', 'bi/content_apps/nls/StringResource'], function (BasePane, AuthoringHelper, StringResource) {
  10. //NOSONAR: needed for amd
  11. var ScheduleRunAsView = BasePane.extend({
  12. init: function init(options) {
  13. ScheduleRunAsView.inherited('init', this, arguments);
  14. if (options.objectInformation.options.outputLocale) {
  15. this._selections = options.objectInformation.options;
  16. this._selections.languages = options.objectInformation.options.outputLocale;
  17. this._selections.formats = {};
  18. options.objectInformation.options.outputFormat.forEach(function (format) {
  19. this._selections.formats[format] = true;
  20. }.bind(this));
  21. this._outputFormat = options.objectInformation.options.outputFormat[0];
  22. this._requestParams.parameters = options.objectInformation.parameters;
  23. if (this._requestParams.parameters) {
  24. this._promptValue = this._requestParams.parameters.length === 0;
  25. }
  26. }
  27. },
  28. _getRunInBackgroundToggleSpec: function _getRunInBackgroundToggleSpec() {
  29. var itemSpec = ScheduleRunAsView.inherited('_getRunInBackgroundToggleSpec', this, arguments);
  30. itemSpec.checked = true;
  31. return itemSpec;
  32. },
  33. _getPromptForValuesOptionSpec: function _getPromptForValuesOptionSpec() {
  34. var itemSpec = ScheduleRunAsView.inherited('_getPromptForValuesOptionSpec', this, arguments);
  35. itemSpec.checked = this._promptValue;
  36. return itemSpec;
  37. },
  38. _getRunInBackgroundFormatsSpec: function _getRunInBackgroundFormatsSpec() {
  39. var itemSpec = ScheduleRunAsView.inherited('_getRunInBackgroundFormatsSpec', this, arguments);
  40. if (this.objectInformation.options.outputFormat) {
  41. if (itemSpec[0].items) {
  42. itemSpec[0].items.forEach(function (checkBox) {
  43. checkBox.checked = this.objectInformation.options.outputFormat.indexOf(checkBox.value) !== -1;
  44. }.bind(this));
  45. }
  46. }
  47. return itemSpec;
  48. },
  49. _setOutputFormatRequestParams: function _setOutputFormatRequestParams() {
  50. var selectedOutputFormats = this._getSelectedFormats(true
  51. /*bRunInBackgroud*/
  52. );
  53. this._requestParams.options.outputFormat = selectedOutputFormats;
  54. },
  55. render: function render() {
  56. ScheduleRunAsView.inherited('render', this, arguments).then(function () {
  57. this._toggleOptionsControl();
  58. this._selections[BasePane.OPTION.RUN_IN_BG] = true;
  59. }.bind(this));
  60. }
  61. });
  62. return ScheduleRunAsView;
  63. });