-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TECH] Passage de PixCertif vers Ember Octane (3.15)
Merge pull request #976 from 1024pix/tech-pix-certif-to-ember-octane
- Loading branch information
Showing
112 changed files
with
2,405 additions
and
3,840 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
|
||
extends: 'octane', | ||
rules: { | ||
'no-invalid-interactive': false, | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
import ApplicationAdapter from './application'; | ||
|
||
export default ApplicationAdapter.extend({ | ||
export default class UserAdapter extends ApplicationAdapter { | ||
|
||
urlForQueryRecord(query) { | ||
if (query.me) { | ||
delete query.me; | ||
return `${this._super(...arguments)}/me`; | ||
return `${super.urlForQueryRecord(...arguments)}/me`; | ||
} | ||
|
||
return this._super(...arguments); | ||
}, | ||
return super.urlForQueryRecord(...arguments); | ||
} | ||
|
||
urlForUpdateRecord(id, modelName, { adapterOptions }) { | ||
const url = this._super(...arguments); | ||
const url = super.urlForUpdateRecord(...arguments); | ||
|
||
if (adapterOptions && adapterOptions.acceptPixCertifTermsOfService) { | ||
delete adapterOptions.acceptPixCertifTermsOfService; | ||
return url + '/pix-certif-terms-of-service-acceptance'; | ||
} | ||
|
||
return url; | ||
}, | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import OAuth2PasswordGrant from 'ember-simple-auth/authenticators/oauth2-password-grant'; | ||
import ENV from 'pix-certif/config/environment'; | ||
|
||
export default OAuth2PasswordGrant.extend({ | ||
serverTokenEndpoint: `${ENV.APP.API_HOST}/api/token`, | ||
serverTokenRevocationEndpoint: `${ENV.APP.API_HOST}/api/revoke`, | ||
}); | ||
export default class OAuth2Authenticator extends OAuth2PasswordGrant { | ||
serverTokenEndpoint = `${ENV.APP.API_HOST}/api/token`; | ||
serverTokenRevocationEndpoint = `${ENV.APP.API_HOST}/api/revoke`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{{#if @isLoading }} | ||
<button data-test-id="action-button" class="button button--regular button--link" {{on 'click' @handleClick}} ...attributes> | ||
<span class="button__loader"> </span> | ||
</button> | ||
{{else}} | ||
<button data-test-id="action-button" class="button button--regular button--link" {{on 'click' @handleClick}} ...attributes> | ||
{{yield}} | ||
</button> | ||
{{/if}} |
This file was deleted.
Oops, something went wrong.
102 changes: 102 additions & 0 deletions
102
certif/app/components/certification-candidate-in-staging-item.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
<tr> | ||
<td data-test-id='panel-candidate__lastName__add-staging'> | ||
<div class="certification-candidates-input-wrapper"> | ||
<input | ||
value="{{@candidateData.lastName}}" | ||
class="certification-candidates-input" | ||
{{on 'input' (fn @updateCandidateData @candidateData 'lastName')}} > | ||
</div> | ||
</td> | ||
<td data-test-id='panel-candidate__firstName__add-staging'> | ||
<div class="certification-candidates-input-wrapper"> | ||
<input | ||
value="{{@candidateData.firstName}}" | ||
class="certification-candidates-input" | ||
{{on 'input' (fn @updateCandidateData @candidateData 'firstName')}} > | ||
</div> | ||
</td> | ||
<td data-test-id='panel-candidate__birthdate__add-staging'> | ||
<div class="certification-candidates-input-wrapper"> | ||
<OneWayDateMask | ||
@placeholder='dd/mm/yyyy' | ||
@options={{hash inputFormat='dd/mm/yyyy' outputFormat='yyyy-mm-dd'}} | ||
@class='certification-candidates-input' | ||
@update={{this.updateCandidateDataBirthdate}}> | ||
</OneWayDateMask> | ||
</div> | ||
</td> | ||
<td data-test-id='panel-candidate__birthCity__add-staging'> | ||
<div class="certification-candidates-input-wrapper"> | ||
<input | ||
value="{{@candidateData.birthCity}}" | ||
class="certification-candidates-input" | ||
{{on 'input' (fn @updateCandidateData @candidateData 'birthCity')}} > | ||
</div> | ||
</td> | ||
<td data-test-id='panel-candidate__birthProvinceCode__add-staging'> | ||
<div class="certification-candidates-input-wrapper"> | ||
<input | ||
value="{{@candidateData.birthProvinceCode}}" | ||
class="certification-candidates-input" | ||
{{on 'input' (fn @updateCandidateData @candidateData 'birthProvinceCode')}} > | ||
</div> | ||
</td> | ||
<td data-test-id='panel-candidate__birthCountry__add-staging'> | ||
<div class="certification-candidates-input-wrapper"> | ||
<input | ||
value="{{@candidateData.birthCountry}}" | ||
class="certification-candidates-input" | ||
{{on 'input' (fn @updateCandidateData @candidateData 'birthCountry')}} > | ||
</div> | ||
</td> | ||
<td data-test-id='panel-candidate__email__add-staging'> | ||
<div class="certification-candidates-input-wrapper"> | ||
<input | ||
value="{{@candidateData.email}}" | ||
class="certification-candidates-input" | ||
{{on 'input' (fn @updateCandidateData @candidateData 'email')}} > | ||
</div> | ||
</td> | ||
<td data-test-id='panel-candidate__externalId__add-staging'> | ||
<div class="certification-candidates-input-wrapper"> | ||
<input | ||
value="{{@candidateData.externalId}}" | ||
class="certification-candidates-input" | ||
{{on 'input' (fn @updateCandidateData @candidateData 'externalId')}} > | ||
</div> | ||
</td> | ||
<td data-test-id='panel-candidate__extraTimePercentage__add-staging'> | ||
<div class="certification-candidates-input-wrapper"> | ||
<input | ||
value="{{@candidateData.extraTimePercentage}}" | ||
class="certification-candidates-input" | ||
{{on 'input' (fn @updateCandidateData @candidateData 'extraTimePercentage')}} > | ||
<span class="certification-candidates-percentage"> | ||
% | ||
</span> | ||
</div> | ||
</td> | ||
<td> | ||
<div class="certification-candidates-input-wrapper certification-candidates-row-actions"> | ||
{{#if (and | ||
@candidateData.firstName | ||
@candidateData.lastName | ||
(is-after @candidateData.birthdate '1900-01-01') | ||
@candidateData.birthCity | ||
@candidateData.birthProvinceCode | ||
@candidateData.birthCountry | ||
)}} | ||
<button data-test-id='panel-candidate__action__save' class="button button--row-item" type="button" {{on "click" (fn @onClickSave @candidateData)}}> | ||
Enregistrer | ||
</button> | ||
{{else}} | ||
<button data-test-id='panel-candidate__action__save' class="button button--row-item button--disabled" type="button" disabled="true"> | ||
Enregistrer | ||
</button> | ||
{{/if}} | ||
<button data-test-id='panel-candidate__action__cancel' class="button button--square button--lightgrey certification-candidates-row-actions__close" type="button" {{on "click" (fn @onClickCancel @candidateData)}}> | ||
{{fa-icon "times" class="fa-fw certification-candidates-add-button__icon"}} | ||
</button> | ||
</div> | ||
</td> | ||
</tr> |
23 changes: 8 additions & 15 deletions
23
certif/app/components/certification-candidate-in-staging-item.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,10 @@ | ||
import moment from 'moment'; | ||
import Component from '@ember/component'; | ||
import { computed } from '@ember/object'; | ||
import Component from '@glimmer/component'; | ||
import { action } from '@ember/object'; | ||
|
||
export default Component.extend({ | ||
tagName: 'tr', | ||
export default class CertificationCandidateInStagingItem extends Component { | ||
|
||
isCandidateDataValid: computed('candidateData.{firstName,lastName,birthCountry,birthProvinceCode,birthCity,birthdate}', function() { | ||
return this.candidateData.firstName && | ||
this.candidateData.lastName && | ||
this.candidateData.birthCity && | ||
this.candidateData.birthProvinceCode && | ||
this.candidateData.birthCountry && | ||
moment.utc(this.candidateData.birthdate, 'YYYY-MM-DD', true).isValid(); | ||
}), | ||
|
||
}); | ||
@action | ||
updateCandidateDataBirthdate(value) { | ||
this.args.updateCandidateBirthdate(this.args.candidateData, value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,43 @@ | ||
import Component from '@ember/component'; | ||
import { computed } from '@ember/object'; | ||
import { inject } from '@ember/service'; | ||
import Component from '@glimmer/component'; | ||
import { inject as service } from '@ember/service'; | ||
import { action } from '@ember/object'; | ||
import { tracked } from '@glimmer/tracking'; | ||
|
||
export default Component.extend({ | ||
export default class LoginForm extends Component { | ||
|
||
session: inject(), | ||
@service session; | ||
@tracked isPasswordVisible; | ||
@tracked isErrorMessagePresent; | ||
|
||
email: null, | ||
password: null, | ||
isPasswordVisible: false, | ||
passwordInputType: computed('isPasswordVisible', function() { | ||
return this.isPasswordVisible ? 'text' : 'password'; | ||
}), | ||
|
||
isErrorMessagePresent: false, | ||
constructor() { | ||
super(...arguments); | ||
|
||
actions: { | ||
this.email = null; | ||
this.password = null; | ||
this.isPasswordVisible = false; | ||
this.isErrorMessagePresent = false; | ||
} | ||
|
||
async authenticate() { | ||
const email = this.email ? this.email.trim() : ''; | ||
const password = this.password; | ||
const scope = 'pix-certif'; | ||
try { | ||
await this.session.authenticate('authenticator:oauth2', email, password, scope); | ||
} catch (err) { | ||
this.set('isErrorMessagePresent', true); | ||
} | ||
}, | ||
get passwordInputType() { | ||
return this.isPasswordVisible ? 'text' : 'password'; | ||
} | ||
|
||
togglePasswordVisibility() { | ||
this.toggleProperty('isPasswordVisible'); | ||
@action | ||
async authenticate(event) { | ||
event.preventDefault(); | ||
const email = this.email ? this.email.trim() : ''; | ||
const password = this.password; | ||
const scope = 'pix-certif'; | ||
try { | ||
await this.session.authenticate('authenticator:oauth2', email, password, scope); | ||
} catch (err) { | ||
this.isErrorMessagePresent = true; | ||
} | ||
} | ||
|
||
@action | ||
togglePasswordVisibility() { | ||
this.isPasswordVisible = !this.isPasswordVisible; | ||
} | ||
|
||
}); | ||
} |
2 changes: 1 addition & 1 deletion
2
...thenticated/sessions/no-session-panel.hbs → certif/app/components/no-session-panel.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 0 additions & 9 deletions
9
certif/app/components/routes/authenticated/sessions/details-item.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.