From 2591bd77815794a7c7414f0ed25f2fe4cc705867 Mon Sep 17 00:00:00 2001 From: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com> Date: Mon, 23 May 2022 07:42:07 +0600 Subject: [PATCH] Filter fixes (#1832) --- models/contact/src/index.ts | 4 + models/contact/src/migration.ts | 17 +++ .../src/components/TagsFilter.svelte | 110 ++++++++++-------- .../src/components/filter/ObjectFilter.svelte | 74 +++++++----- .../components/filter/TimestampFilter.svelte | 3 + .../src/components/filter/ValueFilter.svelte | 96 +++++++++------ 6 files changed, 197 insertions(+), 107 deletions(-) diff --git a/models/contact/src/index.ts b/models/contact/src/index.ts index 86587b96a8..ceeccc9777 100644 --- a/models/contact/src/index.ts +++ b/models/contact/src/index.ts @@ -279,6 +279,10 @@ export function createModel (builder: Builder): void { actions: [view.action.Delete] }) + builder.mixin(contact.class.Contact, core.class.Class, view.mixin.ClassFilters, { + filters: ['city', 'modifiedOn'] + }) + builder.createDoc( presentation.class.ObjectSearchCategory, core.space.Model, diff --git a/models/contact/src/migration.ts b/models/contact/src/migration.ts index 2779e323c7..007e1d6a5b 100644 --- a/models/contact/src/migration.ts +++ b/models/contact/src/migration.ts @@ -37,6 +37,23 @@ async function createSpace (tx: TxOperations): Promise { contact.space.Employee ) } + const contacts = await tx.findOne(core.class.Space, { + _id: contact.space.Contacts + }) + if (contacts === undefined) { + await tx.createDoc( + core.class.Space, + core.space.Space, + { + name: 'Contacts', + description: 'Contacts', + private: false, + archived: false, + members: [] + }, + contact.space.Contacts + ) + } } export const contactOperation: MigrateOperation = { diff --git a/plugins/tags-resources/src/components/TagsFilter.svelte b/plugins/tags-resources/src/components/TagsFilter.svelte index 67214bf192..788b1bad7a 100644 --- a/plugins/tags-resources/src/components/TagsFilter.svelte +++ b/plugins/tags-resources/src/components/TagsFilter.svelte @@ -18,10 +18,10 @@
- + { + getValues(search) + }} + placeholder={phTraslate} + />
- {#each categories as cat} - {#if objects.filter((el) => el.category === cat._id).length > 0} -
- - +
+ ({objects.filter((el) => el.category === cat._id).length}) + {getCount(cat)} +
+ +
-
- {/if} - {/each} + {/if} + {/each} + {/if}
- {/each} + + {/each} + {/if} {/await} diff --git a/plugins/view-resources/src/components/filter/TimestampFilter.svelte b/plugins/view-resources/src/components/filter/TimestampFilter.svelte index 7f0a49a34c..f8e4d9fff1 100644 --- a/plugins/view-resources/src/components/filter/TimestampFilter.svelte +++ b/plugins/view-resources/src/components/filter/TimestampFilter.svelte @@ -13,6 +13,8 @@ // limitations under the License. -->
- + { + getValues(search) + }} + placeholder={phTraslate} + />
{#await promise then attribute} - {#each Array.from(values.keys()) as value} - {@const realValue = [...(realValues.get(value) ?? [])][0]} -
- - {/each} + + {/each} + {/if} {/await}