Schema type is not updated when history push (#1474)
Co-authored-by: Ekaterina Petrova <epetrova@provectus.com>
This commit is contained in:
parent
f2272bd6b3
commit
471e84d0f9
3 changed files with 13 additions and 2 deletions
|
@ -194,6 +194,7 @@ const ResetOffsets: React.FC = () => {
|
||||||
minWidth="100%"
|
minWidth="100%"
|
||||||
name={name}
|
name={name}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
|
defaultValue={value}
|
||||||
value={value}
|
value={value}
|
||||||
options={uniqueTopics.map((topic) => ({
|
options={uniqueTopics.map((topic) => ({
|
||||||
value: topic,
|
value: topic,
|
||||||
|
|
|
@ -14,7 +14,9 @@ import { InputLabel } from 'components/common/Input/InputLabel.styled';
|
||||||
import PageHeading from 'components/common/PageHeading/PageHeading';
|
import PageHeading from 'components/common/PageHeading/PageHeading';
|
||||||
import { useAppDispatch, useAppSelector } from 'lib/hooks/redux';
|
import { useAppDispatch, useAppSelector } from 'lib/hooks/redux';
|
||||||
import {
|
import {
|
||||||
|
schemaAdded,
|
||||||
schemasApiClient,
|
schemasApiClient,
|
||||||
|
schemaUpdated,
|
||||||
selectSchemaById,
|
selectSchemaById,
|
||||||
} from 'redux/reducers/schemas/schemasSlice';
|
} from 'redux/reducers/schemas/schemasSlice';
|
||||||
import { serverErrorAlertAdded } from 'redux/reducers/alerts/alertsSlice';
|
import { serverErrorAlertAdded } from 'redux/reducers/alerts/alertsSlice';
|
||||||
|
@ -48,7 +50,7 @@ const Edit: React.FC = () => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (dirtyFields.newSchema || dirtyFields.schemaType) {
|
if (dirtyFields.newSchema || dirtyFields.schemaType) {
|
||||||
await schemasApiClient.createNewSchema({
|
const resp = await schemasApiClient.createNewSchema({
|
||||||
clusterName,
|
clusterName,
|
||||||
newSchemaSubject: {
|
newSchemaSubject: {
|
||||||
...schema,
|
...schema,
|
||||||
|
@ -56,6 +58,7 @@ const Edit: React.FC = () => {
|
||||||
schemaType: props.schemaType || schema.schemaType,
|
schemaType: props.schemaType || schema.schemaType,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
dispatch(schemaAdded(resp));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dirtyFields.compatibilityLevel) {
|
if (dirtyFields.compatibilityLevel) {
|
||||||
|
@ -66,6 +69,12 @@ const Edit: React.FC = () => {
|
||||||
compatibility: props.compatibilityLevel,
|
compatibility: props.compatibilityLevel,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
dispatch(
|
||||||
|
schemaUpdated({
|
||||||
|
...schema,
|
||||||
|
compatibilityLevel: props.compatibilityLevel,
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
history.push(clusterSchemaPath(clusterName, subject));
|
history.push(clusterSchemaPath(clusterName, subject));
|
||||||
|
|
|
@ -55,6 +55,7 @@ const schemasSlice = createSlice({
|
||||||
}),
|
}),
|
||||||
reducers: {
|
reducers: {
|
||||||
schemaAdded: schemasAdapter.addOne,
|
schemaAdded: schemasAdapter.addOne,
|
||||||
|
schemaUpdated: schemasAdapter.upsertOne,
|
||||||
},
|
},
|
||||||
extraReducers: (builder) => {
|
extraReducers: (builder) => {
|
||||||
builder.addCase(fetchSchemas.fulfilled, (state, { payload }) => {
|
builder.addCase(fetchSchemas.fulfilled, (state, { payload }) => {
|
||||||
|
@ -74,7 +75,7 @@ export const { selectAll: selectAllSchemaVersions } =
|
||||||
(state) => state.schemas.versions
|
(state) => state.schemas.versions
|
||||||
);
|
);
|
||||||
|
|
||||||
export const { schemaAdded } = schemasSlice.actions;
|
export const { schemaAdded, schemaUpdated } = schemasSlice.actions;
|
||||||
|
|
||||||
export const getAreSchemasFulfilled = createSelector(
|
export const getAreSchemasFulfilled = createSelector(
|
||||||
createFetchingSelector('schemas/fetch'),
|
createFetchingSelector('schemas/fetch'),
|
||||||
|
|
Loading…
Add table
Reference in a new issue