Moved Select Options to External Files (#11400)
This is a minor rework of PR #10738. I noticed an inconsistency with how Select options are passed as props. Many files use constants stored in external files to pass options props to Select objects. This allows for code reusability. Some files are not passing options in this format. I modified more files so that they use this method of passing options props. I made changes to: - WorkerQueueMetricsSection.tsx - SettingsDataModelFieldBooleanForm.tsx - SettingsDataModelFieldTextForm.tsx - SettingsDataModelFieldNumberForm.tsx - PlaygroundSetupForm.tsx - ViewPickerContentCreateMode.tsx I also noticed that some of these files were incorrectly using useLingui(), so I fixed the import and usage where needed. --------- Co-authored-by: Beau Smith <bsmith26@iastate.edu> Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -1,14 +1,15 @@
|
||||
import { WORKER_QUEUE_METRICS_SELECT_OPTIONS } from '@/settings/admin-panel/health-status/constants/WorkerQueueMetricsSelectOptions';
|
||||
import { Select } from '@/ui/input/components/Select';
|
||||
import styled from '@emotion/styled';
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { useState } from 'react';
|
||||
import { H2Title } from 'twenty-ui/display';
|
||||
import { Section } from 'twenty-ui/layout';
|
||||
import {
|
||||
AdminPanelWorkerQueueHealth,
|
||||
QueueMetricsTimeRange,
|
||||
} from '~/generated/graphql';
|
||||
import { WorkerMetricsGraph } from './WorkerMetricsGraph';
|
||||
import { H2Title } from 'twenty-ui/display';
|
||||
import { Section } from 'twenty-ui/layout';
|
||||
|
||||
type WorkerQueueMetricsSectionProps = {
|
||||
queue: AdminPanelWorkerQueueHealth;
|
||||
@ -39,19 +40,10 @@ export const WorkerQueueMetricsSection = ({
|
||||
<Select
|
||||
dropdownId={`timerange-${queue.queueName}`}
|
||||
value={timeRange}
|
||||
options={[
|
||||
{ value: QueueMetricsTimeRange.SevenDays, label: t`This week` },
|
||||
{ value: QueueMetricsTimeRange.OneDay, label: t`Today` },
|
||||
{
|
||||
value: QueueMetricsTimeRange.TwelveHours,
|
||||
label: t`Last 12 hours`,
|
||||
},
|
||||
{
|
||||
value: QueueMetricsTimeRange.FourHours,
|
||||
label: t`Last 4 hours`,
|
||||
},
|
||||
{ value: QueueMetricsTimeRange.OneHour, label: t`Last 1 hour` },
|
||||
]}
|
||||
options={WORKER_QUEUE_METRICS_SELECT_OPTIONS.map((option) => ({
|
||||
...option,
|
||||
label: t(option.label),
|
||||
}))}
|
||||
onChange={setTimeRange}
|
||||
needIconCheck
|
||||
selectSizeVariant="small"
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { QueueMetricsTimeRange } from '~/generated/graphql';
|
||||
|
||||
export const WORKER_QUEUE_METRICS_SELECT_OPTIONS = [
|
||||
{ value: QueueMetricsTimeRange.SevenDays, label: msg`This week` },
|
||||
{ value: QueueMetricsTimeRange.OneDay, label: msg`Today` },
|
||||
{
|
||||
value: QueueMetricsTimeRange.TwelveHours,
|
||||
label: msg`Last 12 hours`,
|
||||
},
|
||||
{
|
||||
value: QueueMetricsTimeRange.FourHours,
|
||||
label: msg`Last 4 hours`,
|
||||
},
|
||||
{ value: QueueMetricsTimeRange.OneHour, label: msg`Last 1 hour` },
|
||||
];
|
||||
Reference in New Issue
Block a user