-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Kevin Delemme <[email protected]> Co-authored-by: kibanamachine <[email protected]>
- Loading branch information
1 parent
a30b18d
commit 21fc4cc
Showing
26 changed files
with
1,094 additions
and
299 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
x-pack/plugins/observability/public/pages/slos/components/card_view/cards_per_row.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React, { useEffect } from 'react'; | ||
import { FormattedMessage } from '@kbn/i18n-react'; | ||
import { EuiFormRow, EuiSelect } from '@elastic/eui'; | ||
import useLocalStorage from 'react-use/lib/useLocalStorage'; | ||
|
||
export const SLO_CARD_VIEW_PER_ROW_SIZE = 'slo-card-view-per-row-size'; | ||
|
||
export function CardsPerRow({ | ||
setCardsPerRow, | ||
}: { | ||
setCardsPerRow: (cardsPerRow?: string) => void; | ||
}) { | ||
const [value, setValue] = useLocalStorage(SLO_CARD_VIEW_PER_ROW_SIZE, '3'); | ||
|
||
useEffect(() => { | ||
setCardsPerRow(value); | ||
}, [setCardsPerRow, value]); | ||
|
||
const options = [ | ||
{ value: '3', text: '3' }, | ||
{ value: '4', text: '4' }, | ||
]; | ||
|
||
return ( | ||
<EuiFormRow | ||
label={ | ||
<FormattedMessage | ||
id="xpack.observability.gridSize.euiFormRow.itemsPerRowLabel" | ||
defaultMessage="Cards per row" | ||
/> | ||
} | ||
> | ||
<EuiSelect | ||
data-test-subj="o11yGridSizeSelect" | ||
id={'grid-size-select'} | ||
options={options} | ||
value={value} | ||
onChange={(e) => setValue(e.target.value)} | ||
/> | ||
</EuiFormRow> | ||
); | ||
} |
Oops, something went wrong.