Fixes Archive in Recruit (#1168)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2022-03-18 16:58:34 +07:00 committed by GitHub
parent a4af938871
commit 027d15034a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 23 additions and 45 deletions

View File

@ -14,7 +14,7 @@
//
import { Account, Arr, Domain, DOMAIN_MODEL, IndexKind, Ref, Space } from '@anticrm/core'
import { Index, Model, Prop, TypeBoolean, TypeString } from '@anticrm/model'
import { Index, Model, Prop, TypeBoolean, TypeString, UX } from '@anticrm/model'
import core from './component'
import { TDoc } from './core'
@ -23,6 +23,7 @@ export const DOMAIN_SPACE = 'space' as Domain
// S P A C E
@Model(core.class.Space, core.class.Doc, DOMAIN_SPACE)
@UX(core.string.Space)
export class TSpace extends TDoc implements Space {
@Prop(TypeString(), core.string.Name)
@Index(IndexKind.FullText)

View File

@ -71,7 +71,6 @@ export default mergeIds(recruitId, recruit, {
Vacancies: '' as AnyComponent,
CreateReviewCategory: '' as AnyComponent,
EditReviewCategory: '' as AnyComponent,
CreateReview: '' as AnyComponent,
Reviews: '' as AnyComponent,
KanbanReviewCard: '' as AnyComponent,

View File

@ -215,6 +215,10 @@ export function createModel (builder: Builder): void {
},
view.action.Move
)
builder.mixin(core.class.Space, core.class.Class, view.mixin.AttributePresenter, {
presenter: view.component.ObjectPresenter
})
}
export default view

View File

@ -23,7 +23,7 @@
export let inline: boolean = false
function show () {
// showPanel(recruit.component.EditVacancy, value._id, value._class, 'right')
showPanel(recruit.component.EditReviewCategory, value._id, value._class, 'right')
}
</script>

View File

@ -114,6 +114,7 @@ export default mergeIds(recruitId, recruit, {
VacancyItemPresenter: '' as AnyComponent,
VacancyCountPresenter: '' as AnyComponent,
OpinionsPresenter: '' as AnyComponent,
VacancyModifiedPresenter: '' as AnyComponent
VacancyModifiedPresenter: '' as AnyComponent,
EditReviewCategory: '' as AnyComponent
}
})

View File

@ -14,13 +14,15 @@
-->
<script lang="ts">
import type { Class, Doc, Ref } from '@anticrm/core'
import type { Class, Doc, Ref, Type } from '@anticrm/core'
import { createQuery, getClient } from '@anticrm/presentation'
import { AttributeModel } from '@anticrm/view'
import { getObjectPresenter } from '../utils'
export let objectId: Ref<Doc>
export let _class: Ref<Class<Doc>>
export let value: Doc | undefined
export let attributeType: Type<any>
const client = getClient()
let presenter: AttributeModel | undefined
@ -28,7 +30,11 @@
const docQuery = createQuery()
let doc: Doc | undefined
$: docQuery.query(_class, { _id: objectId }, (r) => { doc = r.shift() })
$: if (value === undefined) {
docQuery.query(_class, { _id: objectId }, (r) => { doc = r.shift() })
} else {
doc = value
}
$: if (doc !== undefined) {
getObjectPresenter(client, doc._class, { key: '' }).then(p => {
@ -38,5 +44,5 @@
</script>
{#if presenter}
<svelte:component this={presenter.presenter} value={doc} inline />
<svelte:component this={presenter.presenter} value={doc} {attributeType} inline />
{/if}

View File

@ -5,7 +5,7 @@
"ShowMenu": "Show menu",
"HideMenu": "Hide menu",
"Archive": "Archive",
"Archived": "Archived {object}",
"Archived": "Archive",
"Open": "Open",
"General": "General",
"Members": "Members",

View File

@ -5,7 +5,7 @@
"ShowMenu": "Показать меню",
"HideMenu": "Спрятать меню",
"Archive": "Архив",
"Archived": "Архивировал {object}",
"Archived": "Архив",
"Open": "Открыть",
"General": "Общее",
"Members": "Участники",

View File

@ -13,10 +13,7 @@
// limitations under the License.
-->
<script lang="ts">
import type { Space } from '@anticrm/core'
import core from '@anticrm/core'
import { translate } from '@anticrm/platform'
import { createQuery } from '@anticrm/presentation'
import { Icon, Label } from '@anticrm/ui'
import view from '@anticrm/view'
import { Table } from '@anticrm/view-resources'
@ -25,46 +22,16 @@
import { getSpecialSpaceClass } from '../utils'
export let model: NavigatorModel | undefined
const query = createQuery()
let spaceSample: Space | undefined
$: if (model) {
query.query(
core.class.Space,
{
_class: { $in: getSpecialSpaceClass(model) },
archived: true
},
(result) => {
spaceSample = result[0]
},
{ limit: 1 }
)
}
let spaceName = ''
$: {
const spaceClass = spaceSample?._class ?? ''
const spaceModel = model?.spaces.find((x) => x.spaceClass === spaceClass)
const label = spaceModel?.label
if (label) {
translate(label, {}).then((l) => {
spaceName = l.toLowerCase()
})
}
}
</script>
<div class="flex-col h-full">
<div class="flex-row-center header">
<div class="content-color mr-3"><Icon icon={view.icon.Archive} size={'medium'} /></div>
<div class="fs-title"><Label label={workbench.string.Archived} params={{ object: spaceName }} /></div>
<div class="fs-title"><Label label={workbench.string.Archived}/></div>
</div>
{#if spaceSample !== undefined && model}
{#if model}
<Table
_class={spaceSample._class}
_class={core.class.Space}
config={['', '$lookup._class.label', 'modifiedOn']}
options={{
lookup: {