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

[atable] use pinia to track table state #213

Merged
merged 4 commits into from
Dec 11, 2024
Merged

Conversation

Alchez
Copy link
Collaborator

@Alchez Alchez commented Dec 6, 2024

Moving towards completing https://github.com/agritheory/fab/issues/55.


Uses Pinia for data store, and also adds a new emit function inside ATable called cellUpdate that will trigger whenever the table data is updated, with the following signature:

<template>
	<ATable @cellUpdate="handleUpdate"/>
</template>

<script setup>
const handleUpdate = (args) => {
	const [colIndex, rowIndex, newValue, oldValue] = args
	// more logic using cell data
}
</script>

@Alchez Alchez requested a review from agritheory December 6, 2024 11:38
@Alchez
Copy link
Collaborator Author

Alchez commented Dec 6, 2024

@agritheory Let me know if this API looks good, and if it should expose anything else as well. Should we add a debounce to avoid spamming the emit handler?

Copy link
Contributor

github-actions bot commented Dec 6, 2024

Coverage Report for ./aform

Status Category Percentage Covered / Total
🟢 Lines 86.58% (🎯 70%) 200 / 231
🟢 Statements 86.01% (🎯 70%) 203 / 236
🟢 Functions 80.76% (🎯 70%) 42 / 52
🔴 Branches 67.88% (🎯 70%) 74 / 109
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Unchanged Files
aform/src/components/AForm.vue 90% 40% 85.71% 90% 40-41
aform/src/components/base/CollapseButton.vue 100% 100% 100% 100%
aform/src/components/form/ACheckbox.vue 100% 100% 100% 100%
aform/src/components/form/AComboBox.vue 0% 0% 100% 0% 2-1
aform/src/components/form/ADate.vue 85.71% 50% 100% 85.71% 38
aform/src/components/form/ADatePicker.vue 94.91% 81.81% 92.85% 94.73% 66, 101, 28
aform/src/components/form/ADropdown.vue 91.48% 76.92% 84.61% 91.48% 55, 84-85, 93
aform/src/components/form/AFieldset.vue 87.5% 100% 50% 87.5% 8
aform/src/components/form/AFileAttach.vue 0% 0% 0% 0% 26-17
aform/src/components/form/ANumericInput.vue 100% 100% 100% 100%
aform/src/components/form/ATextInput.vue 100% 100% 100% 100%
aform/src/components/utilities/Login.vue 87.5% 88.88% 100% 87.5% 76-78
aform/src/directives/mask.ts 84.09% 59.09% 100% 83.72% 33-34, 41, 50, 65, 98, 103
Generated in workflow #461 for commit fcb714c by the Vitest Coverage Report Action

Copy link
Contributor

github-actions bot commented Dec 6, 2024

Coverage Report for ./beam

Status Category Percentage Covered / Total
🔴 Lines 5.3% (🎯 70%) 7 / 132
🔴 Statements 5.63% (🎯 70%) 8 / 142
🔴 Functions 2.43% (🎯 70%) 1 / 41
🔴 Branches 0% (🎯 70%) 0 / 79
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Unchanged Files
beam/src/components/ActionFooter.vue 0% 100% 0% 0% 12-5
beam/src/components/BeamArrow.vue 0% 0% 100% 0% 2-4
beam/src/components/BeamDayDivider.vue 0% 0% 0% 0% 17-2
beam/src/components/BeamFilter.vue 0% 0% 0% 0% 18-9
beam/src/components/BeamFilterOption.vue 0% 0% 0% 0% 41-21
beam/src/components/BeamMetadata.vue 0% 0% 0% 0% 2-1
beam/src/components/BeamModal.vue 0% 0% 0% 0% 3-5
beam/src/components/BeamModalOutlet.vue 0% 100% 100% 0% 2
beam/src/components/BeamProgress.vue 0% 0% 0% 0% 22-3
beam/src/components/Confirm.vue 0% 0% 0% 0% 4-1
beam/src/components/ItemCheck.vue 0% 0% 0% 0% 9-3
beam/src/components/ItemCount.vue 0% 0% 0% 0% 20-1
beam/src/components/ListAnchor.vue 0% 100% 100% 0% 1
beam/src/components/ListItem.vue 0% 0% 0% 0% 27-15
beam/src/components/ListView.vue 0% 0% 0% 0% 29-2
beam/src/components/Navbar.vue 0% 0% 0% 0% 13-null
beam/src/components/ScanInput.vue 88.88% 100% 50% 87.5% 23
beam/src/components/SplitColumn.vue 0% 0% 100% 0% 5-8
beam/src/composables/mqtt.ts 0% 0% 0% 0% 8-40
Generated in workflow #461 for commit fcb714c by the Vitest Coverage Report Action

Copy link
Contributor

github-actions bot commented Dec 6, 2024

Coverage Report for ./atable

Status Category Percentage Covered / Total
🟢 Lines 70.56% (🎯 70%) 151 / 214
🟢 Statements 71.11% (🎯 70%) 160 / 225
🟢 Functions 80.95% (🎯 70%) 34 / 42
🔴 Branches 50% (🎯 70%) 87 / 174
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
atable/src/components/ACell.vue 93.87% 61.11% 100% 93.87% 100, 123-126, 157
atable/src/components/AExpansionRow.vue 0% 0% 0% 0% 33-3
atable/src/components/ARow.vue 58.33% 56.25% 50% 58.33% 50-64, 17
atable/src/components/ATable.vue 55.1% 37.5% 88.88% 54.16% 107-111, 117-145
atable/src/components/ATableHeader.vue 100% 57.14% 100% 100%
atable/src/components/ATableModal.vue 50% 100% 0% 50% 26
atable/src/stores/table.ts 77.65% 54.54% 88.88% 77.64% 33-34, 47, 77-78, 116, 120-131, 158, 166-167, 173
Unchanged Files
atable/src/utils.ts 100% 100% 100% 100%
Generated in workflow #461 for commit fcb714c by the Vitest Coverage Report Action

@agritheory
Copy link
Owner

Let me know if this API looks good, and if it should expose anything else as well. Should we add a debounce to avoid spamming the emit handler?

Will the debounce collect multiple changes and emit as a list or just wait for the changes to "settle"? I think the spammiest emit we would want to avoid is on the initial render

@Alchez
Copy link
Collaborator Author

Alchez commented Dec 10, 2024

@agritheory

Will the debounce collect multiple changes and emit as a list or just wait for the changes to "settle"? I think the spammiest emit we would want to avoid is on the initial render

I think that'll depend on the implementation of the debounce (VueUse has a couple of debounced composables), but I think it would be most likely wait for the input to "settle".

We could also defer the debounce concern until it shows up in a real scenario, what do you think?

@agritheory
Copy link
Owner

We could also defer the debounce concern until it shows up in a real scenario, what do you think?

Let's do that. WE could open it as a new ticket with some context describing it as "evaluate"

@Alchez Alchez merged commit 0a990b3 into development Dec 11, 2024
4 of 7 checks passed
@Alchez Alchez linked an issue Dec 11, 2024 that may be closed by this pull request
@agritheory agritheory deleted the feat-atable-state branch December 11, 2024 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[atable] Missing state API(s) for cell updates
2 participants