diff --git a/changelog.md b/changelog.md index 5dc8e69767..d9d78c0a3a 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,10 @@ ## 0.6.29 (upcoming) +Tracker: + +- Remember view options +- Chunter: - Reactions on messages diff --git a/plugins/tracker-resources/src/components/issues/Issues.svelte b/plugins/tracker-resources/src/components/issues/Issues.svelte deleted file mode 100644 index 75f613fee4..0000000000 --- a/plugins/tracker-resources/src/components/issues/Issues.svelte +++ /dev/null @@ -1,527 +0,0 @@ - - - -{#if currentTeam} -
-
-
- {#if label} - {label} - {:else} -
-
- -
-
- -
- {#if filters.length > 0} - - {/if} - -
- 1}> - - - {#if $$slots.aside !== undefined} -
- -
- {/if} -
-{/if} diff --git a/plugins/tracker-resources/src/components/issues/IssuesContent.svelte b/plugins/tracker-resources/src/components/issues/IssuesContent.svelte index 206acc8667..eb6b8eca44 100644 --- a/plugins/tracker-resources/src/components/issues/IssuesContent.svelte +++ b/plugins/tracker-resources/src/components/issues/IssuesContent.svelte @@ -2,14 +2,14 @@ import { DocumentQuery, Ref, SortingOrder, WithLookup } from '@anticrm/core' import { Component } from '@anticrm/ui' import { BuildModelKey, Viewlet, ViewletPreference } from '@anticrm/view' - import { Issue, IssueStatus, Team, ViewOptions } from '@anticrm/tracker' - import tracker from '../../plugin' + import { Issue, IssueStatus, Team } from '@anticrm/tracker' import { createQuery } from '@anticrm/presentation' + import { viewOptionsStore } from '../../viewOptions' + import tracker from '../../plugin' export let currentSpace: Ref export let viewlet: WithLookup export let query: DocumentQuery = {} - export let viewOptions: ViewOptions const statusesQuery = createQuery() const spaceQuery = createQuery() @@ -62,14 +62,14 @@ {#if viewlet?.$lookup?.descriptor?.component} {/if} diff --git a/plugins/tracker-resources/src/components/issues/IssuesHeader.svelte b/plugins/tracker-resources/src/components/issues/IssuesHeader.svelte index f5aeba7998..e758db9a1d 100644 --- a/plugins/tracker-resources/src/components/issues/IssuesHeader.svelte +++ b/plugins/tracker-resources/src/components/issues/IssuesHeader.svelte @@ -1,28 +1,14 @@ {#if currentSpace} - + {#if asideFloat && $$slots.aside} + + diff --git a/plugins/tracker-resources/src/components/issues/ViewOptionsButton.svelte b/plugins/tracker-resources/src/components/issues/ViewOptionsButton.svelte deleted file mode 100644 index 1fc2ebc934..0000000000 --- a/plugins/tracker-resources/src/components/issues/ViewOptionsButton.svelte +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - diff --git a/plugins/tracker-resources/src/index.ts b/plugins/tracker-resources/src/index.ts index 0370be90f1..12e1f51809 100644 --- a/plugins/tracker-resources/src/index.ts +++ b/plugins/tracker-resources/src/index.ts @@ -26,7 +26,6 @@ import EditIssue from './components/issues/edit/EditIssue.svelte' import IssueItem from './components/issues/IssueItem.svelte' import IssuePresenter from './components/issues/IssuePresenter.svelte' import IssuePreview from './components/issues/IssuePreview.svelte' -import Issues from './components/issues/Issues.svelte' import IssuesView from './components/issues/IssuesView.svelte' import ListView from './components/issues/ListView.svelte' import ModificationDatePresenter from './components/issues/ModificationDatePresenter.svelte' @@ -111,7 +110,6 @@ export default async (): Promise => ({ Active, Backlog, Inbox, - Issues, MyIssues, Projects, Views, diff --git a/plugins/tracker-resources/src/plugin.ts b/plugins/tracker-resources/src/plugin.ts index 351022f917..94c4cf2617 100644 --- a/plugins/tracker-resources/src/plugin.ts +++ b/plugins/tracker-resources/src/plugin.ts @@ -171,7 +171,6 @@ export default mergeIds(trackerId, tracker, { NopeComponent: '' as AnyComponent, Inbox: '' as AnyComponent, MyIssues: '' as AnyComponent, - Issues: '' as AnyComponent, Views: '' as AnyComponent, Active: '' as AnyComponent, Backlog: '' as AnyComponent, diff --git a/plugins/tracker-resources/src/viewOptions.ts b/plugins/tracker-resources/src/viewOptions.ts new file mode 100644 index 0000000000..658e4ecf75 --- /dev/null +++ b/plugins/tracker-resources/src/viewOptions.ts @@ -0,0 +1,7 @@ +import { ViewOptions } from '@anticrm/tracker' +import { writable } from 'svelte/store' + +/** + * @public + */ +export const viewOptionsStore = writable() diff --git a/plugins/view-resources/src/index.ts b/plugins/view-resources/src/index.ts index 1cbd34e8e3..627442d871 100644 --- a/plugins/view-resources/src/index.ts +++ b/plugins/view-resources/src/index.ts @@ -82,7 +82,9 @@ export { getObjectPresenter, LoadingProps, setActiveViewletId, - getActiveViewletId + getActiveViewletId, + setViewOptions, + getViewOptions } from './utils' export { HTMLPresenter, diff --git a/plugins/view-resources/src/utils.ts b/plugins/view-resources/src/utils.ts index 10cc438cbb..145253007d 100644 --- a/plugins/view-resources/src/utils.ts +++ b/plugins/view-resources/src/utils.ts @@ -422,3 +422,24 @@ export function getActiveViewletId (): Ref | null { const key = makeViewletKey() return localStorage.getItem(key) as Ref | null } + +function makeViewOptionsKey (viewletId: Ref): string { + const loc = getCurrentLocation() + loc.fragment = undefined + loc.query = undefined + return `viewOptions:${viewletId}:${locationToUrl(loc)}` +} + +export function setViewOptions (viewletId: Ref, options: string | null): void { + const key = makeViewOptionsKey(viewletId) + if (options !== null) { + localStorage.setItem(key, options) + } else { + localStorage.removeItem(key) + } +} + +export function getViewOptions (viewletId: Ref): string | null { + const key = makeViewOptionsKey(viewletId) + return localStorage.getItem(key) +} diff --git a/tests/sanity/tests/tracker.spec.ts b/tests/sanity/tests/tracker.spec.ts index f76fdba37c..ed376c2299 100644 --- a/tests/sanity/tests/tracker.spec.ts +++ b/tests/sanity/tests/tracker.spec.ts @@ -157,17 +157,24 @@ test('issues-status-display', async ({ page }) => { } }) -test('save-active-viewlet', async ({ page }) => { +test('save-view-options', async ({ page }) => { const panels = ['Issues', 'Active', 'Backlog'] await navigate(page) for (const viewletSelector of [viewletSelectors.Board, viewletSelectors.Table]) { for (const panel of panels) { await page.click(`text="${panel}"`) await page.click(viewletSelector) + await page.click('button:has-text("View")') + await page.click('.antiCard >> button >> nth=0') + await page.click('.menu-item:has-text("Assignee")') + await page.keyboard.press('Escape') } for (const panel of panels) { await page.click(`text="${panel}"`) await expect(page.locator(viewletSelector)).toHaveClass(/selected/) + await page.click('button:has-text("View")') + await expect(page.locator('.antiCard >> button >> nth=0')).toContainText('Assignee') + await page.keyboard.press('Escape') } } })