Skip to content

Commit

Permalink
TSK-1093: Fix Application doneState showing (#2927)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
  • Loading branch information
haiodo authored Apr 10, 2023
1 parent d7f9615 commit d353c0e
Show file tree
Hide file tree
Showing 22 changed files with 149 additions and 56 deletions.
1 change: 1 addition & 0 deletions dev/prod/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "",
Expand Down
5 changes: 4 additions & 1 deletion dev/prod/public/config-dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
2 changes: 1 addition & 1 deletion dev/prod/src/main-dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down
4 changes: 3 additions & 1 deletion dev/prod/src/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 3 additions & 5 deletions dev/prod/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

/**
Expand Down Expand Up @@ -228,7 +229,7 @@ module.exports = {
overlay: true,
progress: false,
},
proxy: devServer ? {
proxy: (devServer && !devProduction) ? {
'/account': {
target: 'http://localhost:3000',
changeOrigin: true,
Expand All @@ -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': '' },
Expand Down
18 changes: 12 additions & 6 deletions models/recruit/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
},
Expand Down Expand Up @@ -570,7 +567,10 @@ export function createModel (builder: Builder): void {
}
}
},
hiddenKeys: ['name', 'attachedTo']
hiddenKeys: ['name', 'attachedTo'],
baseQuery: {
doneState: null
}
},
recruit.viewlet.ApplicantTable
)
Expand All @@ -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
)
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
24 changes: 20 additions & 4 deletions packages/presentation/src/components/IndexedDocumentPreview.svelte
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -20,16 +22,30 @@
}
</script>

<Panel on:changeContent on:close>
<EditBox focus bind:value={search} kind="search-style" />
{#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>
</Panel>
{: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">
{#if indexDoc}
<IndexedDocumentContent {indexDoc} {search} />
{/if}
</div>
</div>
</Panel>
{/if}

<style lang="scss">
.indexed-doc {
Expand Down
2 changes: 1 addition & 1 deletion packages/presentation/src/components/PDFViewer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
26 changes: 20 additions & 6 deletions packages/presentation/src/components/message/Nodes.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -41,7 +52,10 @@
{:else if node.nodeName === 'PRE'}
<pre><svelte:self nodes={node.childNodes} /></pre>
{:else if node.nodeName === 'BR'}
<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'}
Expand All @@ -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>
Expand Down Expand Up @@ -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}
Expand Down
21 changes: 15 additions & 6 deletions plugins/chunter-resources/src/components/CommentPopup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,24 @@
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'
export let objectId: Ref<Doc>
export let object: Doc
let loading = true
let comments: Comment[] = []
const query = createQuery()
$: query.query(
chunter.class.Comment,
{ attachedTo: objectId },
(res) => {
comments = res
loading = false
},
{ sort: { modifiedOn: SortingOrder.Descending } }
)
Expand All @@ -45,19 +48,25 @@
dispatch('changeContent')
}}
>
<div class="fs-title">
<div class="fs-title mr-2">
<Label label={chunter.string.Comments} />
</div>
<DocNavLink {object}>
<ObjectPresenter _class={object._class} objectId={object._id} value={object} />
</DocNavLink>
</div>
<div class="comments max-h-120 flex-row">
{#each comments as comment}
<div class="item">
<CommentPresenter value={comment} />
{#if loading}
<div class="flex-center">
<Spinner />
</div>
{/each}
{:else}
{#each comments as comment}
<div class="item">
<CommentPresenter value={comment} />
</div>
{/each}
{/if}
</div>

<style lang="scss">
Expand Down
4 changes: 2 additions & 2 deletions plugins/recruit-resources/src/components/Applications.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@
<Table
_class={recruit.class.Applicant}
config={preference?.config ?? viewlet.config}
query={{ attachedTo: objectId }}
query={{ attachedTo: objectId, ...(viewlet?.baseQuery ?? {}) }}
loadingProps={{ length: applications }}
/>
</Scroller>
{:else}
<Table
_class={recruit.class.Applicant}
config={preference?.config ?? viewlet.config}
query={{ attachedTo: objectId }}
query={{ attachedTo: objectId, ...(viewlet?.baseQuery ?? {}) }}
loadingProps={{ length: applications }}
/>
{/if}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
sort: {
modifiedOn: SortingOrder.Descending
},
limit: 10
limit: 200
}
let viewlet: Viewlet | undefined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
doneState: task.class.DoneState,
attachedTo: recruit.mixin.Candidate
},
limit: 10
limit: 200
}
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
export let resultQuery: DocumentQuery<Doc>
const options: FindOptions<Vacancy> = {
limit: 10
limit: 200
}
</script>

Expand Down
14 changes: 11 additions & 3 deletions plugins/task-resources/src/components/kanban/KanbanView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit d353c0e

Please sign in to comment.