- removed other options
This commit is contained in:
@@ -2,15 +2,11 @@ import Card from "../../UI/Card";
|
|||||||
import CardHeader from "../../UI/CardHeader";
|
import CardHeader from "../../UI/CardHeader";
|
||||||
import BearerTypeFields from "./BearerTypeFields";
|
import BearerTypeFields from "./BearerTypeFields";
|
||||||
|
|
||||||
type BearerTypeCardProps = {
|
const BearerTypeCard = () => {
|
||||||
options: string[];
|
|
||||||
};
|
|
||||||
|
|
||||||
const BearerTypeCard = ({ options }: BearerTypeCardProps) => {
|
|
||||||
return (
|
return (
|
||||||
<Card className="p-4">
|
<Card className="p-4">
|
||||||
<CardHeader title="Bearer Type" />
|
<CardHeader title="Bearer Type" />
|
||||||
<BearerTypeFields options={options} />
|
<BearerTypeFields />
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,11 +3,7 @@ import FormToggle from "../components/FormToggle";
|
|||||||
import FormGroup from "../components/FormGroup";
|
import FormGroup from "../components/FormGroup";
|
||||||
import type { BearerTypeFieldType, InitialValuesForm } from "../../../types/types";
|
import type { BearerTypeFieldType, InitialValuesForm } from "../../../types/types";
|
||||||
|
|
||||||
type BearerTypeFieldsProps = {
|
const BearerTypeFields = () => {
|
||||||
options: string[];
|
|
||||||
};
|
|
||||||
|
|
||||||
const BearerTypeFields = ({ options }: BearerTypeFieldsProps) => {
|
|
||||||
useFormikContext<BearerTypeFieldType & InitialValuesForm>();
|
useFormikContext<BearerTypeFieldType & InitialValuesForm>();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -20,11 +16,12 @@ const BearerTypeFields = ({ options }: BearerTypeFieldsProps) => {
|
|||||||
id="format"
|
id="format"
|
||||||
className="p-2 border border-gray-400 rounded-lg text-white bg-[#253445] w-full md:w-60"
|
className="p-2 border border-gray-400 rounded-lg text-white bg-[#253445] w-full md:w-60"
|
||||||
>
|
>
|
||||||
{options?.map((option: string) => (
|
<option key={"JSON"} value={"JSON"}>
|
||||||
<option key={option} value={option}>
|
JSON
|
||||||
{option}
|
</option>
|
||||||
|
<option key={"BOF2"} value={"BOF2"}>
|
||||||
|
BOF2
|
||||||
</option>
|
</option>
|
||||||
))}
|
|
||||||
</Field>
|
</Field>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
|
|||||||
@@ -30,6 +30,22 @@ const ChannelFields = ({ touched, isSubmitting, format }: ChannelFieldsProps) =>
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
|
{format?.toLowerCase() !== "bof2" && format?.toLowerCase() !== "json" ? (
|
||||||
|
<>
|
||||||
|
<div className="mt-4 flex flex-col items-center justify-center rounded-2xl border border-slate-800 bg-slate-900/40 p-10 text-center">
|
||||||
|
<div className="mb-3 rounded-xl bg-slate-800 px-3 py-1 text-xs uppercase tracking-wider text-slate-400">
|
||||||
|
Format coming soon
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p className="max-w-md text-slate-300">
|
||||||
|
Output configuration currently supports <span className="font-bold text-blue-400">JSON</span> or{" "}
|
||||||
|
<span className="font-bold text-emerald-400">BOF2</span>. <br /> More formats will be added in future
|
||||||
|
updates.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
<>
|
<>
|
||||||
<div className="flex flex-col space-y-2 px-2">
|
<div className="flex flex-col space-y-2 px-2">
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
@@ -103,6 +119,7 @@ const ChannelFields = ({ touched, isSubmitting, format }: ChannelFieldsProps) =>
|
|||||||
} rounded-lg w-full md:w-60`}
|
} rounded-lg w-full md:w-60`}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
{format?.toLowerCase() === "bof2" && (
|
{format?.toLowerCase() === "bof2" && (
|
||||||
<>
|
<>
|
||||||
<div className="border-b border-gray-500 my-3">
|
<div className="border-b border-gray-500 my-3">
|
||||||
@@ -172,6 +189,8 @@ const ChannelFields = ({ touched, isSubmitting, format }: ChannelFieldsProps) =>
|
|||||||
</button>
|
</button>
|
||||||
<ValidationToastOnce />
|
<ValidationToastOnce />
|
||||||
</>
|
</>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import type {
|
|||||||
InitialValuesFormErrors,
|
InitialValuesFormErrors,
|
||||||
OptionalBOF2Constants,
|
OptionalBOF2Constants,
|
||||||
} from "../../../types/types";
|
} from "../../../types/types";
|
||||||
import { cleanArray } from "../../../utils/utils";
|
|
||||||
import { useQueryClient } from "@tanstack/react-query";
|
import { useQueryClient } from "@tanstack/react-query";
|
||||||
import { useUpdateBackOfficeConfig } from "../../../hooks/useBackOfficeConfig";
|
import { useUpdateBackOfficeConfig } from "../../../hooks/useBackOfficeConfig";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
@@ -21,7 +20,6 @@ const SettingForms = () => {
|
|||||||
const { bof2ConstantsQuery } = useGetDispatcherConfig();
|
const { bof2ConstantsQuery } = useGetDispatcherConfig();
|
||||||
|
|
||||||
const format = dispatcherQuery?.data?.propFormat?.value;
|
const format = dispatcherQuery?.data?.propFormat?.value;
|
||||||
const rawOptions = dispatcherQuery?.data?.propFormat?.accepted;
|
|
||||||
const enabled = dispatcherQuery?.data?.propEnabled?.value;
|
const enabled = dispatcherQuery?.data?.propEnabled?.value;
|
||||||
|
|
||||||
const FFID = bof2ConstantsQuery?.data?.propFeedIdentifier?.value;
|
const FFID = bof2ConstantsQuery?.data?.propFeedIdentifier?.value;
|
||||||
@@ -29,8 +27,6 @@ const SettingForms = () => {
|
|||||||
const GPSFormat = bof2ConstantsQuery?.data?.propGpsFormat?.value;
|
const GPSFormat = bof2ConstantsQuery?.data?.propGpsFormat?.value;
|
||||||
const timestampSource = bof2ConstantsQuery?.data?.propTimeZoneType?.value;
|
const timestampSource = bof2ConstantsQuery?.data?.propTimeZoneType?.value;
|
||||||
|
|
||||||
const options = cleanArray(rawOptions);
|
|
||||||
|
|
||||||
const initialValues: BearerTypeFieldType & InitialValuesForm & OptionalBOF2Constants = {
|
const initialValues: BearerTypeFieldType & InitialValuesForm & OptionalBOF2Constants = {
|
||||||
format: format ?? "JSON",
|
format: format ?? "JSON",
|
||||||
enabled: enabled === "true",
|
enabled: enabled === "true",
|
||||||
@@ -109,7 +105,7 @@ const SettingForms = () => {
|
|||||||
{({ isSubmitting, touched }) => (
|
{({ isSubmitting, touched }) => (
|
||||||
<Form>
|
<Form>
|
||||||
<div className="mx-auto grid grid-cols-1 sm:grid-cols-1 lg:grid-cols-2 gap-2 px-2 sm:px-4 lg:px-0 w-full">
|
<div className="mx-auto grid grid-cols-1 sm:grid-cols-1 lg:grid-cols-2 gap-2 px-2 sm:px-4 lg:px-0 w-full">
|
||||||
<BearerTypeCard options={options} />
|
<BearerTypeCard />
|
||||||
<ChannelCard touched={touched} isSubmitting={isSubmitting} />
|
<ChannelCard touched={touched} isSubmitting={isSubmitting} />
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
|
|||||||
Reference in New Issue
Block a user