mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-21 13:47:39 +02:00
parent
499c9cebfd
commit
80a9591d37
@ -40,21 +40,19 @@ export const FeatureMetrics = () => {
|
|||||||
featureId,
|
featureId,
|
||||||
query.hoursBack || FEATURE_METRIC_HOURS_BACK_DEFAULT,
|
query.hoursBack || FEATURE_METRIC_HOURS_BACK_DEFAULT,
|
||||||
);
|
);
|
||||||
const defaultApplication = Array.from(applications)[0];
|
|
||||||
|
const allApplications = Array.from(applications);
|
||||||
|
const defaultApplication = allApplications[0];
|
||||||
|
|
||||||
const { environment: selectedEnvironment, hoursBack } = query;
|
const { environment: selectedEnvironment, hoursBack } = query;
|
||||||
const selectedApplications = query.applications.filter(
|
const selectedApplications = query.applications.filter(
|
||||||
(item) => item !== null,
|
(item) => item !== null,
|
||||||
) as string[];
|
) as string[];
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (
|
if (query.applications && query.applications.length === 0) {
|
||||||
query.applications &&
|
setQuery({ applications: allApplications });
|
||||||
query.applications.length === 0 &&
|
|
||||||
defaultApplication
|
|
||||||
) {
|
|
||||||
setQuery({ applications: [defaultApplication] });
|
|
||||||
}
|
}
|
||||||
}, [JSON.stringify(Array.from(applications))]);
|
}, [JSON.stringify(allApplications)]);
|
||||||
|
|
||||||
const allSelected = [...applications].every((element) =>
|
const allSelected = [...applications].every((element) =>
|
||||||
selectedApplications.includes(element),
|
selectedApplications.includes(element),
|
||||||
@ -100,7 +98,7 @@ export const FeatureMetrics = () => {
|
|||||||
return (
|
return (
|
||||||
<PageContent>
|
<PageContent>
|
||||||
<Grid container component='header' spacing={2}>
|
<Grid container component='header' spacing={2}>
|
||||||
<Grid item xs={12} md={5}>
|
<Grid item xs={12} md={4}>
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
condition={environments.size > 0}
|
condition={environments.size > 0}
|
||||||
show={
|
show={
|
||||||
@ -115,7 +113,7 @@ export const FeatureMetrics = () => {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} md={5}>
|
<Grid item xs={12} md={6}>
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
condition={applications.size > 0}
|
condition={applications.size > 0}
|
||||||
show={
|
show={
|
||||||
|
@ -64,6 +64,15 @@ export const FeatureMetricsChips = ({
|
|||||||
<div>
|
<div>
|
||||||
<StyledTitle>{title}</StyledTitle>
|
<StyledTitle>{title}</StyledTitle>
|
||||||
<StyledList>
|
<StyledList>
|
||||||
|
{toggleValues && values.size > 1 && (
|
||||||
|
<Button
|
||||||
|
size={'small'}
|
||||||
|
onClick={toggleValues}
|
||||||
|
aria-pressed={allSelected}
|
||||||
|
>
|
||||||
|
{allSelected ? 'Unselect' : 'Select all'}
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
{sortedValues.map((val) => (
|
{sortedValues.map((val) => (
|
||||||
<StyledItem key={val}>
|
<StyledItem key={val}>
|
||||||
<Chip
|
<Chip
|
||||||
@ -74,16 +83,6 @@ export const FeatureMetricsChips = ({
|
|||||||
/>
|
/>
|
||||||
</StyledItem>
|
</StyledItem>
|
||||||
))}
|
))}
|
||||||
|
|
||||||
{toggleValues && values.size > 1 && (
|
|
||||||
<Button
|
|
||||||
size={'small'}
|
|
||||||
onClick={toggleValues}
|
|
||||||
aria-pressed={allSelected}
|
|
||||||
>
|
|
||||||
{allSelected ? 'Unselect' : 'Select all'}
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
</StyledList>
|
</StyledList>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user