assets.2088.b7e9699b286012c3796e.js Maven / Gradle / Ivy
"use strict";(self.webpackChunkopen_metadata=self.webpackChunkopen_metadata||[]).push([[2088],{26528:function(e,t,a){var n=a(8081),i=a.n(n),r=a(23645),l=a.n(r)()(i());l.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=l},17392:function(e,t,a){var n=a(93379),i=a.n(n),r=a(7795),l=a.n(r),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=l(),b.insertStyleElement=o(),i()(h.Z,b),h.Z&&h.Z.locals&&h.Z.locals},42088:function(e,t,a){a.r(t);var n=a(70655),i=a(34041),r=a(56256),l=a(49409),s=a(4107),d=a(71230),c=a(15746),u=a(99177),m=a(85986),o=a(11448),p=a(19650),f=a(71577),h=a(50963),b=a(23031),g=a(96486),y=a(30381),v=a.n(y),E=a(67294),Z=a(68432),N=a(15137),C=a(79686),I=a(18927),D=a(26387),w=a(62761),k=a(60625),T=a(19305),S=a(7692),L=a(96094),x=a(36096),O=a(46321),A=(a(17392),i.Z.Option),R=[{name:(0,b.t)("label.data-insight"),url:(0,x.zc)()},{name:(0,b.t)("label.kpi-list"),url:w.Z6.KPI_LIST},{name:(0,b.t)("label.add-new-entity",{entity:(0,b.t)("label.kpi-uppercase")}),url:"",activeTitle:!0}];t.default=function(){var e=(0,Z.$)().t,t=(0,N.k6)(),a=(0,n.CR)((0,h.useForm)(),1)[0],b=(0,n.CR)((0,E.useState)([]),2),y=b[0],q=b[1],V=(0,n.CR)((0,E.useState)(""),2),P=V[0],F=V[1],W=(0,n.CR)((0,E.useState)(),2),J=W[0],U=W[1],G=(0,n.CR)((0,E.useState)(),2),_=G[0],K=G[1],Y=(0,n.CR)((0,E.useState)(0),2),B=Y[0],H=Y[1],M=(0,n.CR)((0,E.useState)(!1),2),Q=M[0],j=M[1],z=(0,n.CR)((0,E.useState)([]),2),$=z[0],X=z[1],ee=(0,E.useMemo)((function(){var e;return(null!==(e=null==J?void 0:J.metrics)&&void 0!==e?e:[]).filter((function(e){return[T.r.Number,T.r.Percentage].includes(e.chartDataType)}))}),[J]),te=(0,E.useMemo)((function(){return y.filter((function(e){return!$.find((function(t){return t.dataInsightChart.name===e.name}))}))}),[$,y]);return(0,E.useEffect)((function(){(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:return n.trys.push([0,2,,3]),[4,(0,S.zu)()];case 1:return e=n.sent(),t=e.data.filter((function(e){return k.VJ.includes(e.name)})),q(t),[3,3];case 2:return a=n.sent(),(0,O.Eo)(a),[3,3];case 3:return[2]}}))})),(0,n.mG)(void 0,void 0,void 0,(function(){var e;return(0,n.Jh)(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,(0,L.Gw)({fields:"dataInsightChart"})];case 1:return e=t.sent(),X(e.data),[3,3];case 2:return t.sent(),X([]),[3,3];case 3:return[2]}}))}))}),[]),E.createElement(C.Z,{firstPanel:{children:E.createElement("div",{className:"max-width-md w-9/10 service-form-container","data-testid":"add-kpi-container"},E.createElement(D.Z,{className:"my-4",titleLinks:R}),E.createElement(r.Z.Paragraph,{className:"text-base","data-testid":"form-title"},e("label.add-new-entity",{entity:e("label.kpi-uppercase")})),E.createElement(l.Z,{"data-testid":"kpi-form",form:a,id:"kpi-form",layout:"vertical",validateMessages:w.NG,onFinish:function(e){return(0,n.mG)(void 0,void 0,void 0,(function(){var a,i,r,l,s,d,c;return(0,n.Jh)(this,(function(n){switch(n.label){case 0:a=e.startDate.valueOf(),i=e.endDate.valueOf(),r=null==_?void 0:_.chartDataType,l=(0,x.cW)(r,B),s={dataInsightChart:e.dataInsightChart,description:P,name:(0,g.kebabCase)((null!==(c=e.displayName)&&void 0!==c?c:"")+" "+(null==_?void 0:_.name)),displayName:e.displayName,startDate:a,endDate:i,metricType:r,targetDefinition:[{name:null==_?void 0:_.name,value:l+""}]},j(!0),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,(0,L.gg)(s)];case 2:return n.sent(),t.push(w.Z6.KPI_LIST),[3,5];case 3:return d=n.sent(),(0,O.Eo)(d),[3,5];case 4:return j(!1),[7];case 5:return[2]}}))}))},onValuesChange:function(e,t){if(e.startDate){var n=v()(e.startDate).startOf("day");a.setFieldsValue({startDate:n}),e.startDate>t.endDate&&a.setFieldsValue({endDate:""})}if(e.endDate){var i=v()(e.endDate).endOf("day");a.setFieldsValue({endDate:i}),e.endDate=0?Promise.resolve():Promise.reject(e("message.field-text-is-required",{fieldText:e("label.metric-value")}))}}]},E.createElement(E.Fragment,null,_.chartDataType===T.r.Percentage&&E.createElement(d.Z,{"data-testid":"metric-percentage-input",gutter:20},E.createElement(c.Z,{span:20},E.createElement(u.Z,{className:"kpi-slider",marks:{0:"0%",100:"100%"},max:100,min:0,tooltip:{open:!1},value:B,onChange:function(e){H(e)}})),E.createElement(c.Z,{span:4},E.createElement(m.Z,{formatter:function(e){return e+"%"},max:100,min:0,step:1,value:B,onChange:function(e){H(Number(e))}}))),_.chartDataType===T.r.Number&&E.createElement(m.Z,{className:"w-full","data-testid":"metric-number-input",min:0,value:B,onChange:function(e){return H(Number(e))}}))),E.createElement(d.Z,{gutter:[8,8]},E.createElement(c.Z,{span:12},E.createElement(l.Z.Item,{label:e("label.start-entity",{entity:e("label.date")}),messageVariables:{fieldName:"startDate"},name:"startDate",rules:[{required:!0,message:e("label.field-required",{field:e("label.start-entity",{entity:e("label.date")})})}]},E.createElement(o.Z,{className:"w-full","data-testid":"start-date",disabledDate:x.nu,format:k.aJ}))),E.createElement(c.Z,{span:12},E.createElement(l.Z.Item,{label:e("label.end-date"),messageVariables:{fieldName:"endDate"},name:"endDate",rules:[{required:!0,message:e("label.field-required",{field:e("label.end-date")})}]},E.createElement(o.Z,{className:"w-full","data-testid":"end-date",disabledDate:x.nu,format:k.aJ})))),E.createElement(l.Z.Item,{label:e("label.description"),name:"description"},E.createElement(I.Z,{height:"200px",initialValue:P,placeHolder:e("message.write-your-description"),style:{margin:0},onTextChange:function(e){return F(e)}})),E.createElement(p.Z,{align:"center",className:"w-full justify-end"},E.createElement(f.Z,{"data-testid":"cancel-btn",type:"link",onClick:function(){return t.goBack()}},e("label.cancel")),E.createElement(f.Z,{"data-testid":"submit-btn",form:"kpi-form",htmlType:"submit",loading:Q,type:"primary"},e("label.submit"))))),minWidth:700,flex:.7},pageTitle:e("label.add-new-entity",{entity:e("label.kpi-uppercase")}),secondPanel:{children:E.createElement("div",{"data-testid":"right-panel"},E.createElement(r.Z.Paragraph,{className:"text-base font-medium"},e("label.add-entity",{entity:e("label.kpi-uppercase")})),E.createElement(r.Z.Text,null,e("message.add-kpi-message"))),className:"p-md service-doc-panel",minWidth:60,overlay:{displayThreshold:200,header:e("label.setup-guide"),rotation:"counter-clockwise"}}})}}}]);
© 2015 - 2025 Weber Informatics LLC | Privacy Policy