@corva/ui 0.60.0-2 → 0.60.0-3
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/AssetEditorV2/components/SecondaryAssetSelect.js +1 -1
- package/cjs-bundle/components/AssetEditorV2/effects/index.js +1 -1
- package/cjs-bundle/components/AssetEditorV2/index.js +1 -1
- package/cjs-bundle/components/AssetEditorV2/utils/index.js +1 -1
- package/components/AssetEditorV2/components/SecondaryAssetSelect.d.ts.map +1 -1
- package/components/AssetEditorV2/components/SecondaryAssetSelect.js +1 -1
- package/components/AssetEditorV2/effects/index.d.ts +2 -1
- package/components/AssetEditorV2/effects/index.d.ts.map +1 -1
- package/components/AssetEditorV2/effects/index.js +1 -1
- package/components/AssetEditorV2/index.d.ts.map +1 -1
- package/components/AssetEditorV2/index.js +1 -1
- package/components/AssetEditorV2/utils/index.d.ts +5 -2
- package/components/AssetEditorV2/utils/index.d.ts.map +1 -1
- package/components/AssetEditorV2/utils/index.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/toConsumableArray"),t=require("prop-types"),a=require("lodash"),s=require("@material-ui/core"),r=require("../effects/index.js"),n=require("./SelectItem.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/toConsumableArray"),t=require("prop-types"),a=require("lodash"),s=require("@material-ui/core"),r=require("../effects/index.js"),n=require("./SelectItem.js"),l=require("../constants.js"),u=require("react/jsx-runtime");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=i(e),d=i(t),c="DC_SingleAssetEditor",p=s.makeStyles({container:{position:"relative"},select:{display:"flex",alignItems:"center",justifyContent:"space-between"},formControl:{marginTop:16,width:"100%"},selectValue:{padding:0,"&:hover":{backgroundColor:"initial"}},progress:{position:"absolute",right:20,bottom:4}}),f=function(e){var t=e.appKey,i=e.primaryAssetLabel,d=e.secondaryAssetLabel,f=e.currentValue,m=e.defaultValue,y=e.onChange,A=e.parentAssetId,T=e.assetType,v=e.parentAssetType,g=e.assetFields,I=e.activeWellId,C=r.useSecondaryAssetSelectData({appKey:t,assetId:f,assetType:T,parentAssetId:A,parentAssetType:v,assetFields:g,activeWellId:I}),h=C.assets,S=C.loading,_=p(),b=f||m,j=h.some((function(e){return e.status===l.ACTIVE_STATUS})),V=a.capitalize(T),x=[{name:"Active ".concat(V),id:l.ACTIVE_ASSET_ID}].concat(o.default(h));return u.jsxs("div",{className:_.container,children:[u.jsxs(s.FormControl,{className:_.formControl,disabled:S,children:[u.jsx(s.InputLabel,{shrink:!!b,children:d}),u.jsx(s.Select,{"data-testid":e["data-testid"],classes:{select:_.select},value:b,onChange:function(e){return y(e.target.value)},fullWidth:!0,renderValue:function(e){if(e===l.ACTIVE_ASSET_ID&&!j)return"".concat(i," has No Active ").concat(d);if(e===l.ACTIVE_ASSET_ID&&j){var t=h.find((function(e){return e.status===l.ACTIVE_STATUS}));return u.jsx(n,{className:_.selectValue,assetName:t.name,status:t.status})}var a=h.find((function(t){return t.id===e}));return u.jsx(n,{className:_.selectValue,assetName:null==a?void 0:a.name,status:null==a?void 0:a.status})},children:x.map((function(e){var t=e.id,a=e.name,s=e.status,r=a||"";return u.jsx(n,{assetName:r,dataTestId:"".concat(c,"_option_").concat(r,"MenuItem"),value:t,status:s},t)}))})]}),S&&u.jsx(s.CircularProgress,{"data-testid":"".concat(c,"_CircularProgress"),size:20,className:_.progress})]})};f.propTypes={appType:d.default.shape({constants:d.default.shape({})}),currentValue:d.default.oneOfType([d.default.number,d.default.string]),defaultValue:d.default.any,onChange:d.default.func.isRequired,parentAssetId:d.default.number,parentAssetType:d.default.string,assetType:d.default.string.isRequired,"data-testid":d.default.string,appKey:d.default.string,assetFields:d.default.array},f.defaultProps={currentValue:"",defaultValue:"",appType:void 0,parentAssetId:void 0,parentAssetType:void 0,"data-testid":"".concat(c,"_autoComplete"),appKey:null,assetFields:[]},exports.PAGE_NAME=c,exports.default=f;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/toConsumableArray"),t=require("@babel/runtime/helpers/defineProperty"),r=require("@babel/runtime/helpers/asyncToGenerator"),s=require("@babel/runtime/helpers/slicedToArray"),a=require("@babel/runtime/regenerator"),n=require("react");require("uuid"),require("lodash"),require("lodash/set"),require("lodash/get"),require("lodash/unset"),require("moment");var u=require("../../../clients/jsonApi/index.js");require("../../../clients/subscriptions.js"),require("../../../clients/api/apiCore.js"),require("../../../clients/constants.js");var i=require("../../../utils/jsonaDataFormatter.js");require("../../../constants/goals.js"),require("../../../constants/segment.js"),require("../../../constants/alerts.js"),require("../../../constants/apps.js"),require("../../../constants/drillstring.js"),require("../../../constants/completion.js"),require("../../../constants/notifications.js"),require("../../../constants/feed.js"),require("../../../constants/bha.js");var o=require("../../../constants/assetTypes.js");require("../../../utils/env.js"),require("../../GradientManager/configuration/constants.js");var c=require("../utils/index.js");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=p(e),f=p(t),d=p(r),y=p(s),j=p(a);function q(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,s)}return r}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?q(Object(r),!0).forEach((function(t){f.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):q(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}exports.usePrimaryAssetSelectData=function(e){var t,r=e.appKey,s=e.assetType,a=e.companyId,p=e.groups,f=e.parentAssetId,q=e.parentAssetType,m=e.searchText,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/toConsumableArray"),t=require("@babel/runtime/helpers/defineProperty"),r=require("@babel/runtime/helpers/asyncToGenerator"),s=require("@babel/runtime/helpers/slicedToArray"),a=require("@babel/runtime/regenerator"),n=require("react");require("uuid"),require("lodash"),require("lodash/set"),require("lodash/get"),require("lodash/unset"),require("moment");var u=require("../../../clients/jsonApi/index.js");require("../../../clients/subscriptions.js"),require("../../../clients/api/apiCore.js"),require("../../../clients/constants.js");var i=require("../../../utils/jsonaDataFormatter.js");require("../../../constants/goals.js"),require("../../../constants/segment.js"),require("../../../constants/alerts.js"),require("../../../constants/apps.js"),require("../../../constants/drillstring.js"),require("../../../constants/completion.js"),require("../../../constants/notifications.js"),require("../../../constants/feed.js"),require("../../../constants/bha.js");var o=require("../../../constants/assetTypes.js");require("../../../utils/env.js"),require("../../GradientManager/configuration/constants.js");var c=require("../utils/index.js");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=p(e),f=p(t),d=p(r),y=p(s),j=p(a);function q(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,s)}return r}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?q(Object(r),!0).forEach((function(t){f.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):q(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}exports.usePrimaryAssetSelectData=function(e){var t,r=e.appKey,s=e.assetType,a=e.companyId,p=e.groups,f=e.parentAssetId,q=e.parentAssetType,m=e.searchText,v=e.assetFields,h=n.useState([]),g=y.default(h,2),O=g[0],A=g[1],P=n.useState(!1),S=y.default(P,2),w=S[0],x=S[1],T=(t=d.default(j.default.mark((function e(t){var n,p,d,y,h,g,O;return j.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n=(null==t?void 0:t.type)||s,x(!0),p={per_page:1e4},q&&f&&(p[q]=f),a&&(p.company=a),m&&(p.search=m),r&&(p.app_key=r),d=n===o.ASSET_TYPES.pad.type?[].concat(l.default(v),["pad.wells","pad.pad_frac_fleets"]):v,y=u.mapAssetGetRequest(n)(b(b({},c.getRequestOptions(n,d)),p)),e.next=12,y;case 12:h=e.sent,g=i.jsonaDataFormatter.deserialize(h),O=g.map((function(e){return c.formatAsset({asset:e,group:null==t?void 0:t.name})})).sort(c.sortAsset),A((function(e){return[].concat(l.default(e),l.default(O))})),e.next=21;break;case 18:e.prev=18,e.t0=e.catch(0),console.error(e.t0);case 21:return e.prev=21,x(!1),e.finish(21);case 24:case"end":return e.stop()}}),e,null,[[0,18,21,24]])}))),function(e){return t.apply(this,arguments)});return n.useEffect((function(){p?p.forEach((function(e){T(e)})):T()}),[s,q,f,a,r,null==p?void 0:p.length]),{assets:O,loading:w}},exports.useSecondaryAssetSelectData=function(e){var t=e.appKey,r=e.assetType,s=e.assetId,a=e.parentAssetType,o=e.parentAssetId,p=e.queryParams,l=e.assetFields,q=e.activeWellId,m=n.useState([]),v=y.default(m,2),h=v[0],g=v[1],O=n.useState(!0),A=y.default(O,2),P=A[0],S=A[1];return n.useEffect((function(){function e(){return(e=d.default(j.default.mark((function e(){var s,n;return j.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u.mapAssetGetRequest(r)(b(b(b({},c.getRequestOptions(r,l)),{},f.default({per_page:1e4},a,o),t&&{app_key:t}),p));case 2:s=e.sent,n=i.jsonaDataFormatter.deserialize(s),g(n.map((function(e){return c.formatAsset({asset:e,activeWellId:q})})).sort(c.sortAsset)),S(!1);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}S(!0),function(){e.apply(this,arguments)}()}),[r,s,a,o,t]),{assets:h,loading:P}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/slicedToArray"),s=require("react"),a=require("prop-types"),r=require("lodash"),l=require("@material-ui/core"),
|
|
1
|
+
"use strict";var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/slicedToArray"),s=require("react"),a=require("prop-types"),r=require("lodash"),l=require("@material-ui/core"),i=require("./components/PrimaryAssetSelect.js"),n=require("./components/SecondaryAssetSelect.js");require("./components/SelectItem.js");var u=require("./constants.js");require("../../constants/goals.js"),require("../../constants/segment.js"),require("../../constants/alerts.js"),require("../../constants/apps.js"),require("../../constants/drillstring.js"),require("../../constants/completion.js"),require("../../constants/notifications.js"),require("../../constants/feed.js"),require("../../constants/bha.js");var p=require("../../constants/assetTypes.js");require("../../utils/env.js"),require("../GradientManager/configuration/constants.js");var o=require("react/jsx-runtime");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=d(e),y=d(t),f=d(a),g=l.makeStyles({title:{fontWeight:400,fontSize:20,margin:"28px 0 16px"}}),A=function(e){var t=e.appKey,a=e.appType,l=e.defaultValue,d=e.isNullable,f=e.label,A=e.onSettingsChange,S=e.settings,m=r.get(a,["primaryAsset","assetType","type"]),q=r.get(a,["primaryAsset","assetType","id"]),T=r.get(a,["primaryAsset","assetType","label"]),b=r.get(a,["primaryAsset","groups"]),j=r.get(a,["secondaryAsset","assetType","type"]),v=r.get(a,["secondaryAsset","assetType","id"]),h=r.get(a,["secondaryAsset","assetType","label"]),E=r.get(S,q),_=s.useState(E||l),C=y.default(_,2),x=C[0],N=C[1],P=s.useState(r.get(S,v)),I=y.default(P,2),V=I[0],K=I[1],Y=s.useState(null),F=y.default(Y,2),D=F[0],G=F[1],R=s.useState(!1),W=y.default(R,2),w=W[0],L=W[1],k=s.useState(),z=y.default(k,2),M=z[0],B=z[1],H=g(),J=j===p.ASSET_TYPES.pad.type?["pad.wells"]:[];return o.jsxs("div",{className:H.main,children:[o.jsx("div",{className:H.title,children:"Asset"}),o.jsx(i,{appKey:t,assetType:m,"data-testid":"".concat("DC_AppSettingsAssetEditor","_primaryAssetEditorAutocomplete"),defaultValue:l,disableClearable:!d,isNullable:d,label:f,onChange:function(e){var t=e.id,s=e.type,a=e.parentFracFleetId,r=e.activeWellId;if(s!==p.ASSET_TYPES.pad.type){N(t),G(r),K(null);var l=c.default({},q,t);v&&(l[v]=null),A(l),L(!1)}else{var i;L(!0),K(t);var n=(i={},c.default(i,p.ASSET_TYPES.frac_fleet.id,Number(a)),c.default(i,p.ASSET_TYPES.pad.id,t),i);A(n)}},selectedGroup:M,onGroupChange:function(e){B(e)},groups:b,assetFields:m===p.ASSET_TYPES.rig.type?["rig.active_well"]:[]}),x&&!w&&o.jsx(n.default,{"data-testid":"".concat("DC_AppSettingsAssetEditor","_secondaryAutoComplete"),onChange:function(e){K(e),A(c.default({},v,e===u.ACTIVE_ASSET_ID?null:e))},defaultValue:"activeAsset",currentValue:V,activeWellId:D,isNullable:d,assetType:j,parentAssetId:x,parentAssetType:m,primaryAssetLabel:T,secondaryAssetLabel:h,appKey:t,assetFields:J})]})};A.defaultProps={label:"Choose An Asset",isNullable:!1,defaultValue:void 0,appKey:null},A.propTypes={settings:f.default.shape({}).isRequired,appType:f.default.shape({}).isRequired,defaultValue:f.default.any,onSettingsChange:f.default.func.isRequired,label:f.default.string,isNullable:f.default.bool,appKey:f.default.string},module.exports=A;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/toConsumableArray"),t=require("lodash");require("../../../constants/goals.js"),require("../../../constants/segment.js"),require("../../../constants/alerts.js"),require("../../../constants/apps.js"),require("../../../constants/drillstring.js"),require("../../../constants/completion.js"),require("../../../constants/notifications.js"),require("../../../constants/feed.js"),require("../../../constants/bha.js");var r=require("../../../constants/assetTypes.js");require("../../../utils/env.js"),require("../../GradientManager/configuration/constants.js");var s=require("../constants.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=n(e),i=function(){var e,r,s,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],a=null===(e=n.find((function(e){return e===e.current})))||void 0===e?void 0:e.id,i=n.reduce((function(e,t){return new Date(e.lastCurrentAt)>new Date(t.lastCurrentAt)?e:t}),{});return t.isEmpty(a)?null===(r=i.fracFleet)||void 0===r?void 0:r.id:null===(s=a.fracFleet)||void 0===s?void 0:s.id};exports.formatAsset=function(e){var t,n=e.asset,a=e.group,u=e.activeWellId,o={id:+n.id,type:n.type,name:n.name};(a&&(o.group=a),n.type===r.ASSET_TYPES.rig.type)&&(o.activeWellId=(null===(t=n.activeWell)||void 0===t?void 0:t.status)===s.ACTIVE_STATUS?Number(n.activeWell.id):null);return n.type===r.ASSET_TYPES.well.type&&(o.status=Number(n.id)===u?s.ACTIVE_STATUS:null),n.type===r.ASSET_TYPES.pad.type&&(o.status=n.wells.some((function(e){return e.status===s.ACTIVE_STATUS}))?s.ACTIVE_STATUS:null,o.parentFracFleetId=i(n.padFracFleets)),o},exports.getPadFracFleetId=i,exports.getRequestOptions=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return{sort:"name",order:"asc",fields:["".concat(e,".name"),"".concat(e,".asset_id"),"".concat(e,".status")].concat(a.default(t))}},exports.sortAsset=function(e){return e.status===s.ACTIVE_STATUS?-1:1};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SecondaryAssetSelect.d.ts","sourceRoot":"","sources":["../../../../src/components/AssetEditorV2/components/SecondaryAssetSelect.js"],"names":[],"mappings":"AAQA,+CAAgD;;AAwBhD,+
|
|
1
|
+
{"version":3,"file":"SecondaryAssetSelect.d.ts","sourceRoot":"","sources":["../../../../src/components/AssetEditorV2/components/SecondaryAssetSelect.js"],"names":[],"mappings":"AAQA,+CAAgD;;AAwBhD,+DA2FC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"@babel/runtime/helpers/toConsumableArray";import t from"prop-types";import{capitalize as
|
|
1
|
+
import e from"@babel/runtime/helpers/toConsumableArray";import t from"prop-types";import{capitalize as a}from"lodash";import{makeStyles as s,FormControl as r,InputLabel as n,Select as i,CircularProgress as o}from"@material-ui/core";import{useSecondaryAssetSelectData as l}from"../effects/index.js";import u from"./SelectItem.js";import{ACTIVE_STATUS as p,ACTIVE_ASSET_ID as c}from"../constants.js";import{jsxs as d,jsx as m}from"react/jsx-runtime";var f="DC_SingleAssetEditor",y=s({container:{position:"relative"},select:{display:"flex",alignItems:"center",justifyContent:"space-between"},formControl:{marginTop:16,width:"100%"},selectValue:{padding:0,"&:hover":{backgroundColor:"initial"}},progress:{position:"absolute",right:20,bottom:4}}),v=function(t){var s=t.appKey,v=t.primaryAssetLabel,g=t.secondaryAssetLabel,h=t.currentValue,A=t.defaultValue,T=t.onChange,b=t.parentAssetId,C=t.assetType,I=t.parentAssetType,V=t.assetFields,N=t.activeWellId,j=l({appKey:s,assetId:h,assetType:C,parentAssetId:b,parentAssetType:I,assetFields:V,activeWellId:N}),_=j.assets,x=j.loading,F=y(),K=h||A,W=_.some((function(e){return e.status===p})),k=a(C),q=[{name:"Active ".concat(k),id:c}].concat(e(_));return d("div",{className:F.container,children:[d(r,{className:F.formControl,disabled:x,children:[m(n,{shrink:!!K,children:g}),m(i,{"data-testid":t["data-testid"],classes:{select:F.select},value:K,onChange:function(e){return T(e.target.value)},fullWidth:!0,renderValue:function(e){if(e===c&&!W)return"".concat(v," has No Active ").concat(g);if(e===c&&W){var t=_.find((function(e){return e.status===p}));return m(u,{className:F.selectValue,assetName:t.name,status:t.status})}var a=_.find((function(t){return t.id===e}));return m(u,{className:F.selectValue,assetName:null==a?void 0:a.name,status:null==a?void 0:a.status})},children:q.map((function(e){var t=e.id,a=e.name,s=e.status,r=a||"";return m(u,{assetName:r,dataTestId:"".concat(f,"_option_").concat(r,"MenuItem"),value:t,status:s},t)}))})]}),x&&m(o,{"data-testid":"".concat(f,"_CircularProgress"),size:20,className:F.progress})]})};v.propTypes={appType:t.shape({constants:t.shape({})}),currentValue:t.oneOfType([t.number,t.string]),defaultValue:t.any,onChange:t.func.isRequired,parentAssetId:t.number,parentAssetType:t.string,assetType:t.string.isRequired,"data-testid":t.string,appKey:t.string,assetFields:t.array},v.defaultProps={currentValue:"",defaultValue:"",appType:void 0,parentAssetId:void 0,parentAssetType:void 0,"data-testid":"".concat(f,"_autoComplete"),appKey:null,assetFields:[]};export{f as PAGE_NAME,v as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function useSecondaryAssetSelectData({ appKey, assetType, assetId, parentAssetType, parentAssetId, queryParams, assetFields, }: {
|
|
1
|
+
export function useSecondaryAssetSelectData({ appKey, assetType, assetId, parentAssetType, parentAssetId, queryParams, assetFields, activeWellId, }: {
|
|
2
2
|
appKey: any;
|
|
3
3
|
assetType: any;
|
|
4
4
|
assetId: any;
|
|
@@ -6,6 +6,7 @@ export function useSecondaryAssetSelectData({ appKey, assetType, assetId, parent
|
|
|
6
6
|
parentAssetId: any;
|
|
7
7
|
queryParams: any;
|
|
8
8
|
assetFields: any;
|
|
9
|
+
activeWellId: any;
|
|
9
10
|
}): {
|
|
10
11
|
assets: any[];
|
|
11
12
|
loading: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/AssetEditorV2/effects/index.js"],"names":[],"mappings":"AAMA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/AssetEditorV2/effects/index.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;EAkCC;AAED;;;;;;;;;;;;EA2DC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"@babel/runtime/helpers/toConsumableArray";import e from"@babel/runtime/helpers/defineProperty";import r from"@babel/runtime/helpers/asyncToGenerator";import n from"@babel/runtime/helpers/slicedToArray";import s from"@babel/runtime/regenerator";import{useState as o,useEffect as a}from"react";import"uuid";import"lodash";import"lodash/set";import"lodash/get";import"lodash/unset";import"moment";import{mapAssetGetRequest as i}from"../../../clients/jsonApi/index.js";import"../../../clients/subscriptions.js";import"../../../clients/api/apiCore.js";import"../../../clients/constants.js";import{jsonaDataFormatter as p}from"../../../utils/jsonaDataFormatter.js";import"../../../constants/goals.js";import"../../../constants/segment.js";import"../../../constants/alerts.js";import"../../../constants/apps.js";import"../../../constants/drillstring.js";import"../../../constants/completion.js";import"../../../constants/notifications.js";import"../../../constants/feed.js";import"../../../constants/bha.js";import{ASSET_TYPES as c}from"../../../constants/assetTypes.js";import"../../../utils/env.js";import"../../GradientManager/configuration/constants.js";import{formatAsset as m,sortAsset as
|
|
1
|
+
import t from"@babel/runtime/helpers/toConsumableArray";import e from"@babel/runtime/helpers/defineProperty";import r from"@babel/runtime/helpers/asyncToGenerator";import n from"@babel/runtime/helpers/slicedToArray";import s from"@babel/runtime/regenerator";import{useState as o,useEffect as a}from"react";import"uuid";import"lodash";import"lodash/set";import"lodash/get";import"lodash/unset";import"moment";import{mapAssetGetRequest as i}from"../../../clients/jsonApi/index.js";import"../../../clients/subscriptions.js";import"../../../clients/api/apiCore.js";import"../../../clients/constants.js";import{jsonaDataFormatter as p}from"../../../utils/jsonaDataFormatter.js";import"../../../constants/goals.js";import"../../../constants/segment.js";import"../../../constants/alerts.js";import"../../../constants/apps.js";import"../../../constants/drillstring.js";import"../../../constants/completion.js";import"../../../constants/notifications.js";import"../../../constants/feed.js";import"../../../constants/bha.js";import{ASSET_TYPES as c}from"../../../constants/assetTypes.js";import"../../../utils/env.js";import"../../GradientManager/configuration/constants.js";import{formatAsset as m,sortAsset as l,getRequestOptions as u}from"../utils/index.js";function f(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function d(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?f(Object(n),!0).forEach((function(r){e(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function y(t){var c=t.appKey,f=t.assetType,y=t.assetId,j=t.parentAssetType,b=t.parentAssetId,h=t.queryParams,g=t.assetFields,v=t.activeWellId,O=o([]),w=n(O,2),P=w[0],x=w[1],T=o(!0),A=n(T,2),k=A[0],I=A[1];return a((function(){function t(){return(t=r(s.mark((function t(){var r,n;return s.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,i(f)(d(d(d({},u(f,g)),{},e({per_page:1e4},j,b),c&&{app_key:c}),h));case 2:r=t.sent,n=p.deserialize(r),x(n.map((function(t){return m({asset:t,activeWellId:v})})).sort(l)),I(!1);case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}I(!0),function(){t.apply(this,arguments)}()}),[f,y,j,b,c]),{assets:P,loading:k}}function j(e){var f,y=e.appKey,j=e.assetType,b=e.companyId,h=e.groups,g=e.parentAssetId,v=e.parentAssetType,O=e.searchText,w=e.assetFields,P=o([]),x=n(P,2),T=x[0],A=x[1],k=o(!1),I=n(k,2),_=I[0],D=I[1],E=(f=r(s.mark((function e(r){var n,o,a,f,h,P,x;return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n=(null==r?void 0:r.type)||j,D(!0),o={per_page:1e4},v&&g&&(o[v]=g),b&&(o.company=b),O&&(o.search=O),y&&(o.app_key=y),a=n===c.pad.type?[].concat(t(w),["pad.wells","pad.pad_frac_fleets"]):w,f=i(n)(d(d({},u(n,a)),o)),e.next=12,f;case 12:h=e.sent,P=p.deserialize(h),x=P.map((function(t){return m({asset:t,group:null==r?void 0:r.name})})).sort(l),A((function(e){return[].concat(t(e),t(x))})),e.next=21;break;case 18:e.prev=18,e.t0=e.catch(0),console.error(e.t0);case 21:return e.prev=21,D(!1),e.finish(21);case 24:case"end":return e.stop()}}),e,null,[[0,18,21,24]])}))),function(t){return f.apply(this,arguments)});return a((function(){h?h.forEach((function(t){E(t)})):E()}),[j,v,g,b,y,null==h?void 0:h.length]),{assets:T,loading:_}}export{j as usePrimaryAssetSelectData,y as useSecondaryAssetSelectData};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/AssetEditorV2/index.js"],"names":[],"mappings":";AAgBA;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/AssetEditorV2/index.js"],"names":[],"mappings":";AAgBA;;;;;;;;gBAiGC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/slicedToArray";import{useState as s}from"react";import a from"prop-types";import{get as r}from"lodash";import{makeStyles as o}from"@material-ui/core";import
|
|
1
|
+
import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/slicedToArray";import{useState as s}from"react";import a from"prop-types";import{get as r}from"lodash";import{makeStyles as o}from"@material-ui/core";import i from"./components/PrimaryAssetSelect.js";import p from"./components/SecondaryAssetSelect.js";import"./components/SelectItem.js";import{ACTIVE_ASSET_ID as n}from"./constants.js";import"../../constants/goals.js";import"../../constants/segment.js";import"../../constants/alerts.js";import"../../constants/apps.js";import"../../constants/drillstring.js";import"../../constants/completion.js";import"../../constants/notifications.js";import"../../constants/feed.js";import"../../constants/bha.js";import{ASSET_TYPES as l}from"../../constants/assetTypes.js";import"../../utils/env.js";import"../GradientManager/configuration/constants.js";import{jsxs as m,jsx as c}from"react/jsx-runtime";var d=o({title:{fontWeight:400,fontSize:20,margin:"28px 0 16px"}}),u=function(a){var o=a.appKey,u=a.appType,y=a.defaultValue,f=a.isNullable,A=a.label,g=a.onSettingsChange,b=a.settings,j=r(u,["primaryAsset","assetType","type"]),h=r(u,["primaryAsset","assetType","id"]),v=r(u,["primaryAsset","assetType","label"]),T=r(u,["primaryAsset","groups"]),C=r(u,["secondaryAsset","assetType","type"]),S=r(u,["secondaryAsset","assetType","id"]),N=r(u,["secondaryAsset","assetType","label"]),V=r(b,h),_=s(V||y),I=t(_,2),K=I[0],x=I[1],F=s(r(b,S)),q=t(F,2),E=q[0],G=q[1],P=s(null),R=t(P,2),W=R[0],w=R[1],D=s(!1),L=t(D,2),z=L[0],M=L[1],k=s(),B=t(k,2),H=B[0],J=B[1],O=d(),Q=C===l.pad.type?["pad.wells"]:[];return m("div",{className:O.main,children:[c("div",{className:O.title,children:"Asset"}),c(i,{appKey:o,assetType:j,"data-testid":"".concat("DC_AppSettingsAssetEditor","_primaryAssetEditorAutocomplete"),defaultValue:y,disableClearable:!f,isNullable:f,label:A,onChange:function(t){var s=t.id,a=t.type,r=t.parentFracFleetId,o=t.activeWellId;if(a!==l.pad.type){x(s),w(o),G(null);var i=e({},h,s);S&&(i[S]=null),g(i),M(!1)}else{var p;M(!0),G(s);var n=(e(p={},l.frac_fleet.id,Number(r)),e(p,l.pad.id,s),p);g(n)}},selectedGroup:H,onGroupChange:function(e){J(e)},groups:T,assetFields:j===l.rig.type?["rig.active_well"]:[]}),K&&!z&&c(p,{"data-testid":"".concat("DC_AppSettingsAssetEditor","_secondaryAutoComplete"),onChange:function(t){G(t),g(e({},S,t===n?null:t))},defaultValue:"activeAsset",currentValue:E,activeWellId:W,isNullable:f,assetType:C,parentAssetId:K,parentAssetType:j,primaryAssetLabel:v,secondaryAssetLabel:N,appKey:o,assetFields:Q})]})};u.defaultProps={label:"Choose An Asset",isNullable:!1,defaultValue:void 0,appKey:null},u.propTypes={settings:a.shape({}).isRequired,appType:a.shape({}).isRequired,defaultValue:a.any,onSettingsChange:a.func.isRequired,label:a.string,isNullable:a.bool,appKey:a.string};export{u as default};
|
|
@@ -5,11 +5,14 @@ export function getRequestOptions(assetType: any, assetFields?: any[]): {
|
|
|
5
5
|
order: string;
|
|
6
6
|
fields: any[];
|
|
7
7
|
};
|
|
8
|
-
export function formatAsset(asset
|
|
8
|
+
export function formatAsset({ asset, group, activeWellId }: {
|
|
9
|
+
asset: any;
|
|
10
|
+
group: any;
|
|
11
|
+
activeWellId: any;
|
|
12
|
+
}): {
|
|
9
13
|
id: number;
|
|
10
14
|
type: any;
|
|
11
15
|
name: any;
|
|
12
|
-
status: any;
|
|
13
16
|
};
|
|
14
17
|
export function sortAsset(curr: any): 1 | -1;
|
|
15
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/AssetEditorV2/utils/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/AssetEditorV2/utils/index.js"],"names":[],"mappings":"AAIO,yDAUN;AAEM,2DAUN;AAEM;;;;EAIL;AAEK;;;;;;;;EAwBN;AAEM,6CAAkE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"@babel/runtime/helpers/toConsumableArray";import{isEmpty as n}from"lodash";import{ACTIVE_STATUS as e}from"../constants.js";var
|
|
1
|
+
import t from"@babel/runtime/helpers/toConsumableArray";import{isEmpty as n}from"lodash";import"../../../constants/goals.js";import"../../../constants/segment.js";import"../../../constants/alerts.js";import"../../../constants/apps.js";import"../../../constants/drillstring.js";import"../../../constants/completion.js";import"../../../constants/notifications.js";import"../../../constants/feed.js";import"../../../constants/bha.js";import{ASSET_TYPES as s}from"../../../constants/assetTypes.js";import"../../../utils/env.js";import"../../GradientManager/configuration/constants.js";import{ACTIVE_STATUS as e}from"../constants.js";var o=function(){var t,s,e,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=null===(t=o.find((function(t){return t===t.current})))||void 0===t?void 0:t.id,a=o.reduce((function(t,n){return new Date(t.lastCurrentAt)>new Date(n.lastCurrentAt)?t:n}),{});return n(r)?null===(s=a.fracFleet)||void 0===s?void 0:s.id:null===(e=r.fracFleet)||void 0===e?void 0:e.id},r=function(n){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return{sort:"name",order:"asc",fields:["".concat(n,".name"),"".concat(n,".asset_id"),"".concat(n,".status")].concat(t(s))}},a=function(t){var n,r=t.asset,a=t.group,i=t.activeWellId,l={id:+r.id,type:r.type,name:r.name};(a&&(l.group=a),r.type===s.rig.type)&&(l.activeWellId=(null===(n=r.activeWell)||void 0===n?void 0:n.status)===e?Number(r.activeWell.id):null);return r.type===s.well.type&&(l.status=Number(r.id)===i?e:null),r.type===s.pad.type&&(l.status=r.wells.some((function(t){return t.status===e}))?e:null,l.parentFracFleetId=o(r.padFracFleets)),l},i=function(t){return t.status===e?-1:1};export{a as formatAsset,o as getPadFracFleetId,r as getRequestOptions,i as sortAsset};
|