@corva/ui 3.2.0-1 → 3.2.0-2

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/slicedToArray"),a=require("react"),s=require("lodash"),n=require("prop-types"),i=require("classnames"),r=require("@material-ui/core"),l=require("../../AssetNameLabel/SecondaryAssetNameLabel.js"),d=require("../../AssetNameLabel/AssetNameLabel.js"),o=require("./VersionBadge.js"),u=require("./PadMode.js"),p=require("./utils.js"),c=require("./PadIcon.js"),f=require("./AppHeaderStyles.js"),m=require("./AppHeader.css.js"),g=require("../../Annotations/components/LastAnnotation/index.js"),v=require("../../../constants/segment.js"),j=require("../../../constants/devcenter.js");require("../../../constants/goals.js"),require("../../../constants/alerts.js"),require("../../../constants/apps.js"),require("../../../constants/drillstring.js"),require("../../../constants/completion.js"),require("../../../constants/appPackages.js"),require("../../../constants/notifications.js"),require("../../../constants/feed.js"),require("../../../constants/bha.js"),require("../../../utils/env.js"),require("../../GradientManager/configuration/constants.js");var A=require("../../../utils/devcenter.js"),h=require("react/jsx-runtime");function b(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var y=b(e),S=b(t),x=b(n),P=b(i);function N(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,s)}return a}function q(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?N(Object(a),!0).forEach((function(t){y.default(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):N(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}var L="DevCenter_AppHeader",_=function(e){return(null==e?void 0:e.asset_id)&&"/assets/".concat(null==e?void 0:e.asset_id)};function I(e){var t,n,i,u,b,y,x,N,I,O,M,w,C,E=e.app,T=e.appLastAnnotation,W=e.appSettings,k=e.badge,D=e.children,F=e.classes,B=e.coordinates,H=e.currentUser,R=e.fracFleet,U=e.isMaximized,V=e.logoSrc,G=e.onSettingChange,z=e.openAnnotationsList,Y=e.primaryAssetStatusBadge,Z=e.rig,J=e.showLastAnnotation,K=e.updateCurrentDashboardAppLastAnnotation,Q=e.well,X=e.wells,$=e.PadModeComponent,ee=e.activeWellName,te=a.useState(!1),ae=S.default(te,2),se=ae[0],ne=ae[1],ie=a.useRef(null),re=null==B?void 0:B.pixelWidth;a.useEffect((function(){var e,t;ne((null===(e=ie.current)||void 0===e?void 0:e.scrollWidth)>(null===(t=ie.current)||void 0===t?void 0:t.offsetWidth))}),[null===(t=ie.current)||void 0===t?void 0:t.offsetWidth,re]);var le=p.getAppDimension(re),de=A.getAppName(E),oe=A.getAppSegment(E),ue=oe===v.SEGMENTS.COMPLETION,pe=function(e){var t,a=e.appSettings,s=void 0===a?{}:a,n=e.well,i=e.rig,r=e.fracFleet,l=e.segment,d=l===v.SEGMENTS.DRILLING,o=l===v.SEGMENTS.COMPLETION,u=s.wellId,p=s.rigId,c=s.fracFleetId,f=s.padId,m=null==r||null===(t=r.pad_frac_fleets.find((function(e){return e.pad.id===(f||r.current_pad_id)})))||void 0===t?void 0:t.pad,g=d?u&&(null==n?void 0:n.name):null==m?void 0:m.name,j="/assets/types/pad/".concat(f||(null==r?void 0:r.current_pad_id)),A=d?null==i?void 0:i.name:null==r?void 0:r.name,h=!!(u||p||c),b=!1,y=d?A&&_(n):j;return o&&!h&&null!=n&&n.id&&null!=n&&n.name&&(b=!0,h=!0,y=_(n),A=n.name),{isPrimaryAssetStatusVisible:b,isPrimaryNameVisible:h,primaryAssetLink:y,primaryAssetName:A,secondaryAssetLink:d?_(n):"/assets/types/pad/".concat(f||(null==r?void 0:r.current_pad_id)),secondaryAssetName:g}}({appSettings:null==E?void 0:E.settings,well:Q,rig:Z,fracFleet:R,segment:oe}),ce=pe.isPrimaryAssetStatusVisible,fe=pe.isPrimaryNameVisible,me=pe.primaryAssetLink,ge=pe.primaryAssetName,ve=pe.secondaryAssetLink,je=pe.secondaryAssetName,Ae=[p.APP_LAYOUT_SIZES.MEDIUM,p.APP_LAYOUT_SIZES.SMALL].includes(le),he=E&&E.id===j.DEV_CENTER_CLI_APP_ID,be={fracFleet:R,wells:X,well:Q,onSettingChange:G,appSettings:W,disableActiveWellsInPadSelect:null==E||null===(n=E.package)||void 0===n||null===(i=n.manifest)||void 0===i||null===(u=i.application)||void 0===u||null===(b=u.ui)||void 0===b?void 0:b.disableActiveWellsInPadSelect,enableSimulFracInPadSelect:null==E||null===(y=E.package)||void 0===y||null===(x=y.manifest)||void 0===x||null===(N=x.application)||void 0===N||null===(I=N.ui)||void 0===I?void 0:I.enableSimulFracInPadSelect,completionAppType:null==E||null===(O=E.package)||void 0===O||null===(M=O.manifest)||void 0===M||null===(w=M.application)||void 0===w||null===(C=w.ui)||void 0===C?void 0:C.completionAppType},ye=f.useStyles({isMobileSize:Ae});return h.jsxs("div",{className:P.default(ye.appHeaderWrapper,F.appHeader),children:[h.jsxs("div",{className:ye.appHeaderContainer,children:[h.jsx("div",{className:P.default(ye.titleBlock,F.titleBlock),children:h.jsxs("div",{className:F.appHeaderTitleWrapper,ref:ie,children:[h.jsxs("div",{className:ye.titleWrapper,children:[V&&h.jsxs(h.Fragment,{children:[h.jsx("img",{className:ye.logo,src:V,alt:"company logo"}),h.jsx("div",{className:ye.separateLine})]}),h.jsx(r.Tooltip,{title:se?de:"",placement:"bottom",children:h.jsx("h6",{"data-testid":"".concat(L,"_name"),className:ye.title,children:de})}),h.jsx(o.VersionBadge,{appPackage:null==E?void 0:E.package})]}),k]})}),E&&B&&h.jsxs("div",{className:P.default(m.controlsContainer,U&&m.appMaximized),children:[!Ae&&h.jsxs(h.Fragment,{children:[ue&&ee&&h.jsx(r.Typography,{variant:"caption",children:ee}),ue&&h.jsx($,q({},be)),D]}),h.jsxs("div",{className:m.assetLabels,children:[je&&h.jsx(l.SecondaryAssetNameLabel,{assetName:je,coordinatesPixelWidth:re,dataTestId:"".concat(L,"_secondaryAsset"),href:!he&&ve,icon:ue&&h.jsx(c.PadIcon,{}),isColored:!ue||E.settings.padId&&E.settings.padId!==R.current_pad_id}),fe&&h.jsx(d.AssetNameLabel,{assetName:ge,coordinatesPixelWidth:re,dataTestId:"".concat(L,"_primaryAsset"),href:!he&&me,statusBadge:ce&&Y})]})]}),J&&T&&h.jsx(g,{annotation:T,appId:s.get(E,["app","id"]),currentUser:H,dashboardAppId:E.id,openAnnotationsList:z,updateCurrentDashboardAppLastAnnotation:K})]}),Ae&&h.jsxs(r.Box,{display:"flex",alignItems:"center",mt:1,children:[ue&&!Q&&(X||R)&&h.jsx("div",{className:m.padModeSelect,children:h.jsx($,q({},be))}),D]})]})}I.propTypes={app:x.default.object.isRequired,badge:x.default.node,classes:x.default.shape({appHeader:x.default.string,titleBlock:x.default.string,appHeaderTitleWrapper:x.default.string}),showLastAnnotation:x.default.bool,currentUser:x.default.shape({}),appLastAnnotation:x.default.shape({}),updateCurrentDashboardAppLastAnnotation:x.default.func,openAnnotationsList:x.default.func,rig:x.default.shape({name:x.default.string,asset_id:x.default.number}),well:x.default.shape({name:x.default.string,asset_id:x.default.number}),fracFleet:x.default.shape({name:x.default.string,current_pad_id:x.default.number,pad_frac_fleets:x.default.arrayOf(x.default.shape({pad:x.default.shape({id:x.default.number.isRequired,name:x.default.string}).isRequired})).isRequired}),wells:x.default.arrayOf(x.default.shape({})),coordinates:x.default.shape({pixelWidth:x.default.number.isRequired}),isMaximized:x.default.bool,appSettings:x.default.shape({}),onSettingChange:x.default.func,children:x.default.node,logoSrc:x.default.string,primaryAssetStatusBadge:x.default.node,PadModeComponent:x.default.elementType,activeWellName:x.default.string},I.defaultProps={appLastAnnotation:null,appSettings:null,badge:null,children:null,classes:{},coordinates:void 0,currentUser:void 0,fracFleet:null,isMaximized:!1,logoSrc:null,onSettingChange:void 0,openAnnotationsList:void 0,rig:null,showLastAnnotation:!0,updateCurrentDashboardAppLastAnnotation:function(){},well:null,wells:null,primaryAssetStatusBadge:null,PadModeComponent:u,activeWellName:null},exports.PAGE_NAME=L,exports.default=I;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/slicedToArray"),a=require("react"),s=require("lodash"),n=require("prop-types"),i=require("classnames"),r=require("@material-ui/core"),l=require("../../AssetNameLabel/SecondaryAssetNameLabel.js"),d=require("../../AssetNameLabel/AssetNameLabel.js"),o=require("./VersionBadge.js"),u=require("./PadMode.js"),p=require("./utils.js"),c=require("./PadIcon.js"),f=require("./AppHeaderStyles.js"),m=require("./AppHeader.css.js"),g=require("../../Annotations/components/LastAnnotation/index.js"),v=require("../../../constants/segment.js"),j=require("../../../constants/devcenter.js");require("../../../constants/goals.js"),require("../../../constants/alerts.js"),require("../../../constants/apps.js"),require("../../../constants/drillstring.js"),require("../../../constants/completion.js"),require("../../../constants/appPackages.js"),require("../../../constants/notifications.js"),require("../../../constants/feed.js"),require("../../../constants/bha.js"),require("../../../utils/env.js"),require("../../GradientManager/configuration/constants.js");var A=require("../../../utils/devcenter.js"),h=require("../../../utils/mobileDetect.js"),b=require("react/jsx-runtime");function y(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var S=y(e),x=y(t),N=y(n),P=y(i);function q(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,s)}return a}function L(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?q(Object(a),!0).forEach((function(t){S.default(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):q(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}var _="DevCenter_AppHeader",I=function(e){return(null==e?void 0:e.asset_id)&&"/assets/".concat(null==e?void 0:e.asset_id)};function O(e){var t,n,i,u,y,S,N,q,O,M,w,C,E,T=e.app,W=e.appLastAnnotation,D=e.appSettings,k=e.badge,F=e.children,B=e.classes,H=e.coordinates,R=e.currentUser,U=e.fracFleet,V=e.isMaximized,G=e.logoSrc,z=e.onSettingChange,Y=e.openAnnotationsList,Z=e.primaryAssetStatusBadge,J=e.rig,K=e.showLastAnnotation,Q=e.updateCurrentDashboardAppLastAnnotation,X=e.well,$=e.wells,ee=e.PadModeComponent,te=e.activeWellName,ae=a.useState(!1),se=x.default(ae,2),ne=se[0],ie=se[1],re=a.useRef(null),le=null==H?void 0:H.pixelWidth;a.useEffect((function(){var e,t;ie((null===(e=re.current)||void 0===e?void 0:e.scrollWidth)>(null===(t=re.current)||void 0===t?void 0:t.offsetWidth))}),[null===(t=re.current)||void 0===t?void 0:t.offsetWidth,le]);var de=p.getAppDimension(le),oe=A.getAppName(T),ue=A.getAppSegment(T),pe=ue===v.SEGMENTS.COMPLETION,ce=function(e){var t,a=e.appSettings,s=void 0===a?{}:a,n=e.well,i=e.rig,r=e.fracFleet,l=e.segment,d=l===v.SEGMENTS.DRILLING,o=l===v.SEGMENTS.COMPLETION,u=s.wellId,p=s.rigId,c=s.fracFleetId,f=s.padId,m=null==r||null===(t=r.pad_frac_fleets.find((function(e){return e.pad.id===(f||r.current_pad_id)})))||void 0===t?void 0:t.pad,g=d?u&&(null==n?void 0:n.name):null==m?void 0:m.name,j="/assets/types/pad/".concat(f||(null==r?void 0:r.current_pad_id)),A=d?null==i?void 0:i.name:null==r?void 0:r.name,h=!!(u||p||c),b=!1,y=d?A&&I(n):j;return o&&!h&&null!=n&&n.id&&null!=n&&n.name&&(b=!0,h=!0,y=I(n),A=n.name),{isPrimaryAssetStatusVisible:b,isPrimaryNameVisible:h,primaryAssetLink:y,primaryAssetName:A,secondaryAssetLink:d?I(n):"/assets/types/pad/".concat(f||(null==r?void 0:r.current_pad_id)),secondaryAssetName:g}}({appSettings:null==T?void 0:T.settings,well:X,rig:J,fracFleet:U,segment:ue}),fe=ce.isPrimaryAssetStatusVisible,me=ce.isPrimaryNameVisible,ge=ce.primaryAssetLink,ve=ce.primaryAssetName,je=ce.secondaryAssetLink,Ae=ce.secondaryAssetName,he=[p.APP_LAYOUT_SIZES.MEDIUM,p.APP_LAYOUT_SIZES.SMALL].includes(de),be=T&&T.id===j.DEV_CENTER_CLI_APP_ID,ye={fracFleet:U,wells:$,well:X,onSettingChange:z,appSettings:D,disableActiveWellsInPadSelect:null==T||null===(n=T.package)||void 0===n||null===(i=n.manifest)||void 0===i||null===(u=i.application)||void 0===u||null===(y=u.ui)||void 0===y?void 0:y.disableActiveWellsInPadSelect,enableSimulFracInPadSelect:null==T||null===(S=T.package)||void 0===S||null===(N=S.manifest)||void 0===N||null===(q=N.application)||void 0===q||null===(O=q.ui)||void 0===O?void 0:O.enableSimulFracInPadSelect,completionAppType:null==T||null===(M=T.package)||void 0===M||null===(w=M.manifest)||void 0===w||null===(C=w.application)||void 0===C||null===(E=C.ui)||void 0===E?void 0:E.completionAppType},Se=f.useStyles({isMobileSize:he});return b.jsxs("div",{className:P.default(Se.appHeaderWrapper,B.appHeader),children:[b.jsxs("div",{className:Se.appHeaderContainer,children:[b.jsx("div",{className:P.default(Se.titleBlock,B.titleBlock),children:b.jsxs("div",{className:B.appHeaderTitleWrapper,ref:re,children:[b.jsxs("div",{className:Se.titleWrapper,children:[G&&b.jsxs(b.Fragment,{children:[b.jsx("img",{className:Se.logo,src:G,alt:"company logo"}),b.jsx("div",{className:Se.separateLine})]}),b.jsx(r.Tooltip,{title:ne?oe:"",placement:"bottom",children:b.jsx("h6",{"data-testid":"".concat(_,"_name"),className:Se.title,children:oe})}),b.jsx(o.VersionBadge,{appPackage:null==T?void 0:T.package})]}),k]})}),T&&H&&b.jsxs("div",{className:P.default(m.controlsContainer,V&&m.appMaximized),children:[!he&&b.jsxs(b.Fragment,{children:[pe&&te&&b.jsx(r.Typography,{variant:"caption",children:te}),pe&&b.jsx(ee,L({},ye)),F]}),!h.isInsideNewMobileApp&&b.jsxs("div",{className:m.assetLabels,children:[Ae&&b.jsx(l.SecondaryAssetNameLabel,{assetName:Ae,coordinatesPixelWidth:le,dataTestId:"".concat(_,"_secondaryAsset"),href:!be&&je,icon:pe&&b.jsx(c.PadIcon,{}),isColored:!pe||T.settings.padId&&T.settings.padId!==U.current_pad_id}),me&&b.jsx(d.AssetNameLabel,{assetName:ve,coordinatesPixelWidth:le,dataTestId:"".concat(_,"_primaryAsset"),href:!be&&ge,statusBadge:fe&&Z})]})]}),K&&W&&b.jsx(g,{annotation:W,appId:s.get(T,["app","id"]),currentUser:R,dashboardAppId:T.id,openAnnotationsList:Y,updateCurrentDashboardAppLastAnnotation:Q})]}),he&&b.jsxs(r.Box,{display:"flex",alignItems:"center",mt:1,children:[pe&&!X&&($||U)&&b.jsx("div",{className:m.padModeSelect,children:b.jsx(ee,L({},ye))}),F]})]})}O.propTypes={app:N.default.object.isRequired,badge:N.default.node,classes:N.default.shape({appHeader:N.default.string,titleBlock:N.default.string,appHeaderTitleWrapper:N.default.string}),showLastAnnotation:N.default.bool,currentUser:N.default.shape({}),appLastAnnotation:N.default.shape({}),updateCurrentDashboardAppLastAnnotation:N.default.func,openAnnotationsList:N.default.func,rig:N.default.shape({name:N.default.string,asset_id:N.default.number}),well:N.default.shape({name:N.default.string,asset_id:N.default.number}),fracFleet:N.default.shape({name:N.default.string,current_pad_id:N.default.number,pad_frac_fleets:N.default.arrayOf(N.default.shape({pad:N.default.shape({id:N.default.number.isRequired,name:N.default.string}).isRequired})).isRequired}),wells:N.default.arrayOf(N.default.shape({})),coordinates:N.default.shape({pixelWidth:N.default.number.isRequired}),isMaximized:N.default.bool,appSettings:N.default.shape({}),onSettingChange:N.default.func,children:N.default.node,logoSrc:N.default.string,primaryAssetStatusBadge:N.default.node,PadModeComponent:N.default.elementType,activeWellName:N.default.string},O.defaultProps={appLastAnnotation:null,appSettings:null,badge:null,children:null,classes:{},coordinates:void 0,currentUser:void 0,fracFleet:null,isMaximized:!1,logoSrc:null,onSettingChange:void 0,openAnnotationsList:void 0,rig:null,showLastAnnotation:!0,updateCurrentDashboardAppLastAnnotation:function(){},well:null,wells:null,primaryAssetStatusBadge:null,PadModeComponent:u,activeWellName:null},exports.PAGE_NAME=_,exports.default=O;
@@ -1 +1 @@
1
- {"version":3,"file":"AppHeader.d.ts","sourceRoot":"","sources":["../../../../src/components/DevCenter/AppHeader/AppHeader.js"],"names":[],"mappings":"AAsBA,8CAA+C;;AA4C/C;;;;;;;;;;;;;;;;;;;;;;gBAkJC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA8D0C,kEAAQ;;;;;;;;;;;;;sBAhR7B,YAAY;oBAQd,WAAW"}
1
+ {"version":3,"file":"AppHeader.d.ts","sourceRoot":"","sources":["../../../../src/components/DevCenter/AppHeader/AppHeader.js"],"names":[],"mappings":"AAuBA,8CAA+C;;AA4C/C;;;;;;;;;;;;;;;;;;;;;;gBAoJC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA8D0C,kEAAQ;;;;;;;;;;;;;sBAnR7B,YAAY;oBAQd,WAAW"}
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/slicedToArray";import{useState as a,useRef as n,useEffect as i}from"react";import{get as s}from"lodash";import r from"prop-types";import o from"classnames";import{Tooltip as l,Typography as p,Box as d}from"@material-ui/core";import{SecondaryAssetNameLabel as c}from"../../AssetNameLabel/SecondaryAssetNameLabel.js";import{AssetNameLabel as m}from"../../AssetNameLabel/AssetNameLabel.js";import{VersionBadge as u}from"./VersionBadge.js";import f from"./PadMode.js";import{APP_LAYOUT_SIZES as g,getAppDimension as v}from"./utils.js";import{PadIcon as h}from"./PadIcon.js";import{useStyles as b}from"./AppHeaderStyles.js";import A from"./AppHeader.css.js";import y from"../../Annotations/components/LastAnnotation/index.js";import{SEGMENTS as j}from"../../../constants/segment.js";import{DEV_CENTER_CLI_APP_ID as L}from"../../../constants/devcenter.js";import"../../../constants/goals.js";import"../../../constants/alerts.js";import"../../../constants/apps.js";import"../../../constants/drillstring.js";import"../../../constants/completion.js";import"../../../constants/appPackages.js";import"../../../constants/notifications.js";import"../../../constants/feed.js";import"../../../constants/bha.js";import"../../../utils/env.js";import"../../GradientManager/configuration/constants.js";import{getAppName as S,getAppSegment as N}from"../../../utils/devcenter.js";import{jsxs as P,jsx as O,Fragment as _}from"react/jsx-runtime";function I(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function w(t){for(var a=1;a<arguments.length;a++){var n=null!=arguments[a]?arguments[a]:{};a%2?I(Object(n),!0).forEach((function(a){e(t,a,n[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):I(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var C="DevCenter_AppHeader",M=function(e){return(null==e?void 0:e.asset_id)&&"/assets/".concat(null==e?void 0:e.asset_id)};function W(e){var r,f,I,W,k,x,D,T,F,H,B,R,q,z=e.app,E=e.appLastAnnotation,U=e.appSettings,V=e.badge,G=e.children,J=e.classes,K=e.coordinates,Q=e.currentUser,X=e.fracFleet,Y=e.isMaximized,Z=e.logoSrc,$=e.onSettingChange,ee=e.openAnnotationsList,te=e.primaryAssetStatusBadge,ae=e.rig,ne=e.showLastAnnotation,ie=e.updateCurrentDashboardAppLastAnnotation,se=e.well,re=e.wells,oe=e.PadModeComponent,le=e.activeWellName,pe=a(!1),de=t(pe,2),ce=de[0],me=de[1],ue=n(null),fe=null==K?void 0:K.pixelWidth;i((function(){var e,t;me((null===(e=ue.current)||void 0===e?void 0:e.scrollWidth)>(null===(t=ue.current)||void 0===t?void 0:t.offsetWidth))}),[null===(r=ue.current)||void 0===r?void 0:r.offsetWidth,fe]);var ge=v(fe),ve=S(z),he=N(z),be=he===j.COMPLETION,Ae=function(e){var t,a=e.appSettings,n=void 0===a?{}:a,i=e.well,s=e.rig,r=e.fracFleet,o=e.segment,l=o===j.DRILLING,p=o===j.COMPLETION,d=n.wellId,c=n.rigId,m=n.fracFleetId,u=n.padId,f=null==r||null===(t=r.pad_frac_fleets.find((function(e){return e.pad.id===(u||r.current_pad_id)})))||void 0===t?void 0:t.pad,g=l?d&&(null==i?void 0:i.name):null==f?void 0:f.name,v="/assets/types/pad/".concat(u||(null==r?void 0:r.current_pad_id)),h=l?null==s?void 0:s.name:null==r?void 0:r.name,b=!!(d||c||m),A=!1,y=l?h&&M(i):v;return p&&!b&&null!=i&&i.id&&null!=i&&i.name&&(A=!0,b=!0,y=M(i),h=i.name),{isPrimaryAssetStatusVisible:A,isPrimaryNameVisible:b,primaryAssetLink:y,primaryAssetName:h,secondaryAssetLink:l?M(i):"/assets/types/pad/".concat(u||(null==r?void 0:r.current_pad_id)),secondaryAssetName:g}}({appSettings:null==z?void 0:z.settings,well:se,rig:ae,fracFleet:X,segment:he}),ye=Ae.isPrimaryAssetStatusVisible,je=Ae.isPrimaryNameVisible,Le=Ae.primaryAssetLink,Se=Ae.primaryAssetName,Ne=Ae.secondaryAssetLink,Pe=Ae.secondaryAssetName,Oe=[g.MEDIUM,g.SMALL].includes(ge),_e=z&&z.id===L,Ie={fracFleet:X,wells:re,well:se,onSettingChange:$,appSettings:U,disableActiveWellsInPadSelect:null==z||null===(f=z.package)||void 0===f||null===(I=f.manifest)||void 0===I||null===(W=I.application)||void 0===W||null===(k=W.ui)||void 0===k?void 0:k.disableActiveWellsInPadSelect,enableSimulFracInPadSelect:null==z||null===(x=z.package)||void 0===x||null===(D=x.manifest)||void 0===D||null===(T=D.application)||void 0===T||null===(F=T.ui)||void 0===F?void 0:F.enableSimulFracInPadSelect,completionAppType:null==z||null===(H=z.package)||void 0===H||null===(B=H.manifest)||void 0===B||null===(R=B.application)||void 0===R||null===(q=R.ui)||void 0===q?void 0:q.completionAppType},we=b({isMobileSize:Oe});return P("div",{className:o(we.appHeaderWrapper,J.appHeader),children:[P("div",{className:we.appHeaderContainer,children:[O("div",{className:o(we.titleBlock,J.titleBlock),children:P("div",{className:J.appHeaderTitleWrapper,ref:ue,children:[P("div",{className:we.titleWrapper,children:[Z&&P(_,{children:[O("img",{className:we.logo,src:Z,alt:"company logo"}),O("div",{className:we.separateLine})]}),O(l,{title:ce?ve:"",placement:"bottom",children:O("h6",{"data-testid":"".concat(C,"_name"),className:we.title,children:ve})}),O(u,{appPackage:null==z?void 0:z.package})]}),V]})}),z&&K&&P("div",{className:o(A.controlsContainer,Y&&A.appMaximized),children:[!Oe&&P(_,{children:[be&&le&&O(p,{variant:"caption",children:le}),be&&O(oe,w({},Ie)),G]}),P("div",{className:A.assetLabels,children:[Pe&&O(c,{assetName:Pe,coordinatesPixelWidth:fe,dataTestId:"".concat(C,"_secondaryAsset"),href:!_e&&Ne,icon:be&&O(h,{}),isColored:!be||z.settings.padId&&z.settings.padId!==X.current_pad_id}),je&&O(m,{assetName:Se,coordinatesPixelWidth:fe,dataTestId:"".concat(C,"_primaryAsset"),href:!_e&&Le,statusBadge:ye&&te})]})]}),ne&&E&&O(y,{annotation:E,appId:s(z,["app","id"]),currentUser:Q,dashboardAppId:z.id,openAnnotationsList:ee,updateCurrentDashboardAppLastAnnotation:ie})]}),Oe&&P(d,{display:"flex",alignItems:"center",mt:1,children:[be&&!se&&(re||X)&&O("div",{className:A.padModeSelect,children:O(oe,w({},Ie))}),G]})]})}W.propTypes={app:r.object.isRequired,badge:r.node,classes:r.shape({appHeader:r.string,titleBlock:r.string,appHeaderTitleWrapper:r.string}),showLastAnnotation:r.bool,currentUser:r.shape({}),appLastAnnotation:r.shape({}),updateCurrentDashboardAppLastAnnotation:r.func,openAnnotationsList:r.func,rig:r.shape({name:r.string,asset_id:r.number}),well:r.shape({name:r.string,asset_id:r.number}),fracFleet:r.shape({name:r.string,current_pad_id:r.number,pad_frac_fleets:r.arrayOf(r.shape({pad:r.shape({id:r.number.isRequired,name:r.string}).isRequired})).isRequired}),wells:r.arrayOf(r.shape({})),coordinates:r.shape({pixelWidth:r.number.isRequired}),isMaximized:r.bool,appSettings:r.shape({}),onSettingChange:r.func,children:r.node,logoSrc:r.string,primaryAssetStatusBadge:r.node,PadModeComponent:r.elementType,activeWellName:r.string},W.defaultProps={appLastAnnotation:null,appSettings:null,badge:null,children:null,classes:{},coordinates:void 0,currentUser:void 0,fracFleet:null,isMaximized:!1,logoSrc:null,onSettingChange:void 0,openAnnotationsList:void 0,rig:null,showLastAnnotation:!0,updateCurrentDashboardAppLastAnnotation:function(){},well:null,wells:null,primaryAssetStatusBadge:null,PadModeComponent:f,activeWellName:null};export{C as PAGE_NAME,W as default};
1
+ import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/slicedToArray";import{useState as a,useRef as n,useEffect as i}from"react";import{get as s}from"lodash";import r from"prop-types";import o from"classnames";import{Tooltip as l,Typography as p,Box as d}from"@material-ui/core";import{SecondaryAssetNameLabel as c}from"../../AssetNameLabel/SecondaryAssetNameLabel.js";import{AssetNameLabel as m}from"../../AssetNameLabel/AssetNameLabel.js";import{VersionBadge as u}from"./VersionBadge.js";import f from"./PadMode.js";import{APP_LAYOUT_SIZES as g,getAppDimension as v}from"./utils.js";import{PadIcon as h}from"./PadIcon.js";import{useStyles as b}from"./AppHeaderStyles.js";import A from"./AppHeader.css.js";import y from"../../Annotations/components/LastAnnotation/index.js";import{SEGMENTS as j}from"../../../constants/segment.js";import{DEV_CENTER_CLI_APP_ID as L}from"../../../constants/devcenter.js";import"../../../constants/goals.js";import"../../../constants/alerts.js";import"../../../constants/apps.js";import"../../../constants/drillstring.js";import"../../../constants/completion.js";import"../../../constants/appPackages.js";import"../../../constants/notifications.js";import"../../../constants/feed.js";import"../../../constants/bha.js";import"../../../utils/env.js";import"../../GradientManager/configuration/constants.js";import{getAppName as S,getAppSegment as N}from"../../../utils/devcenter.js";import{isInsideNewMobileApp as P}from"../../../utils/mobileDetect.js";import{jsxs as O,jsx as _,Fragment as I}from"react/jsx-runtime";function w(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function C(t){for(var a=1;a<arguments.length;a++){var n=null!=arguments[a]?arguments[a]:{};a%2?w(Object(n),!0).forEach((function(a){e(t,a,n[a])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):w(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var M="DevCenter_AppHeader",W=function(e){return(null==e?void 0:e.asset_id)&&"/assets/".concat(null==e?void 0:e.asset_id)};function k(e){var r,f,w,k,x,D,T,F,H,B,R,q,z,E=e.app,U=e.appLastAnnotation,V=e.appSettings,G=e.badge,J=e.children,K=e.classes,Q=e.coordinates,X=e.currentUser,Y=e.fracFleet,Z=e.isMaximized,$=e.logoSrc,ee=e.onSettingChange,te=e.openAnnotationsList,ae=e.primaryAssetStatusBadge,ne=e.rig,ie=e.showLastAnnotation,se=e.updateCurrentDashboardAppLastAnnotation,re=e.well,oe=e.wells,le=e.PadModeComponent,pe=e.activeWellName,de=a(!1),ce=t(de,2),me=ce[0],ue=ce[1],fe=n(null),ge=null==Q?void 0:Q.pixelWidth;i((function(){var e,t;ue((null===(e=fe.current)||void 0===e?void 0:e.scrollWidth)>(null===(t=fe.current)||void 0===t?void 0:t.offsetWidth))}),[null===(r=fe.current)||void 0===r?void 0:r.offsetWidth,ge]);var ve=v(ge),he=S(E),be=N(E),Ae=be===j.COMPLETION,ye=function(e){var t,a=e.appSettings,n=void 0===a?{}:a,i=e.well,s=e.rig,r=e.fracFleet,o=e.segment,l=o===j.DRILLING,p=o===j.COMPLETION,d=n.wellId,c=n.rigId,m=n.fracFleetId,u=n.padId,f=null==r||null===(t=r.pad_frac_fleets.find((function(e){return e.pad.id===(u||r.current_pad_id)})))||void 0===t?void 0:t.pad,g=l?d&&(null==i?void 0:i.name):null==f?void 0:f.name,v="/assets/types/pad/".concat(u||(null==r?void 0:r.current_pad_id)),h=l?null==s?void 0:s.name:null==r?void 0:r.name,b=!!(d||c||m),A=!1,y=l?h&&W(i):v;return p&&!b&&null!=i&&i.id&&null!=i&&i.name&&(A=!0,b=!0,y=W(i),h=i.name),{isPrimaryAssetStatusVisible:A,isPrimaryNameVisible:b,primaryAssetLink:y,primaryAssetName:h,secondaryAssetLink:l?W(i):"/assets/types/pad/".concat(u||(null==r?void 0:r.current_pad_id)),secondaryAssetName:g}}({appSettings:null==E?void 0:E.settings,well:re,rig:ne,fracFleet:Y,segment:be}),je=ye.isPrimaryAssetStatusVisible,Le=ye.isPrimaryNameVisible,Se=ye.primaryAssetLink,Ne=ye.primaryAssetName,Pe=ye.secondaryAssetLink,Oe=ye.secondaryAssetName,_e=[g.MEDIUM,g.SMALL].includes(ve),Ie=E&&E.id===L,we={fracFleet:Y,wells:oe,well:re,onSettingChange:ee,appSettings:V,disableActiveWellsInPadSelect:null==E||null===(f=E.package)||void 0===f||null===(w=f.manifest)||void 0===w||null===(k=w.application)||void 0===k||null===(x=k.ui)||void 0===x?void 0:x.disableActiveWellsInPadSelect,enableSimulFracInPadSelect:null==E||null===(D=E.package)||void 0===D||null===(T=D.manifest)||void 0===T||null===(F=T.application)||void 0===F||null===(H=F.ui)||void 0===H?void 0:H.enableSimulFracInPadSelect,completionAppType:null==E||null===(B=E.package)||void 0===B||null===(R=B.manifest)||void 0===R||null===(q=R.application)||void 0===q||null===(z=q.ui)||void 0===z?void 0:z.completionAppType},Ce=b({isMobileSize:_e});return O("div",{className:o(Ce.appHeaderWrapper,K.appHeader),children:[O("div",{className:Ce.appHeaderContainer,children:[_("div",{className:o(Ce.titleBlock,K.titleBlock),children:O("div",{className:K.appHeaderTitleWrapper,ref:fe,children:[O("div",{className:Ce.titleWrapper,children:[$&&O(I,{children:[_("img",{className:Ce.logo,src:$,alt:"company logo"}),_("div",{className:Ce.separateLine})]}),_(l,{title:me?he:"",placement:"bottom",children:_("h6",{"data-testid":"".concat(M,"_name"),className:Ce.title,children:he})}),_(u,{appPackage:null==E?void 0:E.package})]}),G]})}),E&&Q&&O("div",{className:o(A.controlsContainer,Z&&A.appMaximized),children:[!_e&&O(I,{children:[Ae&&pe&&_(p,{variant:"caption",children:pe}),Ae&&_(le,C({},we)),J]}),!P&&O("div",{className:A.assetLabels,children:[Oe&&_(c,{assetName:Oe,coordinatesPixelWidth:ge,dataTestId:"".concat(M,"_secondaryAsset"),href:!Ie&&Pe,icon:Ae&&_(h,{}),isColored:!Ae||E.settings.padId&&E.settings.padId!==Y.current_pad_id}),Le&&_(m,{assetName:Ne,coordinatesPixelWidth:ge,dataTestId:"".concat(M,"_primaryAsset"),href:!Ie&&Se,statusBadge:je&&ae})]})]}),ie&&U&&_(y,{annotation:U,appId:s(E,["app","id"]),currentUser:X,dashboardAppId:E.id,openAnnotationsList:te,updateCurrentDashboardAppLastAnnotation:se})]}),_e&&O(d,{display:"flex",alignItems:"center",mt:1,children:[Ae&&!re&&(oe||Y)&&_("div",{className:A.padModeSelect,children:_(le,C({},we))}),J]})]})}k.propTypes={app:r.object.isRequired,badge:r.node,classes:r.shape({appHeader:r.string,titleBlock:r.string,appHeaderTitleWrapper:r.string}),showLastAnnotation:r.bool,currentUser:r.shape({}),appLastAnnotation:r.shape({}),updateCurrentDashboardAppLastAnnotation:r.func,openAnnotationsList:r.func,rig:r.shape({name:r.string,asset_id:r.number}),well:r.shape({name:r.string,asset_id:r.number}),fracFleet:r.shape({name:r.string,current_pad_id:r.number,pad_frac_fleets:r.arrayOf(r.shape({pad:r.shape({id:r.number.isRequired,name:r.string}).isRequired})).isRequired}),wells:r.arrayOf(r.shape({})),coordinates:r.shape({pixelWidth:r.number.isRequired}),isMaximized:r.bool,appSettings:r.shape({}),onSettingChange:r.func,children:r.node,logoSrc:r.string,primaryAssetStatusBadge:r.node,PadModeComponent:r.elementType,activeWellName:r.string},k.defaultProps={appLastAnnotation:null,appSettings:null,badge:null,children:null,classes:{},coordinates:void 0,currentUser:void 0,fracFleet:null,isMaximized:!1,logoSrc:null,onSettingChange:void 0,openAnnotationsList:void 0,rig:null,showLastAnnotation:!0,updateCurrentDashboardAppLastAnnotation:function(){},well:null,wells:null,primaryAssetStatusBadge:null,PadModeComponent:f,activeWellName:null};export{M as PAGE_NAME,k as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corva/ui",
3
- "version": "3.2.0-1",
3
+ "version": "3.2.0-2",
4
4
  "description": "Shared components/utils for Corva ui projects",
5
5
  "keywords": [
6
6
  "corva-ui"