Skip to content

Commit

Permalink
UBER-963: Related issues (#3773)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
  • Loading branch information
haiodo authored Oct 2, 2023
1 parent 152c858 commit b243532
Show file tree
Hide file tree
Showing 31 changed files with 560 additions and 297 deletions.
20 changes: 20 additions & 0 deletions models/lead/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ export function createModel (builder: Builder): void {
{
key: '',
presenter: tracker.component.RelatedIssueSelector,
props: {
kind: 'link'
},
label: tracker.string.Relations
},
'comments',
Expand Down Expand Up @@ -252,6 +255,9 @@ export function createModel (builder: Builder): void {
{
key: '',
presenter: tracker.component.RelatedIssueSelector,
props: {
kind: 'link'
},
label: tracker.string.Issues
},
'status',
Expand Down Expand Up @@ -551,6 +557,20 @@ export function createModel (builder: Builder): void {
filters: ['_class']
})

builder.mixin(lead.mixin.Customer, core.class.Class, view.mixin.ObjectEditorFooter, {
editor: tracker.component.RelatedIssuesSection,
props: {
label: tracker.string.RelatedIssues
}
})

builder.mixin(lead.class.Lead, core.class.Class, view.mixin.ObjectEditorFooter, {
editor: tracker.component.RelatedIssuesSection,
props: {
label: tracker.string.RelatedIssues
}
})

createAction(builder, {
action: workbench.actionImpl.Navigate,
actionProps: {
Expand Down
40 changes: 37 additions & 3 deletions models/recruit/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,9 @@ export function createModel (builder: Builder): void {
{
key: '',
presenter: tracker.component.RelatedIssueSelector,
props: {
kind: 'link'
},
label: tracker.string.Relations
},
'comments',
Expand Down Expand Up @@ -487,6 +490,14 @@ export function createModel (builder: Builder): void {
label: recruit.string.Applications
},
'comments',
{
key: '',
presenter: tracker.component.RelatedIssueSelector,
props: {
kind: 'link'
},
label: tracker.string.Issues
},
'$lookup.company',
'$lookup.company.$lookup.channels',
'location',
Expand Down Expand Up @@ -523,6 +534,12 @@ export function createModel (builder: Builder): void {
label: recruit.string.Applications
},
'comments',
{
key: '',
presenter: tracker.component.RelatedIssueSelector,
label: tracker.string.Issues,
props: { size: 'small', kind: 'link' }
},
'$lookup.channels',
{
key: '@applications.modifiedOn',
Expand Down Expand Up @@ -558,6 +575,9 @@ export function createModel (builder: Builder): void {
{
key: '',
presenter: tracker.component.RelatedIssueSelector,
props: {
kind: 'link'
},
label: tracker.string.Issues
},
'status',
Expand Down Expand Up @@ -606,6 +626,9 @@ export function createModel (builder: Builder): void {
{
key: '',
presenter: tracker.component.RelatedIssueSelector,
props: {
kind: 'link'
},
label: tracker.string.Issues
},
'status',
Expand Down Expand Up @@ -864,6 +887,12 @@ export function createModel (builder: Builder): void {
props: { kind: 'list', size: 'small', shouldShowName: false }
},
{ key: 'comments', displayProps: { key: 'comments', suffix: true } },
{
key: '',
presenter: tracker.component.RelatedIssueSelector,
label: tracker.string.Issues,
props: { size: 'small' }
},
{
key: '$lookup.channels',
label: contact.string.ContactInfo,
Expand Down Expand Up @@ -914,6 +943,11 @@ export function createModel (builder: Builder): void {
},
'description',
{ key: 'comments', displayProps: { key: 'comments', suffix: true } },
{
key: '',
presenter: tracker.component.RelatedIssueSelector,
label: tracker.string.Issues
},
{ key: '', displayProps: { grow: true } },
{
key: '$lookup.company',
Expand Down Expand Up @@ -1601,19 +1635,19 @@ export function createModel (builder: Builder): void {
builder.mixin(recruit.mixin.Candidate, core.class.Class, view.mixin.ObjectEditorFooter, {
editor: tracker.component.RelatedIssuesSection,
props: {
label: recruit.string.RelatedIssues
label: tracker.string.RelatedIssues
}
})
builder.mixin(recruit.class.Vacancy, core.class.Class, view.mixin.ObjectEditorFooter, {
editor: tracker.component.RelatedIssuesSection,
props: {
label: recruit.string.RelatedIssues
label: tracker.string.RelatedIssues
}
})
builder.mixin(recruit.class.Applicant, core.class.Class, view.mixin.ObjectEditorFooter, {
editor: tracker.component.RelatedIssuesSection,
props: {
label: recruit.string.RelatedIssues
label: tracker.string.RelatedIssues
}
})

Expand Down
4 changes: 2 additions & 2 deletions packages/kanban/src/components/KanbanRow.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@
function update (stateObjects: Item[], limit: number | undefined, index: number): void {
clearTimeout(loadingTimeout)
if (limitedObjects.length > 0 || index * 2 === 0) {
if (limitedObjects.length > 0 || index === 0) {
limitedObjects = stateObjects.slice(0, limit)
} else {
loading = true
loadingTimeout = setTimeout(() => {
limitedObjects = stateObjects.slice(0, limit)
loading = false
}, index * 2)
}, index)
}
}
Expand Down
7 changes: 7 additions & 0 deletions packages/theme/styles/popups.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,18 @@
min-width: 12.5rem;
max-width: 17rem;
max-height: 22rem;

background: var(--theme-popup-color);
border: 1px solid var(--theme-popup-divider);
border-radius: .5rem;
box-shadow: var(--theme-popup-shadow);

&.noShadow {
background: none;
border: none;
box-shadow: none;
}

&.full-width {
flex-grow: 1;
background: none;
Expand Down
31 changes: 16 additions & 15 deletions packages/ui/src/components/Lazy.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,28 @@
import { createEventDispatcher } from 'svelte'
const dispatch = createEventDispatcher()
import { lazyObserver } from '../lazy'
import { lazyObserver, isLazyEnabled } from '../lazy'
let visible = false
let visible = !isLazyEnabled()
</script>

<div
use:lazyObserver={(val) => {
if (val) {
visible = true
dispatch('visible')
}
}}
>
{#if visible}
<slot />
{:else}
{#if !visible}
<div
use:lazyObserver={(val, unsubscribe) => {
if (val) {
visible = true
dispatch('visible')
unsubscribe?.()
}
}}
>
<!-- Zero-width space character -->
{#if $$slots.loading}
<slot name="loading" />
{:else}
&#8203;
{/if}
{/if}
</div>
</div>
{:else}
<slot />
{/if}
38 changes: 23 additions & 15 deletions packages/ui/src/components/Scroller.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import IconUpOutline from './icons/UpOutline.svelte'
import IconDownOutline from './icons/DownOutline.svelte'
import HalfUpDown from './icons/HalfUpDown.svelte'
import { DelayedCaller } from '../utils'
export let padding: string | undefined = undefined
export let autoscroll: boolean = false
Expand Down Expand Up @@ -249,20 +250,16 @@
}
}
let checkBarTimeout: any | undefined = undefined
let checkHBarTimeout: any | undefined = undefined
const delayedCaller = new DelayedCaller(25)
const delayCall = (op: () => void, h?: boolean) => {
if (h) {
clearTimeout(checkHBarTimeout)
checkHBarTimeout = setTimeout(op, 5)
} else {
clearTimeout(checkBarTimeout)
checkBarTimeout = setTimeout(op, 5)
}
const delayCall = (op: () => void) => {
delayedCaller.call(op)
}
const checkFade = (): void => {
delayCall(_checkFade)
}
const _checkFade = (): void => {
if (divScroll) {
beforeContent = divScroll.scrollTop
belowContent = divScroll.scrollHeight - divScroll.clientHeight - beforeContent
Expand All @@ -279,11 +276,18 @@
else if (rightContent > 2) maskH = 'left'
else maskH = 'none'
}
if (inter.size) checkIntersectionFade()
if (inter.size) {
checkIntersectionFade()
}
renderFade()
}
if (!isScrolling) delayCall(checkBar)
if (!isScrolling && horizontal) delayCall(checkBarH, true)
if (!isScrolling) {
checkBar()
}
if (!isScrolling && horizontal) {
checkBarH()
}
}
function checkAutoScroll () {
Expand Down Expand Up @@ -383,8 +387,12 @@
if (divScroll && divBox) {
divScroll.addEventListener('wheel', wheelEvent)
divScroll.addEventListener('scroll', checkFade)
delayCall(checkBar)
if (horizontal) delayCall(checkBarH, true)
delayCall(() => {
checkBar()
if (horizontal) {
checkBarH()
}
})
}
})
onDestroy(() => {
Expand Down
15 changes: 13 additions & 2 deletions packages/ui/src/components/SelectPopup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
export let value: Array<ValueType>
export let width: 'medium' | 'large' | 'full' = 'medium'
export let size: 'small' | 'medium' | 'large' = 'small'
export let onSelect: ((value: ValueType['id']) => void) | undefined = undefined
export let showShadow: boolean = true
let search: string = ''
Expand All @@ -60,6 +62,14 @@
let selection = 0
let list: ListView
function sendSelect (id: ValueType['id']): void {
if (onSelect) {
onSelect(id)
} else {
dispatch('close', id)
}
}
function onKeydown (key: KeyboardEvent): void {
if (key.code === 'ArrowUp') {
key.stopPropagation()
Expand All @@ -74,7 +84,7 @@
if (key.code === 'Enter') {
key.preventDefault()
key.stopPropagation()
dispatch('close', value[selection].id)
sendSelect(value[selection].id)
}
}
const manager = createFocusManager()
Expand All @@ -88,6 +98,7 @@

<div
class="selectPopup"
class:noShadow={showShadow === false}
class:full-width={width === 'full'}
class:max-width-40={width === 'large'}
use:resizeObserver={() => {
Expand Down Expand Up @@ -121,7 +132,7 @@
>
<svelte:fragment slot="item" let:item={itemId}>
{@const item = filteredObjects[itemId]}
<button class="menu-item withList w-full" on:click={() => dispatch('close', item.id)}>
<button class="menu-item withList w-full" on:click={() => sendSelect(item.id)}>
<div class="flex-row-center flex-grow pointer-events-none">
{#if item.component}
<div class="flex-grow clear-mins"><svelte:component this={item.component} {...item.props} /></div>
Expand Down
Loading

0 comments on commit b243532

Please sign in to comment.