mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 21:50:34 +03:00
UBER-438: Use tracker as default for new users/workspaces (#3403)
This commit is contained in:
parent
3644892579
commit
3d06e44517
@ -39,7 +39,7 @@ import { tagsId } from '@hcengineering/tags'
|
||||
import { taskId } from '@hcengineering/task'
|
||||
import telegram, { telegramId } from '@hcengineering/telegram'
|
||||
import { templatesId } from '@hcengineering/templates'
|
||||
import { trackerId } from '@hcengineering/tracker'
|
||||
import tracker, { trackerId } from '@hcengineering/tracker'
|
||||
import uiPlugin from '@hcengineering/ui'
|
||||
import { viewId } from '@hcengineering/view'
|
||||
import workbench, { workbenchId } from '@hcengineering/workbench'
|
||||
@ -166,4 +166,7 @@ export async function configurePlatform() {
|
||||
|
||||
setMetadata(workbench.metadata.PlatformTitle, config.TITLE ?? 'Platform')
|
||||
setDefaultLanguage(config.DEFAULT_LANGUAGE ?? 'en')
|
||||
setMetadata(workbench.metadata.DefaultApplication, 'tracker')
|
||||
setMetadata(workbench.metadata.DefaultSpace, tracker.project.DefaultProject)
|
||||
setMetadata(workbench.metadata.DefaultSpecial, 'issues')
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ export function setResolvedLocation (location: PlatformLocation): void {
|
||||
resolvedLocationStore.set(justClone(location))
|
||||
}
|
||||
|
||||
export function navigate (location: PlatformLocation, store = true): void {
|
||||
export function navigate (location: PlatformLocation, store = true): boolean {
|
||||
closePopup()
|
||||
const url = locationToUrl(location)
|
||||
if (locationToUrl(getCurrentLocation()) !== url) {
|
||||
@ -134,5 +134,7 @@ export function navigate (location: PlatformLocation, store = true): void {
|
||||
}
|
||||
}
|
||||
locationWritable.set(location)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ export class AggregationMiddleware extends BasePresentationMiddleware implements
|
||||
const mixin = h.classHierarchyMixin(_class, view.mixin.Aggregation)
|
||||
if (mixin?.createAggregationManager !== undefined) {
|
||||
const f = await getResource(mixin.createAggregationManager)
|
||||
mgr = f(this.client, this.refreshSubscribers)
|
||||
mgr = f(this.client, () => this.refreshSubscribers())
|
||||
this.mgrs.set(_class, mgr)
|
||||
}
|
||||
}
|
||||
|
@ -273,11 +273,38 @@
|
||||
let space = loc.path[3] as Ref<Space>
|
||||
let special = loc.path[4]
|
||||
const fragment = loc.fragment
|
||||
|
||||
let navigateDone = false
|
||||
if (app === undefined) {
|
||||
const last = localStorage.getItem(`platform_last_loc_${loc.path[1]}`)
|
||||
if (last != null) {
|
||||
navigate(JSON.parse(last))
|
||||
const lastValue = JSON.parse(last)
|
||||
navigateDone = navigate(lastValue)
|
||||
if (navigateDone) {
|
||||
return
|
||||
}
|
||||
}
|
||||
if (app === undefined && !navigateDone) {
|
||||
const appShort = getMetadata(workbench.metadata.DefaultApplication) as Ref<Application>
|
||||
const spaceRef = getMetadata(workbench.metadata.DefaultSpace) as Ref<Space>
|
||||
const specialRef = getMetadata(workbench.metadata.DefaultSpecial) as Ref<Space>
|
||||
const loc = getCurrentLocation()
|
||||
// Be sure URI is not yet changed
|
||||
if (loc.path[2] === undefined) {
|
||||
loc.path[2] = appShort
|
||||
let len = 3
|
||||
if (spaceRef !== undefined && specialRef !== undefined) {
|
||||
const spaceObj = await client.findOne(core.class.Space, { _id: spaceRef })
|
||||
if (spaceObj !== undefined) {
|
||||
loc.path[3] = spaceRef
|
||||
loc.path[4] = specialRef
|
||||
len = 5
|
||||
}
|
||||
}
|
||||
loc.path.length = len
|
||||
if (navigate(loc)) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,10 @@ export default plugin(workbenchId, {
|
||||
},
|
||||
metadata: {
|
||||
PlatformTitle: '' as Metadata<string>,
|
||||
ExcludedApplications: '' as Metadata<Ref<Application>[]>
|
||||
ExcludedApplications: '' as Metadata<Ref<Application>[]>,
|
||||
DefaultApplication: '' as Metadata<string>,
|
||||
DefaultSpace: '' as Metadata<Ref<Space>>,
|
||||
DefaultSpecial: '' as Metadata<string>
|
||||
},
|
||||
actionImpl: {
|
||||
Navigate: '' as ViewAction<{
|
||||
|
@ -44,9 +44,9 @@ test.use({
|
||||
const getIssueName = (postfix: string = generateId(5)): string => `issue-${postfix}`
|
||||
|
||||
const panelStatusMap = new Map([
|
||||
['Issues', DEFAULT_STATUSES],
|
||||
['Active', ['Todo', 'In Progress']],
|
||||
['Backlog', ['Backlog']]
|
||||
['Issues/All', DEFAULT_STATUSES],
|
||||
['Issues/Active', ['Todo', 'In Progress']],
|
||||
['Issues/Backlog', ['Backlog']]
|
||||
])
|
||||
|
||||
test('issues-status-display', async ({ page }) => {
|
||||
@ -56,14 +56,24 @@ test('issues-status-display', async ({ page }) => {
|
||||
await createIssue(page, { name: getIssueName(status), status })
|
||||
}
|
||||
for (const [panel, statuses] of panelStatusMap) {
|
||||
const pPage = panel.split('/')
|
||||
await performPanelTest(statuses, pPage[0], pPage[1])
|
||||
}
|
||||
|
||||
async function performPanelTest (statuses: string[], panel: string, mode: string): Promise<void> {
|
||||
const excluded = DEFAULT_STATUSES.filter((status) => !statuses.includes(status))
|
||||
await page.locator(`text="${panel}"`).click()
|
||||
await page.locator(`.antiNav-element__dropbox > a > .antiNav-element:has-text("${panel}")`).click()
|
||||
await page.locator(`.ac-header .overflow-label:has-text("${mode}")`).click()
|
||||
await page.click(ViewletSelectors.Table)
|
||||
await expect(locator).toContainText(statuses)
|
||||
if (excluded.length > 0) await expect(locator).not.toContainText(excluded)
|
||||
if (excluded.length > 0) {
|
||||
await expect(locator).not.toContainText(excluded)
|
||||
}
|
||||
await page.click(ViewletSelectors.Board)
|
||||
|
||||
if (excluded.length > 0) await expect(locator).not.toContainText(excluded)
|
||||
if (excluded.length > 0) {
|
||||
await expect(locator).not.toContainText(excluded)
|
||||
}
|
||||
for (const status of statuses) {
|
||||
await expect(
|
||||
page.locator('.panel-container', {
|
||||
|
@ -26,7 +26,6 @@ export const DEFAULT_USER = 'Appleseed John'
|
||||
export async function navigate (page: Page): Promise<void> {
|
||||
await (await page.goto(`${PlatformURI}/workbench/sanity-ws`))?.finished()
|
||||
await page.click('[id="app-tracker\\:string\\:TrackerApplication"]')
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench/sanity-ws/tracker`)
|
||||
}
|
||||
|
||||
export async function setViewGroup (page: Page, groupName: string): Promise<void> {
|
||||
|
Loading…
Reference in New Issue
Block a user