TSK-1093: Fix Application doneState showing (#2927)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2023-04-10 14:55:22 +07:00 committed by GitHub
parent d7f9615a8e
commit d353c0e42d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 149 additions and 56 deletions

View File

@ -8,6 +8,7 @@
"analyze": "cross-env NODE_ENV=production webpack --json > stats.json",
"show": "webpack-bundle-analyzer stats.json dist",
"dev-server": "cross-env CLIENT_TYPE=dev-server webpack serve",
"dev-production": "cross-env CLIENT_TYPE=dev-production webpack serve",
"start": "cross-env NODE_ENV=production webpack serve",
"preformat-svelte": "prettier -w src/**/*.svelte",
"lint": "",

View File

@ -2,5 +2,8 @@
"ACCOUNTS_URL":"https://account.hc.engineering",
"COLLABORATOR_URL": "wss://collaborator.hc.engineering",
"UPLOAD_URL":"/files",
"MODEL_VERSION": null
"MODEL_VERSION": null,
"TELEGRAM_URL": "https://telegram.hc.engineering",
"GMAIL_URL": "https://gmail.hc.engineering",
"REKONI_URL": "https://rekoni.hc.engineering"
}

View File

@ -19,7 +19,7 @@ import { configurePlatform } from './platform'
import { configurePlatformDevServer } from './platform-dev'
configurePlatform().then(() => {
if (process.env.CLIENT_TYPE === 'dev-server') {
if (process.env.CLIENT_TYPE === 'dev-server' || process.env.CLIENT_TYPE === 'dev-production') {
configurePlatformDevServer()
}

View File

@ -89,8 +89,10 @@ interface Config {
GMAIL_URL: string
}
const devConfig = process.env.CLIENT_TYPE === 'dev-production'
export async function configurePlatform() {
const config: Config = await (await fetch('/config.json')).json()
const config: Config = await (await fetch(devConfig? '/config-dev.json' : '/config.json')).json()
console.log('loading configuration', config)
setMetadata(login.metadata.AccountsUrl, config.ACCOUNTS_URL)
setMetadata(presentation.metadata.UploadURL, config.UPLOAD_URL)

View File

@ -26,7 +26,8 @@ const { Configuration } = require('webpack')
const mode = process.env.NODE_ENV || 'development'
const prod = mode === 'production'
const devServer = (process.env.CLIENT_TYPE ?? '') === 'dev-server'
const dev = (process.env.CLIENT_TYPE ?? '') === 'dev' || devServer
const devProduction = (process.env.CLIENT_TYPE ?? '') === 'dev-production'
const dev = (process.env.CLIENT_TYPE ?? '') === 'dev' || devServer || devProduction
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
/**
@ -228,7 +229,7 @@ module.exports = {
overlay: true,
progress: false,
},
proxy: devServer ? {
proxy: (devServer && !devProduction) ? {
'/account': {
target: 'http://localhost:3000',
changeOrigin: true,
@ -247,15 +248,12 @@ module.exports = {
},
} : {
'/account': {
// target: 'https://ftwm71rwag.execute-api.us-west-2.amazonaws.com/stage/',
target: 'https://account.hc.engineering/',
changeOrigin: true,
pathRewrite: { '^/account': '' },
logLevel: 'debug'
},
'/files': {
// target: 'https://anticrm-upload.herokuapp.com/',
// target: 'http://localhost:3000/',
target: 'https://front.hc.engineering/files',
changeOrigin: true,
pathRewrite: { '^/files': '' },

View File

@ -281,10 +281,7 @@ export function createModel (builder: Builder): void {
label: recruit.string.Applications,
createLabel: recruit.string.ApplicationCreateLabel,
createComponent: recruit.component.CreateApplication,
descriptors: [view.viewlet.Table, task.viewlet.Kanban, recruit.viewlet.ApplicantDashboard],
baseQuery: {
doneState: null
}
descriptors: [view.viewlet.Table, task.viewlet.Kanban, recruit.viewlet.ApplicantDashboard]
},
position: 'vacancy'
},
@ -570,7 +567,10 @@ export function createModel (builder: Builder): void {
}
}
},
hiddenKeys: ['name', 'attachedTo']
hiddenKeys: ['name', 'attachedTo'],
baseQuery: {
doneState: null
}
},
recruit.viewlet.ApplicantTable
)
@ -582,7 +582,10 @@ export function createModel (builder: Builder): void {
attachTo: recruit.class.ApplicantMatch,
descriptor: view.viewlet.Table,
config: ['', 'response', 'attachedTo', 'space', 'modifiedOn'],
hiddenKeys: []
hiddenKeys: [],
baseQuery: {
doneState: null
}
},
recruit.viewlet.TableApplicantMatch
)
@ -630,6 +633,9 @@ export function createModel (builder: Builder): void {
attachTo: recruit.class.Applicant,
descriptor: task.viewlet.Kanban,
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
baseQuery: {
doneState: null
},
viewOptions: {
...applicantViewOptions,
groupDepth: 1

View File

@ -25,8 +25,8 @@
if (bb._class === undefined) {
return a
}
const attr = client.getHierarchy().getAttribute(bb._class, bb.attr)
if (!isFullTextAttribute(attr)) {
const attr = client.getHierarchy().findAttribute(bb._class, bb.attr)
if (attr === undefined || !isFullTextAttribute(attr)) {
return a
}
const pos = a.findIndex((it) => it[0] === attr)

View File

@ -1,13 +1,15 @@
<script lang="ts">
import core, { Doc, DocIndexState, Ref } from '@hcengineering/core'
import { EditBox, Panel } from '@hcengineering/ui'
import { EditBox, Label, Panel } from '@hcengineering/ui'
import { createQuery } from '../utils'
import IndexedDocumentContent from './IndexedDocumentContent.svelte'
import presentation from '../plugin'
export let objectId: Ref<Doc> | undefined
export let indexDoc: DocIndexState | undefined = undefined
export let search: string = ''
export let noPanel = false
const indexDocQuery = createQuery()
$: if (objectId !== undefined) {
@ -20,7 +22,20 @@
}
</script>
<Panel on:changeContent on:close>
{#if noPanel}
<div class="p-1 flex-col">
<Label label={presentation.string.DocumentPreview} />
<EditBox focus bind:value={search} kind="search-style" />
</div>
<div class="indexed-background">
<div class="indexed-doc text-base max-h-125">
{#if indexDoc}
<IndexedDocumentContent {indexDoc} {search} />
{/if}
</div>
</div>
{:else}
<Panel on:changeContent on:close>
<EditBox focus bind:value={search} kind="search-style" />
<div class="indexed-background">
<div class="indexed-doc text-base max-h-125">
@ -29,7 +44,8 @@
{/if}
</div>
</div>
</Panel>
</Panel>
{/if}
<style lang="scss">
.indexed-doc {

View File

@ -80,7 +80,7 @@
</div>
<div class="space" />
{:else if contentType && contentType.startsWith('application/msword')}
<IndexedDocumentPreview objectId={value._id} />
<IndexedDocumentPreview objectId={value._id} noPanel />
{:else}
<iframe
class="pdfviewer-content"

View File

@ -18,15 +18,26 @@
import view from '@hcengineering/view'
export let nodes: NodeListOf<any>
function prevName (pos: number, nodes: NodeListOf<any>): string | undefined {
while (true) {
if (nodes[pos - 1]?.nodeName === '#text' && (nodes[pos - 1]?.data ?? '').trim() === '') {
pos--
continue
}
break
}
return nodes[pos - 1]?.nodeName
}
</script>
{#if nodes}
{#each nodes as node}
{#each nodes as node, ni}
{#if node.nodeType === Node.TEXT_NODE}
{node.data}
{:else if node.nodeName === 'EM'}
<em><svelte:self nodes={node.childNodes} /></em>
{:else if node.nodeName === 'STRONG'}
{:else if node.nodeName === 'STRONG' || node.nodeName === 'B'}
<strong><svelte:self nodes={node.childNodes} /></strong>
{:else if node.nodeName === 'P'}
{#if node.childNodes.length > 0}
@ -41,7 +52,10 @@
{:else if node.nodeName === 'PRE'}
<pre><svelte:self nodes={node.childNodes} /></pre>
{:else if node.nodeName === 'BR'}
{@const pName = prevName(ni, nodes)}
{#if pName !== 'P' && pName !== 'BR' && pName !== undefined}
<br />
{/if}
{:else if node.nodeName === 'HR'}
<hr />
{:else if node.nodeName === 'IMG'}
@ -58,9 +72,9 @@
<h5><svelte:self nodes={node.childNodes} /></h5>
{:else if node.nodeName === 'H6'}
<h6><svelte:self nodes={node.childNodes} /></h6>
{:else if node.nodeName === 'UL'}
{:else if node.nodeName === 'UL' || node.nodeName === 'LIST'}
<ul><svelte:self nodes={node.childNodes} /></ul>
{:else if node.nodeName === 'OL'}
{:else if node.nodeName === 'OL' || node.nodeName === 'LIST=1'}
<ol><svelte:self nodes={node.childNodes} /></ol>
{:else if node.nodeName === 'LI'}
<li class={node.className}><svelte:self nodes={node.childNodes} /></li>
@ -120,7 +134,7 @@
{:else if node.nodeName === 'S'}
<s><svelte:self nodes={node.childNodes} /></s>
{:else}
unknown: {node.nodeName}
unknown: "{node.nodeName}"
<svelte:self nodes={node.childNodes} />
{/if}
{/each}

View File

@ -18,7 +18,7 @@
import chunter, { Comment } from '@hcengineering/chunter'
import { createQuery } from '@hcengineering/presentation'
import { Label, resizeObserver } from '@hcengineering/ui'
import { Label, resizeObserver, Spinner } from '@hcengineering/ui'
import { DocNavLink, ObjectPresenter } from '@hcengineering/view-resources'
import CommentPresenter from './CommentPresenter.svelte'
import { createEventDispatcher } from 'svelte'
@ -26,6 +26,8 @@
export let objectId: Ref<Doc>
export let object: Doc
let loading = true
let comments: Comment[] = []
const query = createQuery()
$: query.query(
@ -33,6 +35,7 @@
{ attachedTo: objectId },
(res) => {
comments = res
loading = false
},
{ sort: { modifiedOn: SortingOrder.Descending } }
)
@ -45,7 +48,7 @@
dispatch('changeContent')
}}
>
<div class="fs-title">
<div class="fs-title mr-2">
<Label label={chunter.string.Comments} />
</div>
<DocNavLink {object}>
@ -53,11 +56,17 @@
</DocNavLink>
</div>
<div class="comments max-h-120 flex-row">
{#if loading}
<div class="flex-center">
<Spinner />
</div>
{:else}
{#each comments as comment}
<div class="item">
<CommentPresenter value={comment} />
</div>
{/each}
{/if}
</div>
<style lang="scss">

View File

@ -79,7 +79,7 @@
<Table
_class={recruit.class.Applicant}
config={preference?.config ?? viewlet.config}
query={{ attachedTo: objectId }}
query={{ attachedTo: objectId, ...(viewlet?.baseQuery ?? {}) }}
loadingProps={{ length: applications }}
/>
</Scroller>
@ -87,7 +87,7 @@
<Table
_class={recruit.class.Applicant}
config={preference?.config ?? viewlet.config}
query={{ attachedTo: objectId }}
query={{ attachedTo: objectId, ...(viewlet?.baseQuery ?? {}) }}
loadingProps={{ length: applications }}
/>
{/if}

View File

@ -35,7 +35,7 @@
sort: {
modifiedOn: SortingOrder.Descending
},
limit: 10
limit: 200
}
let viewlet: Viewlet | undefined

View File

@ -28,7 +28,7 @@
doneState: task.class.DoneState,
attachedTo: recruit.mixin.Candidate
},
limit: 10
limit: 200
}
</script>

View File

@ -21,7 +21,7 @@
export let resultQuery: DocumentQuery<Doc>
const options: FindOptions<Vacancy> = {
limit: 10
limit: 200
}
</script>

View File

@ -81,8 +81,8 @@
currentProject = res.shift()
})
let resultQuery: DocumentQuery<any> = { ...query, doneState: null }
$: getResultQuery(query, viewOptionsConfig, viewOptions).then((p) => (resultQuery = p))
let resultQuery: DocumentQuery<any> = { ...query }
$: getResultQuery(query, viewOptionsConfig, viewOptions).then((p) => (resultQuery = { ...p, ...query }))
const client = getClient()
const hierarchy = client.getHierarchy()
@ -167,7 +167,15 @@
const categoryFunc = viewOption as CategoryOption
if (viewOptions[viewOption.key] ?? viewOption.defaultValue) {
const categoryAction = await getResource(categoryFunc.action)
const res = await categoryAction(_class, space, groupByKey, update, queryId, $statusStore, viewlet.descriptor)
const res = await categoryAction(
_class,
space ? { space } : {},
groupByKey,
update,
queryId,
$statusStore,
viewlet.descriptor
)
if (res !== undefined) {
categories = res
break

View File

@ -193,7 +193,15 @@
const categoryFunc = viewOption as CategoryOption
if (viewOptions[viewOption.key] ?? viewOption.defaultValue) {
const categoryAction = await getResource(categoryFunc.action)
const res = await categoryAction(_class, space, groupByKey, update, queryId, $statusStore, viewlet.descriptor)
const res = await categoryAction(
_class,
space !== undefined ? { space } : {},
groupByKey,
update,
queryId,
$statusStore,
viewlet.descriptor
)
if (res !== undefined) {
categories = res
break

View File

@ -1,15 +1,25 @@
import core, { Class, Doc, DocumentQuery, Ref, SortingOrder, StatusManager } from '@hcengineering/core'
import core, {
Class,
Doc,
DocumentQuery,
Ref,
SortingOrder,
Status,
StatusManager,
WithLookup,
matchQuery
} from '@hcengineering/core'
import { getResource } from '@hcengineering/platform'
import { createQuery, getAttributePresenterClass, getClient, LiveQuery } from '@hcengineering/presentation'
import { LiveQuery, createQuery, getAttributePresenterClass, getClient } from '@hcengineering/presentation'
import { getCurrentLocation, locationToUrl } from '@hcengineering/ui'
import {
DropdownViewOption,
ToggleViewOption,
Viewlet,
ViewletDescriptor,
ViewOptionModel,
ViewOptions,
ViewOptionsModel
ViewOptionsModel,
Viewlet,
ViewletDescriptor
} from '@hcengineering/view'
import { get, writable } from 'svelte/store'
import view from './plugin'
@ -121,8 +131,19 @@ export async function showEmptyGroups (
if (hierarchy.isDerived(attrClass, core.class.Status)) {
// We do not need extensions for all status categories.
const statuses = mgr.statuses.filter((it) => it.ofAttribute === attr._id).map((it) => it._id)
return await groupByCategory(client, _class, key, statuses, mgr)
let statusList = mgr.statuses.filter((it) => {
return it.ofAttribute === attr._id
})
if (query !== undefined) {
statusList = matchQuery<Status>(
statusList,
query as DocumentQuery<Status>,
_class,
hierarchy
) as unknown as Array<WithLookup<Status>>
}
const statuses = statusList.map((it) => it._id)
return await groupByCategory(client, _class, key, statuses, mgr, viewletDescriptorId)
}
const mixin = hierarchy.as(attributeClass, view.mixin.AllValuesFunc)

View File

@ -271,6 +271,7 @@ export interface AllValuesFunc extends Class<Doc> {
*/
export interface Viewlet extends Doc {
attachTo: Ref<Class<Doc>>
baseQuery?: DocumentQuery<Doc>
descriptor: Ref<ViewletDescriptor>
options?: FindOptions<Doc>
config: (BuildModelKey | string)[]

View File

@ -33,7 +33,9 @@
let preference: ViewletPreference | undefined
let loading = true
$: searchQuery = search === '' ? { space } : { $search: search, space }
$: query = viewlet?.baseQuery ?? {}
$: searchQuery = search === '' ? { space, ...query } : { $search: search, space, ...query }
$: resultQuery = searchQuery
$: viewlet &&
@ -56,7 +58,12 @@
{#if loading}
<Loading />
{:else}
<FilterBar {_class} query={searchQuery} {viewOptions} on:change={(e) => (resultQuery = e.detail)} />
<FilterBar
{_class}
query={searchQuery}
{viewOptions}
on:change={(e) => (resultQuery = { ...e.detail, ...query })}
/>
<Component
is={viewlet.$lookup?.descriptor?.component}
props={{

View File

@ -13,7 +13,7 @@
// limitations under the License.
-->
<script lang="ts">
import { Class, Doc, DocumentQuery, Ref, Space, WithLookup } from '@hcengineering/core'
import { Class, Doc, Ref, Space, WithLookup } from '@hcengineering/core'
import { Asset, IntlString } from '@hcengineering/platform'
import { createQuery, getClient } from '@hcengineering/presentation'
import {
@ -49,12 +49,11 @@
export let createComponentProps: Record<string, any> = {}
export let isCreationDisabled = false
export let descriptors: Ref<ViewletDescriptor>[] | undefined = [view.viewlet.Table]
export let baseQuery: DocumentQuery<Doc> = {}
let search = ''
let viewlet: WithLookup<Viewlet> | undefined
$: query = baseQuery || {}
$: query = viewlet?.baseQuery ?? {}
$: searchQuery = search === '' ? query : { $search: search, ...query }
@ -174,7 +173,7 @@
query={searchQuery}
{viewOptions}
on:change={(e) => {
resultQuery = e.detail
resultQuery = { ...e.detail, ...query }
}}
/>
<Component

View File

@ -22,7 +22,7 @@ configurePlatform().then(() => {
if (process.env.CLIENT_TYPE === 'dev') {
configurePlatformDev()
}
if (process.env.CLIENT_TYPE === 'dev-server') {
if (process.env.CLIENT_TYPE === 'dev-server' || process.env.CLIENT_TYPE === 'dev-production') {
configurePlatformDevServer()
}