mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-29 03:34:31 +00:00
Merge branch 'staging' into develop
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
commit
86494e7fd1
@ -13,7 +13,7 @@
|
||||
|
||||
"DESKTOP_UPDATES_CHANNEL": "front",
|
||||
|
||||
"FILES_URL": "https://dl.hc.engineering/blob/:workspace/:blobId",
|
||||
"FILES_URL": "https://dl.hc.engineering/blob/:workspace/:blobId/:filename",
|
||||
|
||||
"GITHUB_APP": "huly-github-staging",
|
||||
|
||||
|
@ -349,7 +349,7 @@ function defineResource (builder: Builder): void {
|
||||
key: '',
|
||||
presenter: drive.component.ResourcePresenter,
|
||||
label: drive.string.Name,
|
||||
sortingKey: 'name'
|
||||
sortingKey: 'title'
|
||||
},
|
||||
'$lookup.file.size',
|
||||
'comments',
|
||||
@ -366,7 +366,7 @@ function defineResource (builder: Builder): void {
|
||||
}
|
||||
} as FindOptions<Resource>,
|
||||
configOptions: {
|
||||
hiddenKeys: ['name', 'parent', 'path', 'file', 'versions'],
|
||||
hiddenKeys: ['title', 'parent', 'path', 'file', 'versions'],
|
||||
sortable: true
|
||||
}
|
||||
},
|
||||
@ -393,7 +393,7 @@ function defineResource (builder: Builder): void {
|
||||
viewOptions: {
|
||||
groupBy: [],
|
||||
orderBy: [
|
||||
['name', SortingOrder.Ascending],
|
||||
['title', SortingOrder.Ascending],
|
||||
['$lookup.file.size', SortingOrder.Ascending],
|
||||
['$lookup.file.modifiedOn', SortingOrder.Descending]
|
||||
],
|
||||
@ -404,14 +404,14 @@ function defineResource (builder: Builder): void {
|
||||
key: '',
|
||||
presenter: drive.component.ResourcePresenter,
|
||||
label: drive.string.Name,
|
||||
sortingKey: 'name'
|
||||
sortingKey: 'title'
|
||||
},
|
||||
'$lookup.file.size',
|
||||
'$lookup.file.modifiedOn',
|
||||
'createdBy'
|
||||
],
|
||||
configOptions: {
|
||||
hiddenKeys: ['name', 'parent', 'path', 'file', 'versions'],
|
||||
hiddenKeys: ['title', 'parent', 'path', 'file', 'versions'],
|
||||
sortable: true
|
||||
},
|
||||
/* eslint-disable @typescript-eslint/consistent-type-assertions */
|
||||
|
@ -275,3 +275,19 @@ export interface Storage {
|
||||
export interface FulltextStorage {
|
||||
searchFulltext: (query: SearchQuery, options: SearchOptions) => Promise<SearchResult>
|
||||
}
|
||||
|
||||
export function shouldShowArchived<T extends Doc> (
|
||||
query: DocumentQuery<T>,
|
||||
options: FindOptions<T> | undefined
|
||||
): boolean {
|
||||
if (options?.showArchived !== undefined) {
|
||||
return options.showArchived
|
||||
}
|
||||
if (query._id !== undefined && typeof query._id === 'string') {
|
||||
return true
|
||||
}
|
||||
if (query.space !== undefined && typeof query.space === 'string') {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
@ -95,13 +95,17 @@
|
||||
case 'disabled':
|
||||
return { _id: { $nin: ignoreObjects, ..._idExtra } }
|
||||
case 'fulltext':
|
||||
return { $search: search, _id: { $nin: ignoreObjects, ..._idExtra } }
|
||||
return search !== ''
|
||||
? { $search: search, _id: { $nin: ignoreObjects, ..._idExtra } }
|
||||
: { _id: { $nin: ignoreObjects, ..._idExtra } }
|
||||
case 'spotlight':
|
||||
return extraItems.length > 0
|
||||
? { _id: { $in: extraItems, $nin: ignoreObjects } }
|
||||
: { _id: { $nin: ignoreObjects, ..._idExtra } }
|
||||
default:
|
||||
return { [searchField]: { $like: '%' + search + '%' }, _id: { $nin: ignoreObjects, ..._idExtra } }
|
||||
return search !== ''
|
||||
? { [searchField]: { $like: '%' + search + '%' }, _id: { $nin: ignoreObjects, ..._idExtra } }
|
||||
: { _id: { $nin: ignoreObjects, ..._idExtra } }
|
||||
}
|
||||
})()
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
<script lang="ts">
|
||||
// import { Doc } from '@hcengineering/core'
|
||||
import type { Blob, Ref } from '@hcengineering/core'
|
||||
import { Button, Dialog, Label, Spinner } from '@hcengineering/ui'
|
||||
import { Button, Dialog, EmbeddedPDF, Label, Spinner } from '@hcengineering/ui'
|
||||
import { createEventDispatcher, onMount } from 'svelte'
|
||||
import presentation, { getFileUrl } from '..'
|
||||
import ActionContext from './ActionContext.svelte'
|
||||
@ -45,22 +45,9 @@
|
||||
})
|
||||
let download: HTMLAnchorElement
|
||||
|
||||
$: srcRef = file !== undefined ? getFileUrl(file, name) : undefined
|
||||
$: src = file !== undefined ? getFileUrl(file, name) : undefined
|
||||
|
||||
$: isImage = contentType !== undefined && contentType.startsWith('image/')
|
||||
|
||||
let frame: HTMLIFrameElement | undefined = undefined
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
|
||||
$: if (css !== undefined && frame !== undefined && frame !== null) {
|
||||
frame.onload = () => {
|
||||
const head = frame?.contentDocument?.querySelector('head')
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
|
||||
if (css !== undefined && head !== undefined && head !== null) {
|
||||
head.appendChild(document.createElement('style')).textContent = css
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<ActionContext context={{ mode: 'browser' }} />
|
||||
@ -85,41 +72,37 @@
|
||||
</svelte:fragment>
|
||||
|
||||
<svelte:fragment slot="utils">
|
||||
{#await srcRef then src}
|
||||
{#if !isLoading && src !== ''}
|
||||
<a class="no-line" href={src} download={name} bind:this={download}>
|
||||
<Button
|
||||
icon={Download}
|
||||
kind={'ghost'}
|
||||
on:click={() => {
|
||||
download.click()
|
||||
}}
|
||||
showTooltip={{ label: presentation.string.Download }}
|
||||
/>
|
||||
</a>
|
||||
{/if}
|
||||
{/await}
|
||||
{#if !isLoading && src !== ''}
|
||||
<a class="no-line" href={src} download={name} bind:this={download}>
|
||||
<Button
|
||||
icon={Download}
|
||||
kind={'ghost'}
|
||||
on:click={() => {
|
||||
download.click()
|
||||
}}
|
||||
showTooltip={{ label: presentation.string.Download }}
|
||||
/>
|
||||
</a>
|
||||
{/if}
|
||||
</svelte:fragment>
|
||||
|
||||
{#await srcRef then src}
|
||||
{#if !isLoading}
|
||||
{#if src === '' || src === undefined}
|
||||
<div class="centered">
|
||||
<Label label={presentation.string.FailedToPreview} />
|
||||
</div>
|
||||
{:else if isImage}
|
||||
<div class="pdfviewer-content img">
|
||||
<img class="img-fit" {src} alt="" />
|
||||
</div>
|
||||
{:else}
|
||||
<iframe bind:this={frame} class="pdfviewer-content" src={src + '#view=FitH&navpanes=0'} title="" />
|
||||
{/if}
|
||||
{:else}
|
||||
{#if !isLoading}
|
||||
{#if src === '' || src === undefined}
|
||||
<div class="centered">
|
||||
<Spinner size="medium" />
|
||||
<Label label={presentation.string.FailedToPreview} />
|
||||
</div>
|
||||
{:else if isImage}
|
||||
<div class="pdfviewer-content img">
|
||||
<img class="img-fit" {src} alt="" />
|
||||
</div>
|
||||
{:else}
|
||||
<EmbeddedPDF {src} {name} {css} fit />
|
||||
{/if}
|
||||
{/await}
|
||||
{:else}
|
||||
<div class="centered">
|
||||
<Spinner size="medium" />
|
||||
</div>
|
||||
{/if}
|
||||
</Dialog>
|
||||
|
||||
<style lang="scss">
|
||||
|
@ -54,6 +54,7 @@ import core, {
|
||||
getObjectValue,
|
||||
matchQuery,
|
||||
reduceCalls,
|
||||
shouldShowArchived,
|
||||
toFindResult
|
||||
} from '@hcengineering/core'
|
||||
import { PlatformError } from '@hcengineering/platform'
|
||||
@ -519,8 +520,7 @@ export class LiveQuery implements WithTx, Client {
|
||||
if (q.options?.lookup !== undefined) {
|
||||
options.lookup = q.options?.lookup
|
||||
}
|
||||
const showArchived: boolean =
|
||||
options?.showArchived ?? (q.query._id !== undefined && typeof q.query._id === 'string')
|
||||
const showArchived = shouldShowArchived(q.query, q.options)
|
||||
|
||||
options.showArchived = showArchived
|
||||
const docIdKey = _id + JSON.stringify(options ?? {}) + q._class
|
||||
|
88
packages/ui/src/components/EmbeddedPDF.svelte
Normal file
88
packages/ui/src/components/EmbeddedPDF.svelte
Normal file
@ -0,0 +1,88 @@
|
||||
<!--
|
||||
// Copyright © 2025 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 { onDestroy } from 'svelte'
|
||||
import Loading from './Loading.svelte'
|
||||
|
||||
export let src: string
|
||||
export let name: string
|
||||
export let fit: boolean = false
|
||||
export let css: string | undefined = undefined
|
||||
|
||||
let iframeSrc: string | undefined = undefined
|
||||
|
||||
async function loadFile (src: string): Promise<void> {
|
||||
if (iframeSrc !== undefined) {
|
||||
URL.revokeObjectURL(iframeSrc)
|
||||
iframeSrc = undefined
|
||||
}
|
||||
|
||||
const response = await fetch(src)
|
||||
const blob = await response.blob()
|
||||
iframeSrc = URL.createObjectURL(blob)
|
||||
}
|
||||
|
||||
$: void loadFile(src)
|
||||
|
||||
let iframe: HTMLIFrameElement | undefined = undefined
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
|
||||
$: if (css !== undefined && iframe !== undefined && iframe !== null) {
|
||||
iframe.onload = () => {
|
||||
const head = iframe?.contentDocument?.querySelector('head')
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
|
||||
if (css !== undefined && head !== undefined && head !== null) {
|
||||
head.appendChild(document.createElement('style')).textContent = css
|
||||
}
|
||||
}
|
||||
|
||||
if (iframe.contentDocument !== undefined) {
|
||||
const style = iframe.contentDocument?.querySelector('head style')
|
||||
|
||||
if (style != null) {
|
||||
style.textContent = css
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onDestroy(() => {
|
||||
if (iframeSrc !== undefined) {
|
||||
URL.revokeObjectURL(iframeSrc)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
{#if iframeSrc}
|
||||
<iframe bind:this={iframe} class:fit src={iframeSrc + '#view=FitH&navpanes=0'} title={name} on:load />
|
||||
{:else}
|
||||
<Loading />
|
||||
{/if}
|
||||
|
||||
<style lang="scss">
|
||||
iframe {
|
||||
width: 100%;
|
||||
border: none;
|
||||
|
||||
&.fit {
|
||||
min-height: 100%;
|
||||
}
|
||||
&:not(.fit) {
|
||||
height: 80vh;
|
||||
min-height: 20rem;
|
||||
}
|
||||
}
|
||||
</style>
|
@ -280,6 +280,7 @@ export { default as CodeForm } from './components/CodeForm.svelte'
|
||||
export { default as CodeInput } from './components/CodeInput.svelte'
|
||||
export { default as TimeLeft } from './components/TimeLeft.svelte'
|
||||
export { default as SectionEmpty } from './components/SectionEmpty.svelte'
|
||||
export { default as EmbeddedPDF } from './components/EmbeddedPDF.svelte'
|
||||
|
||||
export { default as Dock } from './components/Dock.svelte'
|
||||
|
||||
|
@ -86,6 +86,7 @@
|
||||
bind:viewlet
|
||||
bind:preference
|
||||
bind:loading
|
||||
ignoreFragment
|
||||
viewletQuery={{
|
||||
attachTo: contact.class.Contact,
|
||||
descriptor: view.viewlet.Table
|
||||
|
@ -7,7 +7,7 @@
|
||||
import { type Blob, type Ref } from '@hcengineering/core'
|
||||
import { getMetadata } from '@hcengineering/platform'
|
||||
import presentation, { BlobMetadata, getFileUrl } from '@hcengineering/presentation'
|
||||
import { Spinner, themeStore } from '@hcengineering/ui'
|
||||
import { EmbeddedPDF, Spinner, themeStore } from '@hcengineering/ui'
|
||||
import { convertToHTML } from '@hcengineering/print'
|
||||
|
||||
export let value: Ref<Blob>
|
||||
@ -55,7 +55,6 @@
|
||||
--scrollbar-bar-color: #e0e0e0;
|
||||
--scrollbar-bar-hover: #90959d;
|
||||
`
|
||||
let oldColors = colors
|
||||
|
||||
$: css = `
|
||||
* {
|
||||
@ -262,29 +261,6 @@
|
||||
border-radius: 2px;
|
||||
}
|
||||
`
|
||||
|
||||
let frame: HTMLIFrameElement | undefined = undefined
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
|
||||
$: if (css !== undefined && frame !== undefined && frame !== null) {
|
||||
frame.onload = () => {
|
||||
const head = frame?.contentDocument?.querySelector('head')
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
|
||||
if (css !== undefined && head !== undefined && head !== null) {
|
||||
head.appendChild(document.createElement('style')).textContent = css
|
||||
oldColors = colors
|
||||
}
|
||||
}
|
||||
}
|
||||
$: if (oldColors !== colors && css !== undefined && frame != null) {
|
||||
const style = frame?.contentDocument?.querySelector('head style')
|
||||
|
||||
if (style != null) {
|
||||
style.textContent = css
|
||||
oldColors = colors
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if src}
|
||||
@ -293,7 +269,7 @@
|
||||
<Spinner size="medium" />
|
||||
</div>
|
||||
{:else}
|
||||
<iframe bind:this={frame} src={src + '#view=FitH&navpanes=0'} class="w-full h-full" title={name} />
|
||||
<EmbeddedPDF {src} {name} {css} />
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
|
@ -236,6 +236,7 @@
|
||||
isRegular: true,
|
||||
disableLink: true
|
||||
}}
|
||||
searchField={'code'}
|
||||
excluded={excludedChangeControl}
|
||||
kind={'regular'}
|
||||
size={'small'}
|
||||
|
@ -58,6 +58,7 @@
|
||||
<Table
|
||||
_class={recruit.class.Applicant}
|
||||
config={preference?.config ?? viewlet.config}
|
||||
options={{ showArchived: true }}
|
||||
query={{ attachedTo: objectId, ...(viewlet?.baseQuery ?? {}) }}
|
||||
loadingProps={{ length: applications }}
|
||||
{readonly}
|
||||
|
@ -35,6 +35,7 @@
|
||||
_class={recruit.class.Applicant}
|
||||
config={['', '$lookup.space.name', '$lookup.space.company', 'status']}
|
||||
query={{ attachedTo: value._id }}
|
||||
options={{ showArchived: true }}
|
||||
loadingProps={{ length: value.applications ?? 0 }}
|
||||
/>
|
||||
</div>
|
||||
|
@ -198,6 +198,7 @@
|
||||
bind:loading
|
||||
bind:viewlet
|
||||
bind:preference
|
||||
ignoreFragment
|
||||
viewletQuery={{
|
||||
attachTo: recruit.mixin.VacancyList,
|
||||
descriptor: { $in: [view.viewlet.Table, view.viewlet.List] }
|
||||
|
@ -146,6 +146,7 @@
|
||||
bind:loading
|
||||
bind:viewlet
|
||||
bind:preference
|
||||
ignoreFragment
|
||||
viewletQuery={{
|
||||
attachTo: recruit.class.Vacancy,
|
||||
descriptor: { $in: [view.viewlet.Table, view.viewlet.List] }
|
||||
|
@ -15,7 +15,7 @@
|
||||
<script lang="ts">
|
||||
import { Doc, Ref } from '@hcengineering/core'
|
||||
import presentation from '@hcengineering/presentation'
|
||||
import { Button, Icon, IconAdd, Label, showPopup, Scroller } from '@hcengineering/ui'
|
||||
import { Button, Icon, IconAdd, Label, Scroller, showPopup } from '@hcengineering/ui'
|
||||
import view, { BuildModelKey } from '@hcengineering/view'
|
||||
import { Table } from '@hcengineering/view-resources'
|
||||
import recruit from '../plugin'
|
||||
@ -66,6 +66,7 @@
|
||||
_class={recruit.class.Vacancy}
|
||||
{config}
|
||||
query={{ company: objectId }}
|
||||
options={{ showArchived: true }}
|
||||
{readonly}
|
||||
loadingProps={{ length: vacancies ?? 0 }}
|
||||
/>
|
||||
|
@ -1,12 +1,22 @@
|
||||
<script lang="ts">
|
||||
import core, { Association, Class, Data, Doc, Ref } from '@hcengineering/core'
|
||||
import { createQuery } from '@hcengineering/presentation'
|
||||
import { Button, Header, Breadcrumb, Separator, defineSeparators, twoPanelsSeparators } from '@hcengineering/ui'
|
||||
import { createQuery, getClient, MessageBox } from '@hcengineering/presentation'
|
||||
import {
|
||||
Button,
|
||||
Header,
|
||||
Breadcrumb,
|
||||
Separator,
|
||||
defineSeparators,
|
||||
twoPanelsSeparators,
|
||||
IconDelete,
|
||||
showPopup
|
||||
} from '@hcengineering/ui'
|
||||
import settings from '../plugin'
|
||||
import view from '@hcengineering/view'
|
||||
import view from '@hcengineering/view-resources/src/plugin'
|
||||
import AssociationEditor from './AssociationEditor.svelte'
|
||||
|
||||
const query = createQuery()
|
||||
const client = getClient()
|
||||
|
||||
let selected: Association | Data<Association> | undefined
|
||||
|
||||
@ -26,12 +36,37 @@
|
||||
}
|
||||
}
|
||||
|
||||
function isAssociation (data: Data<Association> | Association | undefined): data is Association {
|
||||
return (data as Association)?._id !== undefined
|
||||
}
|
||||
|
||||
defineSeparators('workspaceSettings', twoPanelsSeparators)
|
||||
|
||||
async function remove (val: Association | Data<Association> | undefined): Promise<void> {
|
||||
if (isAssociation(val)) {
|
||||
showPopup(MessageBox, {
|
||||
label: view.string.DeleteObject,
|
||||
message: view.string.DeleteObjectConfirm,
|
||||
params: { count: 1 },
|
||||
dangerous: true,
|
||||
action: async () => {
|
||||
selected = undefined
|
||||
await client.remove(val)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="hulyComponent">
|
||||
<Header adaptive={'disabled'}>
|
||||
<Breadcrumb icon={settings.icon.Relations} label={core.string.Relations} size={'large'} isCurrent />
|
||||
|
||||
<svelte:fragment slot="actions">
|
||||
{#if isAssociation(selected)}
|
||||
<Button icon={IconDelete} label={view.string.Delete} kind={'dangerous'} on:click={() => remove(selected)} />
|
||||
{/if}
|
||||
</svelte:fragment>
|
||||
</Header>
|
||||
|
||||
<div class="hulyComponent-content__container columns">
|
||||
|
@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { Class, Doc, DocumentQuery, FindOptions, mergeQueries, Ref, Space, WithLookup } from '@hcengineering/core'
|
||||
import { Class, Doc, DocumentQuery, mergeQueries, Ref, Space, WithLookup } from '@hcengineering/core'
|
||||
import { IntlString } from '@hcengineering/platform'
|
||||
import { createQuery } from '@hcengineering/presentation'
|
||||
import { Project, ProjectType, ProjectTypeDescriptor } from '@hcengineering/task'
|
||||
@ -97,6 +97,7 @@
|
||||
bind:viewlet
|
||||
bind:preference
|
||||
bind:viewlets
|
||||
ignoreFragment
|
||||
viewletQuery={{
|
||||
attachTo: _class,
|
||||
variant: { $exists: false },
|
||||
|
@ -15,9 +15,9 @@
|
||||
<script lang="ts">
|
||||
import { Analytics } from '@hcengineering/analytics'
|
||||
import { AccountRole, Ref, Space, getCurrentAccount, hasAccountRole } from '@hcengineering/core'
|
||||
import { MultipleDraftController, getClient } from '@hcengineering/presentation'
|
||||
import { MultipleDraftController, createQuery, getClient } from '@hcengineering/presentation'
|
||||
import { TrackerEvents } from '@hcengineering/tracker'
|
||||
import { ButtonWithDropdown, IconAdd, IconDropdown, SelectPopupValueType, showPopup } from '@hcengineering/ui'
|
||||
import { Button, ButtonWithDropdown, IconAdd, IconDropdown, SelectPopupValueType, showPopup } from '@hcengineering/ui'
|
||||
import view from '@hcengineering/view'
|
||||
|
||||
import { onDestroy } from 'svelte'
|
||||
@ -44,6 +44,14 @@
|
||||
})
|
||||
}
|
||||
|
||||
const query = createQuery()
|
||||
|
||||
let projectExists = false
|
||||
|
||||
query.query(tracker.class.Project, {}, (res) => {
|
||||
projectExists = res.length > 0
|
||||
})
|
||||
|
||||
$: label = draftExists || !closed ? tracker.string.ResumeDraft : tracker.string.NewIssue
|
||||
$: dropdownItems = hasAccountRole(getCurrentAccount(), AccountRole.User)
|
||||
? [
|
||||
@ -82,30 +90,45 @@
|
||||
</script>
|
||||
|
||||
<div class="antiNav-subheader">
|
||||
<ButtonWithDropdown
|
||||
icon={IconAdd}
|
||||
justify={'left'}
|
||||
kind={'primary'}
|
||||
{label}
|
||||
on:click={newIssue}
|
||||
{dropdownItems}
|
||||
dropdownIcon={IconDropdown}
|
||||
on:dropdown-selected={(ev) => {
|
||||
dropdownItemSelected(ev.detail)
|
||||
}}
|
||||
mainButtonId={'new-issue'}
|
||||
showTooltipMain={{
|
||||
direction: 'bottom',
|
||||
label,
|
||||
keys
|
||||
}}
|
||||
>
|
||||
<div slot="content" class="draft-circle-container">
|
||||
{#if draftExists}
|
||||
<div class="draft-circle" />
|
||||
{/if}
|
||||
</div>
|
||||
</ButtonWithDropdown>
|
||||
{#if projectExists}
|
||||
<ButtonWithDropdown
|
||||
icon={IconAdd}
|
||||
justify={'left'}
|
||||
kind={'primary'}
|
||||
{label}
|
||||
on:click={newIssue}
|
||||
{dropdownItems}
|
||||
dropdownIcon={IconDropdown}
|
||||
on:dropdown-selected={(ev) => {
|
||||
dropdownItemSelected(ev.detail)
|
||||
}}
|
||||
mainButtonId={'new-issue'}
|
||||
showTooltipMain={{
|
||||
direction: 'bottom',
|
||||
label,
|
||||
keys
|
||||
}}
|
||||
>
|
||||
<div slot="content" class="draft-circle-container">
|
||||
{#if draftExists}
|
||||
<div class="draft-circle" />
|
||||
{/if}
|
||||
</div>
|
||||
</ButtonWithDropdown>
|
||||
{:else}
|
||||
<Button
|
||||
icon={IconAdd}
|
||||
justify="left"
|
||||
kind="primary"
|
||||
label={tracker.string.CreateProject}
|
||||
width="100%"
|
||||
on:click={() => {
|
||||
showPopup(tracker.component.CreateProject, {}, 'top', () => {
|
||||
closed = true
|
||||
})
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
|
@ -326,25 +326,14 @@ async function deleteProject (project: Project | undefined): Promise<void> {
|
||||
})
|
||||
} else {
|
||||
const anyIssue = await client.findOne(tracker.class.Issue, { space: project._id })
|
||||
if (anyIssue !== undefined) {
|
||||
showPopup(MessageBox, {
|
||||
label: tracker.string.ArchiveProjectName,
|
||||
labelProps: { name: project.name },
|
||||
message: tracker.string.ProjectHasIssues,
|
||||
action: async () => {
|
||||
await client.update(project, { archived: true })
|
||||
}
|
||||
})
|
||||
} else {
|
||||
showPopup(MessageBox, {
|
||||
label: tracker.string.ArchiveProjectName,
|
||||
labelProps: { name: project.name },
|
||||
message: tracker.string.ArchiveProjectConfirm,
|
||||
action: async () => {
|
||||
await client.update(project, { archived: true })
|
||||
}
|
||||
})
|
||||
}
|
||||
showPopup(MessageBox, {
|
||||
label: tracker.string.ArchiveProjectName,
|
||||
labelProps: { name: project.name },
|
||||
message: anyIssue !== undefined ? tracker.string.ProjectHasIssues : tracker.string.ArchiveProjectConfirm,
|
||||
action: async () => {
|
||||
await client.update(project, { archived: true })
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,11 +42,12 @@
|
||||
(res) => {
|
||||
configurationRaw = res
|
||||
configurationsLoading = false
|
||||
loading = configurationsLoading || preferencesLoading
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
function fetchPreferences (viewlet: Viewlet): void {
|
||||
function fetchPreferences (configurationRaw: Viewlet[]): void {
|
||||
preferencesLoading = preferenceQuery.query(
|
||||
view.class.ViewletPreference,
|
||||
{
|
||||
@ -56,6 +57,7 @@
|
||||
(res) => {
|
||||
preference = res
|
||||
preferencesLoading = false
|
||||
loading = configurationsLoading || preferencesLoading
|
||||
}
|
||||
)
|
||||
}
|
||||
@ -81,7 +83,7 @@
|
||||
}
|
||||
|
||||
$: fetchConfigurations(viewlet)
|
||||
$: fetchPreferences(viewlet)
|
||||
$: fetchPreferences(configurationRaw)
|
||||
|
||||
$: updateConfiguration(configurationRaw, preference)
|
||||
|
||||
@ -90,6 +92,8 @@
|
||||
|
||||
{#if viewlet?.$lookup?.descriptor?.component}
|
||||
{#if loading}
|
||||
{configurationsLoading}
|
||||
{preferencesLoading}
|
||||
<Loading />
|
||||
{:else}
|
||||
<Component
|
||||
|
@ -12,6 +12,7 @@
|
||||
export let preference: ViewletPreference | undefined = undefined
|
||||
export let loading = true
|
||||
export let hidden = false
|
||||
export let ignoreFragment = false
|
||||
|
||||
const query = createQuery()
|
||||
|
||||
@ -29,11 +30,11 @@
|
||||
}
|
||||
)
|
||||
|
||||
let key = makeViewletKey()
|
||||
let key = makeViewletKey(undefined, ignoreFragment)
|
||||
|
||||
onDestroy(
|
||||
resolvedLocationStore.subscribe((loc) => {
|
||||
key = makeViewletKey(loc)
|
||||
key = makeViewletKey(loc, ignoreFragment)
|
||||
})
|
||||
)
|
||||
|
||||
|
@ -15,25 +15,11 @@
|
||||
<script lang="ts">
|
||||
import { type Blob, type Ref } from '@hcengineering/core'
|
||||
import { getFileUrl } from '@hcengineering/presentation'
|
||||
import { EmbeddedPDF } from '@hcengineering/ui'
|
||||
|
||||
export let value: Ref<Blob>
|
||||
export let name: string
|
||||
export let fit: boolean = false
|
||||
</script>
|
||||
|
||||
<iframe class:fit src={getFileUrl(value, name) + '#view=FitH&navpanes=0'} title={name} />
|
||||
|
||||
<style lang="scss">
|
||||
iframe {
|
||||
width: 100%;
|
||||
border: none;
|
||||
|
||||
&.fit {
|
||||
min-height: 100%;
|
||||
}
|
||||
&:not(.fit) {
|
||||
height: 80vh;
|
||||
min-height: 20rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<EmbeddedPDF src={getFileUrl(value, name)} {name} {fit} />
|
||||
|
@ -743,11 +743,11 @@ export function categorizeFields (
|
||||
return result
|
||||
}
|
||||
|
||||
export function makeViewletKey (loc?: Location): string {
|
||||
export function makeViewletKey (loc?: Location, ignoreFragment = false): string {
|
||||
loc = loc != null ? { path: loc.path, fragment: loc.fragment } : getCurrentResolvedLocation()
|
||||
loc.query = undefined
|
||||
|
||||
if (loc.fragment != null && loc.fragment !== '') {
|
||||
if (!ignoreFragment && loc.fragment != null && loc.fragment !== '') {
|
||||
const props = decodeURIComponent(loc.fragment).split('|')
|
||||
if (props.length >= 3) {
|
||||
const [panel, , _class] = props
|
||||
|
@ -95,7 +95,7 @@
|
||||
{#if space}
|
||||
<Header hideActions={createItemDialog === undefined}>
|
||||
<svelte:fragment slot="beforeTitle">
|
||||
<ViewletSelector {viewletQuery} bind:viewlet bind:viewlets />
|
||||
<ViewletSelector {viewletQuery} ignoreFragment bind:viewlet bind:viewlets />
|
||||
<ViewletSettingButton bind:viewOptions bind:viewlet />
|
||||
</svelte:fragment>
|
||||
|
||||
|
@ -114,6 +114,7 @@
|
||||
bind:viewlet
|
||||
bind:preference
|
||||
bind:viewlets
|
||||
ignoreFragment
|
||||
viewletQuery={{
|
||||
attachTo: _class,
|
||||
variant: { $exists: false },
|
||||
|
@ -758,6 +758,11 @@ export async function backup (
|
||||
backupInfo.domainHashes = {}
|
||||
}
|
||||
|
||||
if (backupInfo.domainHashes === undefined) {
|
||||
// Migration
|
||||
backupInfo.domainHashes = {}
|
||||
}
|
||||
|
||||
let lastTx: Tx | undefined
|
||||
|
||||
let lastTxChecked = false
|
||||
|
@ -43,6 +43,8 @@ import core, {
|
||||
WorkspaceEvent,
|
||||
clone,
|
||||
generateId,
|
||||
shouldShowArchived,
|
||||
systemAccountEmail,
|
||||
toFindResult,
|
||||
type SessionData,
|
||||
type PersonUuid
|
||||
@ -537,7 +539,7 @@ export class SpaceSecurityMiddleware extends BaseMiddleware implements Middlewar
|
||||
const account = ctx.contextData.account
|
||||
const isSpace = this.context.hierarchy.isDerived(_class, core.class.Space)
|
||||
const field = this.getKey(domain)
|
||||
const showArchived: boolean = options?.showArchived ?? (query._id !== undefined && typeof query._id === 'string')
|
||||
const showArchived: boolean = shouldShowArchived(query, options)
|
||||
|
||||
let clientFilterSpaces: Set<Ref<Space>> | undefined
|
||||
|
||||
|
@ -43,6 +43,7 @@ import core, {
|
||||
type Ref,
|
||||
type ReverseLookups,
|
||||
type SessionData,
|
||||
shouldShowArchived,
|
||||
type SortingQuery,
|
||||
type StorageIterator,
|
||||
systemAccountUuid,
|
||||
@ -662,7 +663,7 @@ abstract class PostgresAdapterBase implements DbAdapter {
|
||||
|
||||
const select = `SELECT ${this.getProjection(vars, domain, options?.projection, joins, options?.associations)} FROM ${domain}`
|
||||
|
||||
const showArchived = options?.showArchived ?? (query._id !== undefined && typeof query._id === 'string')
|
||||
const showArchived = shouldShowArchived(query, options)
|
||||
const secJoin = this.addSecurity(vars, query, showArchived, domain, ctx.contextData)
|
||||
if (secJoin !== undefined) {
|
||||
sqlChunks.push(secJoin)
|
||||
@ -683,7 +684,7 @@ abstract class PostgresAdapterBase implements DbAdapter {
|
||||
let total = options?.total === true ? 0 : -1
|
||||
if (options?.total === true) {
|
||||
const pvars = new ValuesVariables()
|
||||
const showArchived = options?.showArchived ?? (query._id !== undefined && typeof query._id === 'string')
|
||||
const showArchived = shouldShowArchived(query, options)
|
||||
const secJoin = this.addSecurity(pvars, query, showArchived, domain, ctx.contextData)
|
||||
const totalChunks: string[] = []
|
||||
if (secJoin !== undefined) {
|
||||
@ -860,7 +861,12 @@ abstract class PostgresAdapterBase implements DbAdapter {
|
||||
if (key === 'data') {
|
||||
obj[p] = { ...obj[p], ...row[column] }
|
||||
} else {
|
||||
if (key === 'attachedTo' && row[column] === 'NULL') {
|
||||
if (key === 'createdOn' || key === 'modifiedOn') {
|
||||
const val = Number.parseInt(row[column])
|
||||
obj[p][key] = Number.isNaN(val) ? null : val
|
||||
} else if (key === '%hash%') {
|
||||
continue
|
||||
} else if (key === 'attachedTo' && row[column] === 'NULL') {
|
||||
continue
|
||||
} else {
|
||||
obj[p][key] = row[column] === 'NULL' ? null : row[column]
|
||||
|
@ -216,7 +216,7 @@ export abstract class IssueSyncManagerBase {
|
||||
const target: IssueSyncTarget | undefined =
|
||||
milestone !== undefined
|
||||
? {
|
||||
mappings: milestone.mappings,
|
||||
mappings: milestone.mappings ?? [],
|
||||
project: prj,
|
||||
target: milestone
|
||||
}
|
||||
@ -1167,7 +1167,7 @@ export abstract class IssueSyncManagerBase {
|
||||
}
|
||||
return {
|
||||
project,
|
||||
mappings: milestone.mappings,
|
||||
mappings: milestone.mappings ?? [],
|
||||
target: milestone,
|
||||
prjData: external.projectItems.nodes.find((it) => it.project.id === milestone.projectNodeId)
|
||||
}
|
||||
@ -1178,7 +1178,7 @@ export abstract class IssueSyncManagerBase {
|
||||
getProjectIssueTarget (project: GithubProject, external?: IssueExternalData): IssueSyncTarget {
|
||||
return {
|
||||
project,
|
||||
mappings: project.mappings,
|
||||
mappings: project.mappings ?? [],
|
||||
target: project,
|
||||
prjData: external?.projectItems.nodes.find((it) => it.project.id === project.projectNodeId)
|
||||
}
|
||||
|
@ -610,7 +610,7 @@ export class ProjectsSyncManager implements DocSyncManager {
|
||||
okit: Octokit
|
||||
): Promise<{ projectStructure: GithubProjectV2, wasUpdates: boolean, mappings: GithubFieldMapping[] }> {
|
||||
let projectStructure = await this.queryProjectStructure(integration, target)
|
||||
let mappings = target.mappings
|
||||
let mappings = target.mappings ?? []
|
||||
|
||||
if (projectStructure === undefined) {
|
||||
if (this.client.getHierarchy().isDerived(tracker.class.Project, target._class)) {
|
||||
@ -653,7 +653,7 @@ export class ProjectsSyncManager implements DocSyncManager {
|
||||
const mHash = JSON.stringify(mappings)
|
||||
// Create any platform field into matching github field
|
||||
for (const [, f] of allFields.entries()) {
|
||||
const existingField = (mappings ?? []).find((it) => it._id === f._id)
|
||||
const existingField = mappings.find((it) => it._id === f._id)
|
||||
if (f.hidden === true) {
|
||||
continue
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user