Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Conversation

@mfix22
Copy link
Contributor

@mfix22 mfix22 commented Jul 10, 2018

Closing in favor of local branch at #488

This is a WIP PR that adds cronInterval support to the frontend πŸ‘

We will shortly add the backend support and merge it in with this branch. We just wanted to get this up for @n-riesco to review before doing so.

TODO:

  • Add backend support for scheduling
  • Finish off unit testing components
  • Run Prettier

@mfix22 mfix22 requested a review from n-riesco July 10, 2018 22:51

import {Row} from '../../layout.jsx';

// react-select requires options to have `label` and `value` keys
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx a lot for adding this kind of comment!

onChange={this.handleIntervalChange}
/>
</div>
<Row style={Object.assign({}, rowStyleOverride, { marginTop: '8px', borderTop: '1px solid #c8d4e3', paddingTop: '24px' })}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

linter fails here with "maximum line kength exceeded"

/* eslint-disable no-multi-str */
import {concat} from 'ramda';

// Default to 1 week for `refreshInterval` for backwards compatability
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for backwards-compatibility?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I've just got it. This is to prevent old versions of falcon from running new scheduled queries as setInterval(runQuery, NaN). Could you add something like that to comment, please?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is to address my concerns about what happens if an non-cron-supporting version of Falcon is started in an environment where there are persisted queries that have been created with a cronInterval.

Copy link
Contributor

@n-riesco n-riesco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very good to me. Thanks for splitting the code into small files, easy to read!

I'm sure the styles are still work in progress. Here's a screen capture with issues I noticed:

peek 2018-07-11 15-13

/* eslint-disable no-multi-str */
import {concat} from 'ramda';

// Default to 1 week for `refreshInterval` for backwards compatability
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I've just got it. This is to prevent old versions of falcon from running new scheduled queries as setInterval(runQuery, NaN). Could you add something like that to comment, please?

onChange={this.updateRefreshInterval}
/>
<div style={{width: '65%', minHeight: '108px'}}>
<CronPicker onChange={this.handleIntervalChange} />
Copy link
Contributor

@n-riesco n-riesco Jul 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should set initialModeId here (and be smart if the scheduled query uses the old format).

<Error message={this.state.error} />
</Row>
)}
{this.props.loggedIn && (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about we do something like this and show a LogIn button if needed?

{this.props.loggedIn ? (...edit/delete...) : (...login..)}

mfix22 added 2 commits July 11, 2018 10:35
    Fix linting from Prettier

    get initial cron mode id from query

    Add login button to preview modal

    Move getInitialCronMode to cron-helpers

    Fix linting from Prettier

    get initial cron mode id from query

    Add login button to preview modal

    Move getInitialCronMode to cron-helpers
return 'MONTHLY';
}
} else if (refreshInterval) {
if (refreshInterval <= 60) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refreshInterval <= 60 * (1 + 5) /2

} else if (refreshInterval) {
if (refreshInterval <= 60) {
return 'MINUTE';
} else if (refreshInterval <= 5 * 60) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refreshInterval <= 60 * (5 + 60) /2

return 'MINUTE';
} else if (refreshInterval <= 5 * 60) {
return 'FREQUENTLY';
} else if (refreshInterval <= 60 * 60) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refreshInterval <= 60 * 60 * (1 + 24) /2

return 'FREQUENTLY';
} else if (refreshInterval <= 60 * 60) {
return 'HOURLY';
} else if (refreshInterval <= 24 * 60 * 60) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refreshInterval <= 24 * 60 * 60 * (1 + 7) /2

return 'HOURLY';
} else if (refreshInterval <= 24 * 60 * 60) {
return 'DAILY';
} else if (refreshInterval <= 7 * 24 * 60 * 60) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refreshInterval <= 24 * 60 * 60 * (7 + 30) /2

return 'DAILY';
} else if (refreshInterval <= 7 * 24 * 60 * 60) {
return 'WEEKLY';
} else if (refreshInterval <= 30 * 24 * 60 * 60) {
Copy link
Contributor

@n-riesco n-riesco Jul 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The maximum refresh interval is 2147483647/1000 (see MDN)

@mfix22 mfix22 mentioned this pull request Jul 11, 2018
3 tasks
@mfix22
Copy link
Contributor Author

mfix22 commented Jul 11, 2018

Closing in favor of local branch at #488

@mfix22 mfix22 closed this Jul 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants