Skip to content

Commit

Permalink
[FEATURE] Afficher un bandeau d'information concernant l'extension Co…
Browse files Browse the repository at this point in the history
…mpanion dans la page du surveillant sur Pix Certif (PIX-12779).

 #10366
  • Loading branch information
pix-service-auto-merge authored Oct 18, 2024
2 parents 8ae42f8 + a5b6a30 commit ef61d14
Show file tree
Hide file tree
Showing 9 changed files with 127 additions and 0 deletions.
15 changes: 15 additions & 0 deletions certif/app/components/session-supervising/header.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,21 @@
</div>
</dl>

{{#if this.isPixCompanionExtensionEnabled}}
<PixMessage @type="info" @withIcon={{true}}>
{{t "pages.session-supervising.header.companion.message"}}
<a
href={{this.pixCompanionDocumentationUrl}}
target="_blank"
class="link session-supervising-header__companion-link"
rel="noopener noreferrer"
>
{{t "pages.session-supervising.header.companion.link"}}
<PixIcon @name="openNew" @alternativeText={{t "navigation.external-link-title"}} />
</a>
</PixMessage>
{{/if}}

<SessionSupervising::ConfirmationModal
@showModal={{this.isConfirmationModalDisplayed}}
@closeConfirmationModal={{this.closeConfirmationModal}}
Expand Down
10 changes: 10 additions & 0 deletions certif/app/components/session-supervising/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { tracked } from '@glimmer/tracking';
export default class Header extends Component {
@service router;
@service intl;
@service url;
@service featureToggles;

@tracked modalDescriptionText;
@tracked modalCancelText;
Expand Down Expand Up @@ -34,4 +36,12 @@ export default class Header extends Component {
this.closeConfirmationModal();
return this.router.replaceWith('login-session-supervisor');
}

get pixCompanionDocumentationUrl() {
return this.url.pixCompanionDocumentationUrl;
}

get isPixCompanionExtensionEnabled() {
return this.featureToggles.featureToggles?.isPixCompanionEnabled;
}
}
1 change: 1 addition & 0 deletions certif/app/models/feature-toggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ import Model, { attr } from '@ember-data/model';

export default class FeatureToggle extends Model {
@attr('boolean') isNeedToAdjustCertificationAccessibilityEnabled;
@attr('boolean') isPixCompanionEnabled;
}
4 changes: 4 additions & 0 deletions certif/app/services/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ export default class Url extends Service {
return 'https://form-eu.123formbuilder.com/41052/form';
}

get pixCompanionDocumentationUrl() {
return 'https://cloud.pix.fr/s/fpeEyDpYEkMeqRX';
}

#isFrenchSpoken() {
return this.intl.primaryLocale === 'fr';
}
Expand Down
16 changes: 16 additions & 0 deletions certif/app/styles/components/session-supervising/header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@
font-weight: 500;
margin: 0;
padding: 8px 0;

&:last-child {
border-bottom: unset;
margin-bottom: var(--pix-spacing-4x);
}
}

&__label {
Expand All @@ -53,4 +58,15 @@
font-weight: normal;
margin-right: 8px;
}

&__companion-link {
align-items: center;
gap: var(--pix-spacing-1x);

svg {
width: 1rem;
height: 1rem;
fill: var(--pix-primary-500);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,64 @@ module('Integration | Component | SessionSupervising::Header', function (hooks)
assert.dom(screen.queryByRole('heading', { name: 'Quitter la surveillance de la session 12345' })).doesNotExist();
});
});

module('when the FT_PIX_COMPANION_ENABLED feature toggle is enabled', function () {
test('should display a companion information with documentation url', async function (assert) {
// given
class FeatureTogglesStub extends Service {
featureToggles = { isPixCompanionEnabled: true };
}
this.owner.register('service:featureToggles', FeatureTogglesStub);
const sessionForSupervising = store.createRecord('session-for-supervising', {
id: '12345',
date: '2020-01-01',
time: '12:00:00',
room: 'Salle 12',
examiner: 'Star Lord',
certificationCandidates: [],
});
this.set('sessionForSupervising', sessionForSupervising);

// when
const screen = await renderScreen(hbs`<SessionSupervising::Header @session={{this.sessionForSupervising}} />`);

// then
assert
.dom(screen.getByText('L’extension Pix Companion est désormais obligatoire pour tous les candidats.'))
.exists();
assert
.dom(screen.getByRole('link', { name: 'Lien vers la documentation d’installation/activation' }))
.hasAttribute('href', 'https://cloud.pix.fr/s/fpeEyDpYEkMeqRX');
});
});

module('when the FT_PIX_COMPANION_ENABLED feature toggle is disabled', function () {
test('should not display a companion information with documentation url', async function (assert) {
// given
class FeatureTogglesStub extends Service {
featureToggles = { isPixCompanionEnabled: false };
}
this.owner.register('service:featureToggles', FeatureTogglesStub);
const sessionForSupervising = store.createRecord('session-for-supervising', {
id: '12345',
date: '2020-01-01',
time: '12:00:00',
room: 'Salle 12',
examiner: 'Star Lord',
certificationCandidates: [],
});
this.set('sessionForSupervising', sessionForSupervising);

// when
const screen = await renderScreen(hbs`<SessionSupervising::Header @session={{this.sessionForSupervising}} />`);

// then
assert
.dom(screen.queryByText('L’extension Pix Companion est désormais obligatoire pour tous les candidats.'))
.doesNotExist();
assert
.dom(screen.queryByRole('link', { name: 'Lien vers la documentation d’installation/activation' }))
.doesNotExist();
});
});
});
13 changes: 13 additions & 0 deletions certif/tests/unit/services/url-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,4 +283,17 @@ module('Unit | Service | url', function (hooks) {
});
});
});

module('#pixCompanionDocumentationUrl', function () {
test('should return the pix companion documentation url', function (assert) {
// given
const service = this.owner.lookup('service:url');

// when
const pixCompanionDocumentationUrl = service.pixCompanionDocumentationUrl;

// then
assert.strictEqual(pixCompanionDocumentationUrl, 'https://cloud.pix.fr/s/fpeEyDpYEkMeqRX');
});
});
});
4 changes: 4 additions & 0 deletions certif/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,10 @@
"exit-extra-information": "Exit the session’s invigilation {sessionId}"
},
"address": "Location name",
"companion": {
"link": "Link to installation/activation documentation",
"message": "The Pix Companion extension is now mandatory for all candidates."
},
"information": "Warning, make sure that all the candidates have finished their exam before exiting the invigilation. To resume the invigilation of this session, you will have to enter again it’s session number and it’s password.",
"invigilator": "Invigilator(s)",
"room": "Room",
Expand Down
4 changes: 4 additions & 0 deletions certif/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,10 @@
"exit-extra-information": "Quitter la surveillance de la session {sessionId}"
},
"address": "Nom du site",
"companion": {
"link": "Lien vers la documentation d’installation/activation",
"message": "L’extension Pix Companion est désormais obligatoire pour tous les candidats."
},
"information": "Attention, assurez-vous que tous les candidats aient terminé leur test avant de quitter la surveillance. Pour reprendre la surveillance de cette session, vous devrez entrer à nouveau son numéro de session et son mot de passe.",
"invigilator": "Surveillant(s)",
"room": "Salle",
Expand Down

0 comments on commit ef61d14

Please sign in to comment.