@corva/ui 0.61.0-13 → 0.61.0-15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs-bundle/components/DevCenter/DevCenterAppContainer/components/DcFullscreenElemsCoordinatorProvider/DcFullscreenElemsCoordinatorProvider.js +1 -1
- package/cjs-bundle/components/StatusBadge/components/DQUnvalidatedContent.js +1 -1
- package/cjs-bundle/components/StatusBadge/index.js +1 -1
- package/components/DevCenter/DevCenterAppContainer/components/DcFullscreenElemsCoordinatorProvider/DcFullscreenElemsCoordinatorProvider.js +1 -1
- package/components/StatusBadge/components/DQUnvalidatedContent.d.ts +3 -1
- package/components/StatusBadge/components/DQUnvalidatedContent.d.ts.map +1 -1
- package/components/StatusBadge/components/DQUnvalidatedContent.js +1 -1
- package/components/StatusBadge/index.d.ts.map +1 -1
- package/components/StatusBadge/index.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,n=require('./../../../../../ext-esm/tslib/tslib.es6.js'),r=require("react/jsx-runtime"),t=require("react");!function(e){e.CLOSED="CLOSED",e.OPENNING="OPENNING",e.OPENED="OPENED",e.CLOSING="CLOSING"}(e||(e={}));var u=t.createContext(null);exports.DcFullscreenElemsCoordinatorProvider=function(i){var s=i.setIsFullscreenModalMode,c=i.children,o={name:e.CLOSED,currentElementInfo:null},a=t.useRef({}),l=t.useMemo((function(){function r(e){var r=e.transitionFn,t=e.plannedAfterTransitionFinishCb;return n.__awaiter(this,void 0,void 0,(function(){var e;return n.__generator(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,r()];case 1:return n.sent(),[3,3];case 2:return e=n.sent(),console.error("Transition error: ",e),[3,3];case 3:return t(),[2]}}))}))}function t(n){var r=n.id;a.current[
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,n=require('./../../../../../ext-esm/tslib/tslib.es6.js'),r=require("react/jsx-runtime"),t=require("react");!function(e){e.CLOSED="CLOSED",e.OPENNING="OPENNING",e.OPENED="OPENED",e.CLOSING="CLOSING"}(e||(e={}));var u=t.createContext(null);exports.DcFullscreenElemsCoordinatorProvider=function(i){var s=i.setIsFullscreenModalMode,c=i.children,o={name:e.CLOSED,currentElementInfo:null},a=t.useRef({}),l=t.useMemo((function(){function r(e){var r=e.transitionFn,t=e.plannedAfterTransitionFinishCb;return n.__awaiter(this,void 0,void 0,(function(){var e;return n.__generator(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,r()];case 1:return n.sent(),[3,3];case 2:return e=n.sent(),console.error("Transition error: ",e),[3,3];case 3:return t(),[2]}}))}))}function t(n){var r,t=n.id;a.current[t]={name:e.OPENED,currentElementInfo:n},null===(r=a.current[t].currentElementInfo)||void 0===r||r.setIsOpened(!0)}function u(n){var u=n.id;a.current[u]={name:e.OPENNING,currentElementInfo:null},r({transitionFn:function(){return s(!0)},plannedAfterTransitionFinishCb:function(){t(n)}})}function i(t){var u=this;a.current[t].name=e.CLOSING,r({transitionFn:function(){return n.__awaiter(u,void 0,void 0,(function(){return n.__generator(this,(function(n){return a.current[t].currentElementInfo.setIsOpened(!1),a.current[t].currentElementInfo=null,Object.keys(a.current).some((function(n){var r=a.current[n].name;return r===e.OPENNING||r===e.OPENED}))?[2]:[2,s(!1)]}))}))},plannedAfterTransitionFinishCb:function(){a.current[t].name=e.CLOSED}})}return{requestOpen:function(n){var r,i=n.id;switch((null===(r=a.current)||void 0===r?void 0:r[i])||(a.current[i]=o),a.current[n.id].name){case e.CLOSED:u(n);break;case e.OPENNING:case e.OPENED:t(n);break;case e.CLOSING:u(n)}},requestClose:function(n){var r,t=n.setIsOpened,u=n.id;switch((null===(r=a.current)||void 0===r?void 0:r[u])||(a.current[u]=o),a.current[u].name){case e.OPENNING:case e.OPENED:i(u);break;case e.CLOSING:case e.CLOSED:default:t(!1)}}}}),[s]);return r.jsx(u.Provider,n.__assign({value:l},{children:c}))},exports.useDcFullscreenElemsCoordinator=function(){return t.useContext(u)};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require('./../../../ext-esm/tslib/tslib.es6.js'),s=require("react/jsx-runtime"),a=require("classnames"),r=require("@material-ui/core"),i=require("@material-ui/icons/Link"),n=require("../../Button/index.js"),t=require("../../Search/utils/truncate.js"),c=require("../styles.js"),l=require("../../DevCenter/DevCenterRouterContext/UniversalLink/UniversalLink.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require('./../../../ext-esm/tslib/tslib.es6.js'),s=require("react/jsx-runtime"),a=require("classnames"),r=require("@material-ui/core"),i=require("@material-ui/icons/Link"),n=require("../../Button/index.js"),t=require("../../Search/utils/truncate.js"),c=require("../styles.js"),l=require("../../DevCenter/DevCenterRouterContext/UniversalLink/UniversalLink.js"),o=require("./DQAccordionDetailsContent.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=d(a),_=d(i);exports.DQUnvalidatedContent=function(a){var i=a.assetsData,d=a.maxHeight,m=a.onClick,h=a.onMouseLeave,x=a.onMouseEnter,j=c.useDQUnvalidatedContentStyles({maxHeight:d});return s.jsxs("div",e.__assign({className:j.container,onMouseLeave:h,onMouseEnter:x},{children:[s.jsxs("div",{children:[s.jsx(r.Typography,e.__assign({className:j.headerText,"data-testid":"Status_badge__DQ_unvalidated_content"},{children:"Data Quality"})),s.jsx(r.Typography,e.__assign({className:j.subheaderText},{children:"Fusion real-time data quality rules for app data"}))]}),s.jsx("div",e.__assign({className:j.relative},{children:s.jsx("div",e.__assign({className:j.accordionsWrapper},{children:Object.keys(i).map((function(a){var n,c=i[a];return s.jsxs(r.Accordion,e.__assign({className:j.accordion,defaultExpanded:!0},{children:[s.jsx(r.AccordionSummary,e.__assign({className:u.default("large","stretched")},{children:s.jsxs("div",e.__assign({className:j.headerWrapper},{children:[s.jsx("span",{children:t.truncateString(a,{maxChars:35,charsNumFromStart:13,charsNumFromEnd:12})}),s.jsx(l.UniversalLink,e.__assign({className:j.link,href:null===(n=c[0])||void 0===n?void 0:n.linkToDQPage},{children:s.jsx(_.default,{className:j.linkIcon})}))]}))})),s.jsx(r.AccordionDetails,e.__assign({className:j.accordionDetails},{children:s.jsx(o.DQAccordionDetailsContent,{assets:c})}))]}),a)}))}))})),s.jsx("div",e.__assign({className:j.reportDQIssueButtonWrapper},{children:s.jsx(n,e.__assign({className:j.reportDQIssueButton,onClick:m,variation:"secondary"},{children:"report data issue"}))}))]}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require('./../../ext-esm/tslib/tslib.es6.js'),t=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require('./../../ext-esm/tslib/tslib.es6.js'),t=require("react/jsx-runtime"),n=require("react"),a=require("moment"),s=require("classnames"),r=require("@material-ui/core"),o=require("../Tooltip/Tooltip.js");require("../Tooltip/ScrollableTooltip.js");var i=require("./constants.js"),c=require("./components/DQStatusIcon.js"),l=require("./components/DQUnvalidatedContent.js"),p=require("./components/ReportIssueModal.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=u(a),g=u(s),m=r.makeStyles((function(e){return{statusBadgeWrapper:{backgroundColor:e.palette.background.b4,display:"flex",height:30},statusBadgeContent:{display:"flex",padding:function(e){var t=e.isSuccessTypeIcon,n=e.isErrorTypeIcon;return"12px 0 2px ".concat(t||n?6:2,"px")},whiteSpace:"nowrap",width:"calc(100% - 140px)"},text:{fontSize:"10px",lineHeight:"12px",alignSelf:"center"},timestamp:{color:e.palette.primary.text6,marginLeft:function(e){return e.isIconExist&&4}},warningMessage:{color:e.palette.primary.text1,marginLeft:4,textOverflow:"ellipsis",overflow:"hidden",fontSize:"12px"},badgeIconWarning:{marginLeft:8},popper:{zIndex:1,"& .MuiTooltip-tooltip":{position:"absolute",bottom:0,width:"max-content",transformOrigin:"center top",maxWidth:"none",padding:4,fontSize:12,boxShadow:"0px 0px 4px 2px rgb(0 0 0 / 12%)",fontWeight:400,lineHeight:"16px",letterSpacing:"0.4px",backgroundColor:e.palette.background.b9}},DQIconWrapper:{display:"flex",alignItems:"center",alignSelf:"center",justifyContent:"center",height:24,width:24,minWidth:24,borderRadius:12,"&:hover":{backgroundColor:function(e){var t=e.isErrorTypeIcon,n=e.isSuccessTypeIcon;return t?"rgba(244, 67, 54, 0.1)":n?"rgba(117, 219, 41, 0.2)":"transparent"}}}}}));exports.StatusBadge=function(a){var s=a.assetsData,u=void 0===s?{}:s,x=a.appWidth,f=a.DQIssueTooltipMaxHeight,_=a.iconType,S=a.className,T=a.lastTimestamp,h=a.onReportErrorClick,I=a.warningData,b=n.useState(!1),v=b[0],j=b[1],y=n.useState(!1),N=y[0],D=y[1],E=n.useState(null),C=E[0],W=E[1],w=null==I?void 0:I.message,M=_==i.BADGE_ICON_STATUSES.error,A=_==i.BADGE_ICON_STATUSES.success,q=x<i.MAX_MOBILE_WIDTH,B=m({isIconExist:!!_,isSuccessTypeIcon:A,isErrorTypeIcon:M});n.useEffect((function(){return function(){return clearTimeout(C)}}),[]);var Q=function(){clearTimeout(C),D(!0)},k=function(){var e=setTimeout((function(){return D(!1)}),700);W(e)};return t.jsxs("div",e.__assign({"data-testid":"Status_badge",className:g.default(B.statusBadgeWrapper,"c-status-badge--".concat(_),S)},{children:[t.jsxs("div",e.__assign({className:B.statusBadgeContent},{children:[_&&t.jsx(o.Tooltip,e.__assign({disableHoverListener:!0,open:N,onMouseEnter:Q,onMouseLeave:k,PopperProps:{className:B.popper},placement:"top-start",title:t.jsx(l.DQUnvalidatedContent,{onMouseEnter:Q,onMouseLeave:k,assetsData:u,maxHeight:f,onClick:function(){return j(!0)}})},{children:t.jsx("div",e.__assign({className:B.DQIconWrapper,"data-testid":"".concat("Status_badge","__DQ_icon_").concat(_)},{children:t.jsx(c.DQStatusIcon,{color:_,iconType:_})}))})),T&&t.jsxs(r.Typography,e.__assign({className:g.default(B.text,B.timestamp),variant:"body1"},{children:["Last Update: ",d.default.unix(T).format("M/D/YYYY h:mm a")]})),I&&t.jsxs(t.Fragment,{children:[t.jsx(o.Tooltip,e.__assign({placement:"top",title:w?"".concat(i.WARNING,". ").concat(w):i.WARNING},{children:t.jsx("div",e.__assign({"data-testid":"".concat("Status_badge","__DQ_icon_warning")},{children:t.jsx(c.DQStatusIcon,{className:B.badgeIconWarning,color:i.BADGE_ICON_STATUSES.warning,iconType:i.BADGE_ICON_STATUSES.warning})}))})),!q&&t.jsx(r.Typography,e.__assign({className:g.default(B.text,B.warningMessage),variant:"body1"},{children:w?"".concat(i.WARNING,". ").concat(w):i.WARNING}))]})]})),t.jsx(p.ReportIssueModal,{assets:Object.keys(u).map((function(e){return{name:e,id:u[e][0].alert.assetId}})),open:v,onSave:h,onClose:function(){return j(!1)}})]}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as n,__awaiter as r,__generator as e}from'./../../../../../ext-esm/tslib/tslib.es6.js';import{jsx as t}from"react/jsx-runtime";import{createContext as i,useRef as u,useMemo as c,useContext as o}from"react";var s;!function(n){n.CLOSED="CLOSED",n.OPENNING="OPENNING",n.OPENED="OPENED",n.CLOSING="CLOSING"}(s||(s={}));var a=i(null),l=function(i){var o=i.setIsFullscreenModalMode,l=i.children,f={name:s.CLOSED,currentElementInfo:null},E=u({}),N=c((function(){function n(n){var t=n.transitionFn,i=n.plannedAfterTransitionFinishCb;return r(this,void 0,void 0,(function(){var n;return e(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,t()];case 1:return r.sent(),[3,3];case 2:return n=r.sent(),console.error("Transition error: ",n),[3,3];case 3:return i(),[2]}}))}))}function t(n){var r=n.id;E.current[
|
|
1
|
+
import{__assign as n,__awaiter as r,__generator as e}from'./../../../../../ext-esm/tslib/tslib.es6.js';import{jsx as t}from"react/jsx-runtime";import{createContext as i,useRef as u,useMemo as c,useContext as o}from"react";var s;!function(n){n.CLOSED="CLOSED",n.OPENNING="OPENNING",n.OPENED="OPENED",n.CLOSING="CLOSING"}(s||(s={}));var a=i(null),l=function(i){var o=i.setIsFullscreenModalMode,l=i.children,f={name:s.CLOSED,currentElementInfo:null},E=u({}),N=c((function(){function n(n){var t=n.transitionFn,i=n.plannedAfterTransitionFinishCb;return r(this,void 0,void 0,(function(){var n;return e(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,t()];case 1:return r.sent(),[3,3];case 2:return n=r.sent(),console.error("Transition error: ",n),[3,3];case 3:return i(),[2]}}))}))}function t(n){var r,e=n.id;E.current[e]={name:s.OPENED,currentElementInfo:n},null===(r=E.current[e].currentElementInfo)||void 0===r||r.setIsOpened(!0)}function i(r){var e=r.id;E.current[e]={name:s.OPENNING,currentElementInfo:null},n({transitionFn:function(){return o(!0)},plannedAfterTransitionFinishCb:function(){t(r)}})}function u(t){var i=this;E.current[t].name=s.CLOSING,n({transitionFn:function(){return r(i,void 0,void 0,(function(){return e(this,(function(n){return E.current[t].currentElementInfo.setIsOpened(!1),E.current[t].currentElementInfo=null,Object.keys(E.current).some((function(n){var r=E.current[n].name;return r===s.OPENNING||r===s.OPENED}))?[2]:[2,o(!1)]}))}))},plannedAfterTransitionFinishCb:function(){E.current[t].name=s.CLOSED}})}return{requestOpen:function(n){var r,e=n.id;switch((null===(r=E.current)||void 0===r?void 0:r[e])||(E.current[e]=f),E.current[n.id].name){case s.CLOSED:i(n);break;case s.OPENNING:case s.OPENED:t(n);break;case s.CLOSING:i(n)}},requestClose:function(n){var r,e=n.setIsOpened,t=n.id;switch((null===(r=E.current)||void 0===r?void 0:r[t])||(E.current[t]=f),E.current[t].name){case s.OPENNING:case s.OPENED:u(t);break;case s.CLOSING:case s.CLOSED:default:e(!1)}}}}),[o]);return t(a.Provider,n({value:N},{children:l}))};function f(){return o(a)}export{l as DcFullscreenElemsCoordinatorProvider,f as useDcFullscreenElemsCoordinator};
|
|
@@ -4,7 +4,9 @@ declare type DQUnvalidatedContentProps = {
|
|
|
4
4
|
assetsData?: AssetData;
|
|
5
5
|
maxHeight?: number;
|
|
6
6
|
onClick: () => void;
|
|
7
|
+
onMouseLeave: () => void;
|
|
8
|
+
onMouseEnter: () => void;
|
|
7
9
|
};
|
|
8
|
-
export declare const DQUnvalidatedContent: ({ assetsData, maxHeight, onClick }: DQUnvalidatedContentProps) => JSX.Element;
|
|
10
|
+
export declare const DQUnvalidatedContent: ({ assetsData, maxHeight, onClick, onMouseLeave, onMouseEnter, }: DQUnvalidatedContentProps) => JSX.Element;
|
|
9
11
|
export {};
|
|
10
12
|
//# sourceMappingURL=DQUnvalidatedContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DQUnvalidatedContent.d.ts","sourceRoot":"","sources":["../../../../src/components/StatusBadge/components/DQUnvalidatedContent.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAM/D,aAAK,yBAAyB,GAAG;IAC/B,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"DQUnvalidatedContent.d.ts","sourceRoot":"","sources":["../../../../src/components/StatusBadge/components/DQUnvalidatedContent.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAM/D,aAAK,yBAAyB,GAAG;IAC/B,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B,CAAA;AAED,eAAO,MAAM,oBAAoB,oEAM9B,yBAAyB,KAAG,WAwD9B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as e}from'./../../../ext-esm/tslib/tslib.es6.js';import{jsxs as a,jsx as r}from"react/jsx-runtime";import
|
|
1
|
+
import{__assign as e}from'./../../../ext-esm/tslib/tslib.es6.js';import{jsxs as a,jsx as r}from"react/jsx-runtime";import s from"classnames";import{Typography as t,Accordion as i,AccordionSummary as n,AccordionDetails as o}from"@material-ui/core";import l from"@material-ui/icons/Link";import c from"../../Button/index.js";import{truncateString as m}from"../../Search/utils/truncate.js";import{useDQUnvalidatedContentStyles as d}from"../styles.js";import{UniversalLink as u}from"../../DevCenter/DevCenterRouterContext/UniversalLink/UniversalLink.js";import{DQAccordionDetailsContent as h}from"./DQAccordionDetailsContent.js";var p=function(p){var v=p.assetsData,f=p.maxHeight,N=p.onClick,D=p.onMouseLeave,x=p.onMouseEnter,k=d({maxHeight:f});return a("div",e({className:k.container,onMouseLeave:D,onMouseEnter:x},{children:[a("div",{children:[r(t,e({className:k.headerText,"data-testid":"Status_badge__DQ_unvalidated_content"},{children:"Data Quality"})),r(t,e({className:k.subheaderText},{children:"Fusion real-time data quality rules for app data"}))]}),r("div",e({className:k.relative},{children:r("div",e({className:k.accordionsWrapper},{children:Object.keys(v).map((function(t){var c,d=v[t];return a(i,e({className:k.accordion,defaultExpanded:!0},{children:[r(n,e({className:s("large","stretched")},{children:a("div",e({className:k.headerWrapper},{children:[r("span",{children:m(t,{maxChars:35,charsNumFromStart:13,charsNumFromEnd:12})}),r(u,e({className:k.link,href:null===(c=d[0])||void 0===c?void 0:c.linkToDQPage},{children:r(l,{className:k.linkIcon})}))]}))})),r(o,e({className:k.accordionDetails},{children:r(h,{assets:d})}))]}),t)}))}))})),r("div",e({className:k.reportDQIssueButtonWrapper},{children:r(c,e({className:k.reportDQIssueButton,onClick:N,variation:"secondary"},{children:"report data issue"}))}))]}))};export{p as DQUnvalidatedContent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/StatusBadge/index.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAkD,SAAS,EAAE,MAAM,aAAa,CAAC;AAgFxF,aAAK,gBAAgB,GAAG;IACtB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACnE,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACnC,CAAC;AAEF,eAAO,MAAM,WAAW,4HASrB,gBAAgB,KAAG,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/StatusBadge/index.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAkD,SAAS,EAAE,MAAM,aAAa,CAAC;AAgFxF,aAAK,gBAAgB,GAAG;IACtB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACnE,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACnC,CAAC;AAEF,eAAO,MAAM,WAAW,4HASrB,gBAAgB,KAAG,WAuGrB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as t}from'./../../ext-esm/tslib/tslib.es6.js';import{jsxs as e,jsx as o,Fragment as
|
|
1
|
+
import{__assign as t}from'./../../ext-esm/tslib/tslib.es6.js';import{jsxs as e,jsx as o,Fragment as n}from"react/jsx-runtime";import{useState as a,useEffect as r}from"react";import i from"moment";import s from"classnames";import{makeStyles as c,Typography as p}from"@material-ui/core";import{Tooltip as l}from"../Tooltip/Tooltip.js";import"../Tooltip/ScrollableTooltip.js";import{WARNING as m,BADGE_ICON_STATUSES as d,MAX_MOBILE_WIDTH as u}from"./constants.js";import{DQStatusIcon as g}from"./components/DQStatusIcon.js";import{DQUnvalidatedContent as f}from"./components/DQUnvalidatedContent.js";import{ReportIssueModal as x}from"./components/ReportIssueModal.js";var h=c((function(t){return{statusBadgeWrapper:{backgroundColor:t.palette.background.b4,display:"flex",height:30},statusBadgeContent:{display:"flex",padding:function(t){var e=t.isSuccessTypeIcon,o=t.isErrorTypeIcon;return"12px 0 2px ".concat(e||o?6:2,"px")},whiteSpace:"nowrap",width:"calc(100% - 140px)"},text:{fontSize:"10px",lineHeight:"12px",alignSelf:"center"},timestamp:{color:t.palette.primary.text6,marginLeft:function(t){return t.isIconExist&&4}},warningMessage:{color:t.palette.primary.text1,marginLeft:4,textOverflow:"ellipsis",overflow:"hidden",fontSize:"12px"},badgeIconWarning:{marginLeft:8},popper:{zIndex:1,"& .MuiTooltip-tooltip":{position:"absolute",bottom:0,width:"max-content",transformOrigin:"center top",maxWidth:"none",padding:4,fontSize:12,boxShadow:"0px 0px 4px 2px rgb(0 0 0 / 12%)",fontWeight:400,lineHeight:"16px",letterSpacing:"0.4px",backgroundColor:t.palette.background.b9}},DQIconWrapper:{display:"flex",alignItems:"center",alignSelf:"center",justifyContent:"center",height:24,width:24,minWidth:24,borderRadius:12,"&:hover":{backgroundColor:function(t){var e=t.isErrorTypeIcon,o=t.isSuccessTypeIcon;return e?"rgba(244, 67, 54, 0.1)":o?"rgba(117, 219, 41, 0.2)":"transparent"}}}}})),b=function(c){var b=c.assetsData,v=void 0===b?{}:b,T=c.appWidth,y=c.DQIssueTooltipMaxHeight,I=c.iconType,S=c.className,w=c.lastTimestamp,_=c.onReportErrorClick,D=c.warningData,j=a(!1),C=j[0],M=j[1],W=a(!1),k=W[0],E=W[1],N=a(null),L=N[0],Q=N[1],H=null==D?void 0:D.message,z=I==d.error,B=I==d.success,Y=T<u,O=h({isIconExist:!!I,isSuccessTypeIcon:B,isErrorTypeIcon:z});r((function(){return function(){return clearTimeout(L)}}),[]);var R=function(){clearTimeout(L),E(!0)},P=function(){var t=setTimeout((function(){return E(!1)}),700);Q(t)};return e("div",t({"data-testid":"Status_badge",className:s(O.statusBadgeWrapper,"c-status-badge--".concat(I),S)},{children:[e("div",t({className:O.statusBadgeContent},{children:[I&&o(l,t({disableHoverListener:!0,open:k,onMouseEnter:R,onMouseLeave:P,PopperProps:{className:O.popper},placement:"top-start",title:o(f,{onMouseEnter:R,onMouseLeave:P,assetsData:v,maxHeight:y,onClick:function(){return M(!0)}})},{children:o("div",t({className:O.DQIconWrapper,"data-testid":"".concat("Status_badge","__DQ_icon_").concat(I)},{children:o(g,{color:I,iconType:I})}))})),w&&e(p,t({className:s(O.text,O.timestamp),variant:"body1"},{children:["Last Update: ",i.unix(w).format("M/D/YYYY h:mm a")]})),D&&e(n,{children:[o(l,t({placement:"top",title:H?"".concat(m,". ").concat(H):m},{children:o("div",t({"data-testid":"".concat("Status_badge","__DQ_icon_warning")},{children:o(g,{className:O.badgeIconWarning,color:d.warning,iconType:d.warning})}))})),!Y&&o(p,t({className:s(O.text,O.warningMessage),variant:"body1"},{children:H?"".concat(m,". ").concat(H):m}))]})]})),o(x,{assets:Object.keys(v).map((function(t){return{name:t,id:v[t][0].alert.assetId}})),open:C,onSave:_,onClose:function(){return M(!1)}})]}))};export{b as StatusBadge};
|