12345678 |
- /*!
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: Modeling UI
- * (C) Copyright IBM Corp. 2020
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- (window.caModellingPerspective=window.caModellingPerspective||[]).push([[16],{1575:function(t,e,a){"use strict";a.r(e),a.d(e,"default",function(){return b});var o,i=a(1),r=a.n(i),n=a(16),c=a(3),u=a(25),s=a(2),l=a(10),p=a(5),m=a(44),h=a(1576),d=a(1579);var b=Object(m.a)(l.e,{initializer:function(t,e){return new d.a({},{moserObjects:e.elements,commonValue:e.commonValue})}})(o=Object(p.e)(function(t){return{isDirty:t.isDirty,saveDataCache:t.saveDataCache}})(o=Object(n.observer)(o=function(t){function e(){for(var e,a=arguments.length,o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];return(e=t.call.apply(t,[this].concat(o))||this)._onSave=function(){var t=e.props;(0,t.onClose)(t.saveDataCache)},e}return function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t),e.prototype.render=function(){var t=this.props,e=t.onClose,a=t.prepareForClose,o=t.isDirty;return r.a.createElement(c.Dialog,{"data-tid":Object(u.a)("dataCacheDialog"),width:"600px",onClose:e},r.a.createElement(c.Dialog.Header,{"data-tid":Object(u.a)("dataCacheDialog","header")},r.a.createElement(c.TruncatedText,{value:Object(s.getString)("dataCache")})),r.a.createElement(c.Dialog.Body,null,r.a.createElement(h.a,null)),r.a.createElement(c.Dialog.Footer,null,r.a.createElement(c.Dialog.Button,{primary:!0,"data-tid":Object(u.a)("dataCacheDialog","ok"),label:Object(s.getString)("ok"),disabled:a||!o,onClick:this._onSave}),r.a.createElement(c.Dialog.Button,{"data-tid":Object(u.a)("dataCacheDialog","cancel"),label:Object(s.getString)("cancel"),onClick:e})))},e}(i.Component))||o)||o)||o},1576:function(t,e,a){"use strict";a.d(e,"a",function(){return m});var o,i=a(1),r=a.n(i),n=a(16),c=a(3),u=a(25),s=a(5),l=a(2),p=a(825);a(1577);var m=Object(s.e)(function(t){return{automaticLabel:t.automaticLabel,cacheOption:t.cacheOption,customValue:t.customValue,customUnit:t.customUnit,isReadOnly:t.isReadOnly,macroValue:t.macroValue,maxCustomTimeValue:t.maxCustomTimeValue,setCustomValue:t.setCustomValue,setCustomUnit:t.setCustomUnit,setCacheOption:t.setCacheOption,setMacroValue:t.setMacroValue}})(o=Object(n.observer)(o=function(t){function e(){for(var e,a=arguments.length,o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];return(e=t.call.apply(t,[this].concat(o))||this)._radio=void 0,e._getTid=function(t){return Object(u.a)("DataCacheView",t)},e._radioOption=function(t,a,o){var i=e.props.cacheOption===a;return r.a.createElement(c.FlexItem,{gutter:[0,0,2,0]},r.a.createElement(c.Radio,{className:"ba-mui-data-cache-view__radio",disabled:e.props.isReadOnly,name:"dataCacheRadioGroup",label:o||Object(l.getString)(t),value:a,checked:i,onChange:e.props.setCacheOption,"data-tid":e._getTid(t),"aria-label":o||Object(l.getString)(t),ref:function(t){t&&i&&(e._radio=t)}}))},e._description=function(){return r.a.createElement(c.FlexItem,{gutter:[0,0,4,0]},Object(l.getString)("dataCacheDescription"))},e._optionNoCache=function(){return e._radioOption("dataCacheOptionNone",p.c.None)},e._optionAutomatic=function(){return e._radioOption("dataCacheOptionAutomatic",p.c.Automatic,e.props.automaticLabel)},e._customValueOnValueAccept=function(t,a){var o=e.props.setCustomValue;Number(t)===Number(a)&&o(t)},e._optionCustom=function(){var t=[{value:p.a.Seconds,label:Object(l.getString)("format_units_seconds"),title:Object(l.getString)("format_units_seconds"),"data-tid":e._getTid("seconds")},{value:p.a.Minutes,label:Object(l.getString)("format_units_minutes"),title:Object(l.getString)("format_units_minutes"),"data-tid":e._getTid("minutes")},{value:p.a.Hours,label:Object(l.getString)("format_units_hours"),title:Object(l.getString)("format_units_hours"),"data-tid":e._getTid("hours")},{value:p.a.Days,label:Object(l.getString)("format_units_days"),title:Object(l.getString)("format_units_days"),"data-tid":e._getTid("days")}];return r.a.createElement(r.a.Fragment,null,e._radioOption("dataCacheOptionCustom",p.c.Custom),r.a.createElement(c.FlexItem,null,r.a.createElement(c.FlexLayout,{alignItems:"center"},r.a.createElement(c.FlexItem,{gutter:[0,0,2,3]},r.a.createElement(c.NumberInput,{disabled:e.props.isReadOnly,min:1,max:e.props.maxCustomTimeValue,scale:0,value:e.props.customValue,onValueChange:e._customValueOnValueAccept,placeholder:"0","data-tid":e._getTid("customValue")})),r.a.createElement(c.FlexItem,{gutter:[0,0,2,1]},r.a.createElement(c.Select,{readOnly:e.props.isReadOnly,truncated:!1,showAllList:!0,options:t,selected:e.props.customUnit,onChange:e.props.setCustomUnit,"data-tid":e._getTid("customUnit")})))))},e._optionMacro=function(){return r.a.createElement(r.a.Fragment,null,e._radioOption("dataCacheOptionMacro",p.c.Macro),r.a.createElement(c.FlexItem,{gutter:[0,0,2,3]},r.a.createElement(c.FlexLayout,{direction:"row",alignItems:"center",width:"70%"},""+p.b,r.a.createElement(c.HSpacer,{size:1}),r.a.createElement(c.TextInput,{fullWidth:!0,disabled:e.props.isReadOnly,value:e.props.macroValue,onChange:e.props.setMacroValue,placeholder:Object(l.getString)("dataCacheMacroPlaceholder"),"data-tid":e._getTid("macroValue")}),r.a.createElement(c.HSpacer,{size:1}),""+p.b)))},e}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var a=e.prototype;return a.componentDidMount=function(){this._radio&&this._radio.focus&&this._radio.focus()},a.render=function(){return r.a.createElement(c.Container,{gutter:[0,0,3,0]},r.a.createElement(c.FlexLayout,{direction:"column","data-tid":this._getTid("view")},this._description(),this._optionNoCache(),this.props.automaticLabel&&this._optionAutomatic(),this._optionCustom(),this._optionMacro()))},e}(i.Component))||o)||o},1577:function(t,e,a){var o=a(1578);"string"==typeof o&&(o=[[t.i,o,""]]);var i={hmr:!0,transform:void 0};a(36)(o,i);o.locals&&(t.exports=o.locals)},1578:function(t,e,a){(t.exports=a(32)(void 0)).push([t.i,".ba-mui-data-cache-view__radio{width:fit-content}",""])},1579:function(t,e,a){"use strict";a.d(e,"a",function(){return T});var o,i,r,n,c,u,s,l,p,m,h,d,b=a(6),O=a(0),g=a.n(O),y=a(5),f=a(4),v=a(825),C=a(2),j=a(29),V=a(9),_=a(8),D=a(1014);function E(t,e,a,o){a&&Object.defineProperty(t,e,{enumerable:a.enumerable,configurable:a.configurable,writable:a.writable,value:a.initializer?a.initializer.call(o):void 0})}function w(t,e){for(var a=0;a<e.length;a++){var o=e[a];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function S(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function U(t,e,a,o,i){var r={};return Object.keys(o).forEach(function(t){r[t]=o[t]}),r.enumerable=!!r.enumerable,r.configurable=!!r.configurable,("value"in r||r.initializer)&&(r.writable=!0),r=a.slice().reverse().reduce(function(a,o){return o(t,e,a)||a},r),i&&void 0!==r.initializer&&(r.value=r.initializer?r.initializer.call(i):void 0,r.initializer=void 0),void 0===r.initializer&&(Object.defineProperty(t,e,r),r=null),r}var T=(o=y.c.undoable(Object(C.getString)("dataCache")),i=y.c.undoable(),r=y.c.undoable(function(t){return""+Object(C.getString)("dataCacheOptionCustom",{value:t})}),n=y.c.undoable(function(t){return""+Object(C.getString)("dataCacheOptionCustom",{value:t})}),c=y.c.undoable(function(t){return""+Object(C.getString)("dataCacheOptionMacro",{value:t})}),d=h=function(t){function e(){for(var e,a=arguments.length,o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];return E(e=t.call.apply(t,[this].concat(o))||this,"cacheOption",s,S(e)),e.cacheOptionInit=void 0,E(e,"customValue",l,S(e)),e.customValueInit=void 0,E(e,"customUnit",p,S(e)),e.customUnitInit=v.a.Seconds,E(e,"macroValue",m,S(e)),e.macroValueInit=void 0,e.selection=[],e.isReadOnly=!1,e}!function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}(e,t);var a=e.prototype;return a.storeDidMount=function(t){var e=this,a=t.moserObjects,o=t.commonValue,i=a;if(a.every(function(t){return Object(f.isMoserObjectTypeOf)(t,g.a.MoserObjectTypes.QUERY_SUBJECT)})&&(this.isReadOnly=Object(j.e)(a)),a.every(function(t){return t.getObjectType()===g.a.MoserObjectTypes.MODULE&&Object(f.belongsToBaseModule)(t)})&&(i=a.map(function(t){return Object(f.getSourceUseSpec)(t)})),i.forEach(function(t){var a=Object(D.a)(t),o=Object.assign({moserObject:t},a);e.selection.push(o)}),o){var r=this.selection[0];this.cacheOption=r.cacheOption,this.customValue=r.customValue,this.customUnit=r.customUnit,this.macroValue=r.macroValue}else this.cacheOption=void 0;return this.cacheOptionInit=this.cacheOption,this.customValueInit=this.customValue,this.customUnitInit=this.customUnit,this.macroValueInit=this.macroValue,this},a.getObjectsAndSettings=function(){var t={cacheOption:this.cacheOption,customValue:this.customValue,customUnit:this.customUnit,macroValue:this.macroValue};return this.selection.map(function(e){return{moserObject:e.moserObject,settings:t}})},a.saveDataCache=function(){var t=this.getObjectsAndSettings(),e=this.dataCacheExpiryValue;t.forEach(function(t){t.moserObject.setDataCacheExpiry(e),Object(_.setObjectProperty)(t.moserObject,V.s,t.settings)})},a.setCacheOption=function(t){this.cacheOption=t},a.setCustomValue=function(t){this.customValue=t,this.cacheOption=v.c.Custom},a.setCustomUnit=function(t){this.customUnit=t,this.cacheOption=v.c.Custom},a.setMacroValue=function(t){this.macroValue=t,this.cacheOption=v.c.Macro},function(t,e,a){e&&w(t.prototype,e),a&&w(t,a)}(e,[{key:"isDirty",get:function(){var t=this.cacheOption!==this.cacheOptionInit||this.customValue!==this.customValueInit||this.customUnit!==this.customUnitInit||this.macroValue!==this.macroValueInit;return t&&this.cacheOption===v.c.Macro&&(t=""!==this.macroValue),t}},{key:"automaticLabel",get:function(){var t,e=this.selection[0].moserObject;if(e.getObjectType()===g.a.MoserObjectTypes.QUERY_SUBJECT){var a=Object(f.getSourceUseSpec)(e);a&&(t=Object(D.b)(a.getDataCacheExpiry(),a,!0,!0))}return t}},{key:"maxCustomTimeValue",get:function(){var t;switch(this.customUnit){case v.a.Seconds:t=31536e3;break;case v.a.Minutes:t=525600;break;case v.a.Hours:t=8760;break;case v.a.Days:t=365}return t}},{key:"dataCacheExpiryValue",get:function(){var t=null;switch(this.cacheOption){case v.c.None:t=0;break;case v.c.Automatic:t=null;break;case v.c.Custom:switch(this.customUnit){case v.a.Seconds:t=this.customValue;break;case v.a.Minutes:t=60*this.customValue;break;case v.a.Hours:t=60*this.customValue*60;break;case v.a.Days:t=60*this.customValue*60*24}break;case v.c.Macro:t=v.b+this.macroValue+v.b}return t}}]),e}(y.a),h.providerTypes={},s=U((u=d).prototype,"cacheOption",[b.observable],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return v.c.None}}),l=U(u.prototype,"customValue",[b.observable],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),p=U(u.prototype,"customUnit",[b.observable],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return v.a.Seconds}}),m=U(u.prototype,"macroValue",[b.observable],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),U(u.prototype,"isDirty",[b.computed],Object.getOwnPropertyDescriptor(u.prototype,"isDirty"),u.prototype),U(u.prototype,"automaticLabel",[b.computed],Object.getOwnPropertyDescriptor(u.prototype,"automaticLabel"),u.prototype),U(u.prototype,"maxCustomTimeValue",[b.computed],Object.getOwnPropertyDescriptor(u.prototype,"maxCustomTimeValue"),u.prototype),U(u.prototype,"dataCacheExpiryValue",[b.computed],Object.getOwnPropertyDescriptor(u.prototype,"dataCacheExpiryValue"),u.prototype),U(u.prototype,"saveDataCache",[o],Object.getOwnPropertyDescriptor(u.prototype,"saveDataCache"),u.prototype),U(u.prototype,"setCacheOption",[i],Object.getOwnPropertyDescriptor(u.prototype,"setCacheOption"),u.prototype),U(u.prototype,"setCustomValue",[r],Object.getOwnPropertyDescriptor(u.prototype,"setCustomValue"),u.prototype),U(u.prototype,"setCustomUnit",[n],Object.getOwnPropertyDescriptor(u.prototype,"setCustomUnit"),u.prototype),U(u.prototype,"setMacroValue",[c],Object.getOwnPropertyDescriptor(u.prototype,"setMacroValue"),u.prototype),u)},702:function(t,e,a){"use strict";a.r(e);var o=a(1575);e.default={"components/DataCacheDialog":o}}}]);
- //# sourceMappingURL=dataCache.js.map
|