-
Notifications
You must be signed in to change notification settings - Fork 160
Feat; filter collectors jobs by status #2236
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
Conversation
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.
Good idea! I would perhaps use CSS to make the button look differently when it's enabled/disabled, as opposed to adding a checkbox, but that's not super important.
@@ -8,6 +9,15 @@ const props = defineProps<{ | |||
function statusClass(c: CollectorConfig): string { | |||
return c.isActive ? "active" : "inactive"; | |||
} | |||
|
|||
const FILTERS = ["InProgress", "Queued", "Success", "Failure"]; | |||
const ACTIVE_FILTERS = ref(new Set(FILTERS)); |
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.
Sets don't fully work reactively with ref
, because the watching is not "deep" (https://github.com/orgs/vuejs/discussions/10834).
I would suggest representing the state in a structurally more straightforward way, as we do elsewhere in the frontend:
const filter: Ref<{[index: keyof BenchmarkJobStatus]: boolean}> = ref({
InProgress: true,
Queued: true,
Success: true,
Failed: false,
});
plus something like this:
function toggleJobStatusFilter(status: BenchmarkJobStatus) {
filter.value[status] = !filter.value[status];
}
You can then index into filter[status]
to see if the status value is enabled or not.
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.
The set did work, I have changed it to how you have suggested. Though I have filtered out both Failed
and Success
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.
Right, it did indeed track the inner modifications of the Set
, but it's not ideal to track such inner state in Vue, the reactivity tracking works best when observing simple values and objects, and the set wasn't really needed here, so that's why I suggested removing it.
Btw I would prefer to show Failed
jobs by default, we should make these highly visible and not hidden by default.
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.
e1025b8 👍
1d81692
to
84b3215
Compare
e1025b8
to
64485f7
Compare
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!
Adds the ability to filter jobs in a collector by status;