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

ANT-3235 #953

Merged
merged 1 commit into from
Nov 27, 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
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-autoql",
"version": "8.8.50",
"version": "8.8.51",
"description": "React Widget Library",
"main": "dist/autoql.cjs.js",
"module": "dist/autoql.esm.js",
Expand Down
33 changes: 9 additions & 24 deletions src/components/Notifications/ScheduleBuilder/ScheduleBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default class ScheduleBuilder extends React.Component {
conditionType: EXISTS_TYPE,
showTypeSelector: true,
dataAlert: undefined,
onCompleteChange: () => { },
onCompleteChange: () => {},
}

componentDidMount = () => {
Expand Down Expand Up @@ -163,7 +163,6 @@ export default class ScheduleBuilder extends React.Component {

getInitialStateFromDataAlert = (props, state) => {
const { dataAlert } = props

try {
const evalFrequency = dataAlert?.evaluation_frequency

Expand All @@ -178,16 +177,6 @@ export default class ScheduleBuilder extends React.Component {
state.isCustomEvaluationFrequencyInputVisible = true
}

if (
!state.resetPeriodSelectValue &&
props.dataAlertType !== SCHEDULED_TYPE &&
this.SUPPORTED_CONDITION_TYPES.includes(COMPARE_TYPE)
) {
// We don't want to support null reset_periods for compare type data alerts
// To avoid continuous triggering of the alert. Use default value in this case
state.resetPeriodSelectValue = this.timeRange ?? this.DEFAULT_RESET_PERIOD_SELECT_VALUE
}

if (state.resetPeriodSelectValue === null) {
state.resetPeriodSelectValue = 'NONE'
}
Expand Down Expand Up @@ -219,8 +208,9 @@ export default class ScheduleBuilder extends React.Component {
}

getSummary = () => {
return `${this.state.resetPeriodSelectValue} ${this.getDayOfSelection(this.state.resetPeriodSelectValue)} ${this.state.intervalTimeSelectValue?.value
} ${this.state.timezone}`
return `${this.state.resetPeriodSelectValue} ${this.getDayOfSelection(this.state.resetPeriodSelectValue)} ${
this.state.intervalTimeSelectValue?.value
} ${this.state.timezone}`
}

getData = () => {
Expand Down Expand Up @@ -391,7 +381,7 @@ export default class ScheduleBuilder extends React.Component {
}

dayOfMonthSelector = () => {
const dayOptions = Array.from({ length: 31 }, (_, i) => i + 1);
const dayOptions = Array.from({ length: 31 }, (_, i) => i + 1)
const formattedOptions = dayOptions.map((value) => ({
value,
label: <span dangerouslySetInnerHTML={{ __html: `${value}${getDayOfTheMonthSuffix(value)}` }} />,
Expand All @@ -413,7 +403,6 @@ export default class ScheduleBuilder extends React.Component {
/>
</div>
</>

)
}

Expand Down Expand Up @@ -597,14 +586,10 @@ export default class ScheduleBuilder extends React.Component {
return (
<div className='react-autoql-data-alert-frequency-option'>
<Select
options={Object.keys(RESET_PERIOD_OPTIONS)
.map((value) => ({
value,
label: <span dangerouslySetInnerHTML={{ __html: RESET_PERIOD_OPTIONS[value].displayName }} />,
}))
// To show "every time this happens", it must be an exists type query that was either selected by the user,
// or an exists type query that does not have a compare option (list query)
.filter((option) => (option?.value === 'NONE' ? this.props.conditionType === EXISTS_TYPE : true))}
options={Object.keys(RESET_PERIOD_OPTIONS).map((value) => ({
value,
label: <span dangerouslySetInnerHTML={{ __html: RESET_PERIOD_OPTIONS[value].displayName }} />,
}))}
label='Send a notification'
value={this.state.resetPeriodSelectValue}
onChange={(option) => this.setState({ resetPeriodSelectValue: option })}
Expand Down