UBERF-8564 More readonly fields in guest mode (#7076)

Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
Alexander Onnikov 2024-11-01 00:22:38 +07:00 committed by GitHub
parent 6962e80acd
commit da0da6b452
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 79 additions and 49 deletions

View File

@ -184,7 +184,7 @@
{getName(client.getHierarchy(), selected)} {getName(client.getHierarchy(), selected)}
{/if} {/if}
{:else} {:else}
<div class="flex-presenter not-selected"> <div class="flex-presenter not-selected" class:cursor-default={readonly}>
{#if icon} {#if icon}
<div class="icon w-4 flex-no-shrink" class:small-gap={size === 'inline' || size === 'small'}> <div class="icon w-4 flex-no-shrink" class:small-gap={size === 'inline' || size === 'small'}>
<Icon {icon} size={'small'} /> <Icon {icon} size={'small'} />

View File

@ -97,6 +97,7 @@
on:close={() => { on:close={() => {
dispatch('close') dispatch('close')
}} }}
withoutInput={readonly}
> >
<svelte:fragment slot="title"> <svelte:fragment slot="title">
<DocNavLink noUnderline {object}> <DocNavLink noUnderline {object}>
@ -106,7 +107,7 @@
<svelte:fragment slot="attributes" let:direction={dir}> <svelte:fragment slot="attributes" let:direction={dir}>
{#if dir === 'column'} {#if dir === 'column'}
<DocAttributeBar {object} {mixins} {ignoreKeys} /> <DocAttributeBar {object} {mixins} {ignoreKeys} {readonly} />
{/if} {/if}
</svelte:fragment> </svelte:fragment>
@ -117,14 +118,16 @@
</svelte:fragment> </svelte:fragment>
<svelte:fragment slot="utils"> <svelte:fragment slot="utils">
<Button {#if !readonly}
icon={IconMoreH} <Button
iconProps={{ size: 'medium' }} icon={IconMoreH}
kind={'icon'} iconProps={{ size: 'medium' }}
on:click={(e) => { kind={'icon'}
showMenu(e, { object, excludedActions: [view.action.Open] }) on:click={(e) => {
}} showMenu(e, { object, excludedActions: [view.action.Open] })
/> }}
/>
{/if}
<Button <Button
icon={IconMixin} icon={IconMixin}
kind={'icon'} kind={'icon'}
@ -137,7 +140,7 @@
</svelte:fragment> </svelte:fragment>
<div class="flex-col flex-grow flex-no-shrink step-tb-6"> <div class="flex-col flex-grow flex-no-shrink step-tb-6">
<EditOrganization {object} /> <EditOrganization {object} {readonly} />
<div class="flex-col flex-grow w-full mt-6 relative"> <div class="flex-col flex-grow w-full mt-6 relative">
<AttachmentStyleBoxCollabEditor <AttachmentStyleBoxCollabEditor
focusIndex={30} focusIndex={30}
@ -145,6 +148,7 @@
key={{ key: 'description', attr: descriptionKey }} key={{ key: 'description', attr: descriptionKey }}
placeholder={core.string.Description} placeholder={core.string.Description}
enableAttachments={false} enableAttachments={false}
{readonly}
on:saved={(evt) => { on:saved={(evt) => {
saved = evt.detail saved = evt.detail
}} }}

View File

@ -103,6 +103,7 @@
{kind} {kind}
{size} {size}
{justify} {justify}
disabled={readonly}
showTooltip={label ? { label, direction: labelDirection } : undefined} showTooltip={label ? { label, direction: labelDirection } : undefined}
on:click={addPerson} on:click={addPerson}
> >

View File

@ -24,8 +24,8 @@
import SectionEmpty from './SectionEmpty.svelte' import SectionEmpty from './SectionEmpty.svelte'
export let objectId: Ref<Doc> export let objectId: Ref<Doc>
export let applications: number export let applications: number
export let readonly: boolean = false
const createApp = (ev: MouseEvent): void => { const createApp = (ev: MouseEvent): void => {
showPopup(CreateApplication, { candidate: objectId, preserveCandidate: true }, ev.target as HTMLElement) showPopup(CreateApplication, { candidate: objectId, preserveCandidate: true }, ev.target as HTMLElement)
@ -46,7 +46,9 @@
bind:loading bind:loading
bind:preference bind:preference
/> />
<Button id="appls.add" icon={IconAdd} kind={'ghost'} on:click={createApp} /> {#if !readonly}
<Button id="appls.add" icon={IconAdd} kind={'ghost'} on:click={createApp} />
{/if}
</div> </div>
</svelte:fragment> </svelte:fragment>
@ -58,15 +60,18 @@
config={preference?.config ?? viewlet.config} config={preference?.config ?? viewlet.config}
query={{ attachedTo: objectId, ...(viewlet?.baseQuery ?? {}) }} query={{ attachedTo: objectId, ...(viewlet?.baseQuery ?? {}) }}
loadingProps={{ length: applications }} loadingProps={{ length: applications }}
{readonly}
/> />
</Scroller> </Scroller>
{:else} {:else}
<SectionEmpty icon={FileDuo} label={recruit.string.NoApplicationsForTalent}> <SectionEmpty icon={FileDuo} label={recruit.string.NoApplicationsForTalent}>
<!-- svelte-ignore a11y-click-events-have-key-events --> {#if !readonly}
<!-- svelte-ignore a11y-no-static-element-interactions --> <!-- svelte-ignore a11y-click-events-have-key-events -->
<span class="over-underline content-color" on:click={createApp}> <!-- svelte-ignore a11y-no-static-element-interactions -->
<Label label={recruit.string.CreateAnApplication} /> <span class="over-underline content-color" on:click={createApp}>
</span> <Label label={recruit.string.CreateAnApplication} />
</span>
{/if}
</SectionEmpty> </SectionEmpty>
{/if} {/if}
</svelte:fragment> </svelte:fragment>

View File

@ -31,6 +31,7 @@
export let _id: Ref<Vacancy> export let _id: Ref<Vacancy>
export let embedded: boolean = false export let embedded: boolean = false
export let readonly = false
let object: Required<Vacancy> let object: Required<Vacancy>
let rawName: string = '' let rawName: string = ''
@ -140,6 +141,7 @@
<DocAttributeBar <DocAttributeBar
{object} {object}
{mixins} {mixins}
{readonly}
ignoreKeys={['name', 'fullDescription', 'private', 'archived', 'type', 'owners']} ignoreKeys={['name', 'fullDescription', 'private', 'archived', 'type', 'owners']}
/> />
{/if} {/if}
@ -151,6 +153,7 @@
kind={'large-style'} kind={'large-style'}
focusable focusable
autoFocus={!embedded} autoFocus={!embedded}
disabled={readonly}
on:blur={save} on:blur={save}
/> />
@ -160,14 +163,16 @@
{/if} {/if}
</svelte:fragment> </svelte:fragment>
<svelte:fragment slot="utils"> <svelte:fragment slot="utils">
<Button {#if !readonly}
icon={IconMoreH} <Button
iconProps={{ size: 'medium' }} icon={IconMoreH}
kind={'icon'} iconProps={{ size: 'medium' }}
on:click={(e) => { kind={'icon'}
showMenu(e, { object, excludedActions: [view.action.Open] }) on:click={(e) => {
}} showMenu(e, { object, excludedActions: [view.action.Open] })
/> }}
/>
{/if}
<Button <Button
icon={IconMixin} icon={IconMixin}
kind={'icon'} kind={'icon'}
@ -187,6 +192,7 @@
key={{ key: 'fullDescription', attr: descriptionKey }} key={{ key: 'fullDescription', attr: descriptionKey }}
bind:this={descriptionBox} bind:this={descriptionBox}
placeholder={recruit.string.FullDescription} placeholder={recruit.string.FullDescription}
{readonly}
on:saved={(evt) => { on:saved={(evt) => {
saved = evt.detail saved = evt.detail
}} }}
@ -194,7 +200,7 @@
</div> </div>
<div class="w-full mt-6"> <div class="w-full mt-6">
<VacancyApplications objectId={object._id} /> <VacancyApplications objectId={object._id} {readonly} />
</div> </div>
<div class="w-full mt-6"> <div class="w-full mt-6">
<Component is={tracker.component.RelatedIssuesSection} props={{ object, label: tracker.string.RelatedIssues }} /> <Component is={tracker.component.RelatedIssuesSection} props={{ object, label: tracker.string.RelatedIssues }} />

View File

@ -26,6 +26,7 @@
import SectionEmpty from './SectionEmpty.svelte' import SectionEmpty from './SectionEmpty.svelte'
export let objectId: Ref<Vacancy> export let objectId: Ref<Vacancy>
export let readonly = false
let applications: number let applications: number
const query = createQuery() const query = createQuery()
@ -60,7 +61,9 @@
bind:preference bind:preference
bind:loading bind:loading
/> />
<Button id="appls.add" icon={IconAdd} kind={'ghost'} on:click={createApp} /> {#if !readonly}
<Button id="appls.add" icon={IconAdd} kind={'ghost'} on:click={createApp} />
{/if}
</div> </div>
</div> </div>
{#if applications > 0} {#if applications > 0}
@ -71,6 +74,7 @@
config={preference?.config ?? viewlet.config} config={preference?.config ?? viewlet.config}
query={{ space: objectId }} query={{ space: objectId }}
loadingProps={{ length: applications }} loadingProps={{ length: applications }}
{readonly}
/> />
</Scroller> </Scroller>
{:else} {:else}
@ -80,9 +84,11 @@
<SectionEmpty icon={FileDuo} label={recruit.string.NoApplicationsForVacancy}> <SectionEmpty icon={FileDuo} label={recruit.string.NoApplicationsForVacancy}>
<!-- svelte-ignore a11y-click-events-have-key-events --> <!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-static-element-interactions --> <!-- svelte-ignore a11y-no-static-element-interactions -->
<span class="over-underline content-color" on:click={createApp}> {#if !readonly}
<Label label={recruit.string.CreateAnApplication} /> <span class="over-underline content-color" on:click={createApp}>
</span> <Label label={recruit.string.CreateAnApplication} />
</span>
{/if}
</SectionEmpty> </SectionEmpty>
{/if} {/if}
</div> </div>

View File

@ -72,11 +72,13 @@
</Scroller> </Scroller>
{:else} {:else}
<SectionEmpty icon={FileDuo} label={recruit.string.NoVacancies}> <SectionEmpty icon={FileDuo} label={recruit.string.NoVacancies}>
<!-- svelte-ignore a11y-click-events-have-key-events --> {#if !readonly}
<!-- svelte-ignore a11y-no-static-element-interactions --> <!-- svelte-ignore a11y-click-events-have-key-events -->
<span class="over-underline content-color" on:click={createApp}> <!-- svelte-ignore a11y-no-static-element-interactions -->
<Label label={recruit.string.CreateVacancy} /> <span class="over-underline content-color" on:click={createApp}>
</span> <Label label={recruit.string.CreateVacancy} />
</span>
{/if}
</SectionEmpty> </SectionEmpty>
{/if} {/if}
</div> </div>

View File

@ -22,6 +22,7 @@
export let object: Doc export let object: Doc
export let _class: Ref<Class<Doc>> export let _class: Ref<Class<Doc>>
export let key: KeyedAttribute export let key: KeyedAttribute
export let readonly: boolean = false
const client = getClient() const client = getClient()
@ -56,6 +57,7 @@
<TagsEditor <TagsEditor
{key} {key}
{readonly}
bind:items bind:items
targetClass={_class} targetClass={_class}
on:open={(evt) => addRef(evt.detail)} on:open={(evt) => addRef(evt.detail)}

View File

@ -46,6 +46,7 @@
export let key: KeyedAttribute export let key: KeyedAttribute
export let showTitle = true export let showTitle = true
export let schema: '0' | '3' | '9' = key.attr.schema ?? '0' export let schema: '0' | '3' | '9' = key.attr.schema ?? '0'
export let readonly = false
let elements: IdMap<TagElement> = new Map() let elements: IdMap<TagElement> = new Map()
const elementQuery = createQuery() const elementQuery = createQuery()
@ -113,13 +114,15 @@
<Label label={key.attr.label} /> <Label label={key.attr.label} />
</span> </span>
<div class="buttons-group x-small"> <div class="buttons-group x-small">
<Button {#if !readonly}
icon={IconAdd} <Button
kind={'ghost'} icon={IconAdd}
showTooltip={{ label: tags.string.AddTagTooltip, props: { word: keyLabel } }} kind={'ghost'}
id={'add-tag'} showTooltip={{ label: tags.string.AddTagTooltip, props: { word: keyLabel } }}
on:click={addTag} id={'add-tag'}
/> on:click={addTag}
/>
{/if}
</div> </div>
</div> </div>
{/if} {/if}

View File

@ -106,14 +106,15 @@
&:not(.readonly) { &:not(.readonly) {
cursor: pointer; cursor: pointer;
}
.add-action {
visibility: hidden;
}
&:hover {
.add-action { .add-action {
visibility: visible; visibility: hidden;
}
&:hover {
.add-action {
visibility: visible;
}
} }
} }
} }