mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-23 11:31:57 +03:00
Workspace in url (#2214)
Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com>
This commit is contained in:
parent
8df9011bb0
commit
67d1d92e24
@ -2,21 +2,25 @@ import client from '@anticrm/client'
|
||||
import contact from '@anticrm/contact'
|
||||
import core, { Client, setCurrentAccount, Version } from '@anticrm/core'
|
||||
import login from '@anticrm/login'
|
||||
import { getMetadata, getResource } from '@anticrm/platform'
|
||||
import { getMetadata, getResource, setMetadata } from '@anticrm/platform'
|
||||
import { fetchMetadataLocalStorage, getCurrentLocation, navigate, setMetadataLocalStorage } from '@anticrm/ui'
|
||||
import presentation from './plugin'
|
||||
|
||||
export let versionError: string | undefined = ''
|
||||
|
||||
export async function connect (title: string): Promise<Client | undefined> {
|
||||
const token = fetchMetadataLocalStorage(login.metadata.LoginToken)
|
||||
const loc = getCurrentLocation()
|
||||
const ws = loc.path[1]
|
||||
const tokens: Record<string, string> = fetchMetadataLocalStorage(login.metadata.LoginTokens) ?? {}
|
||||
const token = tokens[ws]
|
||||
setMetadata(login.metadata.LoginToken, token)
|
||||
const endpoint = fetchMetadataLocalStorage(login.metadata.LoginEndpoint)
|
||||
const email = fetchMetadataLocalStorage(login.metadata.LoginEmail)
|
||||
|
||||
if (token === null || endpoint === null || email === null) {
|
||||
if (token === undefined || endpoint === null || email === null) {
|
||||
navigate({
|
||||
path: [login.component.LoginApp],
|
||||
query: { navigateUrl: encodeURIComponent(JSON.stringify(getCurrentLocation())) }
|
||||
query: { navigateUrl: encodeURIComponent(JSON.stringify(loc)) }
|
||||
})
|
||||
return
|
||||
}
|
||||
@ -29,7 +33,7 @@ export async function connect (title: string): Promise<Client | undefined> {
|
||||
location.reload()
|
||||
},
|
||||
() => {
|
||||
clearMetadata()
|
||||
clearMetadata(ws)
|
||||
navigate({
|
||||
path: [login.component.LoginApp],
|
||||
query: {}
|
||||
@ -44,7 +48,7 @@ export async function connect (title: string): Promise<Client | undefined> {
|
||||
setCurrentAccount(me)
|
||||
} else {
|
||||
console.error('WARNING: no employee account found.')
|
||||
clearMetadata()
|
||||
clearMetadata(ws)
|
||||
navigate({
|
||||
path: [login.component.LoginApp],
|
||||
query: { navigateUrl: encodeURIComponent(JSON.stringify(getCurrentLocation())) }
|
||||
@ -77,13 +81,19 @@ export async function connect (title: string): Promise<Client | undefined> {
|
||||
}
|
||||
|
||||
// Update window title
|
||||
document.title = [fetchMetadataLocalStorage(login.metadata.CurrentWorkspace), title].filter((it) => it).join(' - ')
|
||||
document.title = [ws, title].filter((it) => it).join(' - ')
|
||||
|
||||
return instance
|
||||
}
|
||||
function clearMetadata (): void {
|
||||
setMetadataLocalStorage(login.metadata.LoginToken, null)
|
||||
function clearMetadata (ws: string): void {
|
||||
const tokens = fetchMetadataLocalStorage(login.metadata.LoginTokens)
|
||||
if (tokens !== null) {
|
||||
const loc = getCurrentLocation()
|
||||
// eslint-disable-next-line
|
||||
delete tokens[loc.path[1]]
|
||||
setMetadataLocalStorage(login.metadata.LoginTokens, tokens)
|
||||
}
|
||||
setMetadata(login.metadata.LoginToken, null)
|
||||
setMetadataLocalStorage(login.metadata.LoginEndpoint, null)
|
||||
setMetadataLocalStorage(login.metadata.LoginEmail, null)
|
||||
setMetadataLocalStorage(login.metadata.CurrentWorkspace, null)
|
||||
}
|
||||
|
@ -16,19 +16,26 @@
|
||||
import type { Metadata } from '@anticrm/platform'
|
||||
import { setMetadata } from '@anticrm/platform'
|
||||
|
||||
export function setMetadataLocalStorage (id: Metadata<string>, value: string | null): void {
|
||||
export function setMetadataLocalStorage<T> (id: Metadata<T>, value: T | null): void {
|
||||
if (value != null) {
|
||||
localStorage.setItem(id, value)
|
||||
localStorage.setItem(id, typeof value === 'string' ? value : JSON.stringify(value))
|
||||
} else {
|
||||
localStorage.removeItem(id)
|
||||
}
|
||||
setMetadata(id, value)
|
||||
}
|
||||
|
||||
export function fetchMetadataLocalStorage (id: Metadata<string>): string | null {
|
||||
const value = localStorage.getItem(id)
|
||||
if (value !== null) {
|
||||
export function fetchMetadataLocalStorage<T> (id: Metadata<T>): T | null {
|
||||
const data = localStorage.getItem(id)
|
||||
if (data === null) {
|
||||
return null
|
||||
}
|
||||
try {
|
||||
const value = JSON.parse(data)
|
||||
setMetadata(id, value)
|
||||
}
|
||||
return value
|
||||
} catch {
|
||||
setMetadata(id, data as unknown as T)
|
||||
return data as unknown as T
|
||||
}
|
||||
}
|
||||
|
@ -20,10 +20,10 @@
|
||||
|
||||
function showMenu () {
|
||||
const loc = getCurrentLocation()
|
||||
loc.path[3] = space._id
|
||||
loc.path[4] = space._id
|
||||
navigate(loc)
|
||||
}
|
||||
$: showMenuButton = $location.path[3] === undefined
|
||||
$: showMenuButton = $location.path[4] === undefined
|
||||
|
||||
$: viewslist = viewlets.map((views) => {
|
||||
return {
|
||||
|
@ -79,7 +79,7 @@
|
||||
|
||||
function openThread (_id: Ref<Message>) {
|
||||
const loc = getCurrentLocation()
|
||||
loc.path[3] = _id
|
||||
loc.path[4] = _id
|
||||
navigate(loc)
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@
|
||||
class="showMoreAttachmentsButton"
|
||||
on:click={() => {
|
||||
const loc = getCurrentLocation()
|
||||
loc.path[2] = 'fileBrowser'
|
||||
loc.path[3] = 'fileBrowser'
|
||||
loc.query = channel ? { spaceId: channel._id } : {}
|
||||
navigate(loc)
|
||||
}}
|
||||
|
@ -113,13 +113,13 @@
|
||||
const location = getCurrentLocation()
|
||||
|
||||
location.fragment = message._id
|
||||
location.path[2] = message.space
|
||||
location.path[3] = message.space
|
||||
|
||||
if (message.attachedToClass === chunter.class.Message) {
|
||||
location.path.length = 4
|
||||
location.path[3] = message.attachedTo
|
||||
location.path.length = 5
|
||||
location.path[4] = message.attachedTo
|
||||
} else {
|
||||
location.path.length = 3
|
||||
location.path.length = 4
|
||||
}
|
||||
await navigator.clipboard.writeText(`${window.location.origin}${locationToUrl(location)}`)
|
||||
}
|
||||
|
@ -82,7 +82,7 @@
|
||||
|
||||
if (!message) {
|
||||
const loc = getCurrentLocation()
|
||||
loc.path.length = 3
|
||||
loc.path.length = 4
|
||||
navigate(loc)
|
||||
}
|
||||
},
|
||||
|
@ -123,8 +123,8 @@ export async function ArchiveChannel (channel: Channel, evt: any, afterArchive?:
|
||||
if (afterArchive != null) afterArchive()
|
||||
|
||||
const loc = getCurrentLocation()
|
||||
if (loc.path[2] === channel._id) {
|
||||
loc.path.length = 2
|
||||
if (loc.path[3] === channel._id) {
|
||||
loc.path.length = 3
|
||||
navigate(loc)
|
||||
}
|
||||
}
|
||||
|
@ -58,9 +58,9 @@ export async function getDmName (client: Client, dm: Space): Promise<string> {
|
||||
export function getSpaceLink (id: Ref<Space>): string {
|
||||
const loc = getCurrentLocation()
|
||||
|
||||
loc.path[1] = chunterId
|
||||
loc.path[2] = id
|
||||
loc.path.length = 3
|
||||
loc.path[2] = chunterId
|
||||
loc.path[3] = id
|
||||
loc.path.length = 4
|
||||
loc.fragment = undefined
|
||||
|
||||
return locationToUrl(loc)
|
||||
@ -76,19 +76,19 @@ export function openMessageFromSpecial (message: ChunterMessage): void {
|
||||
const loc = getCurrentLocation()
|
||||
|
||||
if (message.attachedToClass === chunter.class.ChunterSpace) {
|
||||
loc.path.length = 3
|
||||
loc.path[2] = message.attachedTo
|
||||
} else if (message.attachedToClass === chunter.class.Message) {
|
||||
loc.path.length = 4
|
||||
loc.path[2] = message.space
|
||||
loc.path[3] = message.attachedTo
|
||||
} else if (message.attachedToClass === chunter.class.Message) {
|
||||
loc.path.length = 5
|
||||
loc.path[3] = message.space
|
||||
loc.path[4] = message.attachedTo
|
||||
}
|
||||
navigate(loc)
|
||||
}
|
||||
|
||||
export function navigateToSpecial (specialId: string): void {
|
||||
const loc = getCurrentLocation()
|
||||
loc.path[2] = specialId
|
||||
loc.path[3] = specialId
|
||||
navigate(loc)
|
||||
}
|
||||
|
||||
|
@ -37,8 +37,8 @@
|
||||
closePopup()
|
||||
closePanel()
|
||||
const loc = getCurrentLocation()
|
||||
loc.path[2] = organization._id
|
||||
loc.path.length = 3
|
||||
loc.path[3] = organization._id
|
||||
loc.path.length = 4
|
||||
navigate(loc)
|
||||
}
|
||||
}}
|
||||
|
@ -14,11 +14,17 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { Status, Severity, OK } from '@anticrm/platform'
|
||||
import { Status, Severity, OK, setMetadata } from '@anticrm/platform'
|
||||
|
||||
import Form from './Form.svelte'
|
||||
import { createWorkspace } from '../utils'
|
||||
import { getCurrentLocation, navigate, setMetadataLocalStorage, showPopup } from '@anticrm/ui'
|
||||
import {
|
||||
fetchMetadataLocalStorage,
|
||||
getCurrentLocation,
|
||||
navigate,
|
||||
setMetadataLocalStorage,
|
||||
showPopup
|
||||
} from '@anticrm/ui'
|
||||
import login from '../plugin'
|
||||
import { workbenchId } from '@anticrm/workbench'
|
||||
import InviteLink from './InviteLink.svelte'
|
||||
@ -40,12 +46,14 @@
|
||||
status = loginStatus
|
||||
|
||||
if (result !== undefined) {
|
||||
setMetadataLocalStorage(login.metadata.LoginToken, result.token)
|
||||
setMetadata(login.metadata.LoginToken, result.token)
|
||||
const tokens: Record<string, string> = fetchMetadataLocalStorage(login.metadata.LoginTokens) ?? {}
|
||||
tokens[object.workspace] = result.token
|
||||
setMetadataLocalStorage(login.metadata.LoginTokens, tokens)
|
||||
setMetadataLocalStorage(login.metadata.LoginEndpoint, result.endpoint)
|
||||
setMetadataLocalStorage(login.metadata.LoginEmail, result.email)
|
||||
setMetadataLocalStorage(login.metadata.CurrentWorkspace, object.workspace)
|
||||
showPopup(InviteLink, {}, undefined, () => {
|
||||
navigate({ path: [workbenchId] })
|
||||
navigate({ path: [workbenchId, object.workspace] })
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -13,8 +13,8 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { OK, Status, Severity } from '@anticrm/platform'
|
||||
import { getCurrentLocation, navigate, setMetadataLocalStorage } from '@anticrm/ui'
|
||||
import { OK, Status, Severity, setMetadata } from '@anticrm/platform'
|
||||
import { fetchMetadataLocalStorage, getCurrentLocation, navigate, setMetadataLocalStorage } from '@anticrm/ui'
|
||||
|
||||
import Form from './Form.svelte'
|
||||
import { join, signUpJoin } from '../utils'
|
||||
@ -72,11 +72,13 @@
|
||||
status = loginStatus
|
||||
|
||||
if (result !== undefined) {
|
||||
setMetadata(login.metadata.LoginToken, result.token)
|
||||
const tokens: Record<string, string> = fetchMetadataLocalStorage(login.metadata.LoginTokens) ?? {}
|
||||
tokens[result.workspace] = result.token
|
||||
setMetadataLocalStorage(login.metadata.LoginToken, result.token)
|
||||
setMetadataLocalStorage(login.metadata.LoginEndpoint, result.endpoint)
|
||||
setMetadataLocalStorage(login.metadata.LoginEmail, result.email)
|
||||
setMetadataLocalStorage(login.metadata.CurrentWorkspace, result.workspace)
|
||||
navigate({ path: [workbenchId] })
|
||||
navigate({ path: [workbenchId, result.workspace] })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { fetchMetadataLocalStorage, location, Popup, ticker } from '@anticrm/ui'
|
||||
import { location, Popup, ticker } from '@anticrm/ui'
|
||||
|
||||
import LoginForm from './LoginForm.svelte'
|
||||
import SignupForm from './SignupForm.svelte'
|
||||
@ -23,13 +23,14 @@
|
||||
import Join from './Join.svelte'
|
||||
import { onDestroy } from 'svelte'
|
||||
import login from '../plugin'
|
||||
import { getMetadata } from '@anticrm/platform'
|
||||
|
||||
export let page: string = 'login'
|
||||
|
||||
let navigateUrl: string | undefined
|
||||
|
||||
function getToken (timer: number): string | null {
|
||||
return fetchMetadataLocalStorage(login.metadata.LoginToken)
|
||||
function getToken (timer: number): string | undefined {
|
||||
return getMetadata(login.metadata.LoginToken)
|
||||
}
|
||||
$: token = getToken($ticker)
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { OK, Status, Severity } from '@anticrm/platform'
|
||||
import { OK, Status, Severity, setMetadata } from '@anticrm/platform'
|
||||
import { getCurrentLocation, navigate, setMetadataLocalStorage } from '@anticrm/ui'
|
||||
|
||||
import Form from './Form.svelte'
|
||||
@ -50,7 +50,7 @@
|
||||
status = loginStatus
|
||||
|
||||
if (result !== undefined) {
|
||||
setMetadataLocalStorage(login.metadata.LoginToken, result.token)
|
||||
setMetadata(login.metadata.LoginToken, result.token)
|
||||
setMetadataLocalStorage(login.metadata.LoginEndpoint, result.endpoint)
|
||||
setMetadataLocalStorage(login.metadata.LoginEmail, result.email)
|
||||
const loc = getCurrentLocation()
|
||||
|
@ -14,8 +14,16 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { OK, Severity, Status } from '@anticrm/platform'
|
||||
import { Button, getCurrentLocation, Label, navigate, setMetadataLocalStorage } from '@anticrm/ui'
|
||||
import { OK, setMetadata, Severity, Status } from '@anticrm/platform'
|
||||
import {
|
||||
Button,
|
||||
fetchMetadataLocalStorage,
|
||||
getCurrentLocation,
|
||||
Label,
|
||||
Location,
|
||||
navigate,
|
||||
setMetadataLocalStorage
|
||||
} from '@anticrm/ui'
|
||||
import { workbenchId } from '@anticrm/workbench'
|
||||
import login from '../plugin'
|
||||
import { getWorkspaces, selectWorkspace, Workspace } from '../utils'
|
||||
@ -32,16 +40,21 @@
|
||||
status = loginStatus
|
||||
|
||||
if (result !== undefined) {
|
||||
setMetadataLocalStorage(login.metadata.LoginToken, result.token)
|
||||
setMetadata(login.metadata.LoginToken, result.token)
|
||||
const tokens: Record<string, string> = fetchMetadataLocalStorage(login.metadata.LoginTokens) ?? {}
|
||||
tokens[result.workspace] = result.token
|
||||
setMetadataLocalStorage(login.metadata.LoginTokens, tokens)
|
||||
setMetadataLocalStorage(login.metadata.LoginEndpoint, result.endpoint)
|
||||
setMetadataLocalStorage(login.metadata.LoginEmail, result.email)
|
||||
setMetadataLocalStorage(login.metadata.CurrentWorkspace, workspace)
|
||||
if (navigateUrl !== undefined) {
|
||||
navigate(JSON.parse(decodeURIComponent(navigateUrl)))
|
||||
} else {
|
||||
navigate({ path: [workbenchId] })
|
||||
const url = JSON.parse(decodeURIComponent(navigateUrl)) as Location
|
||||
if (url.path[1] === workspace) {
|
||||
navigate(url)
|
||||
return
|
||||
}
|
||||
}
|
||||
navigate({ path: [workbenchId, workspace] })
|
||||
}
|
||||
}
|
||||
|
||||
async function _getWorkspaces (): Promise<Workspace[]> {
|
||||
@ -51,7 +64,6 @@
|
||||
setMetadataLocalStorage(login.metadata.LoginToken, null)
|
||||
setMetadataLocalStorage(login.metadata.LoginEndpoint, null)
|
||||
setMetadataLocalStorage(login.metadata.LoginEmail, null)
|
||||
setMetadataLocalStorage(login.metadata.CurrentWorkspace, null)
|
||||
changeAccount()
|
||||
throw err
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { Status, Severity, OK } from '@anticrm/platform'
|
||||
import { Status, Severity, OK, setMetadata } from '@anticrm/platform'
|
||||
|
||||
import Form from './Form.svelte'
|
||||
import { signUp } from '../utils'
|
||||
@ -49,7 +49,7 @@
|
||||
status = loginStatus
|
||||
|
||||
if (result !== undefined) {
|
||||
setMetadataLocalStorage(login.metadata.LoginToken, result.token)
|
||||
setMetadata(login.metadata.LoginToken, result.token)
|
||||
setMetadataLocalStorage(login.metadata.LoginEndpoint, result.endpoint)
|
||||
setMetadataLocalStorage(login.metadata.LoginEmail, result.email)
|
||||
const loc = getCurrentLocation()
|
||||
|
@ -139,8 +139,8 @@ export async function createWorkspace (workspace: string): Promise<[Status, Logi
|
||||
}
|
||||
}
|
||||
|
||||
const token = fetchMetadataLocalStorage(login.metadata.LoginToken)
|
||||
if (token === null) {
|
||||
const token = getMetadata(login.metadata.LoginToken)
|
||||
if (token === undefined) {
|
||||
const loc = getCurrentLocation()
|
||||
loc.path[1] = 'login'
|
||||
loc.path.length = 2
|
||||
@ -188,8 +188,8 @@ export async function getWorkspaces (): Promise<Workspace[]> {
|
||||
}
|
||||
}
|
||||
|
||||
const token = fetchMetadataLocalStorage(login.metadata.LoginToken)
|
||||
if (token === null) {
|
||||
const token = getMetadata(login.metadata.LoginToken)
|
||||
if (token === undefined) {
|
||||
const loc = getCurrentLocation()
|
||||
loc.path[1] = 'login'
|
||||
loc.path.length = 2
|
||||
@ -238,8 +238,8 @@ export async function selectWorkspace (workspace: string): Promise<[Status, Work
|
||||
}
|
||||
}
|
||||
|
||||
const token = fetchMetadataLocalStorage(login.metadata.LoginToken)
|
||||
if (token === null) {
|
||||
const token = getMetadata(login.metadata.LoginToken)
|
||||
if (token === undefined) {
|
||||
const loc = getCurrentLocation()
|
||||
loc.path[1] = 'login'
|
||||
loc.path.length = 2
|
||||
@ -279,8 +279,8 @@ export async function getInviteLink (): Promise<string> {
|
||||
throw new Error('accounts url not specified')
|
||||
}
|
||||
|
||||
const token = fetchMetadataLocalStorage(login.metadata.LoginToken)
|
||||
if (token === null) {
|
||||
const token = getMetadata(login.metadata.LoginToken)
|
||||
if (token === undefined) {
|
||||
const loc = getCurrentLocation()
|
||||
loc.path[1] = 'login'
|
||||
loc.path.length = 2
|
||||
@ -399,7 +399,7 @@ export async function changeName (first: string, last: string): Promise<void> {
|
||||
return
|
||||
}
|
||||
}
|
||||
const token = fetchMetadataLocalStorage(login.metadata.LoginToken) as string
|
||||
const token = getMetadata(login.metadata.LoginToken) as string
|
||||
|
||||
const request: Request<[string, string]> = {
|
||||
method: 'changeName',
|
||||
@ -430,7 +430,7 @@ export async function changePassword (oldPassword: string, password: string): Pr
|
||||
return
|
||||
}
|
||||
}
|
||||
const token = fetchMetadataLocalStorage(login.metadata.LoginToken) as string
|
||||
const token = getMetadata(login.metadata.LoginToken) as string
|
||||
|
||||
const request: Request<[string, string]> = {
|
||||
method: 'changePassword',
|
||||
@ -461,7 +461,7 @@ export async function leaveWorkspace (email: string): Promise<void> {
|
||||
return
|
||||
}
|
||||
}
|
||||
const token = fetchMetadataLocalStorage(login.metadata.LoginToken) as string
|
||||
const token = getMetadata(login.metadata.LoginToken) as string
|
||||
|
||||
const request: Request<[string]> = {
|
||||
method: 'leaveWorkspace',
|
||||
|
@ -30,9 +30,9 @@ export default plugin(loginId, {
|
||||
TelegramUrl: '' as Asset,
|
||||
GmailUrl: '' as Asset,
|
||||
LoginToken: '' as Metadata<string>,
|
||||
LoginTokens: '' as Metadata<Record<string, string>>,
|
||||
LoginEndpoint: '' as Metadata<string>,
|
||||
LoginEmail: '' as Metadata<string>,
|
||||
CurrentWorkspace: '' as Metadata<string>,
|
||||
OverrideLoginToken: '' as Metadata<string>, // debug purposes
|
||||
OverrideEndpoint: '' as Metadata<string>
|
||||
},
|
||||
|
@ -6,8 +6,8 @@
|
||||
function onTag (tag: TagElement): void {
|
||||
selectedTagElements.set([tag._id])
|
||||
const loc = getCurrentLocation()
|
||||
loc.path[2] = 'candidates'
|
||||
loc.path.length = 3
|
||||
loc.path[3] = 'candidates'
|
||||
loc.path.length = 4
|
||||
navigate(loc)
|
||||
}
|
||||
</script>
|
||||
|
@ -52,8 +52,8 @@
|
||||
closePopup()
|
||||
closePanel()
|
||||
const loc = getCurrentLocation()
|
||||
loc.path[2] = vacancy._id
|
||||
loc.path.length = 3
|
||||
loc.path[3] = vacancy._id
|
||||
loc.path.length = 4
|
||||
navigate(loc)
|
||||
}
|
||||
}}
|
||||
|
@ -36,8 +36,8 @@
|
||||
|
||||
function getLoc (): Location {
|
||||
const loc = getCurrentLocation()
|
||||
loc.path[2] = value._id
|
||||
loc.path.length = 3
|
||||
loc.path[3] = value._id
|
||||
loc.path.length = 4
|
||||
return loc
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
import setting, { SettingsCategory } from '@anticrm/setting'
|
||||
import {
|
||||
Component,
|
||||
fetchMetadataLocalStorage,
|
||||
getCurrentLocation,
|
||||
Label,
|
||||
location,
|
||||
@ -29,6 +30,7 @@
|
||||
import login from '@anticrm/login'
|
||||
import { AccountRole, getCurrentAccount } from '@anticrm/core'
|
||||
import { EmployeeAccount } from '@anticrm/contact'
|
||||
import { setMetadata } from '@anticrm/platform'
|
||||
|
||||
let category: SettingsCategory | undefined
|
||||
let categoryId: string = ''
|
||||
@ -49,7 +51,7 @@
|
||||
|
||||
onDestroy(
|
||||
location.subscribe(async (loc) => {
|
||||
categoryId = loc.path[2]
|
||||
categoryId = loc.path[3]
|
||||
category = findCategory(categoryId)
|
||||
})
|
||||
)
|
||||
@ -59,15 +61,20 @@
|
||||
}
|
||||
function selectCategory (id: string): void {
|
||||
const loc = getCurrentLocation()
|
||||
loc.path[2] = id
|
||||
loc.path.length = 3
|
||||
loc.path[3] = id
|
||||
loc.path.length = 4
|
||||
navigate(loc)
|
||||
}
|
||||
function signOut (): void {
|
||||
setMetadataLocalStorage(login.metadata.LoginToken, null)
|
||||
const tokens = fetchMetadataLocalStorage(login.metadata.LoginTokens)
|
||||
if (tokens !== null) {
|
||||
const loc = getCurrentLocation()
|
||||
delete tokens[loc.path[1]]
|
||||
setMetadataLocalStorage(login.metadata.LoginTokens, tokens)
|
||||
}
|
||||
setMetadata(login.metadata.LoginToken, null)
|
||||
setMetadataLocalStorage(login.metadata.LoginEndpoint, null)
|
||||
setMetadataLocalStorage(login.metadata.LoginEmail, null)
|
||||
setMetadataLocalStorage(login.metadata.CurrentWorkspace, null)
|
||||
navigate({ path: [login.component.LoginApp] })
|
||||
}
|
||||
function selectWorkspace (): void {
|
||||
|
@ -44,15 +44,15 @@
|
||||
|
||||
onDestroy(
|
||||
location.subscribe(async (loc) => {
|
||||
categoryId = loc.path[3]
|
||||
categoryId = loc.path[4]
|
||||
category = findCategory(categoryId)
|
||||
})
|
||||
)
|
||||
|
||||
function selectCategory (id: string): void {
|
||||
const loc = getCurrentLocation()
|
||||
loc.path[3] = id
|
||||
loc.path.length = 4
|
||||
loc.path[4] = id
|
||||
loc.path.length = 5
|
||||
navigate(loc)
|
||||
}
|
||||
</script>
|
||||
|
@ -16,9 +16,18 @@
|
||||
import contact, { Employee, EmployeeAccount, formatName } from '@anticrm/contact'
|
||||
import { getCurrentAccount } from '@anticrm/core'
|
||||
import login from '@anticrm/login'
|
||||
import { setMetadata } from '@anticrm/platform'
|
||||
import { Avatar, createQuery } from '@anticrm/presentation'
|
||||
import setting, { SettingsCategory, settingId } from '@anticrm/setting'
|
||||
import { closePopup, getCurrentLocation, Icon, Label, navigate, setMetadataLocalStorage } from '@anticrm/ui'
|
||||
import {
|
||||
closePopup,
|
||||
fetchMetadataLocalStorage,
|
||||
getCurrentLocation,
|
||||
Icon,
|
||||
Label,
|
||||
navigate,
|
||||
setMetadataLocalStorage
|
||||
} from '@anticrm/ui'
|
||||
|
||||
// const client = getClient()
|
||||
async function getItems (): Promise<SettingsCategory[]> {
|
||||
@ -43,17 +52,22 @@
|
||||
function selectCategory (sp: SettingsCategory): void {
|
||||
closePopup()
|
||||
const loc = getCurrentLocation()
|
||||
loc.path[1] = settingId
|
||||
loc.path[2] = sp.name
|
||||
loc.path.length = 3
|
||||
loc.path[2] = settingId
|
||||
loc.path[3] = sp.name
|
||||
loc.path.length = 4
|
||||
navigate(loc)
|
||||
}
|
||||
|
||||
function signOut (): void {
|
||||
setMetadataLocalStorage(login.metadata.LoginToken, null)
|
||||
const tokens = fetchMetadataLocalStorage(login.metadata.LoginTokens)
|
||||
if (tokens !== null) {
|
||||
const loc = getCurrentLocation()
|
||||
delete tokens[loc.path[1]]
|
||||
setMetadataLocalStorage(login.metadata.LoginTokens, tokens)
|
||||
}
|
||||
setMetadata(login.metadata.LoginToken, null)
|
||||
setMetadataLocalStorage(login.metadata.LoginEndpoint, null)
|
||||
setMetadataLocalStorage(login.metadata.LoginEmail, null)
|
||||
setMetadataLocalStorage(login.metadata.CurrentWorkspace, null)
|
||||
navigate({ path: [login.component.LoginApp] })
|
||||
}
|
||||
|
||||
|
@ -20,8 +20,8 @@
|
||||
export let value: WithLookup<Project>
|
||||
function navigateToProject () {
|
||||
const loc = getCurrentLocation()
|
||||
loc.path[4] = value._id
|
||||
loc.path.length = 5
|
||||
loc.path[5] = value._id
|
||||
loc.path.length = 6
|
||||
navigate(loc)
|
||||
}
|
||||
</script>
|
||||
|
@ -37,8 +37,7 @@
|
||||
closeTooltip()
|
||||
closePopup()
|
||||
|
||||
projectId = loc.path[4] as Ref<Project>
|
||||
console.log('PROJECT SELECTED', projectId)
|
||||
projectId = loc.path[5] as Ref<Project>
|
||||
})
|
||||
)
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Doc, Ref, TxOperations } from '@anticrm/core'
|
||||
import { getClient } from '@anticrm/presentation'
|
||||
import { Issue, Team, trackerId } from '@anticrm/tracker'
|
||||
import { getPanelURI, Location } from '@anticrm/ui'
|
||||
import { getCurrentLocation, getPanelURI, Location } from '@anticrm/ui'
|
||||
import { workbenchId } from '@anticrm/workbench'
|
||||
import tracker from './plugin'
|
||||
|
||||
@ -47,7 +47,8 @@ export async function copyToClipboard (object: Issue, ev: Event, { type }: { typ
|
||||
}
|
||||
|
||||
export function generateIssueShortLink (issueId: string): string {
|
||||
return `${window.location.host}/${workbenchId}/${trackerId}/${issueId}`
|
||||
const location = getCurrentLocation()
|
||||
return `${window.location.host}/${workbenchId}/${location.path[1]}/${trackerId}/${issueId}`
|
||||
}
|
||||
|
||||
export async function generateIssueLocation (loc: Location, issueId: string): Promise<Location | undefined> {
|
||||
@ -71,19 +72,20 @@ export async function generateIssueLocation (loc: Location, issueId: string): Pr
|
||||
return undefined
|
||||
}
|
||||
const appComponent = loc.path[0] ?? ''
|
||||
const workspace = loc.path[1] ?? ''
|
||||
return {
|
||||
path: [appComponent, trackerId, team._id, 'issues'],
|
||||
path: [appComponent, workspace, trackerId, team._id, 'issues'],
|
||||
fragment: generateIssuePanelUri(issue)
|
||||
}
|
||||
}
|
||||
|
||||
export async function resolveLocation (loc: Location): Promise<Location | undefined> {
|
||||
const app = loc.path.length > 1 ? loc.path[1] : undefined
|
||||
const app = loc.path.length > 2 ? loc.path[2] : undefined
|
||||
if (app !== trackerId) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
const shortLink = loc.path.length > 2 ? loc.path[2] : undefined
|
||||
const shortLink = loc.path.length > 3 ? loc.path[3] : undefined
|
||||
if (shortLink === undefined || shortLink === null) {
|
||||
return undefined
|
||||
}
|
||||
|
@ -65,10 +65,10 @@
|
||||
on:click={(ev) => {
|
||||
ev.stopPropagation()
|
||||
const loc = getCurrentLocation()
|
||||
loc.path[1] = settingId
|
||||
loc.path[2] = 'setting'
|
||||
loc.path[3] = 'classes'
|
||||
loc.path.length = 4
|
||||
loc.path[2] = settingId
|
||||
loc.path[3] = 'setting'
|
||||
loc.path[4] = 'classes'
|
||||
loc.path.length = 5
|
||||
loc.query = { _class }
|
||||
loc.fragment = undefined
|
||||
navigate(loc)
|
||||
|
@ -16,9 +16,10 @@
|
||||
import contact, { Employee, EmployeeAccount, formatName } from '@anticrm/contact'
|
||||
import { AccountRole, getCurrentAccount } from '@anticrm/core'
|
||||
import login from '@anticrm/login'
|
||||
import { setMetadata } from '@anticrm/platform'
|
||||
import { Avatar, createQuery } from '@anticrm/presentation'
|
||||
import setting, { settingId, SettingsCategory } from '@anticrm/setting'
|
||||
import type { Action } from '@anticrm/ui'
|
||||
import { Action, fetchMetadataLocalStorage } from '@anticrm/ui'
|
||||
import {
|
||||
closePanel,
|
||||
closePopup,
|
||||
@ -62,17 +63,22 @@
|
||||
closePopup()
|
||||
closePanel()
|
||||
const loc = getCurrentLocation()
|
||||
loc.path[1] = settingId
|
||||
loc.path[2] = sp.name
|
||||
loc.path.length = 3
|
||||
loc.path[2] = settingId
|
||||
loc.path[3] = sp.name
|
||||
loc.path.length = 4
|
||||
navigate(loc)
|
||||
}
|
||||
|
||||
function signOut (): void {
|
||||
setMetadataLocalStorage(login.metadata.LoginToken, null)
|
||||
const tokens = fetchMetadataLocalStorage(login.metadata.LoginTokens)
|
||||
if (tokens !== null) {
|
||||
const loc = getCurrentLocation()
|
||||
delete tokens[loc.path[1]]
|
||||
setMetadataLocalStorage(login.metadata.LoginTokens, tokens)
|
||||
}
|
||||
setMetadata(login.metadata.LoginToken, null)
|
||||
setMetadataLocalStorage(login.metadata.LoginEndpoint, null)
|
||||
setMetadataLocalStorage(login.metadata.LoginEmail, null)
|
||||
setMetadataLocalStorage(login.metadata.CurrentWorkspace, null)
|
||||
navigate({ path: [login.component.LoginApp] })
|
||||
}
|
||||
|
||||
@ -98,9 +104,9 @@
|
||||
|
||||
function getURLCategory (sp: SettingsCategory): string {
|
||||
const loc = getCurrentLocation()
|
||||
loc.path[1] = settingId
|
||||
loc.path[2] = sp.name
|
||||
loc.path.length = 3
|
||||
loc.path[2] = settingId
|
||||
loc.path[3] = sp.name
|
||||
loc.path.length = 4
|
||||
return locationToUrl(loc)
|
||||
}
|
||||
|
||||
|
@ -14,18 +14,19 @@
|
||||
-->
|
||||
<script lang="ts">
|
||||
import type { IntlString } from '@anticrm/platform'
|
||||
import { fetchMetadataLocalStorage, Label } from '@anticrm/ui'
|
||||
import login from '@anticrm/login'
|
||||
import { getCurrentLocation, Label } from '@anticrm/ui'
|
||||
|
||||
export let label: IntlString
|
||||
// export let action: () => Promise<void> | void
|
||||
|
||||
const loc = getCurrentLocation()
|
||||
</script>
|
||||
|
||||
<div class="antiNav-header">
|
||||
<div class="flex-row">
|
||||
<span class="fs-title overflow-label"><Label {label} /></span>
|
||||
<div>
|
||||
{fetchMetadataLocalStorage(login.metadata.CurrentWorkspace)}
|
||||
{loc.path[1]}
|
||||
</div>
|
||||
</div>
|
||||
<!-- <ActionIcon label={workbench.string.More} icon={IconMoreH} size={'small'} {action}/> -->
|
||||
|
@ -107,7 +107,7 @@
|
||||
|
||||
async function view (space: Space): Promise<void> {
|
||||
const loc = getCurrentLocation()
|
||||
loc.path[2] = space._id
|
||||
loc.path[3] = space._id
|
||||
navigate(loc)
|
||||
}
|
||||
</script>
|
||||
|
@ -26,7 +26,6 @@
|
||||
closeTooltip,
|
||||
Component,
|
||||
DatePickerPopup,
|
||||
fetchMetadataLocalStorage,
|
||||
getCurrentLocation,
|
||||
Label,
|
||||
location,
|
||||
@ -39,7 +38,6 @@
|
||||
showPopup,
|
||||
TooltipInstance
|
||||
} from '@anticrm/ui'
|
||||
import login from '@anticrm/login'
|
||||
import view from '@anticrm/view'
|
||||
import { ActionContext, ActionHandler } from '@anticrm/view-resources'
|
||||
import type { Application, NavigatorModel, SpecialNavModel, ViewConfiguration } from '@anticrm/workbench'
|
||||
@ -147,7 +145,7 @@
|
||||
|
||||
async function updateWindowTitle (loc: Location) {
|
||||
const title = (await getWindowTitle(loc)) ?? getMetadata(workbench.metadata.PlatformTitle) ?? 'Platform'
|
||||
const ws = fetchMetadataLocalStorage(login.metadata.CurrentWorkspace)
|
||||
const ws = loc.path[1]
|
||||
document.title = ws == null ? title : `${ws} - ${title}`
|
||||
}
|
||||
async function getWindowTitle (loc: Location) {
|
||||
@ -169,9 +167,9 @@
|
||||
}
|
||||
|
||||
async function syncLoc (loc: Location): Promise<void> {
|
||||
const app = loc.path.length > 1 ? loc.path[1] : undefined
|
||||
const space = loc.path.length > 2 ? (loc.path[2] as Ref<Space>) : undefined
|
||||
const special = loc.path.length > 3 ? loc.path[3] : undefined
|
||||
const app = loc.path.length > 2 ? loc.path[2] : undefined
|
||||
const space = loc.path.length > 3 ? (loc.path[3] as Ref<Space>) : undefined
|
||||
const special = loc.path.length > 4 ? loc.path[4] : undefined
|
||||
|
||||
if (currentAppAlias !== app) {
|
||||
clear(1)
|
||||
@ -195,13 +193,13 @@
|
||||
const last = localStorage.getItem(`platform_last_loc_${app}`)
|
||||
if (last !== null) {
|
||||
const newLocation: Location = JSON.parse(last)
|
||||
if (newLocation.path[2] != null) {
|
||||
loc.path[2] = newLocation.path[2] as Ref<Space>
|
||||
loc.path[3] = newLocation.path[3]
|
||||
if (loc.path[3] == null) {
|
||||
loc.path.length = 3
|
||||
} else {
|
||||
if (newLocation.path[3] != null) {
|
||||
loc.path[3] = newLocation.path[3] as Ref<Space>
|
||||
loc.path[4] = newLocation.path[4]
|
||||
if (loc.path[4] == null) {
|
||||
loc.path.length = 4
|
||||
} else {
|
||||
loc.path.length = 5
|
||||
}
|
||||
navigate(loc)
|
||||
return
|
||||
@ -282,7 +280,7 @@
|
||||
|
||||
function closeAside (): void {
|
||||
const loc = getCurrentLocation()
|
||||
loc.path.length = 3
|
||||
loc.path.length = 4
|
||||
checkOnHide()
|
||||
navigate(loc)
|
||||
}
|
||||
|
@ -63,7 +63,7 @@
|
||||
icon: IconSearch,
|
||||
action: async (_id: Ref<Doc>): Promise<void> => {
|
||||
const loc = getCurrentLocation()
|
||||
loc.path[2] = 'spaceBrowser'
|
||||
loc.path[3] = 'spaceBrowser'
|
||||
dispatch('open')
|
||||
navigate(loc)
|
||||
}
|
||||
|
@ -72,44 +72,44 @@ export async function doNavigate (
|
||||
const client = getClient()
|
||||
switch (props.mode) {
|
||||
case 'app':
|
||||
loc.path[1] = props.application ?? ''
|
||||
loc.path[2] = props.application ?? ''
|
||||
if (props.special !== undefined) {
|
||||
loc.path[2] = props.special
|
||||
loc.path.length = 3
|
||||
loc.path[3] = props.special
|
||||
loc.path.length = 4
|
||||
} else {
|
||||
loc.path.length = 2
|
||||
loc.path.length = 3
|
||||
}
|
||||
navigate(loc)
|
||||
break
|
||||
case 'special':
|
||||
if (props.application !== undefined && loc.path[1] !== props.application) {
|
||||
loc.path[1] = props.application
|
||||
if (props.application !== undefined && loc.path[2] !== props.application) {
|
||||
loc.path[2] = props.application
|
||||
}
|
||||
loc.path[2] = props.special ?? ''
|
||||
loc.path.length = 3
|
||||
loc.path[3] = props.special ?? ''
|
||||
loc.path.length = 4
|
||||
navigate(loc)
|
||||
break
|
||||
case 'space': {
|
||||
if (props.space !== undefined) {
|
||||
loc.path[2] = props.space
|
||||
loc.path[3] = props.space
|
||||
} else {
|
||||
if (doc !== undefined && !Array.isArray(doc) && client.getHierarchy().isDerived(doc._class, core.class.Space)) {
|
||||
loc.path[2] = doc._id
|
||||
loc.path[3] = doc._id
|
||||
}
|
||||
}
|
||||
if (props.spaceSpecial !== undefined) {
|
||||
loc.path[3] = props.spaceSpecial
|
||||
loc.path[4] = props.spaceSpecial
|
||||
}
|
||||
if (props.spaceClass !== undefined) {
|
||||
const ex = await client.findOne(props.spaceClass, { _id: loc.path[2] as Ref<Space> })
|
||||
const ex = await client.findOne(props.spaceClass, { _id: loc.path[3] as Ref<Space> })
|
||||
if (ex === undefined) {
|
||||
const r = await client.findOne(props.spaceClass, {})
|
||||
if (r !== undefined) {
|
||||
loc.path[2] = r._id
|
||||
loc.path[3] = r._id
|
||||
}
|
||||
}
|
||||
}
|
||||
loc.path.length = 4
|
||||
loc.path.length = 5
|
||||
navigate(loc)
|
||||
|
||||
break
|
||||
|
@ -9,12 +9,8 @@
|
||||
"value": "user1"
|
||||
},
|
||||
{
|
||||
"name": "login:metadata:LoginToken",
|
||||
"value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6InVzZXIxIiwid29ya3NwYWNlIjoic2FuaXR5LXdzIn0.hfUCqePHO-WNps2by4B-CYGKIpDpLG0WVCUUtU-SVI4"
|
||||
},
|
||||
{
|
||||
"name": "login:metadata:CurrentWorkspace",
|
||||
"value": "sanity-ws"
|
||||
"name": "login:metadata:LoginTokens",
|
||||
"value": "{\"sanity-ws\":\"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6InVzZXIxIiwid29ya3NwYWNlIjoic2FuaXR5LXdzIn0.hfUCqePHO-WNps2by4B-CYGKIpDpLG0WVCUUtU-SVI4\"}"
|
||||
},
|
||||
{
|
||||
"name": "login:metadata:LoginEndpoint",
|
||||
|
@ -9,12 +9,8 @@
|
||||
"value": "user1"
|
||||
},
|
||||
{
|
||||
"name": "login:metadata:LoginToken",
|
||||
"value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6InVzZXIxIiwid29ya3NwYWNlIjoic2FuaXR5LXdzIn0.hfUCqePHO-WNps2by4B-CYGKIpDpLG0WVCUUtU-SVI4"
|
||||
},
|
||||
{
|
||||
"name": "login:metadata:CurrentWorkspace",
|
||||
"value": "sanity-ws"
|
||||
"name": "login:metadata:LoginTokens",
|
||||
"value": "{\"sanity-ws\":\"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6InVzZXIxIiwid29ya3NwYWNlIjoic2FuaXR5LXdzIn0.hfUCqePHO-WNps2by4B-CYGKIpDpLG0WVCUUtU-SVI4\"}"
|
||||
},
|
||||
{
|
||||
"name": "login:metadata:LoginEndpoint",
|
||||
|
@ -8,13 +8,13 @@ test.use({
|
||||
test.describe('actions tests', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
// Create user and workspace
|
||||
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`)
|
||||
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/sanity-ws`)
|
||||
})
|
||||
test('action-new-candidate', async ({ page }) => {
|
||||
await page.click('[id="app-recruit\\:string\\:RecruitApplication"]')
|
||||
|
||||
await page.click('text=Talents')
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit/talents`)
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/recruit/talents`)
|
||||
|
||||
await page.click('td:has-text("Frontend Engineer")')
|
||||
|
||||
@ -29,26 +29,26 @@ test.describe('actions tests', () => {
|
||||
await page.click('[id="app-recruit\\:string\\:RecruitApplication"]')
|
||||
|
||||
await page.click('text=Talents')
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit/talents`)
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/recruit/talents`)
|
||||
|
||||
await page.press('body', 'Meta+k')
|
||||
await page.fill('[placeholder="type\\ to\\ filter\\.\\.\\."]', 'go to')
|
||||
expect(await page.locator('div.selectPopup :text("Go To Vacancies")').count()).toBe(1)
|
||||
await page.click('div.selectPopup :text("Go To Vacancies")')
|
||||
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit/vacancies`)
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/recruit/vacancies`)
|
||||
})
|
||||
test('action-switch-applications', async ({ page }) => {
|
||||
await page.click('[id="app-recruit\\:string\\:RecruitApplication"]')
|
||||
|
||||
await page.click('text=Talents')
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit/talents`)
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/recruit/talents`)
|
||||
|
||||
await page.press('body', 'Meta+k')
|
||||
await page.fill('[placeholder="type\\ to\\ filter\\.\\.\\."]', 'go to')
|
||||
expect(await page.locator('div.selectPopup :text("Go To Applications")').count()).toBe(1)
|
||||
await page.click('div.selectPopup :text("Go To Applications")')
|
||||
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit/candidates`)
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/recruit/candidates`)
|
||||
})
|
||||
})
|
||||
|
@ -8,7 +8,7 @@ test.use({
|
||||
test.describe('duplicate-org-test', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
// Create user and workspace
|
||||
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`)
|
||||
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws`)
|
||||
})
|
||||
test('test', async ({ page }) => {
|
||||
await page.click('[id="app-lead\\:string\\:LeadApplication"]')
|
||||
|
@ -8,7 +8,7 @@ test.use({
|
||||
test.describe('contact tests', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
// Create user and workspace
|
||||
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`)
|
||||
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws`)
|
||||
})
|
||||
test('create-contact', async ({ page }) => {
|
||||
// Create a new context with the saved storage state.
|
||||
|
@ -8,7 +8,7 @@ test.use({
|
||||
test.describe('recruit tests', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
// Create user and workspace
|
||||
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`)
|
||||
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws`)
|
||||
})
|
||||
|
||||
test('org-add-member', async ({ page }) => {
|
||||
|
@ -8,7 +8,7 @@ test.use({
|
||||
test.describe('recruit review tests', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
// Create user and workspace
|
||||
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`)
|
||||
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws`)
|
||||
})
|
||||
test('create-review', async ({ page, context }) => {
|
||||
await page.click('[id="app-recruit\\:string\\:RecruitApplication"]')
|
||||
|
@ -8,7 +8,7 @@ test.use({
|
||||
test.describe('recruit tests', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
// Create user and workspace
|
||||
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`)
|
||||
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws`)
|
||||
})
|
||||
test('create-candidate', async ({ page, context }) => {
|
||||
await page.locator('[id="app-recruit\\:string\\:RecruitApplication"]').click()
|
||||
|
@ -7,18 +7,18 @@ test.use({
|
||||
test.describe('contact tests', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
// Create user and workspace
|
||||
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`)
|
||||
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws`)
|
||||
})
|
||||
test('update-profile', async ({ page, context }) => {
|
||||
// Go to http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp
|
||||
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`)
|
||||
// Go to http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp/sanity-ws
|
||||
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws`)
|
||||
// Click #profile-button
|
||||
await page.click('#profile-button')
|
||||
await page.click('text=John Appleseed')
|
||||
// await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/setting/setting`)
|
||||
// await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/setting/setting`)
|
||||
// Click text=Edit profile
|
||||
// await page.click('text=Edit profile')
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/setting/profile`)
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/setting/profile`)
|
||||
// Click [placeholder="Location"]
|
||||
await page.click('[placeholder="Location"]')
|
||||
// Fill [placeholder="Location"]
|
||||
@ -37,8 +37,8 @@ test.describe('contact tests', () => {
|
||||
await page.click('.editor-container button:nth-child(3)')
|
||||
})
|
||||
test('create-template', async ({ page }) => {
|
||||
// Go to http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp
|
||||
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`)
|
||||
// Go to http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp/sanity-ws
|
||||
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws`)
|
||||
// Click #profile-button
|
||||
await page.click('#profile-button')
|
||||
// Click button:has-text("Settings")
|
||||
@ -70,8 +70,8 @@ test.describe('contact tests', () => {
|
||||
})
|
||||
|
||||
test('manage-status-templates', async ({ page }) => {
|
||||
// Go to http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp
|
||||
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`)
|
||||
// Go to http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp/sanity-ws
|
||||
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws`)
|
||||
// Click #profile-button
|
||||
await page.click('#profile-button')
|
||||
// await page.click('text=Workspace')
|
||||
|
@ -8,17 +8,17 @@ test.use({
|
||||
test.describe('recruit tests', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
// Create user and workspace
|
||||
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`)
|
||||
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws`)
|
||||
})
|
||||
test('create-candidate-with-skill', async ({ page }) => {
|
||||
// Go to http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp
|
||||
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`)
|
||||
// Go to http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp/sanity-ws
|
||||
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws`)
|
||||
// Click [id="app-recruit\:string\:RecruitApplication"]
|
||||
await page.click('[id="app-recruit\\:string\\:RecruitApplication"]')
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit`)
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/recruit`)
|
||||
// Click text=Talents
|
||||
await page.click('text=Talents')
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit/talents`)
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/recruit/talents`)
|
||||
// Click button:has-text("Talent")
|
||||
await page.click('button:has-text("Talent")')
|
||||
// Fill [placeholder="John"]
|
||||
@ -48,14 +48,14 @@ test.describe('recruit tests', () => {
|
||||
})
|
||||
|
||||
test('create-tag-candidate', async ({ page }) => {
|
||||
// Go to http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp
|
||||
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`)
|
||||
// Go to http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp/sanity-ws
|
||||
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws`)
|
||||
// Click [id="app-recruit\:string\:RecruitApplication"]
|
||||
await page.click('[id="app-recruit\\:string\\:RecruitApplication"]')
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit`)
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/recruit`)
|
||||
// Click text=Skills
|
||||
await page.click('text=Skills')
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit/skills`)
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/recruit/skills`)
|
||||
// Click button:has-text("Skill")
|
||||
await page.click('button:has-text("Skill")')
|
||||
// Click [placeholder="Please\ type\ skill\ title"]
|
||||
@ -78,7 +78,7 @@ test.describe('recruit tests', () => {
|
||||
await page.click('button:has-text("Create")')
|
||||
// Click text=Talents
|
||||
await page.click('text=Talents')
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit/talents`)
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/recruit/talents`)
|
||||
// Click button:has-text("Talent")
|
||||
await page.click('button:has-text("Talent")')
|
||||
// Click #add-tag div div
|
||||
|
@ -8,7 +8,7 @@ test.use({
|
||||
test.describe('project tests', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
// Create user and workspace
|
||||
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`)
|
||||
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws`)
|
||||
})
|
||||
test('create-project-issue', async ({ page }) => {
|
||||
await page.click('[id="app-tracker\\:string\\:TrackerApplication"]')
|
||||
@ -16,7 +16,7 @@ test.describe('project tests', () => {
|
||||
// Click text=Projects
|
||||
await page.click('text=Projects')
|
||||
await expect(page).toHaveURL(
|
||||
`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/tracker/tracker%3Ateam%3ADefaultTeam/projects`
|
||||
`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/tracker/tracker%3Ateam%3ADefaultTeam/projects`
|
||||
)
|
||||
await page.click('button:has-text("Project")')
|
||||
await page.click('[placeholder="Project\\ name"]')
|
||||
@ -39,7 +39,7 @@ test.describe('project tests', () => {
|
||||
await page.click('[id="app-tracker\\:string\\:TrackerApplication"]')
|
||||
await page.click('text=Projects')
|
||||
await expect(page).toHaveURL(
|
||||
`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/tracker/tracker%3Ateam%3ADefaultTeam/projects`
|
||||
`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/tracker/tracker%3Ateam%3ADefaultTeam/projects`
|
||||
)
|
||||
await page.click('button:has-text("Project")')
|
||||
const prjId = 'project-' + generateId()
|
||||
|
@ -5,9 +5,9 @@ test.use({
|
||||
})
|
||||
|
||||
async function navigate (page: Page): Promise<void> {
|
||||
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`)
|
||||
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws`)
|
||||
await page.click('[id="app-tracker\\:string\\:TrackerApplication"]')
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/tracker`)
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/tracker`)
|
||||
}
|
||||
|
||||
interface IssueProps {
|
||||
|
@ -7,28 +7,28 @@ test.use({
|
||||
test.describe('workbench tests', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
// Create user and workspace
|
||||
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`)
|
||||
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws`)
|
||||
})
|
||||
test('navigator', async ({ page }) => {
|
||||
// Click [id="app-recruit\:string\:RecruitApplication"]
|
||||
await page.click('[id="app-recruit\\:string\\:RecruitApplication"]')
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit`)
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/recruit`)
|
||||
// Click text=Applications
|
||||
await page.click('text=Applications')
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit/candidates`)
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/recruit/candidates`)
|
||||
// Click text=Applications Application >> span
|
||||
await expect(page.locator('text=Applications Filter')).toBeVisible()
|
||||
await expect(page.locator('text="APP-1')).toBeDefined()
|
||||
|
||||
// Click text=Talents
|
||||
await page.click('text=Talents')
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit/talents`)
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/recruit/talents`)
|
||||
|
||||
await expect(page.locator('text=Andrey P.')).toBeVisible()
|
||||
|
||||
// Click text=Vacancies
|
||||
await page.click('text=Vacancies')
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit/vacancies`)
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/recruit/vacancies`)
|
||||
// Click text=Software Engineer
|
||||
await page.click('text=Software Engineer')
|
||||
await expect(page.locator('text=Software Engineer')).toBeVisible()
|
||||
@ -38,7 +38,7 @@ test.describe('workbench tests', () => {
|
||||
|
||||
// Click [id="app-chunter\:string\:ApplicationLabelChunter"]
|
||||
await page.click('[id="app-chunter\\:string\\:ApplicationLabelChunter"]')
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/chunter`)
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/chunter`)
|
||||
|
||||
await page.click('text=general')
|
||||
|
||||
@ -46,7 +46,7 @@ test.describe('workbench tests', () => {
|
||||
await expect(page.locator('.textInput')).toBeVisible()
|
||||
|
||||
await page.click('[id="app-contact\\:string\\:Contacts"]')
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/contact`)
|
||||
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/sanity-ws/contact`)
|
||||
// Click text=John Appleseed
|
||||
await expect(page.locator('text=John Appleseed')).toBeVisible()
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user