expose modifiedOn field

Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
Andrey Platov 2021-10-05 16:34:52 +02:00
parent 640bd0637c
commit 8ba50e184a
No known key found for this signature in database
GPG Key ID: C8787EFEB4B64AF0
13 changed files with 1089 additions and 843 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -16,7 +16,7 @@
import type { IntlString } from '@anticrm/platform' import type { IntlString } from '@anticrm/platform'
import type { Account, AnyAttribute, Class, ClassifierKind, Doc, Domain, Mixin, Obj, Ref, Space, Timestamp, Type } from '@anticrm/core' import type { Account, AnyAttribute, Class, ClassifierKind, Doc, Domain, Mixin, Obj, Ref, Space, Timestamp, Type } from '@anticrm/core'
import { DOMAIN_MODEL } from '@anticrm/core' import { DOMAIN_MODEL } from '@anticrm/core'
import { Model } from '@anticrm/model' import { Model, Prop, TypeTimestamp } from '@anticrm/model'
import core from './component' import core from './component'
// C O R E // C O R E
@ -29,7 +29,10 @@ export class TObj implements Obj {
export class TDoc extends TObj implements Doc { export class TDoc extends TObj implements Doc {
_id!: Ref<this> _id!: Ref<this>
space!: Ref<Space> space!: Ref<Space>
@Prop(TypeTimestamp(), 'Modified On' as IntlString)
modifiedOn!: Timestamp modifiedOn!: Timestamp
modifiedBy!: Ref<Account> modifiedBy!: Ref<Account>
} }
@ -62,3 +65,6 @@ export class TTypeString extends TType {}
@Model(core.class.TypeBoolean, core.class.Type) @Model(core.class.TypeBoolean, core.class.Type)
export class TTypeBoolean extends TType {} export class TTypeBoolean extends TType {}
@Model(core.class.TypeTimestamp, core.class.Type)
export class TTypeTimestamp extends TType {}

View File

@ -15,7 +15,7 @@
import { Builder } from '@anticrm/model' import { Builder } from '@anticrm/model'
import core from './component' import core from './component'
import { TAttribute, TClass, TDoc, TMixin, TObj, TType, TTypeString, TTypeBoolean } from './core' import { TAttribute, TClass, TDoc, TMixin, TObj, TType, TTypeString, TTypeBoolean, TTypeTimestamp } from './core'
import { TSpace, TAccount, TState, TSpaceWithStates } from './security' import { TSpace, TAccount, TState, TSpaceWithStates } from './security'
import { TTx, TTxCreateDoc, TTxMixin, TTxUpdateDoc, TTxCUD, TTxPutBag, TTxRemoveDoc } from './tx' import { TTx, TTxCreateDoc, TTxMixin, TTxUpdateDoc, TTxCUD, TTxPutBag, TTxRemoveDoc } from './tx'
@ -44,6 +44,7 @@ export function createModel (builder: Builder): void {
TType, TType,
TTypeString, TTypeString,
TTypeBoolean, TTypeBoolean,
TTypeTimestamp,
TState TState
) )
} }

View File

@ -128,6 +128,7 @@ export function createModel (builder: Builder): void {
'city', 'city',
{ presenter: recruit.component.ApplicationsPresenter, label: 'Apps' }, { presenter: recruit.component.ApplicationsPresenter, label: 'Apps' },
{ presenter: chunter.component.AttachmentPresenter, label: 'Files' }, { presenter: chunter.component.AttachmentPresenter, label: 'Files' },
'modifiedOn',
'channels' 'channels'
] ]
}) })

View File

@ -86,6 +86,10 @@ export function createModel (builder: Builder): void {
editor: view.component.BooleanEditor editor: view.component.BooleanEditor
}) })
builder.mixin(core.class.TypeTimestamp, core.class.Class, view.mixin.AttributePresenter, {
presenter: view.component.TimestampPresenter
})
builder.mixin(core.class.State, core.class.Class, view.mixin.AttributePresenter, { builder.mixin(core.class.State, core.class.Class, view.mixin.AttributePresenter, {
presenter: view.component.StatePresenter presenter: view.component.StatePresenter
}) })

View File

