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

UBER-1143: setting for skill import, redirect to talents from skillsView #3925

Merged
merged 2 commits into from
Oct 31, 2023
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
3 changes: 2 additions & 1 deletion plugins/recruit-assets/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@
"ShowApplications": "Show applications",
"GetTalentIds": "Get talents' ids",
"HideDoneState": "Hide complete applications",
"HideArchivedVacancies": "Hide from archived Vacancies"
"HideArchivedVacancies": "Hide from archived Vacancies",
"CreateNewSkills": "Create new skills if existing not found"
},
"status": {
"ApplicationExists": "Application already exists",
Expand Down
3 changes: 2 additions & 1 deletion plugins/recruit-assets/lang/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@
"ShowApplications": "Показать кандидатов",
"GetTalentIds": "Получить ID талантов",
"HideDoneState": "Скрыть завершенных кандидатов",
"HideArchivedVacancies": "Скрыть архивные вакансии"
"HideArchivedVacancies": "Скрыть архивные вакансии",
"CreateNewSkills": "Создать навыки, если не найдены существующие"
},
"status": {
"ApplicationExists": "Кандидат уже существует",
Expand Down
33 changes: 20 additions & 13 deletions plugins/recruit-resources/src/components/CreateCandidate.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
IconInfo,
Label,
showPopup,
Spinner
Spinner,
MiniToggle
} from '@hcengineering/ui'
import { createEventDispatcher, onDestroy } from 'svelte'
import recruit from '../plugin'
Expand Down Expand Up @@ -136,6 +137,7 @@
let inputFile: HTMLInputElement
let loading = false
let dragover = false
let shouldCreateNewSkills = false

let avatar: File | undefined = draft?.avatar

Expand Down Expand Up @@ -349,7 +351,7 @@
for (const s of doc.skills ?? []) {
const title = s.trim().toLowerCase()
let e = namedElements.get(title)
if (e === undefined) {
if (e === undefined && shouldCreateNewSkills) {
// No yet tag with title
const category = findTagCategory(s, categories)
const cinstance = categoriesMap.get(category)
Expand All @@ -366,18 +368,20 @@
elements.set(e._id, e)
newElements.push(e)
}
newSkills.push(
TxProcessor.createDoc2Doc(
client.txFactory.createTxCreateDoc(tags.class.TagReference, tags.space.Tags, {
title: e.title,
color: e.color,
tag: e._id,
attachedTo: '' as Ref<Doc>,
attachedToClass: recruit.mixin.Candidate,
collection: 'skills'
})
if (e !== undefined) {
newSkills.push(
TxProcessor.createDoc2Doc(
client.txFactory.createTxCreateDoc(tags.class.TagReference, tags.space.Tags, {
title: e.title,
color: e.color,
tag: e._id,
attachedTo: '' as Ref<Doc>,
attachedToClass: recruit.mixin.Candidate,
collection: 'skills'
})
)
)
)
}
}
object.skills = [...object.skills, ...newSkills]
} catch (err: any) {
Expand Down Expand Up @@ -705,6 +709,9 @@
{/if}
<input bind:this={inputFile} type="file" name="file" id="file" style="display: none" on:change={fileSelected} />
{/if}
<div class="ml-1">
<MiniToggle bind:on={shouldCreateNewSkills} label={recruit.string.CreateNewSkills} />
</div>
</div>
{#if matches.length > 0}
<div class="flex-col-stretch flex-grow error-color">
Expand Down
23 changes: 21 additions & 2 deletions plugins/recruit-resources/src/components/SkillsView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,33 @@
import tags, { selectedTagElements, TagElement } from '@hcengineering/tags'
import { Component, getCurrentResolvedLocation, navigate } from '@hcengineering/ui'
import recruit from '../plugin'
import { buildFilterKey, setFilters } from '@hcengineering/view-resources'
import { getClient } from '@hcengineering/presentation'
import { Filter } from '@hcengineering/view'

function onTag (tag: TagElement): void {
function setFilterTag (tag: TagElement) {
const client = getClient()
const hierarchy = client.getHierarchy()
const attribute = hierarchy.getAttribute(recruit.mixin.Candidate, 'skills')
const key = buildFilterKey(hierarchy, recruit.mixin.Candidate, '_class', attribute)
const filter = {
key,
value: [tag._id],
props: { level: 0 },
modes: [tags.filter.FilterTagsIn, tags.filter.FilterTagsNin],
mode: tags.filter.FilterTagsIn,
index: 1
} as Filter
setFilters([filter])
}
async function onTag (tag: TagElement): Promise<void> {
selectedTagElements.set([tag._id])
const loc = getCurrentResolvedLocation()
loc.path[2] = 'recruit'
loc.path[3] = 'candidates'
loc.path[3] = 'talents'
loc.path.length = 4
navigate(loc)
setTimeout(() => setFilterTag(tag), 50)
}
</script>

Expand Down
3 changes: 2 additions & 1 deletion plugins/recruit-resources/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ export default mergeIds(recruitId, recruit, {
Apply: '' as IntlString,
OpenVacancyList: '' as IntlString,
Export: '' as IntlString,
GetTalentIds: '' as IntlString
GetTalentIds: '' as IntlString,
CreateNewSkills: '' as IntlString
},
space: {
CandidatesPublic: '' as Ref<Space>
Expand Down