Skip to content
代码片段 群组 项目
未验证 提交 6d55a454 编辑于 作者: Benjamin's avatar Benjamin 提交者: GitHub
浏览文件

Fix UI cluster closing issues while using text based filtering (#1274)

上级 41c0089d
No related branches found
标签 v2024.03.14-nightly
无相关合并请求
...@@ -58,10 +58,17 @@ describe('Testing cluster filters', () => { ...@@ -58,10 +58,17 @@ describe('Testing cluster filters', () => {
() => { () => {
cy.get('.q-virtual-scroll__content > :nth-child(2)').click({ cy.get('.q-virtual-scroll__content > :nth-child(2)').click({
force: true, force: true,
multiple: true,
}) })
cy.fixture('data').then((data) => { cy.fixture('data').then((data) => {
cy.get('tbody').children().should('contain', data.cluster2) cy.get('tbody').children().should('contain', data.cluster2)
}) })
} }
) )
it('Close all the clusters', () => {
cy.dataCy('cluster-btn-closeall').click()
cy.get('[data-test=Cluster').each(($row) => {
cy.wrap($row).should('have.class', 'q-expansion-item--collapsed')
})
})
}) })
...@@ -60,4 +60,10 @@ describe('Add multiple clusters and search', () => { ...@@ -60,4 +60,10 @@ describe('Add multiple clusters and search', () => {
cy.get('tbody').children().should('contain', data.cluster2) cy.get('tbody').children().should('contain', data.cluster2)
}) })
}) })
it('Close all the clusters', () => {
cy.dataCy('cluster-btn-closeall').click()
cy.get('[data-test=Cluster').each(($row) => {
cy.wrap($row).should('have.class', 'q-expansion-item--collapsed')
})
})
}) })
...@@ -41,4 +41,23 @@ describe('Testing cluster search', () => { ...@@ -41,4 +41,23 @@ describe('Testing cluster search', () => {
cy.get('tbody').children().should('contain', data.cluster2) cy.get('tbody').children().should('contain', data.cluster2)
}) })
}) })
it('check individual cluster closing and opening', () => {
cy.get('[data-test=Cluster').each(($row) => {
cy.wrap($row).should('have.class', 'q-expansion-item--expanded')
})
cy.dataCy('cluster-general').children().children().eq(0).click()
cy.dataCy('cluster-general').should(
'have.class',
'q-expansion-item--collapsed'
)
cy.dataCy('cluster-general').children().children().eq(0).click()
cy.dataCy('cluster-general').should(
'have.class',
'q-expansion-item--expanded'
)
cy.dataCy('cluster-btn-closeall').click()
cy.get('[data-test=Cluster').each(($row) => {
cy.wrap($row).should('have.class', 'q-expansion-item--collapsed')
})
})
}) })
...@@ -57,6 +57,7 @@ limitations under the License. ...@@ -57,6 +57,7 @@ limitations under the License.
dense dense
@update:model-value="changeDomainFilter($event)" @update:model-value="changeDomainFilter($event)"
data-test="filter-input" data-test="filter-input"
data-cy="cluster-domain-filter"
/> />
</div> </div>
...@@ -70,6 +71,7 @@ limitations under the License. ...@@ -70,6 +71,7 @@ limitations under the License.
@clear="changeFilterString('')" @clear="changeFilterString('')"
:model-value="filterString" :model-value="filterString"
data-test="search-clusters" data-test="search-clusters"
data-cy="cluster-text-filter"
> >
<template v-slot:prepend> <template v-slot:prepend>
<q-icon name="search" /> <q-icon name="search" />
...@@ -83,7 +85,11 @@ limitations under the License. ...@@ -83,7 +85,11 @@ limitations under the License.
rounded rounded
@click="doActionFilter(actionOption)" @click="doActionFilter(actionOption)"
:label="actionOption.label" :label="actionOption.label"
color="primary" color="secondary"
:data-cy="
'cluster-btn-' +
actionOption.label.replace(/\s/g, '').toLowerCase()
"
/> />
</div> </div>
</div> </div>
...@@ -99,6 +105,7 @@ limitations under the License. ...@@ -99,6 +105,7 @@ limitations under the License.
@update:model-value="setOpenDomain(domainName, $event)" @update:model-value="setOpenDomain(domainName, $event)"
:model-value="getDomainOpenState(domainName)" :model-value="getDomainOpenState(domainName)"
data-test="Cluster" data-test="Cluster"
:data-cy="'cluster-' + domainName.replace(/\s/g, '').toLowerCase()"
header-class="bg-white text-primary" header-class="bg-white text-primary"
> >
<q-card> <q-card>
...@@ -301,7 +308,7 @@ export default { ...@@ -301,7 +308,7 @@ export default {
}) })
}, },
getDomainOpenState(domainName) { getDomainOpenState(domainName) {
return this.openDomains[domainName] || this.filterString != '' return this.openDomains[domainName]
}, },
changeDomainFilter(filter) { changeDomainFilter(filter) {
this.$store.dispatch('zap/setDomainFilter', { this.$store.dispatch('zap/setDomainFilter', {
......
...@@ -488,15 +488,15 @@ export function setDomainFilter(state, filterEnabledClusterPair) { ...@@ -488,15 +488,15 @@ export function setDomainFilter(state, filterEnabledClusterPair) {
let filter = filterEnabledClusterPair.filter let filter = filterEnabledClusterPair.filter
state.clusterManager.filter = filter state.clusterManager.filter = filter
state.domains.map((domainName) => { state.domains.map((domainName) => {
const openDomainValue =
state.clusterManager.filterString === ''
? filter.domainFilterFn(domainName, state.clusterManager.openDomains, {
enabledClusters: filterEnabledClusterPair.enabledClusters,
})
: true
setOpenDomain(state, { setOpenDomain(state, {
domainName: domainName, domainName: domainName,
value: filter.domainFilterFn( value: openDomainValue,
domainName,
state.clusterManager.openDomains,
{
enabledClusters: filterEnabledClusterPair.enabledClusters,
}
),
}) })
}) })
} }
...@@ -504,7 +504,6 @@ export function setDomainFilter(state, filterEnabledClusterPair) { ...@@ -504,7 +504,6 @@ export function setDomainFilter(state, filterEnabledClusterPair) {
export function doActionFilter(state, filterEnabledClusterPair) { export function doActionFilter(state, filterEnabledClusterPair) {
let filter = filterEnabledClusterPair.filter let filter = filterEnabledClusterPair.filter
// When we close all, we also clear all filters. // When we close all, we also clear all filters.
resetFilters(state)
state.domains.map((domainName) => { state.domains.map((domainName) => {
setOpenDomain(state, { setOpenDomain(state, {
domainName: domainName, domainName: domainName,
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册