mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-22 19:11:33 +03:00
hide archieved vacanies toggle in viewoptions (#4220)
Signed-off-by: Sergey Voytsehovich <syargreg@gmail.com>
This commit is contained in:
parent
f0dbfe3971
commit
c705fd385c
@ -272,7 +272,6 @@ export function createModel (builder: Builder): void {
|
||||
const talentsId = 'talents'
|
||||
const skillsId = 'skills'
|
||||
const candidatesId = 'candidates'
|
||||
const archiveId = 'archive'
|
||||
const myApplicationsId = 'my-applications'
|
||||
const organizationsId = 'organizations'
|
||||
|
||||
@ -341,18 +340,6 @@ export function createModel (builder: Builder): void {
|
||||
},
|
||||
position: 'vacancy'
|
||||
},
|
||||
{
|
||||
id: archiveId,
|
||||
component: recruit.component.Vacancies,
|
||||
icon: view.icon.Archive,
|
||||
label: workbench.string.Archive,
|
||||
position: 'bottom',
|
||||
visibleIf: workbench.function.HasArchiveSpaces,
|
||||
spaceClass: recruit.class.Vacancy,
|
||||
componentProps: {
|
||||
archived: true
|
||||
}
|
||||
},
|
||||
{
|
||||
id: skillsId,
|
||||
component: recruit.component.SkillsView,
|
||||
@ -502,6 +489,14 @@ export function createModel (builder: Builder): void {
|
||||
recruit.viewlet.VacancyApplicationsEmbeddeed
|
||||
)
|
||||
|
||||
// hiding arhived vacancies from vacancy view
|
||||
const vacancyHideArchivedOption: ViewOptionModel = {
|
||||
key: 'hideArchived',
|
||||
type: 'toggle',
|
||||
defaultValue: true,
|
||||
label: recruit.string.HideArchivedVacancies
|
||||
}
|
||||
|
||||
builder.createDoc(
|
||||
view.class.Viewlet,
|
||||
core.space.Model,
|
||||
@ -535,6 +530,11 @@ export function createModel (builder: Builder): void {
|
||||
configOptions: {
|
||||
hiddenKeys: ['name', 'space', 'modifiedOn'],
|
||||
sortable: true
|
||||
},
|
||||
viewOptions: {
|
||||
groupBy: [],
|
||||
orderBy: [],
|
||||
other: [vacancyHideArchivedOption]
|
||||
}
|
||||
},
|
||||
recruit.viewlet.TableVacancy
|
||||
@ -730,13 +730,14 @@ export function createModel (builder: Builder): void {
|
||||
label: recruit.string.HideDoneState
|
||||
}
|
||||
|
||||
const vacancyHideOption: ViewOptionModel = {
|
||||
// hiding applicants related to archived vacancies from applicants view
|
||||
const hideApplicantsFromArchivedVacanciesOption: ViewOptionModel = {
|
||||
key: 'hideArchivedVacancies',
|
||||
type: 'toggle',
|
||||
defaultValue: true,
|
||||
actionTarget: 'query',
|
||||
action: recruit.function.HideArchivedVacancies,
|
||||
label: recruit.string.HideArchivedVacancies
|
||||
label: recruit.string.HideApplicantsFromArchivedVacancies
|
||||
}
|
||||
|
||||
const applicantViewOptions = (colors: boolean, hides: boolean): ViewOptionsModel => {
|
||||
@ -764,7 +765,7 @@ export function createModel (builder: Builder): void {
|
||||
model.other.push(showColorsViewOption)
|
||||
}
|
||||
if (hides) {
|
||||
model.other.push(...[applicationDoneOption, vacancyHideOption])
|
||||
model.other.push(...[applicationDoneOption, hideApplicantsFromArchivedVacanciesOption])
|
||||
}
|
||||
return model
|
||||
}
|
||||
@ -997,7 +998,7 @@ export function createModel (builder: Builder): void {
|
||||
['modifiedOn', SortingOrder.Descending],
|
||||
['createdOn', SortingOrder.Descending]
|
||||
],
|
||||
other: []
|
||||
other: [vacancyHideArchivedOption]
|
||||
}
|
||||
},
|
||||
recruit.viewlet.ListVacancy
|
||||
|
@ -72,7 +72,8 @@ export default mergeIds(recruitId, recruit, {
|
||||
ConfigDescription: '' as IntlString,
|
||||
ShowApplications: '' as IntlString,
|
||||
HideDoneState: '' as IntlString,
|
||||
HideArchivedVacancies: '' as IntlString
|
||||
HideArchivedVacancies: '' as IntlString,
|
||||
HideApplicantsFromArchivedVacancies: '' as IntlString
|
||||
},
|
||||
validator: {
|
||||
ApplicantValidator: '' as Resource<<T extends Doc>(doc: T, client: Client) => Promise<Status>>
|
||||
|
@ -119,7 +119,8 @@
|
||||
"ShowApplications": "Show applications",
|
||||
"GetTalentIds": "Get talents' ids",
|
||||
"HideDoneState": "Hide complete applications",
|
||||
"HideArchivedVacancies": "Hide from archived Vacancies",
|
||||
"HideArchivedVacancies": "Hide archived Vacancies",
|
||||
"HideApplicantsFromArchivedVacancies": "Hide from archived Vacancies",
|
||||
"CreateNewSkills": "Create new skills if existing not found"
|
||||
},
|
||||
"status": {
|
||||
|
@ -120,6 +120,7 @@
|
||||
"GetTalentIds": "Получить ID талантов",
|
||||
"HideDoneState": "Скрыть завершенных кандидатов",
|
||||
"HideArchivedVacancies": "Скрыть архивные вакансии",
|
||||
"HideApplicantsFromArchivedVacancies": "Скрыть из архивных вакансии",
|
||||
"CreateNewSkills": "Создать навыки, если не найдены существующие"
|
||||
},
|
||||
"status": {
|
||||
|
@ -22,8 +22,6 @@
|
||||
import recruit from '../plugin'
|
||||
import CreateVacancy from './CreateVacancy.svelte'
|
||||
|
||||
export let archived = false
|
||||
|
||||
let search: string = ''
|
||||
let searchQuery: DocumentQuery<Doc> = {}
|
||||
let resultQuery: DocumentQuery<Doc> = {}
|
||||
@ -191,7 +189,7 @@
|
||||
viewOptionsConfig: viewlet.viewOptions?.other,
|
||||
query: {
|
||||
...resultQuery,
|
||||
archived
|
||||
...(viewOptions?.hideArchived !== false ? { archived: false } : {})
|
||||
},
|
||||
totalQuery: {},
|
||||
tableId: 'vacanciesData'
|
||||
|
@ -65,49 +65,62 @@
|
||||
dispatch('update', { key: model.key, value: viewOptions[model.key] })
|
||||
}
|
||||
|
||||
// checking if selector provides multiple choice options
|
||||
const hasMultipleSelections = (varTocheck: any) => {
|
||||
if (!varTocheck) return false
|
||||
if (Array.isArray(varTocheck)) {
|
||||
return varTocheck.filter((item) => item !== undefined && item !== null && item !== '').length > 1
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
$: visibleOthers = config.other.filter((p) => !p.hidden?.(viewOptions))
|
||||
</script>
|
||||
|
||||
<div class="antiCard dialog menu">
|
||||
<div class="antiCard-menu__spacer" />
|
||||
{#each groups as group, i}
|
||||
<div class="antiCard-menu__item grouping">
|
||||
<span class="overflow-label"><Label label={i === 0 ? view.string.Grouping : view.string.Then} /></span>
|
||||
{#if hasMultipleSelections(config.groupBy)}
|
||||
{#each groups as group, i}
|
||||
<div class="antiCard-menu__item grouping">
|
||||
<span class="overflow-label"><Label label={i === 0 ? view.string.Grouping : view.string.Then} /></span>
|
||||
<DropdownLabelsIntl
|
||||
label={view.string.Grouping}
|
||||
kind={'regular'}
|
||||
size={'medium'}
|
||||
items={getItems(groupBy, i, viewOptions.groupBy)}
|
||||
selected={group}
|
||||
width="10rem"
|
||||
justify="left"
|
||||
on:selected={(e) => {
|
||||
selectGrouping(e.detail, i)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
{/each}
|
||||
{/if}
|
||||
{#if hasMultipleSelections(config.orderBy)}
|
||||
<div class="antiCard-menu__item ordering">
|
||||
<span class="overflow-label"><Label label={view.string.Ordering} /></span>
|
||||
<DropdownLabelsIntl
|
||||
label={view.string.Grouping}
|
||||
label={view.string.Ordering}
|
||||
kind={'regular'}
|
||||
size={'medium'}
|
||||
items={getItems(groupBy, i, viewOptions.groupBy)}
|
||||
selected={group}
|
||||
items={orderBy}
|
||||
selected={viewOptions.orderBy?.[0]}
|
||||
width="10rem"
|
||||
justify="left"
|
||||
on:selected={(e) => {
|
||||
selectGrouping(e.detail, i)
|
||||
const key = e.detail
|
||||
const value = config.orderBy.find((p) => p[0] === key)
|
||||
if (value !== undefined) {
|
||||
viewOptions.orderBy = value
|
||||
dispatch('update', { key: 'orderBy', value })
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
{/each}
|
||||
<div class="antiCard-menu__item ordering">
|
||||
<span class="overflow-label"><Label label={view.string.Ordering} /></span>
|
||||
<DropdownLabelsIntl
|
||||
label={view.string.Ordering}
|
||||
kind={'regular'}
|
||||
size={'medium'}
|
||||
items={orderBy}
|
||||
selected={viewOptions.orderBy?.[0]}
|
||||
width="10rem"
|
||||
justify="left"
|
||||
on:selected={(e) => {
|
||||
const key = e.detail
|
||||
const value = config.orderBy.find((p) => p[0] === key)
|
||||
if (value !== undefined) {
|
||||
viewOptions.orderBy = value
|
||||
dispatch('update', { key: 'orderBy', value })
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
{#if visibleOthers.length > 0}
|
||||
{/if}
|
||||
{#if visibleOthers.length > 0 && (hasMultipleSelections(config.groupBy) || hasMultipleSelections(config.orderBy))}
|
||||
<div class="antiCard-menu__divider" />
|
||||
{/if}
|
||||
{#each visibleOthers as model}
|
||||
|
@ -66,8 +66,8 @@ function _getViewOptions (viewlet: Viewlet, viewOptionStore: Map<string, ViewOpt
|
||||
|
||||
function getDefaults (viewOptions: ViewOptionsModel): ViewOptions {
|
||||
const res: ViewOptions = {
|
||||
groupBy: [viewOptions.groupBy[0]],
|
||||
orderBy: viewOptions.orderBy?.[0]
|
||||
groupBy: [viewOptions.groupBy[0] ?? defaulOptions.groupBy[0]],
|
||||
orderBy: viewOptions.orderBy?.[0] ?? defaulOptions.orderBy
|
||||
}
|
||||
for (const opt of viewOptions.other) {
|
||||
res[opt.key] = opt.defaultValue
|
||||
|
@ -43,7 +43,26 @@ export class VacanciesPage extends CommonRecruitingPage {
|
||||
await this.page.locator('tr', { hasText: vacancyName }).locator('div[class$="firstCell"]').click()
|
||||
}
|
||||
|
||||
async checkVacancyNotExist (vacancyName: string): Promise<void> {
|
||||
await expect(this.page.locator('tr', { hasText: vacancyName })).toHaveCount(0)
|
||||
async rightClickVacancyByName (vacancyName: string): Promise<void> {
|
||||
await this.page
|
||||
.locator('tr', { hasText: vacancyName })
|
||||
.locator('div[class$="firstCell"]')
|
||||
.click({ button: 'right' })
|
||||
}
|
||||
|
||||
async archiveVacancyByName (vacancyName: string): Promise<void> {
|
||||
await this.rightClickVacancyByName(vacancyName)
|
||||
await this.page.waitForSelector('div.antiPopup :text("Archive")')
|
||||
await this.page.locator('div.antiPopup :text("Archive")').click()
|
||||
await this.page.waitForSelector('div.msgbox-container :text("Ok")')
|
||||
await this.page.locator('div.msgbox-container :text("Ok")').click()
|
||||
}
|
||||
|
||||
async checkVacancyNotExist (vacancyName: string, message: string): Promise<void> {
|
||||
await expect(this.page.locator('tr', { hasText: vacancyName }), message).toHaveCount(0)
|
||||
}
|
||||
|
||||
async checkVacancyExist (vacancyName: string, message: string): Promise<void> {
|
||||
await expect(this.page.locator('tr', { hasText: vacancyName }), message).toHaveCount(1)
|
||||
}
|
||||
}
|
||||
|
@ -108,4 +108,37 @@ test.describe('Vacancy tests', () => {
|
||||
await vacancyDetailsPage.addCompany('Apple')
|
||||
await vacancyDetailsPage.addDueDateToday()
|
||||
})
|
||||
|
||||
test('Filter vacancies', async ({ page }) => {
|
||||
// viable when test set of vacancies fits to single page
|
||||
const vacancyName = 'Archive Vacancy ' + generateId(5)
|
||||
const navigationMenuPage = new NavigationMenuPage(page)
|
||||
await navigationMenuPage.buttonVacancies.click()
|
||||
const vacanciesPage = new VacanciesPage(page)
|
||||
await vacanciesPage.createNewVacancy({
|
||||
title: vacancyName,
|
||||
description: 'Vacancy description from Filter vacancies test',
|
||||
location: 'Filter vacancies location'
|
||||
})
|
||||
await vacanciesPage.checkVacancyExist(vacancyName, `Created vacancy "${vacancyName}" visible by default.`)
|
||||
await vacanciesPage.archiveVacancyByName(vacancyName)
|
||||
|
||||
await vacanciesPage.checkVacancyNotExist(vacancyName, `Archieved vacancy "${vacancyName}" not visible by default.`)
|
||||
|
||||
await page.click("button:has-text('View')")
|
||||
await page.waitForSelector(".antiCard-menu__item:has-text('Hide archived vacancies')")
|
||||
await page.click(".antiCard-menu__item:has-text('Hide archived vacancies')")
|
||||
|
||||
await vacanciesPage.checkVacancyExist(
|
||||
vacancyName,
|
||||
`Archieved vacancy "${vacancyName}" visible when hide archved off.`
|
||||
)
|
||||
|
||||
await page.click(".antiCard-menu__item:has-text('Hide archived vacancies')")
|
||||
|
||||
await vacanciesPage.checkVacancyNotExist(
|
||||
vacancyName,
|
||||
`Archieved vacancy "${vacancyName}" not visible when hide archved back on.`
|
||||
)
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user