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

Remove Notifications from Create/Edit #212

Merged
merged 1 commit into from
Nov 3, 2021
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 @@ -37,7 +37,6 @@ import {
EuiSpacer,
} from '@elastic/eui';
import { ReportSettings } from '../report_settings';
import { ReportDelivery } from '../delivery';
import { generateReportFromDefinitionId } from '../../main/main_utils';
import { converter } from '../utils';
import {
Expand Down Expand Up @@ -159,29 +158,6 @@ export function CreateReport(props: { [x: string]: any; setBreadcrumbs?: any; ht
setShowTriggerIntervalNaNError,
] = useState(false);
const [showCronError, setShowCronError] = useState(false);
const [showDeliveryChannelError, setShowDeliveryChannelError] = useState(
false
);
const [
deliveryChannelError,
setDeliveryChannelError,
] = useState('');
const [
showDeliverySubjectError,
setShowDeliverySubjectError
] = useState(false);
const [
deliverySubjectError,
setDeliverySubjectError
] = useState('');
const [
showDeliveryTextError,
setShowDeliveryTextError
] = useState(false);
const [
deliveryTextError,
setDeliveryTextError
] = useState('');
const [showTimeRangeError, setShowTimeRangeError] = useState(false);

// preserve the state of the request after an invalid create report definition request
Expand Down Expand Up @@ -287,12 +263,6 @@ export function CreateReport(props: { [x: string]: any; setBreadcrumbs?: any; ht
timeRange,
setShowTimeRangeError,
setShowCronError,
setShowDeliveryChannelError,
setDeliveryChannelError,
setShowDeliverySubjectError,
setDeliverySubjectError,
setShowDeliveryTextError,
setDeliveryTextError
).then((response) => {
error = response;
});
Expand Down Expand Up @@ -385,19 +355,6 @@ export function CreateReport(props: { [x: string]: any; setBreadcrumbs?: any; ht
showCronError={showCronError}
/>
<EuiSpacer />
<ReportDelivery
edit={false}
editDefinitionId={''}
httpClientProps={props['httpClient']}
reportDefinitionRequest={createReportDefinitionRequest}
showDeliveryChannelError={showDeliveryChannelError}
deliveryChannelError={deliveryChannelError}
showDeliverySubjectError={showDeliverySubjectError}
deliverySubjectError={deliverySubjectError}
showDeliveryTextError={showDeliveryTextError}
deliveryTextError={deliveryTextError}
/>
<EuiSpacer />
<EuiFlexGroup justifyContent="flexEnd">
<EuiFlexItem grow={false}>
<EuiButtonEmpty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import {
EuiGlobalToastList,
} from '@elastic/eui';
import { ReportSettings } from '../report_settings';
import { ReportDelivery } from '../delivery';
import { ReportTrigger } from '../report_trigger';
import { ReportDefinitionSchemaType } from 'server/model';
import { converter } from '../utils';
Expand Down Expand Up @@ -74,13 +73,6 @@ export function EditReportDefinition(props: { [x: string]: any; setBreadcrumbs?:
setShowTriggerIntervalNaNError,
] = useState(false);
const [showCronError, setShowCronError] = useState(false);
const [showDeliveryChannelError, setShowDeliveryChannelError] = useState(
false
);
const [
deliveryChannelError,
setDeliveryChannelError,
] = useState('');
const [showTimeRangeError, setShowTimeRangeError] = useState(false);

const addPermissionsMissingViewEditPageToastHandler = (errorType: string) => {
Expand Down Expand Up @@ -262,8 +254,6 @@ export function EditReportDefinition(props: { [x: string]: any; setBreadcrumbs?:
timeRange,
setShowTimeRangeError,
setShowCronError,
setShowDeliveryChannelError,
setDeliveryChannelError
).then((response) => {
error = response;
});
Expand Down Expand Up @@ -347,15 +337,6 @@ export function EditReportDefinition(props: { [x: string]: any; setBreadcrumbs?:
showCronError={showCronError}
/>
<EuiSpacer />
<ReportDelivery
edit={true}
editDefinitionId={reportDefinitionId}
reportDefinitionRequest={editReportDefinitionRequest}
httpClientProps={props['httpClient']}
showDeliveryChannelError={showDeliveryChannelError}
deliveryChannelError={deliveryChannelError}
/>
<EuiSpacer />
<EuiFlexGroup justifyContent="flexEnd">
<EuiFlexItem grow={false}>
<EuiButtonEmpty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,7 @@ export const definitionInputValidation = async (
setShowTriggerIntervalNaNError,
timeRange,
setShowTimeRangeError,
setShowCronError,
setShowDeliveryChannelError,
setDeliveryChannelsErrorMessage,
setShowDeliverySubjectError,
setDeliverySubjectError,
setShowDeliveryTextError,
setDeliveryTextError
setShowCronError
) => {
// check report name
// allow a-z, A-Z, 0-9, (), [], ',' - and _ and spaces
Expand Down Expand Up @@ -104,41 +98,5 @@ export const definitionInputValidation = async (
error = true;
}
}
// delivery
if (includeDelivery) {
if (metadata.delivery.configIds.length === 0) {
// no channels are listed
setShowDeliveryChannelError(true);
setDeliveryChannelsErrorMessage(
i18n.translate(
'opensearch.reports.error.channelListCannotBeEmpty',
{ defaultMessage: 'Channels list cannot be empty.' }
)
);
error = true;
}
// subject is empty
if (metadata.delivery.title === '') {
setShowDeliverySubjectError(true);
setDeliverySubjectError(
i18n.translate(
'opensearch.reports.error.deliverySubjectCannotBeEmpty',
{ defaultMessage: 'Subject cannot be empty.' }
)
);
error = true;
}
// message is empty
if (metadata.delivery.textDescription === '') {
setShowDeliveryTextError(true);
setDeliveryTextError(
i18n.translate(
'opensearch.reports.error.deliverySubjectCannotBeEmpty',
{ defaultMessage: 'Subject cannot be empty.' }
)
);
error = true;
}
}
return error;
};