Skip to content

Commit

Permalink
Merge pull request #2640 from NationalSecurityAgency/t#2490/self_repo…
Browse files Browse the repository at this point in the history
…rt_configure

T#2490/self report configure
  • Loading branch information
sudo-may authored Jul 10, 2024
2 parents feabfe9 + 17200a0 commit 17d2f4d
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 81 deletions.
54 changes: 25 additions & 29 deletions dashboard-prime/src/components/projects/EmailUsers.vue
Original file line number Diff line number Diff line change
Expand Up @@ -544,51 +544,47 @@ const previewEmail = () => {
</Message>
<BlockUI :blocked="!emailFeatureConfigured">
<div class="font-bold text-lg pt-2 mt-2 pr-2 pl-2 mr-2 ml-2 uppercase">Filters</div>
<div class="flex p-2 m-2 gap-2">
<div class="flex flex-1 border-right-1">
<SkillsDropDown
label="Type"
name="filterSelector"
id="filterSelector"
:disabled="criteria.allProjectUsers"
data-cy="filterSelector"
class="w-full ml-2 mr-4"
placeholder="Select a filter to add"
optionLabel="text"
optionValue="value"
v-model="currentFilterType"
:options="filterOptions" />
</div>
<div class="flex flex-1 gap-2 flex-column">
<div class="font-bold text-lg uppercase mb-3">Filters</div>
<div class="">
<SkillsDropDown
label="Type"
name="filterSelector"
id="filterSelector"
:disabled="criteria.allProjectUsers"
data-cy="filterSelector"
class="w-full"
placeholder="Select a filter to add"
optionLabel="text"
optionValue="value"
v-model="currentFilterType"
:options="filterOptions" />
<div class="flex flex-1 gap-2 flex-column ml-4">
<SkillsDropDown
v-if="currentFilterType && currentFilterType !== 'project'"
:disabled="currentFilterType && currentFilterType === 'project'"
label="Name"
name="name-selector"
id="name-selector"
data-cy="name-selector"
class="ml-2"
:placeholder="selectText"
optionLabel="name"
v-model="selectedItem"
:options="ids" />
<SkillsDropDown
v-if="currentFilterType !== 'skill' && currentFilterType !== 'badge'"
v-if="currentFilterType === 'project' || currentFilterType === 'subject'"
label="Minimum Level"
name="emailUsers-levelsInput"
id="emailUsers-levelsInput"
data-cy="emailUsers-levelsInput"
class="ml-2"
optionLabel="text"
optionValue="value"
placeholder="Any Level"
:disabled="levelsDisabled || criteria.allProjectUsers"
v-model="levels.selected"
:options="levels.available" />
<div class="flex" v-if="currentFilterType && currentFilterType==='skill'">
<div class="flex mb-3" v-if="currentFilterType && currentFilterType==='skill'">
<SkillsInputSwitch
v-model="skills.achieved"
inputId="skillAchieved"
Expand All @@ -599,7 +595,7 @@ const previewEmail = () => {
</div>
</div>
<div>
<SkillsButton class="mr-1 mt-4" @click="addCriteria" data-cy="emailUsers-addBtn"
<SkillsButton class="ml-4" @click="addCriteria" data-cy="emailUsers-addBtn"
:disabled="isAddDisabled || maxTagsReached" label="Add" icon="fas fa-plus-circle" />
<transition name="fade">
<span v-if="alreadyApplied" data-cy="filterExists" class="pt-2 pl-1" role="alert">Filter already exists</span>
Expand All @@ -608,30 +604,30 @@ const previewEmail = () => {
</div>
</div>
<div class="pl-3 pr-3 pb-3 pt-1 mr-3 ml-1">
<div class="pr-3 pb-3 pt-4 mr-3 ml-1">
<div class="flex flex-wrap gap-2 pb-3 mt-1 ml-3">
<Chip v-for="(tag) of tags" :key="tag.display" :label="tag.display" data-cy="filterBadge" removable @remove="deleteCriteria(tag)" />
</div>
<div class="ml-4 h5 uppercase" data-cy="usersMatchingFilters"><Badge variant="info">{{currentCount}}</Badge> Users Selected</div>
<div class="h5 uppercase" data-cy="usersMatchingFilters"><Badge variant="info">{{currentCount}}</Badge> Users Selected</div>
</div>
<hr />
<div class="pl-2 ml-2 pr-2 mr-2 pb-2 font-bold text-lg uppercase">Email Content</div>
<div class="flex pl-3 pr-3 pt-3 pb-1 m-3 mb-1">
<div class="py-2 font-bold text-lg uppercase">Email Content</div>
<div class="mt-2">
<SkillsTextInput name="subjectLine" label="Subject Line" data-cy="emailUsers_subject" class="w-full" />
</div>
<div class="flex pl-3 pr-3 pb-1 ml-3 mr-3 mb-1 mt-1">
<div class="flex w-full">
<markdown-editor class="w-full"
data-cy="emailUsers_body"
label="Email Body"
name="emailBody"
:resizable="true"
:resizable="false"
:allow-attachments="false"
:use-html="true"/>
</div>
<div class="flex pl-3 pr-3 pb-3 pt-1 ml-3 mr-3 mb-3 mt-1">
<div class="flex ">
<SkillsButton class="mr-3" data-cy="previewUsersEmail"
:disabled="isPreviewDisabled || !meta.valid"
@click="previewEmail"
Expand Down
6 changes: 2 additions & 4 deletions dashboard-prime/src/components/skills/AddSkillEvent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,13 @@ const { values, meta, handleSubmit, isSubmitting, setFieldValue, validate, error
})
onMounted(() => {
isLoading.value = true;
loadProject()
});
watch(
() => skillsState.skill?.totalPoints,
() => {
if (!isLoading.value) {
isLoading.value = true;
(after, before) => {
if (before) {
loadProject(true)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ const userTagConfLabel = computed(() => {
});
const toggleConfDetails = (dataToToggle) => {
// eslint-disable-next-line no-underscore-dangle
// data.value = data.value.map((item) => ({ ...item, _showDetails: data.item.userId === item.userId ? !item._showDetails : false }));
data.value.forEach((item) => {
collapseRow(item.userId);
})
toggleRow(dataToToggle.userId);
};
Expand Down Expand Up @@ -139,9 +134,6 @@ const updateTable = (basicTableInfo) => {
data.value = res;
};
const removeTagConf = (removedConf) => {
removeConf(removedConf, 'tagConf');
};
const updatedConf = (newConf) => {
const itemToUpdate = data.value.find((i) => i.userId === newConf.approverUserId);
Expand Down Expand Up @@ -267,10 +259,10 @@ const sortTable = (sortContext) => {
<span class=""><i class="fas fa-users" :class="colors.getTextClass(2)" aria-hidden="true"/> Approval Workload</span>
</template>
<template #body="slotProps">
<div class="flex" :data-cy="`workloadCell_${slotProps.data.userId}`">
<div class="flex flex-1">
<div v-if="!slotProps.data.hasConf">
<InputSwitch class="mr-2"
<div class="flex gap-2" :data-cy="`workloadCell_${slotProps.data.userId}`">
<div class="flex flex-1 gap-2 align-items-center">
<div v-if="!slotProps.data.hasConf" class="flex flex-1 gap-2 align-items-center">
<InputSwitch
:aria-label="`Enable and disable fallback for ${slotProps.data.userId} approve`"
@update:modelValue="handleFallback($event, slotProps.data)"
data-cy="fallbackSwitch"
Expand All @@ -283,10 +275,10 @@ const sortTable = (sortContext) => {
<div v-for="tConf in slotProps.data.tagConf" :key="tConf.userTagValue">Users in <span class="font-italic text-secondary">{{tConf.userTagKeyLabel}}:</span> <span>{{tConf.userTagValue}}</span></div>
</div>
<div v-if="slotProps.data.userConf && slotProps.data.userConf.length > 0" >
<Badge variant="success">{{slotProps.data.userConf.length}}</Badge> Specific User{{ slotProps.data.userConf.length > 1 ? 's' : '' }}
<Tag variant="success">{{slotProps.data.userConf.length}}</Tag> Specific User{{ slotProps.data.userConf.length > 1 ? 's' : '' }}
</div>
<div v-if="slotProps.data.skillConf && slotProps.data.skillConf.length > 0" >
<Badge variant="info">{{ slotProps.data.skillConf.length }}</Badge> Specific Skill{{ slotProps.data.skillConf.length > 1 ? 's' : '' }}
<Tag variant="info">{{ slotProps.data.skillConf.length }}</Tag> Specific Skill{{ slotProps.data.skillConf.length > 1 ? 's' : '' }}
</div>
</div>
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,13 @@ const removeTagConf = (removedItem) => {
</script>

<template>
<Card>
<Card :pt="{ body: { class: 'p-0' }, content: { class: 'p-0' } }">
<template #header>
<SkillsCardHeader title="Split Workload By Skill"></SkillsCardHeader>
</template>
<template #content>
<div v-if="!(loadingMeta.skills || loadingMeta.subjects)" class="flex no-gutters mx-1">
<div class="flex flex-1 flex-column mx-1 mt-1 align-self-end">
<div v-if="!(loadingMeta.skills || loadingMeta.subjects)" class="flex gap-1 align-items-center pt-3 px-3 flex-column lg:flex-row">
<div class="flex flex-1 flex-column mx-1 mt-1 w-full">
<div class="mb-1">Add a Single Skill</div>
<skills-selector
:disabled="selectedSubject !== null || loading"
Expand All @@ -196,10 +196,10 @@ const removeTagConf = (removedItem) => {
:onlySingleSelectedValue="true"
:warnBeforeRemoving="false"/>
</div>
<div class="flex mx-1 text-center align-self-end">
<span class="mt-3">OR</span>
<div class="flex mx-1 text-center">
<span class="text-center">OR</span>
</div>
<div class="flex flex-1 flex-column mx-1 mt-1 align-self-end">
<div class="flex flex-1 flex-column mx-1 mt-1 align-self-end w-full">
<div class="mb-1">Add <b>ALL</b> Skills under a Subject</div>
<subject-selector v-if="availableSubjects && availableSubjects.length > 0"
:disabled="(selectedSkills && selectedSkills.length > 0) || loading"
Expand All @@ -210,7 +210,7 @@ const removeTagConf = (removedItem) => {
:onlySingleSelectedValue="true"
:warnBeforeRemoving="false"/>
</div>
<div class="mx-1 mt-1 text-center align-self-end">
<div class="mx-1 mt-1 text-center lg:align-self-end">
<SkillsButton
aria-label="Add Tag Value"
@click="addSkillToConf"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ const updateSelectedList = () => {
</script>
<template>
<Card>
<Card :pt="{ body: { class: 'p-0' }, content: { class: 'p-0' } }">
<template #header>
<SkillsCardHeader title="Split Workload By Specific Users"></SkillsCardHeader>
</template>
<template #content>
<div class="flex mx-2">
<div class="flex px-3 pt-3 gap-2 flex-column md:flex-row align-items-center">
<div class="flex flex-1 px-1">
<existing-user-input
class="w-full"
Expand Down Expand Up @@ -180,7 +180,7 @@ const updateSelectedList = () => {
</SkillsDataTable>
<no-content2 v-if="!hadData" title="Not Configured Yet..."
class="my-5"
class="py-5"
data-cy="noUserConf"
icon-size="fa-2x"
icon="fas fa-user-plus">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ const removeTagConf = (removedIem) => {
</script>
<template>
<Card>
<Card :pt="{ body: { class: 'p-0' }, content: { class: 'p-0' } }">
<template #header>
<SkillsCardHeader :title="'Split Workload By ' + tagLabel"></SkillsCardHeader>
</template>
<template #content>
<div class="flex gap-2">
<div class="flex gap-2 px-3 pt-3">
<div class="flex flex-1">
<SkillsTextInput
class="w-full"
Expand Down Expand Up @@ -151,7 +151,7 @@ const removeTagConf = (removedIem) => {
</SkillsDataTable>
<no-content2 v-if="!hadData" title="Not Configured Yet..."
class="my-5"
class="py-5"
icon-size="fa-2x"
data-cy="noTagKeyConf"
icon="fas fa-user-tag">
Expand Down
14 changes: 0 additions & 14 deletions e2e-tests/cypress/e2e/approver/approver_conf_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,18 +167,4 @@ describe('Approver Config Tests', () => {
});
});

it('only one row can be expanded', function () {
cy.request('POST', `/admin/projects/proj1/users/user1/roles/ROLE_PROJECT_APPROVER`);
cy.request('POST', `/admin/projects/proj1/users/user2/roles/ROLE_PROJECT_APPROVER`);

cy.visit('/administrator/projects/proj1/self-report/configure');
const user1 = 'user1'
const user2 = 'user2'
cy.get(`[data-cy="workloadCell_${user1}"] [data-cy="editApprovalBtn"]`).click()
cy.get(`[data-cy="expandedChild_${user1}"] [data-cy="noUserConf"]`).should('exist')

cy.get(`[data-cy="workloadCell_${user2}"] [data-cy="editApprovalBtn"]`).click()
cy.get(`[data-cy="expandedChild_${user2}"] [data-cy="noUserConf"]`).should('exist')
cy.get(`[data-cy="expandedChild_${user1}"] [data-cy="noUserConf"]`).should('not.exist')
});
});
11 changes: 5 additions & 6 deletions e2e-tests/cypress/e2e/approver/approver_role_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -509,8 +509,7 @@ describe('Approver Role Tests', () => {
});

it('approver role does not have cannot add skill events', function () {
const runCheck = (projNum, assertChainPrepend = null) => {
const chainerPrepend = assertChainPrepend ? assertChainPrepend : '';
const runCheck = (projNum, chainerPrepend = '', addSkillEventAssertChainPrepend = '') => {

// don't even show the link for private projects
cy.visit(`/administrator/projects/proj${projNum}/subjects/subj1/skills/skill1`);
Expand All @@ -521,11 +520,11 @@ describe('Approver Role Tests', () => {
cy.wait(`@getSettingsProj${projNum}`);
cy.wait(`@getProj${projNum}Skill1`)
// cy.get('[data-cy="addSkillEventButton"]').should(`${chainerPrepend}be.enabled`);
cy.get('[data-cy="addEventDisabledBlockUI"] > [data-pc-section="mask"]').should(`${chainerPrepend}not.exist`);
cy.get('[data-cy="addEventDisabledMsg"]').should(`${chainerPrepend}not.exist`);
cy.get('[data-cy="addEventDisabledBlockUI"] > [data-pc-section="mask"]').should(`${addSkillEventAssertChainPrepend}exist`);
cy.get('[data-cy="addEventDisabledMsg"]').should(`${addSkillEventAssertChainPrepend}exist`);
}
runCheck(2)
runCheck(1, 'not.')
runCheck(2, '', 'not.')
runCheck(1, 'not.','')
});

});
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ describe('Client Display Tests', () => {
cy.wait('@pointHistoryChart');
cy.validatePoweredBy()
cy.get('[data-cy="subjectTileBtn"]').should('have.length', 3);
cy.wait(500); //we have to wait for the chart to load before doing accessibility tests
cy.wait(4000); //we have to wait for the chart to load before doing accessibility tests
cy.customA11y();
});

Expand Down

0 comments on commit 17d2f4d

Please sign in to comment.