diff --git a/dashboard-prime/src/components/projects/ProjectPage.vue b/dashboard-prime/src/components/projects/ProjectPage.vue index 9276163623..96f56e7373 100644 --- a/dashboard-prime/src/components/projects/ProjectPage.vue +++ b/dashboard-prime/src/components/projects/ProjectPage.vue @@ -132,7 +132,6 @@ const headerOptions = computed(() => { stats.push({ label: 'Points', count: project.value.totalPoints, - warnMsg: project.value.totalPoints < minimumPoints ? 'Project has insufficient points assigned. Skills cannot be achieved until project has at least 100 points.' : null, icon: 'far fa-arrow-alt-circle-up skills-color-points', secondaryStats: [{ label: 'reused', @@ -162,8 +161,9 @@ const headerOptions = computed(() => { } }) -const minimumPoints = computed(() => { - return appConfig.minimumProjectPoints +const isInsufficientPoints = computed(() => { + const projPoints = project.value?.totalPoints || 0 + return projPoints < appConfig.minimumProjectPoints }) const copyAndDisplayShareProjInfo = () => { @@ -197,12 +197,16 @@ const setProject = (newProject) => { projectDetailsState.project = newProject } +const isProjectExpiring = computed(() => { + return project.value && project.value.expiring && !isReadOnlyProj.value +}) + </script> <template> <div ref="mainFocus"> <PageHeader :loading="isLoading" :options="headerOptions"> - <template #banner v-if="project && project.expiring && !isReadOnlyProj"> + <template #banner v-if="isProjectExpiring"> <project-expiration-warning :project="project" @extended="project.expiring = false" /> </template> <template #subTitle v-if="project"> @@ -280,6 +284,10 @@ const setProject = (newProject) => { </template> </PageHeader> + <Message v-if="isInsufficientPoints" :closable="false" data-cy="projectInsufficientPoints"> + Project has insufficient points assigned. Skills cannot be achieved until project has at least <Tag>{{ appConfig.minimumProjectPoints }}</Tag> points. + </Message> + <import-finalize-alert /> <Navigation :nav-items="navItems"> diff --git a/dashboard-prime/src/components/subjects/SubjectPage.vue b/dashboard-prime/src/components/subjects/SubjectPage.vue index 741798d402..dca23d6492 100644 --- a/dashboard-prime/src/components/subjects/SubjectPage.vue +++ b/dashboard-prime/src/components/subjects/SubjectPage.vue @@ -88,7 +88,6 @@ const headerOptions = computed(() => { label: 'Points', count: subject.totalPoints, warn: subject.totalPoints < minimumPoints.value, - warnMsg: (subject.totalPoints + subject.totalPointsReused) < minimumPoints.value ? `Subject has insufficient points assigned. Skills cannot be achieved until subject has at least ${minimumPoints.value} points.` : null, icon: 'far fa-arrow-alt-circle-up skills-color-points', secondaryStats: [{ label: 'reused', @@ -99,6 +98,10 @@ const headerOptions = computed(() => { } }) +const isInsufficientPoints = computed(() => { + return subjectState.subject.totalPoints < appConfig.minimumSubjectPoints +}) + const minimumPoints = computed(() => { return appConfig.minimumSubjectPoints }) @@ -156,6 +159,10 @@ const subjectEdited = (updatedSubject) => { </template> </page-header> + <Message v-if="isInsufficientPoints" :closable="false" data-cy="subjInsufficientPoints"> + Subject has insufficient points assigned. Skills cannot be achieved until subject has at least <Tag>{{ appConfig.minimumSubjectPoints}}</Tag> points + </Message> + <import-finalize-alert /> <navigation v-if="!isLoadingData" :nav-items="navItems"> diff --git a/e2e-tests/cypress/e2e/projects_spec.js b/e2e-tests/cypress/e2e/projects_spec.js index 728ed87398..ae54cae6e7 100644 --- a/e2e-tests/cypress/e2e/projects_spec.js +++ b/e2e-tests/cypress/e2e/projects_spec.js @@ -278,6 +278,35 @@ describe('Projects Tests', () => { .contains('Project has insufficient points assigned'); cy.get('[data-cy="projectCard_proj3"] [data-cy="projectCardWarning"]') .contains('Project has insufficient points assigned'); + + cy.get('[data-cy="projectCard_proj2"] [data-cy="projectCardWarning"] [data-pc-section="closeicon"]').click(); + cy.get('[data-cy="projectCard_proj3"] [data-cy="projectCardWarning"]') + .contains('Project has insufficient points assigned'); + cy.get('[data-cy="projectCard_proj1"] [data-cy="projectCardWarning"]').should('not.exist') + cy.get('[data-cy="projectCard_proj2"] [data-cy="projectCardWarning"]').should('not.exist') + + cy.visit('/administrator'); + cy.get('[data-cy="projectCard_proj3"] [data-cy="projectCardWarning"]') + .contains('Project has insufficient points assigned'); + cy.get('[data-cy="projectCard_proj1"] [data-cy="projectCardWarning"]').should('not.exist') + cy.get('[data-cy="projectCard_proj2"] [data-cy="projectCardWarning"]').should('not.exist') + + cy.get('[data-cy="projCard_proj2_manageLink"]').click() + cy.contains('No Subjects Yet') + cy.get('[data-cy="projectInsufficientPoints"]') + + cy.get('[data-cy="breadcrumb-Projects"]').click() + cy.get('[data-cy="projCard_proj1_manageLink"]').click() + cy.get('[data-cy="subjectCard-subj1"]') + cy.get('[data-cy="projectInsufficientPoints"]').should('not.exist') + + cy.visit('/administrator/projects/proj2'); + cy.contains('No Subjects Yet') + cy.get('[data-cy="projectInsufficientPoints"]') + + cy.visit('/administrator/projects/proj1'); + cy.get('[data-cy="subjectCard-subj1"]') + cy.get('[data-cy="projectInsufficientPoints"]').should('not.exist') }); it('project description is retained after editing', () => { diff --git a/e2e-tests/cypress/e2e/subjects_spec.js b/e2e-tests/cypress/e2e/subjects_spec.js index d10bef282f..fbfe8328c6 100644 --- a/e2e-tests/cypress/e2e/subjects_spec.js +++ b/e2e-tests/cypress/e2e/subjects_spec.js @@ -965,4 +965,28 @@ describe('Subjects Tests', () => { cy.wait('@validateDesc') cy.get('[data-cy="descriptionError"]').contains('Mocked up validation failure') }); + + it('insufficient points warning', () => { + cy.createSubject(1, 1); + cy.createSkill(1, 1, 1); + cy.createSubject(1, 2); + + cy.visit('/administrator/projects/proj1') + cy.get('[data-cy="subjectCard-subj2"] [data-cy="titleLink"]').click() + cy.contains('No Skills Yet') + cy.get('[data-cy="subjInsufficientPoints"]') + + cy.get('[data-cy="breadcrumb-proj1"]').click() + cy.get('[data-cy="subjectCard-subj1"] [data-cy="titleLink"]').click() + cy.get('[data-cy="manageSkillLink_skill1"]') + cy.get('[data-cy="subjInsufficientPoints"]').should('not.exist') + + cy.visit('/administrator/projects/proj1/subjects/subj2') + cy.contains('No Skills Yet') + cy.get('[data-cy="subjInsufficientPoints"]') + + cy.visit('/administrator/projects/proj1/subjects/subj1') + cy.get('[data-cy="manageSkillLink_skill1"]') + cy.get('[data-cy="subjInsufficientPoints"]').should('not.exist') + }) });