@ -31,6 +31,7 @@ export default mergeIds(viewId, view, {
StringPresenter: '' as AnyComponent, StringPresenter: '' as AnyComponent,
BooleanEditor: '' as AnyComponent, BooleanEditor: '' as AnyComponent,
StatePresenter: '' as AnyComponent, StatePresenter: '' as AnyComponent,
TimestampPresenter: '' as AnyComponent,
TableView: '' as AnyComponent, TableView: '' as AnyComponent,
KanbanView: '' as AnyComponent KanbanView: '' as AnyComponent

View File

@ -14,7 +14,7 @@
// //
import type { Plugin, StatusCode } from '@anticrm/platform' import type { Plugin, StatusCode } from '@anticrm/platform'
import { plugin } from '@anticrm/platform' import { plugin } from '@anticrm/platform'
import type { Account, Class, Doc, Obj, Ref, Space, AnyAttribute, State, Type, PropertyType, SpaceWithStates } from './classes' import type { Account, Class, Doc, Obj, Ref, Space, AnyAttribute, State, Type, PropertyType, SpaceWithStates, Timestamp } from './classes'
import type { Tx, TxCreateDoc, TxCUD, TxMixin, TxPutBag, TxRemoveDoc, TxUpdateDoc } from './tx' import type { Tx, TxCreateDoc, TxCUD, TxMixin, TxPutBag, TxRemoveDoc, TxUpdateDoc } from './tx'
/** /**
@ -40,7 +40,8 @@ export default plugin(coreId, {
Account: '' as Ref<Class<Account>>, Account: '' as Ref<Class<Account>>,
State: '' as Ref<Class<State>>, State: '' as Ref<Class<State>>,
TypeString: '' as Ref<Class<Type<string>>>, TypeString: '' as Ref<Class<Type<string>>>,
TypeBoolean: '' as Ref<Class<Type<string>>>, TypeBoolean: '' as Ref<Class<Type<boolean>>>,
TypeTimestamp: '' as Ref<Class<Type<Timestamp>>>,
Bag: '' as Ref<Class<Type<Record<string, PropertyType>>>> Bag: '' as Ref<Class<Type<Record<string, PropertyType>>>>
}, },
space: { space: {

View File

@ -278,6 +278,13 @@ export function TypeBoolean (): Type<string> {
return { _class: core.class.TypeBoolean, label: 'TypeBoolean' as IntlString } return { _class: core.class.TypeBoolean, label: 'TypeBoolean' as IntlString }
} }
/**
* @public
*/
export function TypeTimestamp (): Type<string> {
return { _class: core.class.TypeTimestamp, label: 'TypeTimestamp' as IntlString }
}
/** /**
* @public * @public
*/ */

View File

@ -17,6 +17,7 @@
<script lang="ts"> <script lang="ts">
import { createEventDispatcher } from 'svelte' import { createEventDispatcher } from 'svelte'
import type { Ref, Class, Doc, Space, FindOptions } from '@anticrm/core' import type { Ref, Class, Doc, Space, FindOptions } from '@anticrm/core'
import { SortingOrder } from '@anticrm/core'
import { buildModel } from '../utils' import { buildModel } from '../utils'
import { getClient } from '@anticrm/presentation' import { getClient } from '@anticrm/presentation'
import { Label, showPopup, Loading, ScrollBox, CheckBox } from '@anticrm/ui' import { Label, showPopup, Loading, ScrollBox, CheckBox } from '@anticrm/ui'
@ -31,10 +32,12 @@
export let config: string[] export let config: string[]
export let search: string export let search: string
let sortKey = 'modifiedOn'
let objects: Doc[] let objects: Doc[]
const query = createQuery() const query = createQuery()
$: query.query(_class, search === '' ? { space } : { $search: search }, result => { objects = result }, options) $: query.query(_class, search === '' ? { space } : { $search: search }, result => { objects = result }, { sort: { [sortKey]: SortingOrder.Descending }, ...options })
function getValue(doc: Doc, key: string): any { function getValue(doc: Doc, key: string): any {
if (key.length === 0) if (key.length === 0)

View File

@ -0,0 +1,25 @@
<!--
// Copyright © 2020, 2021 Anticrm Platform Contributors.
// Copyright © 2021 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
-->
<script lang="ts">
import { TimeSince } from '@anticrm/ui'
export let value: number
</script>
<TimeSince {value}/>

View File

@ -19,6 +19,7 @@ import StringEditor from './components/StringEditor.svelte'
import StringPresenter from './components/StringPresenter.svelte' import StringPresenter from './components/StringPresenter.svelte'
import BooleanEditor from './components/BooleanEditor.svelte' import BooleanEditor from './components/BooleanEditor.svelte'
import StatePresenter from './components/StatePresenter.svelte' import StatePresenter from './components/StatePresenter.svelte'
import TimestampPresenter from './components/TimestampPresenter.svelte'
import TableView from './components/TableView.svelte' import TableView from './components/TableView.svelte'
import KanbanView from './components/KanbanView.svelte' import KanbanView from './components/KanbanView.svelte'
@ -39,6 +40,7 @@ export default async () => ({
BooleanEditor, BooleanEditor,
StatePresenter, StatePresenter,
TableView, TableView,
KanbanView KanbanView,
TimestampPresenter
}, },
}) })

File diff suppressed because it is too large Load Diff