Skip to content

Commit 240d5d9

Browse files
committed
dataExport: gate export button with Feature and disable on missing discover-query; show GS hovercard via hookName
1 parent cfe9e2e commit 240d5d9

File tree

1 file changed

+35
-27
lines changed

1 file changed

+35
-27
lines changed

static/app/components/dataExport.tsx

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -128,33 +128,41 @@ function DataExport({
128128
}, []);
129129

130130
return (
131-
<Feature features="organizations:discover-query">
132-
{inProgress ? (
133-
<Button
134-
size="sm"
135-
priority="default"
136-
title={t(
137-
"You can get on with your life. We'll email you when your data's ready."
138-
)}
139-
disabled
140-
icon={icon}
141-
>
142-
{t("We're working on it...")}
143-
</Button>
144-
) : (
145-
<Button
146-
onClick={debounce(handleDataExport, 500)}
147-
disabled={disabled || false}
148-
size="sm"
149-
priority="default"
150-
title={t(
151-
"Put your data to work. Start your export and we'll email you when it's finished."
152-
)}
153-
icon={icon}
154-
>
155-
{children ? children : t('Export All to CSV')}
156-
</Button>
157-
)}
131+
<Feature
132+
features="organizations:discover-query"
133+
hookName="feature-disabled:grid-editable-actions"
134+
renderDisabled={props =>
135+
typeof props.children === 'function' ? props.children(props) : props.children
136+
}
137+
>
138+
{({hasFeature}) =>
139+
inProgress ? (
140+
<Button
141+
size="sm"
142+
priority="default"
143+
title={t(
144+
"You can get on with your life. We'll email you when your data's ready."
145+
)}
146+
disabled
147+
icon={icon}
148+
>
149+
{t("We're working on it...")}
150+
</Button>
151+
) : (
152+
<Button
153+
onClick={debounce(handleDataExport, 500)}
154+
disabled={Boolean(disabled) || !hasFeature}
155+
size="sm"
156+
priority="default"
157+
title={t(
158+
"Put your data to work. Start your export and we'll email you when it's finished."
159+
)}
160+
icon={icon}
161+
>
162+
{children ? children : t('Export All to CSV')}
163+
</Button>
164+
)
165+
}
158166
</Feature>
159167
);
160168
}

0 commit comments

Comments
 (0)