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