Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[frontend] enable latitude and longitude removing from UI (#8440) #8450

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ AdministrativeAreaEditionOverviewProps
},
});
};
const handleSubmitField = (name: string, value: Option | string) => {
const handleSubmitField = (name: string, value: Option | string | null) => {
if (!enableReferences) {
let finalValue: string = value as string;
if (name === 'x_opencti_workflow_id') {
Expand All @@ -212,7 +212,7 @@ AdministrativeAreaEditionOverviewProps
editor.fieldPatch({
variables: {
id: administrativeArea.id,
input: [{ key: name, value: [finalValue ?? ''] }],
input: [{ key: name, value: [finalValue ?? null] }],
},
});
})
Expand Down Expand Up @@ -286,10 +286,11 @@ AdministrativeAreaEditionOverviewProps
variant="standard"
style={{ marginTop: 20 }}
name="latitude"
type="number"
label={t_i18n('Latitude')}
fullWidth={true}
onFocus={editor.changeFocus}
onSubmit={handleSubmitField}
onSubmit={(name: string, value: string) => handleSubmitField(name, (value === '' ? null : value))}
helperText={
<SubscriptionFocus context={context} fieldName="latitude" />
}
Expand All @@ -299,10 +300,11 @@ AdministrativeAreaEditionOverviewProps
variant="standard"
style={{ marginTop: 20 }}
name="longitude"
type="number"
label={t_i18n('Longitude')}
fullWidth={true}
onFocus={editor.changeFocus}
onSubmit={handleSubmitField}
onSubmit={(name: string, value: string) => handleSubmitField(name, (value === '' ? null : value))}
helperText={
<SubscriptionFocus context={context} fieldName="longitude" />
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ const CityEditionOverview: FunctionComponent<CityEditionOverviewProps> = ({
},
});
};
const handleSubmitField = (name: string, value: Option | string) => {
const handleSubmitField = (name: string, value: Option | string | null) => {
if (!enableReferences) {
let finalValue: string = value as string;
if (name === 'x_opencti_workflow_id') {
Expand All @@ -199,7 +199,7 @@ const CityEditionOverview: FunctionComponent<CityEditionOverviewProps> = ({
editor.fieldPatch({
variables: {
id: city.id,
input: [{ key: name, value: [finalValue ?? ''] }],
input: [{ key: name, value: [finalValue ?? null] }],
},
});
})
Expand Down Expand Up @@ -273,10 +273,11 @@ const CityEditionOverview: FunctionComponent<CityEditionOverviewProps> = ({
variant="standard"
style={{ marginTop: 20 }}
name="latitude"
type="number"
label={t_i18n('Latitude')}
fullWidth={true}
onFocus={editor.changeFocus}
onSubmit={handleSubmitField}
onSubmit={(name: string, value: string) => handleSubmitField(name, (value === '' ? null : value))}
helperText={
<SubscriptionFocus context={context} fieldName="latitude" />
}
Expand All @@ -286,10 +287,11 @@ const CityEditionOverview: FunctionComponent<CityEditionOverviewProps> = ({
variant="standard"
style={{ marginTop: 20 }}
name="longitude"
type="number"
label={t_i18n('Longitude')}
fullWidth={true}
onFocus={editor.changeFocus}
onSubmit={handleSubmitField}
onSubmit={(name: string, value: string) => handleSubmitField(name, (value === '' ? null : value))}
helperText={
<SubscriptionFocus context={context} fieldName="longitude" />
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ const PositionEditionOverviewComponent = (props) => {
editor.fieldPatch({
variables: {
id: position.id,
input: {
input: [{
key: name,
value: finalValue ?? '',
},
value: finalValue ?? [null],
}],
},
});
})
Expand Down Expand Up @@ -238,10 +238,11 @@ const PositionEditionOverviewComponent = (props) => {
variant="standard"
style={{ marginTop: 20 }}
name="latitude"
type="number"
label={t_i18n('Latitude')}
fullWidth={true}
onFocus={editor.changeFocus}
onSubmit={handleSubmitField}
onSubmit={(name, value) => handleSubmitField(name, (value === '' ? null : value))}
helperText={
<SubscriptionFocus context={context} fieldName="latitude" />
}
Expand All @@ -251,10 +252,11 @@ const PositionEditionOverviewComponent = (props) => {
variant="standard"
style={{ marginTop: 20 }}
name="longitude"
type="number"
label={t_i18n('Longitude')}
fullWidth={true}
onFocus={editor.changeFocus}
onSubmit={handleSubmitField}
onSubmit={(name, value) => handleSubmitField(name, (value === '' ? null : value))}
helperText={
<SubscriptionFocus context={context} fieldName="longitude" />
}
Expand Down