-
Notifications
You must be signed in to change notification settings - Fork 60
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
Calendar widget #56
Calendar widget #56
Conversation
…C/calendar-widget-poc # Conflicts: # package.json # yarn.lock
…nt reference: stale element not found problem while testing binding columns to widgets
commented code removed
explanation of try-catch in SteCustomWidgetMapping
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(partial review, ran out of time, will work on more later)
calendar/page.js
Outdated
// when user move or resize event on the calendar, we want to update the record in the table | ||
const onCalendarEventBeingUpdated = async (info) => { | ||
if (info.changes?.start || info.changes?.end) { | ||
const record = await grist.fetchSelectedRecord(info.event.id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm why do we need to refetch the record from the application? Can't we just update the start and end?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was my first approach, but TableOperations.update()
seems to nullify all fields that are absent in argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems bad, is this a bug in TableOperations.update
? Fetching, patching and re-saving would leave any user of this api prone to races.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, it was not a bug in TableOperations.update
but rather specific way in with grist.mapColumnNamesBack
works. It map back all fields that was in source object, but for absent fields it just put a "undefined" under the target object value for given key.
It's up to discussion if grist.mapColumnNamesBack
should work that way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any thoughts on what grist.mapColumnNamesBack
should do for absent fields @berhalak ?
…C/calendar-widget-poc # Conflicts: # test/getGrist.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Close to being fine. I continue to find erratic whitespace distracting, most of my comments were just that, sorry.
It would probably make sense to write a widget this big in typescript rather than straight javascript, but reasonable not to tackle setting that up in the one piece of work.
test/getGrist.ts
Outdated
} catch (e) { | ||
//sometimes here we get into "detached" state and test fail. | ||
//if this happened, just try one more time | ||
await driver.findWait(selector, 2000).click(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await driver.findWait(selector, 2000).click(); | |
await driver.findWait(selector, 2000).click(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did this change turn out to be good enough for the tests to be reliable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i did some empirical tests - before in average one in ten tests run was failing on my machine on a set of 50 runs. After this change i get no single failure in 80 runs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @JakubSerafin !
calendar widget that allow to show data from the table on the daily/weekly/monthly view.
features:
TESTS:
a few tests was added for CRUD operations in the table being reflected on the calendar.