mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-25 11:05:07 +02:00
Process data manager (#9124)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
<!--
|
||||
// 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 { ContextId, Process, ProcessContext } from '@hcengineering/process'
|
||||
import { EditBox, Grid, Modal } from '@hcengineering/ui'
|
||||
import plugin from '../../plugin'
|
||||
import presentation, { getClient } from '@hcengineering/presentation'
|
||||
import { clearSettingsStore } from '@hcengineering/setting-resources'
|
||||
import core from '@hcengineering/core'
|
||||
import ProcessContextRawPresenter from '../contextEditors/ProcessContextRawPresenter.svelte'
|
||||
|
||||
export let process: Process
|
||||
export let readonly: boolean
|
||||
|
||||
const client = getClient()
|
||||
|
||||
async function save () {
|
||||
await client.update(process, { context: process.context })
|
||||
clearSettingsStore()
|
||||
}
|
||||
|
||||
function onNameChange (ev: Event, _id: string, ctx: ProcessContext) {
|
||||
const value = (ev.target as HTMLInputElement).value?.trim()
|
||||
ctx.name = value
|
||||
process.context[_id as ContextId] = ctx
|
||||
}
|
||||
</script>
|
||||
|
||||
<Modal
|
||||
label={plugin.string.Data}
|
||||
type={'type-aside'}
|
||||
canSave={!readonly}
|
||||
okLabel={presentation.string.Save}
|
||||
okAction={save}
|
||||
showCancelButton={false}
|
||||
onCancel={clearSettingsStore}
|
||||
>
|
||||
<div class="mt-2">
|
||||
<Grid>
|
||||
{#each Object.entries(process.context) as val}
|
||||
<div class="context flex-center">
|
||||
<ProcessContextRawPresenter context={val[1]} />
|
||||
</div>
|
||||
<EditBox
|
||||
kind={'ghost'}
|
||||
value={val[1].name ?? ''}
|
||||
placeholder={core.string.Name}
|
||||
disabled={readonly}
|
||||
on:change={(e) => {
|
||||
onNameChange(e, val[0], val[1])
|
||||
}}
|
||||
/>
|
||||
{/each}
|
||||
</Grid>
|
||||
</div>
|
||||
</Modal>
|
||||
|
||||
<style lang="scss">
|
||||
.context {
|
||||
justify-content: start;
|
||||
min-height: 2.5rem;
|
||||
border: 0.0625rem solid var(---primary-button-default);
|
||||
border-radius: 0.375rem;
|
||||
background: #3575de33;
|
||||
padding-left: 0.75rem;
|
||||
max-width: 100%;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
color: var(--theme-caption-color);
|
||||
}
|
||||
</style>
|
||||
@@ -13,10 +13,10 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import core, { Doc, Ref } from '@hcengineering/core'
|
||||
import core, { Ref } from '@hcengineering/core'
|
||||
import { translate } from '@hcengineering/platform'
|
||||
import { createQuery, getClient, MessageBox } from '@hcengineering/presentation'
|
||||
import { ContextId, Process, SelectedExecutonContext, State, Step } from '@hcengineering/process'
|
||||
import { Process, SelectedExecutonContext, State } from '@hcengineering/process'
|
||||
import { clearSettingsStore, settingsStore } from '@hcengineering/setting-resources'
|
||||
import {
|
||||
Button,
|
||||
@@ -27,6 +27,7 @@
|
||||
IconAdd,
|
||||
IconDelete,
|
||||
IconDescription,
|
||||
IconDetails,
|
||||
navigate,
|
||||
NavItem,
|
||||
Scroller,
|
||||
@@ -40,6 +41,7 @@
|
||||
import { getToDoEndAction } from '../../utils'
|
||||
import AsideStepEditor from './AsideStepEditor.svelte'
|
||||
import StateEditor from './StateEditor.svelte'
|
||||
import ContextEditor from './ContextEditor.svelte'
|
||||
|
||||
export let _id: Ref<Process>
|
||||
export let visibleSecondNav: boolean = true
|
||||
@@ -161,6 +163,14 @@
|
||||
const sectionRefs: Record<string, HTMLElement | undefined> = {}
|
||||
|
||||
defineSeparators('spaceTypeEditor', secondNavSeparators)
|
||||
|
||||
function handleContext (): void {
|
||||
$settingsStore = {
|
||||
id: value?._id,
|
||||
component: ContextEditor,
|
||||
props: { readonly, process: value }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="hulyComponent-content__container columns">
|
||||
@@ -189,7 +199,16 @@
|
||||
<div class="hulyComponent-content gap">
|
||||
<div class="header flex-between">
|
||||
<EditBox bind:value={value.name} on:change={saveName} placeholder={process.string.Untitled} />
|
||||
<ButtonIcon icon={IconDelete} size="small" kind="secondary" on:click={handleDelete} />
|
||||
<div class="flex-row-center flex-gap-2">
|
||||
<ButtonIcon
|
||||
icon={IconDetails}
|
||||
tooltip={{ label: process.string.Data }}
|
||||
size="small"
|
||||
kind="secondary"
|
||||
on:click={handleContext}
|
||||
/>
|
||||
<ButtonIcon icon={IconDelete} size="small" kind="secondary" on:click={handleDelete} />
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<ToggleWithLabel
|
||||
|
||||
Reference in New Issue
Block a user