fix for the list (#6096)

Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
Vyacheslav Tumanov 2024-07-24 15:15:37 +05:00 committed by GitHub
parent 807426e0b2
commit cfe99b6bcf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 168 additions and 125 deletions

View File

@ -15,8 +15,8 @@
--> -->
<script lang="ts"> <script lang="ts">
import { PersonAccount } from '@hcengineering/contact' import { PersonAccount } from '@hcengineering/contact'
import { AggregateValue, Ref } from '@hcengineering/core' import core, { AggregateValue, Ref } from '@hcengineering/core'
import { IconSize } from '@hcengineering/ui' import { IconSize, Label } from '@hcengineering/ui'
import { personAccountByIdStore } from '../utils' import { personAccountByIdStore } from '../utils'
import PersonAccountPresenter from './PersonAccountPresenter.svelte' import PersonAccountPresenter from './PersonAccountPresenter.svelte'
import { personStore } from '..' import { personStore } from '..'
@ -48,4 +48,6 @@
{compact} {compact}
on:accent-color on:accent-color
/> />
{:else}
<Label label={core.string.System} />
{/if} {/if}

View File

@ -371,127 +371,125 @@
{#each categories as category, i (typeof category === 'object' ? category.name : category)} {#each categories as category, i (typeof category === 'object' ? category.name : category)}
{@const items = groupByKey === noCategory ? docs : getGroupByValues(groupByDocs, category)} {@const items = groupByKey === noCategory ? docs : getGroupByValues(groupByDocs, category)}
{@const categoryDocKeys = getGroupByKey(docKeys, category, resultQuery)} {@const categoryDocKeys = getGroupByKey(docKeys, category, resultQuery)}
{#if items.length !== 0} <ListCategory
<ListCategory bind:this={listListCategory[i]}
bind:this={listListCategory[i]} {extraHeaders}
{extraHeaders} {space}
{space} {selectedObjectIds}
{selectedObjectIds} {headerComponent}
{headerComponent} {baseMenuClass}
{baseMenuClass} {level}
{level} {viewOptions}
{viewOptions} {groupByKey}
{groupByKey} {lookup}
{lookup} {config}
{config} {configurations}
{configurations} {configurationsVersion}
{configurationsVersion} {itemModels}
{itemModels} {_class}
{_class} parentCategories={categories.length}
parentCategories={categories.length} groupPersistKey={`${groupPersistKey}_${level}_${typeof category === 'object' ? category.name : category}`}
groupPersistKey={`${groupPersistKey}_${level}_${typeof category === 'object' ? category.name : category}`} singleCat={level === 0 && categories.length === 1}
singleCat={level === 0 && categories.length === 1} oneCat={viewOptions.groupBy.length === 1}
oneCat={viewOptions.groupBy.length === 1} lastCat={i === categories.length - 1}
lastCat={i === categories.length - 1} {category}
{category} itemProj={items}
itemProj={items} docKeys={categoryDocKeys}
docKeys={categoryDocKeys} {newObjectProps}
{newObjectProps} {createItemDialog}
{createItemDialog} {createItemDialogProps}
{createItemDialogProps} {createItemLabel}
{createItemLabel} {viewOptionsConfig}
{viewOptionsConfig} {compactMode}
{compactMode} {resultQuery}
{resultQuery} {resultOptions}
{resultOptions} {limiter}
{limiter} {listProvider}
{listProvider} on:check
on:check on:uncheckAll
on:uncheckAll on:row-focus
on:row-focus on:dragstart={(e) => {
on:dragstart={(e) => { dispatch('dragstart', {
dispatch('dragstart', { target: e.detail.target,
target: e.detail.target, index: e.detail.index + getInitIndex(categories, i)
index: e.detail.index + getInitIndex(categories, i) })
}) }}
}} on:collapsed
on:collapsed {flatHeaders}
{flatHeaders} {disableHeader}
{disableHeader} {props}
{props} {listDiv}
{listDiv} bind:dragItem
bind:dragItem >
<svelte:fragment
slot="category"
let:docs
let:_class
let:space
let:lookup
let:baseMenuClass
let:config
let:selectedObjectIds
let:createItemDialog
let:createItemLabel
let:viewOptions
let:newObjectProps
let:flatHeaders
let:props
let:level
let:viewOptionsConfig
let:listDiv
let:dragstart
> >
<svelte:fragment <svelte:self
slot="category" {docs}
let:docs bind:this={listCategory[i]}
let:_class {_class}
let:space {space}
let:lookup {lookup}
let:baseMenuClass {baseMenuClass}
let:config {config}
let:selectedObjectIds {selectedObjectIds}
let:createItemDialog {createItemDialog}
let:createItemLabel {createItemLabel}
let:viewOptions {viewOptions}
let:newObjectProps {newObjectProps}
let:flatHeaders {flatHeaders}
let:props {props}
let:level {level}
let:viewOptionsConfig docKeys={categoryDocKeys}
let:listDiv groupPersistKey={`${groupPersistKey}_${level}_${typeof category === 'object' ? category.name : category}`}
let:dragstart {initIndex}
> {viewOptionsConfig}
<svelte:self {listDiv}
{docs} {resultQuery}
bind:this={listCategory[i]} {resultOptions}
{_class} {limiter}
{space} {listProvider}
{lookup} bind:dragItem
{baseMenuClass} on:dragItem
{config} on:check
{selectedObjectIds} on:uncheckAll
{createItemDialog} on:row-focus
{createItemLabel} on:dragstart={dragstart}
{viewOptions} on:select={(evt) => {
{newObjectProps} select(0, evt.detail)
{flatHeaders} }}
{props} on:select-next={(evt) => {
{level} if (level !== 0) {
docKeys={categoryDocKeys} dispatch('select-next', evt.detail)
groupPersistKey={`${groupPersistKey}_${level}_${typeof category === 'object' ? category.name : category}`} } else {
{initIndex} select(2, evt.detail)
{viewOptionsConfig} }
{listDiv} }}
{resultQuery} on:select-prev={(evt) => {
{resultOptions} if (level !== 0) {
{limiter} dispatch('select-prev', evt.detail)
{listProvider} } else {
bind:dragItem select(-2, evt.detail)
on:dragItem }
on:check }}
on:uncheckAll />
on:row-focus </svelte:fragment>
on:dragstart={dragstart} </ListCategory>
on:select={(evt) => {
select(0, evt.detail)
}}
on:select-next={(evt) => {
if (level !== 0) {
dispatch('select-next', evt.detail)
} else {
select(2, evt.detail)
}
}}
on:select-prev={(evt) => {
if (level !== 0) {
dispatch('select-prev', evt.detail)
} else {
select(-2, evt.detail)
}
}}
/>
</svelte:fragment>
</ListCategory>
{/if}
{/each} {/each}

View File

@ -93,6 +93,9 @@ export class CommonTrackerPage extends CalendarPage {
viewButton = (): Locator => this.page.locator('button:has-text("View")') viewButton = (): Locator => this.page.locator('button:has-text("View")')
firstOptionButton = (): Locator => this.page.locator('.antiCard >> button >> nth=0') firstOptionButton = (): Locator => this.page.locator('.antiCard >> button >> nth=0')
assigneeMenuItem = (): Locator => this.page.locator('.menu-item:has-text("Assignee")') assigneeMenuItem = (): Locator => this.page.locator('.menu-item:has-text("Assignee")')
shouldShowAllToggle = (): Locator =>
this.page.locator('.antiCard.menu .antiCard-menu__item:has-text("Show empty groups")')
header = (): Locator => this.page.getByText('Issues All Active Backlog') header = (): Locator => this.page.getByText('Issues All Active Backlog')
filter = (): Locator => this.page.getByRole('button', { name: 'Filter' }) filter = (): Locator => this.page.getByRole('button', { name: 'Filter' })
view = (): Locator => this.page.getByRole('button', { name: 'View' }) view = (): Locator => this.page.getByRole('button', { name: 'View' })
@ -122,6 +125,12 @@ export class CommonTrackerPage extends CalendarPage {
} }
} }
async openViewOptionsAndToggleShouldShowAll (): Promise<void> {
await this.viewButton().click()
await this.shouldShowAllToggle().click()
await this.page.keyboard.press('Escape')
}
async verifyViewOption (panel: string, viewletSelector: string): Promise<void> { async verifyViewOption (panel: string, viewletSelector: string): Promise<void> {
await this.page.click(`text="${panel}"`) await this.page.click(`text="${panel}"`)
const viewlet = this.page.locator(viewletSelector) const viewlet = this.page.locator(viewletSelector)

View File

@ -100,6 +100,13 @@ export class IssuesPage extends CommonTrackerPage {
todoHeader = (): Locator => this.page.locator('.categoryHeader :text-is("Todo")').first() todoHeader = (): Locator => this.page.locator('.categoryHeader :text-is("Todo")').first()
doneHeader = (): Locator => this.page.locator('.categoryHeader :text-is("Done")').first() doneHeader = (): Locator => this.page.locator('.categoryHeader :text-is("Done")').first()
canceledHeader = (): Locator => this.page.locator('.categoryHeader :text-is("Canceled")').first() canceledHeader = (): Locator => this.page.locator('.categoryHeader :text-is("Canceled")').first()
inProgressHeaderKanban = (): Locator => this.page.locator('.header :text-is("In Progress")').first()
backlogHeaderKanban = (): Locator => this.page.locator('.header :text-is("Backlog")').first()
todoHeaderKanban = (): Locator => this.page.locator('.header :text-is("Todo")').first()
doneHeaderKanban = (): Locator => this.page.locator('.header :text-is("Done")').first()
canceledHeaderKanban = (): Locator => this.page.locator('.header :text-is("Canceled")').first()
myIssuesButton = (): Locator => this.page.locator('text="My issues"') myIssuesButton = (): Locator => this.page.locator('text="My issues"')
assignedTab = (): Locator => this.page.locator('[data-id="tab-assigned"]') assignedTab = (): Locator => this.page.locator('[data-id="tab-assigned"]')
createdTab = (): Locator => this.page.locator('[data-id="tab-created"]') createdTab = (): Locator => this.page.locator('[data-id="tab-created"]')
@ -602,6 +609,14 @@ export class IssuesPage extends CommonTrackerPage {
await expect(this.canceledHeader()).toBeVisible() await expect(this.canceledHeader()).toBeVisible()
} }
async verifyCategoryHeadersVisibilityKanban (): Promise<void> {
await expect(this.inProgressHeaderKanban()).toBeVisible()
await expect(this.backlogHeaderKanban()).toBeVisible()
await expect(this.todoHeaderKanban()).toBeVisible()
await expect(this.doneHeaderKanban()).toBeVisible()
await expect(this.canceledHeaderKanban()).toBeVisible()
}
async openAllCategories (): Promise<void> { async openAllCategories (): Promise<void> {
for await (const category of iterateLocator(this.buttonCollapsedCategories())) { for await (const category of iterateLocator(this.buttonCollapsedCategories())) {
await category.click() await category.click()

View File

@ -2,7 +2,7 @@ import { test } from '@playwright/test'
import { CommonTrackerPage } from '../model/tracker/common-tracker-page' import { CommonTrackerPage } from '../model/tracker/common-tracker-page'
import { IssuesDetailsPage } from '../model/tracker/issues-details-page' import { IssuesDetailsPage } from '../model/tracker/issues-details-page'
import { IssuesPage } from '../model/tracker/issues-page' import { IssuesPage } from '../model/tracker/issues-page'
import { PlatformSetting, fillSearch } from '../utils' import { PlatformSetting, PlatformURI, fillSearch } from '../utils'
import { import {
DEFAULT_STATUSES, DEFAULT_STATUSES,
ViewletSelectors, ViewletSelectors,
@ -169,6 +169,25 @@ test.describe('Tracker tests', () => {
dueDate: '24' dueDate: '24'
}) })
}) })
test('check shouldShowAll option', async ({ page }) => {
await (
await page.goto(`${PlatformURI}/workbench/sanity-ws/tracker/tracker%3Aproject%3ADefaultProject/issues`)
)?.finished()
const issuesPage = new IssuesPage(page)
await navigate(page)
await issuesPage.navigateToIssues()
await issuesPage.searchIssueByName('!!!!')
await issuesPage.openViewOptionsAndToggleShouldShowAll()
await issuesPage.clickModelSelectorAll()
await issuesPage.verifyCategoryHeadersVisibility()
await issuesPage.openViewOptionsAndToggleShouldShowAll()
await page.click(ViewletSelectors.Board)
await issuesPage.openViewOptionsAndToggleShouldShowAll()
await issuesPage.verifyCategoryHeadersVisibilityKanban()
await issuesPage.openViewOptionsAndToggleShouldShowAll()
})
}) })
async function doSaveViewTest ( async function doSaveViewTest (
panels: string[], panels: string[],