All Downloads are FREE. Search and download functionalities are using the official Maven repository.

assets.1095.b9a7715fecfe4fab2858.js Maven / Gradle / Ivy

There is a newer version: 1.5.4
Show newest version
"use strict";(self.webpackChunkopen_metadata=self.webpackChunkopen_metadata||[]).push([[1095],{26528:function(e,t,a){var n=a(8081),i=a.n(n),l=a(23645),r=a.n(l)()(i());r.push([e.id,'/*\n *  Copyright 2022 Collate.\n *  Licensed under the Apache License, Version 2.0 (the "License");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *  http://www.apache.org/licenses/LICENSE-2.0\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an "AS IS" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\n/*\n *  Copyright 2022 Collate.\n *  Licensed under the Apache License, Version 2.0 (the "License");\n *  you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *  http://www.apache.org/licenses/LICENSE-2.0\n *  Unless required by applicable law or agreed to in writing, software\n *  distributed under the License is distributed on an "AS IS" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *  See the License for the specific language governing permissions and\n *  limitations under the License.\n */\n/* navbar+tab_height+padding = 64+46+12  */\n.kpi-slider .ant-slider-track {\n  background: #0968da;\n}\n',""]),t.Z=r},17392:function(e,t,a){var n=a(93379),i=a.n(n),l=a(7795),r=a.n(l),s=a(90569),d=a.n(s),c=a(3565),u=a.n(c),m=a(19216),o=a.n(m),p=a(44589),f=a.n(p),h=a(26528),b={};b.styleTagTransform=f(),b.setAttributes=u(),b.insert=d().bind(null,"head"),b.domAPI=r(),b.insertStyleElement=o(),i()(h.Z,b),h.Z&&h.Z.locals&&h.Z.locals},87057:function(e,t,a){var n;a.d(t,{m:function(){return n}}),function(e){e.Number="NUMBER",e.Percentage="PERCENTAGE"}(n||(n={}))},61095:function(e,t,a){a.r(t);var n=a(70655),i=a(56256),l=a(49409),r=a(4107),s=a(71230),d=a(15746),c=a(99177),u=a(85986),m=a(11448),o=a(19650),p=a(71577),f=a(94199),h=a(50963),b=a(34901),g=a(96486),y=a(30381),v=a.n(y),E=a(67294),N=a(68432),Z=a(15137),D=a(79686),I=a(18927),C=a(26387),w=a(69523),T=a(62761),k=a(60625),S=a(87057),L=a(85087),x=a(7692),A=a(96094),O=a(36096),R=a(46321);a(17392),t.default=function(){var e=(0,L.a)().isAdminUser,t=(0,Z.UO)().kpiName,a=(0,N.$)().t,y=(0,Z.k6)(),P=(0,n.CR)((0,h.useForm)(),1)[0],V=(0,n.CR)((0,E.useState)(),2),q=V[0],F=V[1],U=(0,n.CR)((0,E.useState)(!1),2),W=U[0],_=U[1],G=(0,n.CR)((0,E.useState)(""),2),J=G[0],M=G[1],B=(0,n.CR)((0,E.useState)(),2),H=B[0],K=B[1],Y=(0,n.CR)((0,E.useState)(0),2),j=Y[0],$=Y[1],z=(0,n.CR)((0,E.useState)(!1),2),Q=z[0],X=z[1],ee=(0,E.useMemo)((function(){var e;return[{name:a("label.data-insight"),url:(0,O.zc)()},{name:a("label.kpi-list"),url:T.Z6.KPI_LIST},{name:null!==(e=null==q?void 0:q.name)&&void 0!==e?e:"",url:"",activeTitle:!0}]}),[q]),te=(0,E.useMemo)((function(){if(q)return q.targetDefinition[0]}),[q]),ae=(0,E.useMemo)((function(){if(q){var e=q.targetDefinition[0],t=q.dataInsightChart,a=v()(q.startDate),n=v()(q.endDate);return{name:q.name,displayName:q.displayName,dataInsightChart:t.displayName||t.name,metricType:e.name,startDate:a,endDate:n}}return{}}),[q]);return(0,E.useEffect)((function(){(0,n.mG)(void 0,void 0,void 0,(function(){var e,a;return(0,n.Jh)(this,(function(n){switch(n.label){case 0:_(!0),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,(0,A._q)(t,{fields:"startDate,endDate,targetDefinition,dataInsightChart,metricType"})];case 2:return e=n.sent(),F(e),[3,5];case 3:return a=n.sent(),(0,R.Eo)(a),[3,5];case 4:return _(!1),[7];case 5:return[2]}}))}))}),[t]),(0,E.useEffect)((function(){q&&((0,n.mG)(void 0,void 0,void 0,(function(){var e,t,a;return(0,n.Jh)(this,(function(n){switch(n.label){case 0:if(!(e=null==q?void 0:q.dataInsightChart.id))return[3,4];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,(0,x.$w)(e)];case 2:return t=n.sent(),K(t),[3,4];case 3:return a=n.sent(),(0,R.Eo)(a),[3,4];case 4:return[2]}}))})),M(q.description))}),[q]),(0,E.useEffect)((function(){var e,t=(0,g.toNumber)(null!==(e=null==te?void 0:te.value)&&void 0!==e?e:"0"),a=(null==q?void 0:q.metricType)===S.m.Percentage?100*t:t;$((0,g.toInteger)(a))}),[te,q]),W?E.createElement(w.Z,null):E.createElement(D.Z,{firstPanel:{children:E.createElement("div",{className:"max-width-md w-9/10 service-form-container","data-testid":"edit-kpi-container"},E.createElement(C.Z,{className:"my-4",titleLinks:ee}),E.createElement(i.Z.Paragraph,{className:"text-base","data-testid":"form-title"},a("label.edit-entity",{entity:a("label.kpi-uppercase")})),E.createElement(l.Z,{"data-testid":"kpi-form",form:P,id:"kpi-form",initialValues:ae,layout:"vertical",validateMessages:T.NG,onFinish:function(e){return(0,n.mG)(void 0,void 0,void 0,(function(){var t,a,i,l,r,s,d;return(0,n.Jh)(this,(function(c){switch(c.label){case 0:if(!q||!te)return[3,5];t=e.startDate.valueOf(),a=e.endDate.valueOf(),i=(0,O.cW)(q.metricType,j),l=(0,n.pi)((0,n.pi)({},q),{description:J,displayName:e.displayName,endDate:a,startDate:t,targetDefinition:[(0,n.pi)((0,n.pi)({},te),{value:i+""})]}),r=(0,b.qu)(q,l),X(!0),c.label=1;case 1:return c.trys.push([1,3,4,5]),[4,(0,A.pH)(null!==(d=q.id)&&void 0!==d?d:"",r)];case 2:return c.sent(),y.push(T.Z6.KPI_LIST),[3,5];case 3:return s=c.sent(),(0,R.Eo)(s),[3,5];case 4:return X(!1),[7];case 5:return[2]}}))}))},onValuesChange:function(e,t){if(e.startDate){var a=v()(e.startDate).startOf("day");P.setFieldsValue({startDate:a}),e.startDate>t.endDate&&P.setFieldsValue({endDate:""})}if(e.endDate){var n=v()(e.endDate).endOf("day");P.setFieldsValue({endDate:n}),e.endDate=0?Promise.resolve():Promise.reject(a("message.field-text-is-required",{fieldText:a("label.metric-value")}))}}]},E.createElement(E.Fragment,null,(null==q?void 0:q.metricType)===S.m.Percentage&&E.createElement(s.Z,{"data-testid":"metric-percentage-input",gutter:20},E.createElement(d.Z,{span:20},E.createElement(c.Z,{className:"kpi-slider",marks:{0:"0%",100:"100%"},max:100,min:0,tooltip:{open:!1},value:j,onChange:function(e){$(e)}})),E.createElement(d.Z,{span:4},E.createElement(u.Z,{formatter:function(e){return e+"%"},max:100,min:0,step:1,value:j,onChange:function(e){$(Number(e))}}))),(null==q?void 0:q.metricType)===S.m.Number&&E.createElement(u.Z,{className:"w-full","data-testid":"metric-number-input",min:0,value:j,onChange:function(e){return $(Number(e))}}))),E.createElement(s.Z,{gutter:[8,8]},E.createElement(d.Z,{span:12},E.createElement(l.Z.Item,{label:a("label.start-entity",{entity:a("label.date")}),messageVariables:{fieldName:"startDate"},name:"startDate",rules:[{required:!0,message:a("label.field-required",{field:a("label.start-entity",{entity:a("label.date")})})}]},E.createElement(m.Z,{className:"w-full","data-testid":"start-date",disabledDate:O.nu,format:k.aJ}))),E.createElement(d.Z,{span:12},E.createElement(l.Z.Item,{label:a("label.end-date"),messageVariables:{fieldName:"endDate"},name:"endDate",rules:[{required:!0,message:a("label.field-required",{field:a("label.end-date")})}]},E.createElement(m.Z,{className:"w-full","data-testid":"end-date",disabledDate:O.nu,format:k.aJ})))),E.createElement(l.Z.Item,{label:a("label.description"),name:"description"},E.createElement(I.Z,{height:"200px",initialValue:J,placeHolder:a("message.write-your-description"),style:{margin:0},onTextChange:function(e){return M(e)}})),E.createElement(o.Z,{align:"center",className:"w-full justify-end"},E.createElement(p.Z,{"data-testid":"cancel-btn",type:"link",onClick:function(){return y.goBack()}},a("label.go-back")),e?E.createElement(f.Z,{title:a("label.save")},E.createElement(p.Z,{"data-testid":"submit-btn",htmlType:"submit",loading:Q,type:"primary"},a("label.save"))):null))),minWidth:700,flex:.7},pageTitle:a("label.edit-entity",{entity:a("label.kpi-uppercase")}),secondPanel:{children:E.createElement("div",{"data-testid":"right-panel"},E.createElement(i.Z.Paragraph,{className:"text-base font-medium"},a("label.edit-entity",{entity:a("label.kpi-uppercase")})),E.createElement(i.Z.Text,null,a("message.add-kpi-message"))),className:"p-md service-doc-panel",minWidth:60,overlay:{displayThreshold:200,header:a("label.setup-guide"),rotation:"counter-clockwise"}}})}}}]);




© 2015 - 2024 Weber Informatics LLC | Privacy Policy