SeriesListe, valuePaneList ve valueAxisList
This commit is contained in:
parent
e74484fbc2
commit
d731943147
5 changed files with 48 additions and 93 deletions
|
|
@ -130,27 +130,6 @@ const FormEdit = () => {
|
|||
await getUserList()
|
||||
}
|
||||
|
||||
// const valueAxisList = () => {
|
||||
// return listFormValues?.valueAxisDto.map((key: ChartValueAxisDto) => ({
|
||||
// value: key.name,
|
||||
// label: key.name,
|
||||
// }))
|
||||
// }
|
||||
|
||||
// const valuePaneList = () => {
|
||||
// return listFormValues?.panesDto.map((key: ChartPanesDto) => ({
|
||||
// value: key.name,
|
||||
// label: key.name,
|
||||
// }))
|
||||
// }
|
||||
|
||||
// const SeriesList = () => {
|
||||
// return listFormValues?.seriesDto.map((key: ChartSeriesDto) => ({
|
||||
// value: key.name,
|
||||
// label: key.name,
|
||||
// }))
|
||||
// }
|
||||
|
||||
//LİST FORM ve LİST FORM FİELDS AİT BİLGİLER
|
||||
useEffect(() => {
|
||||
refreshData()
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import { SelectBoxOption } from '@/shared/types'
|
|||
import { useStoreActions, useStoreState } from '@/store'
|
||||
import { useLocalization } from '@/utils/hooks/useLocalization'
|
||||
import { Field, FieldProps, Form, Formik } from 'formik'
|
||||
import { Dispatch, SetStateAction, useEffect, useState } from 'react'
|
||||
import { Dispatch, SetStateAction } from 'react'
|
||||
import { number, object, string } from 'yup'
|
||||
import { JsonRowDialogData } from './types'
|
||||
import {
|
||||
|
|
@ -32,6 +32,7 @@ import {
|
|||
chartTitleWordWrapListOptions,
|
||||
chartSeriesDashStyleOptions,
|
||||
} from '../options'
|
||||
import { ChartSeriesDto } from '@/proxy/admin/charts/models'
|
||||
|
||||
const schema = object().shape({
|
||||
name: string().required('Name Required'),
|
||||
|
|
@ -50,28 +51,21 @@ function JsonRowOpDialogAnnotation({
|
|||
data: JsonRowDialogData | undefined
|
||||
setData: Dispatch<SetStateAction<JsonRowDialogData | undefined>>
|
||||
}) {
|
||||
const [permissionOptions, setPermissionOptions] = useState<SelectBoxOption[]>([])
|
||||
const { translate } = useLocalization()
|
||||
|
||||
const permissions: Record<string, boolean> | undefined = useStoreState(
|
||||
(state) => state.abpConfig.config?.auth.grantedPolicies,
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
if (permissions) {
|
||||
setPermissionOptions(
|
||||
Object.keys(permissions).map((key) => {
|
||||
return {
|
||||
value: key,
|
||||
label: key,
|
||||
}
|
||||
}),
|
||||
)
|
||||
}
|
||||
}, [permissions])
|
||||
|
||||
const { setJsonValue } = useStoreActions((a) => a.admin)
|
||||
|
||||
const listFormValues = useStoreState((s) => s.admin.listFormValues)
|
||||
if (!listFormValues) {
|
||||
return null
|
||||
}
|
||||
|
||||
const SeriesList = () => {
|
||||
return listFormValues?.seriesDto.map((key: ChartSeriesDto) => ({
|
||||
value: key.name,
|
||||
label: key.name,
|
||||
}))
|
||||
}
|
||||
|
||||
const handleClose = async (e?: any) => {
|
||||
if (e) {
|
||||
e.preventDefault()
|
||||
|
|
@ -219,17 +213,19 @@ function JsonRowOpDialogAnnotation({
|
|||
invalid={errors.series && touched.series}
|
||||
errorMessage={errors.series}
|
||||
>
|
||||
<Field type="text" name="type">
|
||||
<Field type="text" name="series">
|
||||
{({ field, form }: FieldProps<SelectBoxOption>) => (
|
||||
<Select
|
||||
field={field}
|
||||
form={form}
|
||||
isClearable={true}
|
||||
// options={SeriesList()}
|
||||
// value={SeriesList()?.find(
|
||||
// (option) => option.value === values.series,
|
||||
// )}
|
||||
// onChange={(option) => form.setFieldValue(field.name, option?.value)}
|
||||
options={SeriesList()}
|
||||
value={SeriesList()?.find(
|
||||
(option) => option.value === values.series,
|
||||
)}
|
||||
onChange={(option) =>
|
||||
form.setFieldValue(field.name, option?.value)
|
||||
}
|
||||
/>
|
||||
)}
|
||||
</Field>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import {
|
|||
toast,
|
||||
} from '@/components/ui'
|
||||
import { ListFormJsonRowDto } from '@/proxy/admin/list-form/models'
|
||||
import { useStoreActions, useStoreState } from '@/store'
|
||||
import { useStoreActions } from '@/store'
|
||||
import { useLocalization } from '@/utils/hooks/useLocalization'
|
||||
import { Field, Form, Formik } from 'formik'
|
||||
import { Dispatch, SetStateAction, useEffect, useState } from 'react'
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import {
|
|||
} from '@/components/ui'
|
||||
import { ListFormJsonRowDto } from '@/proxy/admin/list-form/models'
|
||||
import { SelectBoxOption } from '@/shared/types'
|
||||
import { useStoreActions } from '@/store'
|
||||
import { useStoreActions, useStoreState } from '@/store'
|
||||
import { useLocalization } from '@/utils/hooks/useLocalization'
|
||||
import { Field, FieldProps, Form, Formik } from 'formik'
|
||||
import { Dispatch, SetStateAction, useEffect, useState } from 'react'
|
||||
|
|
@ -30,6 +30,7 @@ import {
|
|||
chartSeriesSelectionModeOptions,
|
||||
chartSeriesTypeOptions,
|
||||
} from '../options'
|
||||
import { ChartPanesDto, ChartSeriesDto, ChartValueAxisDto } from '@/proxy/admin/charts/models'
|
||||
|
||||
const schema = object().shape({
|
||||
visible: boolean().notRequired(),
|
||||
|
|
@ -91,26 +92,24 @@ function JsonRowOpDialogSeries({
|
|||
setIsOpen(false)
|
||||
}
|
||||
|
||||
// const valueAxisList = () => {
|
||||
// return data?.chartPaneValues?.map((key: ChartValueAxisDto) => ({
|
||||
// value: key.name,
|
||||
// label: key.name,
|
||||
// }))
|
||||
// }
|
||||
const listFormValues = useStoreState((s) => s.admin.listFormValues)
|
||||
if (!listFormValues) {
|
||||
return null
|
||||
}
|
||||
|
||||
// const valuePaneList = () => {
|
||||
// return data?.chartPaneValues?.map((key: ChartPanesDto) => ({
|
||||
// value: key.name,
|
||||
// label: key.name,
|
||||
// }))
|
||||
// }
|
||||
const valueAxisList = () => {
|
||||
return listFormValues?.valueAxisDto.map((key: ChartValueAxisDto) => ({
|
||||
value: key.name,
|
||||
label: key.name,
|
||||
}))
|
||||
}
|
||||
|
||||
// const SeriesList = () => {
|
||||
// return data?.chartSeriesValues?.map((key: ChartSeriesDto) => ({
|
||||
// value: key.name,
|
||||
// label: key.name,
|
||||
// }))
|
||||
// }
|
||||
const valuePaneList = () => {
|
||||
return listFormValues?.panesDto.map((key: ChartPanesDto) => ({
|
||||
value: key.name,
|
||||
label: key.name,
|
||||
}))
|
||||
}
|
||||
|
||||
if (!data) {
|
||||
return null
|
||||
|
|
@ -276,9 +275,9 @@ function JsonRowOpDialogSeries({
|
|||
field={field}
|
||||
form={form}
|
||||
isClearable={true}
|
||||
// options={valueAxisList()}
|
||||
// value={valueAxisList()?.find((option) => option.value === values.axis)}
|
||||
// onChange={(option) => form.setFieldValue(field.name, option?.value)}
|
||||
options={valueAxisList()}
|
||||
value={valueAxisList()?.find((option) => option.value === values.axis)}
|
||||
onChange={(option) => form.setFieldValue(field.name, option?.value)}
|
||||
/>
|
||||
)}
|
||||
</Field>
|
||||
|
|
@ -295,9 +294,9 @@ function JsonRowOpDialogSeries({
|
|||
field={field}
|
||||
form={form}
|
||||
isClearable={true}
|
||||
// options={valuePaneList()}
|
||||
// value={valuePaneList()?.find((option) => option.value === values.pane)}
|
||||
// onChange={(option) => form.setFieldValue(field.name, option?.value)}
|
||||
options={valuePaneList()}
|
||||
value={valuePaneList()?.find((option) => option.value === values.pane)}
|
||||
onChange={(option) => form.setFieldValue(field.name, option?.value)}
|
||||
/>
|
||||
)}
|
||||
</Field>
|
||||
|
|
|
|||
|
|
@ -49,26 +49,7 @@ function JsonRowOpDialogWidget({
|
|||
data: JsonRowDialogData | undefined
|
||||
setData: Dispatch<SetStateAction<JsonRowDialogData | undefined>>
|
||||
}) {
|
||||
const [permissionOptions, setPermissionOptions] = useState<SelectBoxOption[]>([])
|
||||
const { translate } = useLocalization()
|
||||
|
||||
const permissions: Record<string, boolean> | undefined = useStoreState(
|
||||
(state) => state.abpConfig.config?.auth.grantedPolicies,
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
if (permissions) {
|
||||
setPermissionOptions(
|
||||
Object.keys(permissions).map((key) => {
|
||||
return {
|
||||
value: key,
|
||||
label: key,
|
||||
}
|
||||
}),
|
||||
)
|
||||
}
|
||||
}, [permissions])
|
||||
|
||||
const { setJsonValue } = useStoreActions((a) => a.admin)
|
||||
|
||||
const handleClose = async (e?: any) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue