Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UBERF-8564 More readonly fields in guest mode #7076

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
{getName(client.getHierarchy(), selected)}
{/if}
{:else}
<div class="flex-presenter not-selected">
<div class="flex-presenter not-selected" class:cursor-default={readonly}>
{#if icon}
<div class="icon w-4 flex-no-shrink" class:small-gap={size === 'inline' || size === 'small'}>
<Icon {icon} size={'small'} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
on:close={() => {
dispatch('close')
}}
withoutInput={readonly}
>
<svelte:fragment slot="title">
<DocNavLink noUnderline {object}>
Expand All @@ -106,7 +107,7 @@

<svelte:fragment slot="attributes" let:direction={dir}>
{#if dir === 'column'}
<DocAttributeBar {object} {mixins} {ignoreKeys} />
<DocAttributeBar {object} {mixins} {ignoreKeys} {readonly} />
{/if}
</svelte:fragment>

Expand All @@ -117,14 +118,16 @@
</svelte:fragment>

<svelte:fragment slot="utils">
<Button
icon={IconMoreH}
iconProps={{ size: 'medium' }}
kind={'icon'}
on:click={(e) => {
showMenu(e, { object, excludedActions: [view.action.Open] })
}}
/>
{#if !readonly}
<Button
icon={IconMoreH}
iconProps={{ size: 'medium' }}
kind={'icon'}
on:click={(e) => {
showMenu(e, { object, excludedActions: [view.action.Open] })
}}
/>
{/if}
<Button
icon={IconMixin}
kind={'icon'}
Expand All @@ -137,14 +140,15 @@
</svelte:fragment>

<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">
<AttachmentStyleBoxCollabEditor
focusIndex={30}
{object}
key={{ key: 'description', attr: descriptionKey }}
placeholder={core.string.Description}
enableAttachments={false}
{readonly}
on:saved={(evt) => {
saved = evt.detail
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
{kind}
{size}
{justify}
disabled={readonly}
showTooltip={label ? { label, direction: labelDirection } : undefined}
on:click={addPerson}
>
Expand Down
19 changes: 12 additions & 7 deletions plugins/recruit-resources/src/components/Applications.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import SectionEmpty from './SectionEmpty.svelte'

export let objectId: Ref<Doc>

export let applications: number
export let readonly: boolean = false

const createApp = (ev: MouseEvent): void => {
showPopup(CreateApplication, { candidate: objectId, preserveCandidate: true }, ev.target as HTMLElement)
Expand All @@ -46,7 +46,9 @@
bind:loading
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>
</svelte:fragment>

Expand All @@ -58,15 +60,18 @@
config={preference?.config ?? viewlet.config}
query={{ attachedTo: objectId, ...(viewlet?.baseQuery ?? {}) }}
loadingProps={{ length: applications }}
{readonly}
/>
</Scroller>
{:else}
<SectionEmpty icon={FileDuo} label={recruit.string.NoApplicationsForTalent}>
<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
<span class="over-underline content-color" on:click={createApp}>
<Label label={recruit.string.CreateAnApplication} />
</span>
{#if !readonly}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
<span class="over-underline content-color" on:click={createApp}>
<Label label={recruit.string.CreateAnApplication} />
</span>
{/if}
</SectionEmpty>
{/if}
</svelte:fragment>
Expand Down
24 changes: 15 additions & 9 deletions plugins/recruit-resources/src/components/EditVacancy.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

export let _id: Ref<Vacancy>
export let embedded: boolean = false
export let readonly = false

let object: Required<Vacancy>
let rawName: string = ''
Expand Down Expand Up @@ -140,6 +141,7 @@
<DocAttributeBar
{object}
{mixins}
{readonly}
ignoreKeys={['name', 'fullDescription', 'private', 'archived', 'type', 'owners']}
/>
{/if}
Expand All @@ -151,6 +153,7 @@
kind={'large-style'}
focusable
autoFocus={!embedded}
disabled={readonly}
on:blur={save}
/>

Expand All @@ -160,14 +163,16 @@
{/if}
</svelte:fragment>
<svelte:fragment slot="utils">
<Button
icon={IconMoreH}
iconProps={{ size: 'medium' }}
kind={'icon'}
on:click={(e) => {
showMenu(e, { object, excludedActions: [view.action.Open] })
}}
/>
{#if !readonly}
<Button
icon={IconMoreH}
iconProps={{ size: 'medium' }}
kind={'icon'}
on:click={(e) => {
showMenu(e, { object, excludedActions: [view.action.Open] })
}}
/>
{/if}
<Button
icon={IconMixin}
kind={'icon'}
Expand All @@ -187,14 +192,15 @@
key={{ key: 'fullDescription', attr: descriptionKey }}
bind:this={descriptionBox}
placeholder={recruit.string.FullDescription}
{readonly}
on:saved={(evt) => {
saved = evt.detail
}}
/>
</div>

<div class="w-full mt-6">
<VacancyApplications objectId={object._id} />
<VacancyApplications objectId={object._id} {readonly} />
</div>
<div class="w-full mt-6">
<Component is={tracker.component.RelatedIssuesSection} props={{ object, label: tracker.string.RelatedIssues }} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import SectionEmpty from './SectionEmpty.svelte'

export let objectId: Ref<Vacancy>
export let readonly = false
let applications: number

const query = createQuery()
Expand Down Expand Up @@ -60,7 +61,9 @@
bind:preference
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>
{#if applications > 0}
Expand All @@ -71,6 +74,7 @@
config={preference?.config ?? viewlet.config}
query={{ space: objectId }}
loadingProps={{ length: applications }}
{readonly}
/>
</Scroller>
{:else}
Expand All @@ -80,9 +84,11 @@
<SectionEmpty icon={FileDuo} label={recruit.string.NoApplicationsForVacancy}>
<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
<span class="over-underline content-color" on:click={createApp}>
<Label label={recruit.string.CreateAnApplication} />
</span>
{#if !readonly}
<span class="over-underline content-color" on:click={createApp}>
<Label label={recruit.string.CreateAnApplication} />
</span>
{/if}
</SectionEmpty>
{/if}
</div>
12 changes: 7 additions & 5 deletions plugins/recruit-resources/src/components/VacancyList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,13 @@
</Scroller>
{:else}
<SectionEmpty icon={FileDuo} label={recruit.string.NoVacancies}>
<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
<span class="over-underline content-color" on:click={createApp}>
<Label label={recruit.string.CreateVacancy} />
</span>
{#if !readonly}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
<span class="over-underline content-color" on:click={createApp}>
<Label label={recruit.string.CreateVacancy} />
</span>
{/if}
</SectionEmpty>
{/if}
</div>
2 changes: 2 additions & 0 deletions plugins/tags-resources/src/components/Tags.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
export let object: Doc
export let _class: Ref<Class<Doc>>
export let key: KeyedAttribute
export let readonly: boolean = false

const client = getClient()

Expand Down Expand Up @@ -56,6 +57,7 @@

<TagsEditor
{key}
{readonly}
bind:items
targetClass={_class}
on:open={(evt) => addRef(evt.detail)}
Expand Down
17 changes: 10 additions & 7 deletions plugins/tags-resources/src/components/TagsEditor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
export let key: KeyedAttribute
export let showTitle = true
export let schema: '0' | '3' | '9' = key.attr.schema ?? '0'
export let readonly = false

let elements: IdMap<TagElement> = new Map()
const elementQuery = createQuery()
Expand Down Expand Up @@ -113,13 +114,15 @@
<Label label={key.attr.label} />
</span>
<div class="buttons-group x-small">
<Button
icon={IconAdd}
kind={'ghost'}
showTooltip={{ label: tags.string.AddTagTooltip, props: { word: keyLabel } }}
id={'add-tag'}
on:click={addTag}
/>
{#if !readonly}
<Button
icon={IconAdd}
kind={'ghost'}
showTooltip={{ label: tags.string.AddTagTooltip, props: { word: keyLabel } }}
id={'add-tag'}
on:click={addTag}
/>
{/if}
</div>
</div>
{/if}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,15 @@

&:not(.readonly) {
cursor: pointer;
}
.add-action {
visibility: hidden;
}

&:hover {
.add-action {
visibility: visible;
visibility: hidden;
}

&:hover {
.add-action {
visibility: visible;
}
}
}
}
Expand Down
Loading