popupdate

This commit is contained in:
Nate Kelley 2025-03-29 21:45:06 -06:00
parent 6d5f0c24ed
commit 9fa8c6a2d3
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
3 changed files with 20 additions and 6 deletions

View File

@ -8,10 +8,11 @@ export const SaveResetFilePopup: React.FC<{
open: boolean; open: boolean;
onReset: () => void; onReset: () => void;
onSave: () => void; onSave: () => void;
}> = React.memo(({ open, onReset, onSave }) => { isSaving: boolean;
}> = React.memo(({ open, onReset, onSave, isSaving = false }) => {
return ( return (
<PopupContainer show={open}> <PopupContainer show={open}>
<SplitterContent onReset={onReset} onSave={onSave} /> <SplitterContent onReset={onReset} onSave={onSave} isSaving={isSaving} />
</PopupContainer> </PopupContainer>
); );
}); });
@ -19,7 +20,8 @@ export const SaveResetFilePopup: React.FC<{
const SplitterContent: React.FC<{ const SplitterContent: React.FC<{
onReset: () => void; onReset: () => void;
onSave: () => void; onSave: () => void;
}> = React.memo(({ onReset, onSave }) => { isSaving: boolean;
}> = React.memo(({ onReset, onSave, isSaving }) => {
return ( return (
<div className="flex w-full items-center space-x-2.5"> <div className="flex w-full items-center space-x-2.5">
<div className="flex items-center space-x-1"> <div className="flex items-center space-x-1">
@ -35,6 +37,7 @@ const SplitterContent: React.FC<{
className="flex items-center" className="flex items-center"
variant="black" variant="black"
onClick={onSave} onClick={onSave}
loading={isSaving}
suffix={ suffix={
<div className="flex space-x-1"> <div className="flex space-x-1">
<Command /> <Command />

View File

@ -22,7 +22,7 @@ export const SelectAxisItemLabel = React.memo(
return formatLabel(id, columnLabelFormat, true); return formatLabel(id, columnLabelFormat, true);
}, [columnLabelFormat, id]); }, [columnLabelFormat, id]);
const Icon = useMemo(() => ColumnTypeIcon[style], [style]); const Icon = useMemo(() => ColumnTypeIcon[style] || ColumnTypeIcon.string, [style]);
return ( return (
<div <div

View File

@ -12,7 +12,13 @@ export const MetricViewFile: React.FC<MetricViewProps> = React.memo(({ metricId
file_name file_name
})); }));
const { openSuccessMessage } = useBusterNotifications(); const { openSuccessMessage } = useBusterNotifications();
const { mutateAsync: updateMetric, error: updateMetricError } = useSaveMetric(); const {
mutateAsync: updateMetric,
isPending: isUpdatingMetric,
error: updateMetricError
} = useSaveMetric({
updateOnSave: true
});
const updateMetricErrorMessage = updateMetricError?.message; const updateMetricErrorMessage = updateMetricError?.message;
@ -49,7 +55,12 @@ export const MetricViewFile: React.FC<MetricViewProps> = React.memo(({ metricId
error={updateMetricErrorMessage} error={updateMetricErrorMessage}
/> />
<SaveResetFilePopup open={showPopup} onReset={onResetFile} onSave={onSaveFile} /> <SaveResetFilePopup
open={showPopup}
onReset={onResetFile}
onSave={onSaveFile}
isSaving={isUpdatingMetric}
/>
</div> </div>
); );
}); });