mirror of
https://github.com/hcengineering/platform.git
synced 2026-08-26 22:32:23 +02:00
TSK-678: Update First/Last names (#2652)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
@@ -1,93 +0,0 @@
|
||||
<!--
|
||||
// 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 { ScrollBox, tooltip } from '@hcengineering/ui'
|
||||
import ActionIcon from '@hcengineering/ui/src/components/ActionIcon.svelte'
|
||||
import view from '@hcengineering/view'
|
||||
import { queries, toIntl } from '..'
|
||||
import ContentPopup from './ContentPopup.svelte'
|
||||
</script>
|
||||
|
||||
<ScrollBox vertical>
|
||||
<div class="query-content">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Index</th>
|
||||
<th>Class</th>
|
||||
<th>Query</th>
|
||||
<th>Options</th>
|
||||
<th>Result Count</th>
|
||||
<th>Result</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each queries as q}
|
||||
<tr class="tr-body">
|
||||
<td>{queries.indexOf(q)}</td>
|
||||
<td>{q._class}</td>
|
||||
<td>{JSON.stringify(q.query)}</td>
|
||||
<td>{JSON.stringify(q.options ?? {})}</td>
|
||||
<td>{q.result.length}</td>
|
||||
<td>
|
||||
<span use:tooltip={{ label: toIntl('Content'), component: ContentPopup, props: { content: q.result } }}>
|
||||
Results
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<ActionIcon
|
||||
direction={undefined}
|
||||
size="small"
|
||||
icon={view.icon.MoreH}
|
||||
label={toIntl('Perform Class Query')}
|
||||
action={() => {}}
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</ScrollBox>
|
||||
|
||||
<style lang="scss">
|
||||
.query-content {
|
||||
display: flex;
|
||||
margin: 20px;
|
||||
}
|
||||
|
||||
th,
|
||||
td {
|
||||
padding: 0.5rem 1.5rem;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
th {
|
||||
height: 2.5rem;
|
||||
font-weight: 500;
|
||||
font-size: 0.75rem;
|
||||
color: var(--theme-content-dark-color);
|
||||
box-shadow: inset 0 -1px 0 0 var(--theme-bg-focused-color);
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.tr-body {
|
||||
height: 3.25rem;
|
||||
color: var(--theme-caption-color);
|
||||
border-bottom: 1px solid var(--theme-button-border-hovered);
|
||||
}
|
||||
</style>
|
||||
@@ -23,7 +23,6 @@ import core, {
|
||||
Hierarchy,
|
||||
ModelDb,
|
||||
Ref,
|
||||
toFindResult,
|
||||
Tx,
|
||||
TxResult,
|
||||
WithLookup
|
||||
@@ -51,17 +50,16 @@ export interface QueryWithResult {
|
||||
}
|
||||
|
||||
export const transactions: TxWitHResult[] = []
|
||||
export const notifications: Tx[] = []
|
||||
export const queries: QueryWithResult[] = []
|
||||
|
||||
class ModelClient implements Client {
|
||||
notifyEnabled = true
|
||||
constructor (readonly client: Client) {
|
||||
this.notifyEnabled = (localStorage.getItem('#platform.notification.logging') ?? 'true') === 'true'
|
||||
|
||||
client.notify = (tx) => {
|
||||
this.notify?.(tx)
|
||||
console.info('devmodel# notify=>', tx, this.client.getModel(), getMetadata(devmodel.metadata.DevModel))
|
||||
notifications.push(tx)
|
||||
if (notifications.length > 500) {
|
||||
notifications.shift()
|
||||
if (this.notifyEnabled) {
|
||||
console.info('devmodel# notify=>', tx, this.client.getModel(), getMetadata(devmodel.metadata.DevModel))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -82,26 +80,18 @@ class ModelClient implements Client {
|
||||
options?: FindOptions<T>
|
||||
): Promise<WithLookup<T> | undefined> {
|
||||
const result = await this.client.findOne(_class, query, options)
|
||||
console.info(
|
||||
'devmodel# findOne=>',
|
||||
_class,
|
||||
query,
|
||||
options,
|
||||
'result => ',
|
||||
result,
|
||||
' =>model',
|
||||
this.client.getModel(),
|
||||
getMetadata(devmodel.metadata.DevModel)
|
||||
)
|
||||
queries.push({
|
||||
_class,
|
||||
query,
|
||||
options: options as FindOptions<Doc>,
|
||||
result: toFindResult(result !== undefined ? [result] : []),
|
||||
findOne: true
|
||||
})
|
||||
if (queries.length > 100) {
|
||||
queries.shift()
|
||||
if (this.notifyEnabled) {
|
||||
console.info(
|
||||
'devmodel# findOne=>',
|
||||
_class,
|
||||
query,
|
||||
options,
|
||||
'result => ',
|
||||
result,
|
||||
' =>model',
|
||||
this.client.getModel(),
|
||||
getMetadata(devmodel.metadata.DevModel)
|
||||
)
|
||||
}
|
||||
return result
|
||||
}
|
||||
@@ -112,27 +102,27 @@ class ModelClient implements Client {
|
||||
options?: FindOptions<T>
|
||||
): Promise<FindResult<T>> {
|
||||
const result = await this.client.findAll(_class, query, options)
|
||||
console.info(
|
||||
'devmodel# findAll=>',
|
||||
_class,
|
||||
query,
|
||||
options,
|
||||
'result => ',
|
||||
result,
|
||||
' =>model',
|
||||
this.client.getModel(),
|
||||
getMetadata(devmodel.metadata.DevModel)
|
||||
)
|
||||
queries.push({ _class, query, options: options as FindOptions<Doc>, result, findOne: false })
|
||||
if (queries.length > 100) {
|
||||
queries.shift()
|
||||
if (this.notifyEnabled) {
|
||||
console.info(
|
||||
'devmodel# findAll=>',
|
||||
_class,
|
||||
query,
|
||||
options,
|
||||
'result => ',
|
||||
result,
|
||||
' =>model',
|
||||
this.client.getModel(),
|
||||
getMetadata(devmodel.metadata.DevModel)
|
||||
)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
async tx (tx: Tx): Promise<TxResult> {
|
||||
const result = await this.client.tx(tx)
|
||||
console.info('devmodel# tx=>', tx, result, getMetadata(devmodel.metadata.DevModel))
|
||||
if (this.notifyEnabled) {
|
||||
console.info('devmodel# tx=>', tx, result, getMetadata(devmodel.metadata.DevModel))
|
||||
}
|
||||
transactions.push({ tx, result })
|
||||
if (transactions.length > 100) {
|
||||
transactions.shift()
|
||||
@@ -166,12 +156,6 @@ export async function Hook (client: Client): Promise<Client> {
|
||||
icon: view.icon.Table,
|
||||
id: 'transactions',
|
||||
component: devmodel.component.ModelView
|
||||
},
|
||||
{
|
||||
label: 'Queries' as IntlString,
|
||||
icon: view.icon.Table,
|
||||
id: 'queries',
|
||||
component: devmodel.component.QueryView
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user