chore: disable filter button if all rows do not have sourceSchedule

Signed-off-by: andy.lee <andy.lee@suse.com>
(cherry picked from commit d72857f374911ebe7faf70679a59abd89ffc9890)
This commit is contained in:
andy.lee 2025-01-13 16:26:22 +08:00 committed by Mergify
parent 408818904a
commit 1ecac7adf4
2 changed files with 7 additions and 3 deletions

View File

@ -25,6 +25,9 @@ export default {
return Array.from(new Set(options)); return Array.from(new Set(options));
}, },
enableFilterButton() {
return this.rows.some((r) => r.sourceSchedule !== undefined);
}
}, },
methods: { methods: {
@ -63,7 +66,9 @@ export default {
</script> </script>
<template> <template>
<div class="vm-schedule-filter"> <div
class="vm-schedule-filter"
>
<span <span
v-if="selected" v-if="selected"
class="banner-item bg-warning" class="banner-item bg-warning"
@ -84,6 +89,7 @@ export default {
<button <button
ref="actionDropDown" ref="actionDropDown"
class="btn bg-primary mr-10" class="btn bg-primary mr-10"
:disabled="!enableFilterButton"
> >
<slot name="title"> <slot name="title">
{{ t('harvester.fields.filterSchedule') }} {{ t('harvester.fields.filterSchedule') }}

View File

@ -120,8 +120,6 @@ export default {
methods: { methods: {
changeRows(filteredRows, searchSchedule) { changeRows(filteredRows, searchSchedule) {
console.log('🚀 ~ changeRows ~ searchSchedule:', searchSchedule);
console.log('🚀 ~ changeRows ~ filteredRows:', filteredRows);
this['searchSchedule'] = searchSchedule; this['searchSchedule'] = searchSchedule;
this['snapshots'] = filteredRows; this['snapshots'] = filteredRows;
}, },