mirror of
https://github.com/hcengineering/platform.git
synced 2026-10-01 22:15:04 +02:00
Merge branch 'develop' of https://github.com/hcengineering/platform into staging-new
Signed-off-by: Artem Savchenko <armisav@gmail.com>
This commit is contained in:
@@ -120,13 +120,14 @@ export class ProcessMiddleware extends BasePresentationMiddleware implements Pre
|
||||
},
|
||||
{ sort: { rank: SortingOrder.Ascending } }
|
||||
)
|
||||
if (transitions.length === 0) continue
|
||||
const inputContext = {
|
||||
...execution.context,
|
||||
card: updated,
|
||||
operations: isUpdateTx(updateTx) ? updateTx.operations : updateTx.attributes
|
||||
}
|
||||
const transition = await pickTransition(this.client, execution, transitions, inputContext)
|
||||
if (transition === undefined) return
|
||||
if (transition === undefined) continue
|
||||
const result = await getNextStateUserInput(execution, transition, execution.context, inputContext)
|
||||
if (result?.changed === true) {
|
||||
preTx.push(
|
||||
|
||||
@@ -463,11 +463,12 @@ export async function requestUserInput (
|
||||
target: Transition,
|
||||
execution: Execution,
|
||||
userContext: ExecutionContext,
|
||||
inputContext: Record<string, any> = {}
|
||||
inputContext: Record<string, any> = {},
|
||||
skipExisting: boolean = false
|
||||
): Promise<{ context: ExecutionContext, state: Ref<State>, changed: boolean }> {
|
||||
const client = getClient()
|
||||
let changed = false
|
||||
const tr = await getTransitionUserInput(processId, space, target, userContext)
|
||||
const tr = await getTransitionUserInput(processId, space, target, userContext, skipExisting)
|
||||
if (tr !== undefined) {
|
||||
userContext = { ...userContext, ...tr }
|
||||
changed = true
|
||||
@@ -485,7 +486,9 @@ export async function requestUserInput (
|
||||
process: processId,
|
||||
from: target.to
|
||||
})
|
||||
.filter((t) => client.getModel().findObject(t.trigger)?.auto === true)
|
||||
.filter(
|
||||
(t) => client.getModel().findObject(t.trigger)?.auto === true && t.trigger !== process.trigger.OnSubProcessesDone
|
||||
)
|
||||
|
||||
if (nextAutoTransitions.length > 0) {
|
||||
const newExecution = {
|
||||
@@ -518,7 +521,8 @@ export async function getTransitionUserInput (
|
||||
processId: Ref<Process>,
|
||||
space: Ref<Space>,
|
||||
transition: Transition,
|
||||
userContext: ExecutionContext
|
||||
userContext: ExecutionContext,
|
||||
skipExisting: boolean = false
|
||||
): Promise<ExecutionContext | undefined> {
|
||||
let changed = false
|
||||
for (const action of transition.actions) {
|
||||
@@ -526,9 +530,20 @@ export async function getTransitionUserInput (
|
||||
const inputs: SelectedUserRequest[] = []
|
||||
for (const key in action.params) {
|
||||
const value = (action.params as any)[key]
|
||||
const context = parseContext(value)
|
||||
if (context !== undefined && context.type === 'userRequest') {
|
||||
inputs.push(context)
|
||||
if (typeof value === 'string') {
|
||||
const context = parseContext(value)
|
||||
if (context !== undefined && context.type === 'userRequest') {
|
||||
if (skipExisting && userContext[context.id] !== undefined) continue
|
||||
inputs.push(context)
|
||||
}
|
||||
} else if (typeof value === 'object' && !Array.isArray(value)) {
|
||||
for (const element of Object.values(value)) {
|
||||
const context = parseContext(element)
|
||||
if (context !== undefined && context.type === 'userRequest') {
|
||||
if (skipExisting && userContext[context.id] !== undefined) continue
|
||||
inputs.push(context)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (inputs.length > 0) {
|
||||
@@ -576,7 +591,14 @@ export async function getSubProcessesUserInput (
|
||||
if (action.methodId !== process.method.RunSubProcess) continue
|
||||
const processId = action.params._id as Ref<Process>
|
||||
if (processId === undefined) continue
|
||||
const context: ExecutionContext = action.params.context ?? getEmptyContext()
|
||||
const context: ExecutionContext = JSON.parse(JSON.stringify(action.params.context ?? getEmptyContext()))
|
||||
for (const [k, v] of Object.entries(context)) {
|
||||
const c = parseContext(v)
|
||||
if (c !== undefined && c.type === 'userRequest') {
|
||||
if (userContext[c.id] !== undefined) continue
|
||||
;(context as any)[k] = userContext[c.id]
|
||||
}
|
||||
}
|
||||
const initTransition = getClient().getModel().findAllSync(process.class.Transition, {
|
||||
process: processId,
|
||||
from: null
|
||||
@@ -597,9 +619,10 @@ export async function getSubProcessesUserInput (
|
||||
modifiedOn: 0,
|
||||
modifiedBy: client.user
|
||||
}
|
||||
const res = await newExecutionUserInput(processId, space, mockExecution)
|
||||
const res = await newExecutionUserInput(processId, space, mockExecution, true)
|
||||
if (action.context == null || res === undefined) continue
|
||||
userContext[action.context._id] = res
|
||||
userContext = { ...userContext, ...res.context }
|
||||
changed = true
|
||||
}
|
||||
return changed ? userContext : undefined
|
||||
@@ -608,7 +631,8 @@ export async function getSubProcessesUserInput (
|
||||
export async function newExecutionUserInput (
|
||||
_id: Ref<Process>,
|
||||
space: Ref<Space>,
|
||||
execution: Execution
|
||||
execution: Execution,
|
||||
skipExisting: boolean = false
|
||||
): Promise<{ context: ExecutionContext, state: Ref<State>, changed: boolean } | undefined> {
|
||||
const client = getClient()
|
||||
const initTransition = client.getModel().findAllSync(process.class.Transition, {
|
||||
@@ -616,7 +640,7 @@ export async function newExecutionUserInput (
|
||||
from: null
|
||||
})[0]
|
||||
if (initTransition === undefined) return undefined
|
||||
return await requestUserInput(_id, space, initTransition, execution, execution.context)
|
||||
return await requestUserInput(_id, space, initTransition, execution, execution.context, {}, skipExisting)
|
||||
}
|
||||
|
||||
export async function getNextStateUserInput (
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { getMetadata } from '@hcengineering/platform'
|
||||
import presentation from '@hcengineering/presentation'
|
||||
import setting from '@hcengineering/setting'
|
||||
import { Icon, Label, showPopup } from '@hcengineering/ui'
|
||||
import workbench from '../plugin'
|
||||
@@ -21,6 +23,8 @@
|
||||
export let split: boolean = false
|
||||
|
||||
let selected: boolean = false
|
||||
|
||||
const version = getMetadata(presentation.metadata.FrontVersion)
|
||||
</script>
|
||||
|
||||
<div class="antiNav-footer-line" />
|
||||
@@ -46,5 +50,17 @@
|
||||
<span class="an-element__label">
|
||||
<Label label={workbench.string.HelpAndSupport} />
|
||||
</span>
|
||||
{#if version}
|
||||
<span class="version-label">{version}</span>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.version-label {
|
||||
margin-left: auto;
|
||||
font-size: 0.6875rem;
|
||||
color: var(--theme-dark-color);
|
||||
user-select: all;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -29,7 +29,6 @@ import github, {
|
||||
GithubIntegrationRepository,
|
||||
GithubIssueStateReason,
|
||||
GithubProject,
|
||||
IntegrationRepositoryData,
|
||||
GithubIssue as TGithubIssue
|
||||
} from '@hcengineering/github'
|
||||
import task, { TaskType, calcRank } from '@hcengineering/task'
|
||||
@@ -523,9 +522,7 @@ export class IssueSyncManager extends IssueSyncManagerBase implements DocSyncMan
|
||||
info.repository as Ref<GithubIntegrationRepository>,
|
||||
container.project,
|
||||
taskTypes[0]._id,
|
||||
repo as GithubIntegrationRepository & {
|
||||
repository: IntegrationRepositoryData
|
||||
},
|
||||
repo,
|
||||
!markdownCompatible
|
||||
)
|
||||
},
|
||||
|
||||
@@ -86,6 +86,7 @@ import { ReviewCommentSyncManager } from './sync/reviewComments'
|
||||
import { ReviewThreadSyncManager } from './sync/reviewThreads'
|
||||
import { ReviewSyncManager } from './sync/reviews'
|
||||
import { UsersSyncManager, fetchViewerDetails } from './sync/users'
|
||||
import { appendGuestLinkToImage } from './sync/guest'
|
||||
import { errorToObj } from './sync/utils'
|
||||
import {
|
||||
ContainerFocus,
|
||||
@@ -243,7 +244,10 @@ export class GithubWorker implements IntegrationManager {
|
||||
concatLink(this.getBranding()?.front ?? config.FrontURL, `/browse/?workspace=${this.workspace.uuid}`),
|
||||
// TODO storage URL
|
||||
concatLink(this.getBranding()?.front ?? config.FrontURL, `/files/${this.workspace.uuid}/`),
|
||||
preprocessor
|
||||
preprocessor ??
|
||||
(async (nodes) => {
|
||||
appendGuestLinkToImage(nodes, this.workspace.uuid)
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user