Skip to content

Commit

Permalink
feat: Add visibility to status (#3340)
Browse files Browse the repository at this point in the history
  • Loading branch information
akucharska authored Sep 12, 2024
1 parent 3fcbdbb commit 270e75e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/components/Extensibility/ExtensibilityDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ export const ExtensibilityDetailsCore = ({
const dataSources = resMetaData?.dataSources || {};
const general = resMetaData?.general || {};

const prepareVisibility = (def, resource) => {
const [visible, error] = jsonata(def.visibility, { resource }, true);
return { visible, error };
};

return (
<ResourceDetails
layoutCloseCreateUrl={layoutCloseCreateUrl}
Expand All @@ -88,14 +93,7 @@ export const ExtensibilityDetailsCore = ({
Array.isArray(header)
? header.map((def, i) => ({
header: widgetT(def),
visibility: resource => {
const [visible, error] = jsonata(
def.visibility,
{ resource },
true,
);
return { visible, error };
},
visibility: resource => prepareVisibility(def, resource),
value: resource => (
<Widget
key={i}
Expand Down Expand Up @@ -133,6 +131,7 @@ export const ExtensibilityDetailsCore = ({
.map((def, i) => ({
header: widgetT(def),
fullWidth: def.fullWidth,
visibility: resource => prepareVisibility(def, resource),
value: resource => (
<Widget
key={i}
Expand All @@ -152,6 +151,7 @@ export const ExtensibilityDetailsCore = ({
.filter(def => def.widget === 'ConditionList')
.map((def, i) => ({
header: widgetT(def),
visibility: resource => prepareVisibility(def, resource),
value: resource => (
<Widget
key={i}
Expand Down

0 comments on commit 270e75e

Please sign in to comment.