-
Notifications
You must be signed in to change notification settings - Fork 0
Compatibilite crudit studio #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
59f8734
compatibilite / dependance a crudit studio 2le/crudit#556
TheoHab 2ac2bf1
compatibilite / dependance a crudit studio 2le/crudit#556
TheoHab 4b90e6b
cache + allegement cmd
1ab9c55
pipeline
dc0681b
github action cache v2->v4
e6d9957
Refactor load service
valentin-helies c793eb4
Refactor init + warmup services
valentin-helies 932ce96
Rename command
valentin-helies 3df05e5
Rename configs
valentin-helies c9cca4b
Delete useless service
valentin-helies 559631d
Update matrice
valentin-helies 33021a2
add client
e9f3ae5
Update design
valentin-helies edc8fc6
Update design
valentin-helies 37228e4
api toggle
da55b03
controller et js
9355b3e
Merge branch 'compatibilite_crudit_studio' of github.com:2lenet/Crede…
fdb7971
Modify controllers
valentin-helies 63fe5ef
Modify routes + warmup service
valentin-helies 9754900
Rename entity column
valentin-helies 26944b1
PHPCS
valentin-helies 2750eb9
PHPSTAN
valentin-helies af30db3
Add token for api call security
valentin-helies b6607fc
Modify load service
valentin-helies fe7a745
PHPCS
valentin-helies e081434
Merge master
valentin-helies a20e9a2
Fix phpstan
valentin-helies bb04d21
Fix phpstan annotation error
valentin-helies 358e579
Credential: modify setLabel parameter name
valentin-helies d7a1131
Fix some problems + finish client adaptation
valentin-helies 0460dc8
Fix PHPStan
valentin-helies 1ef6175
Lable => label
valentin-helies File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,3 @@ | ||
| /vendor/ | ||
| /.phpcs-cache | ||
| /node_modules |
This file contains hidden or 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,209 @@ | ||
| import Toastify from 'toastify-js' | ||
|
|
||
| window.addEventListener('load', () => { | ||
| let matrice = document.getElementById('lle-credential-matrice'); | ||
| if (matrice) { | ||
| checkSections(); | ||
| checkGroups(); | ||
|
|
||
| checkAllCredentialsOfGroup(); | ||
| checkAllCredentialsOfSection(); | ||
| checkCredential(); | ||
| enableCredentialByStatus(); | ||
| checkCredentialByStatus(); | ||
| } | ||
| }); | ||
|
|
||
| function checkSections() { | ||
| const sectionCheckboxes = document.querySelectorAll('.lle-credential-checkbox-group-section'); | ||
|
|
||
| // Check sectionCheckbox if all credentials are checked | ||
| for (let sectionCheckbox of sectionCheckboxes) { | ||
| let groupId = sectionCheckbox.dataset.groupId; | ||
| let sectionName = sectionCheckbox.dataset.sectionName; | ||
|
|
||
| let allChecked = true; | ||
| let checkboxes = document.querySelectorAll('.lle-credential-checkbox-group-' + groupId + '-section-' + sectionName + '-credential'); | ||
|
|
||
| for (let checkbox of checkboxes) { | ||
| if (!checkbox.checked) { | ||
| allChecked = false; | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| sectionCheckbox.checked = allChecked; | ||
| } | ||
| } | ||
|
|
||
| function checkGroups() { | ||
| const groupCheckboxes = document.querySelectorAll('.lle-credential-checkbox-group'); | ||
|
|
||
| // Check groupCheckbox if all sections are checked | ||
| for (let groupCheckbox of groupCheckboxes) { | ||
| let groupId = groupCheckbox.dataset.groupId; | ||
|
|
||
| let allChecked = true; | ||
| let checkboxes = document.querySelectorAll('.lle-credential-checkbox-group-' + groupId + '-section'); | ||
|
|
||
| for (let checkbox of checkboxes) { | ||
| if (!checkbox.checked) { | ||
| allChecked = false; | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| groupCheckbox.checked = allChecked; | ||
| } | ||
| } | ||
|
|
||
| function checkAllCredentialsOfGroup() { | ||
| const groupCheckboxes = document.querySelectorAll('.lle-credential-checkbox-group'); | ||
| groupCheckboxes.forEach((groupCheckbox) => { | ||
| groupCheckbox.addEventListener('click', () => { | ||
| let shouldCheck = window.confirm(groupCheckbox.dataset.confirmMessage); | ||
| if (!shouldCheck) { | ||
| groupCheckbox.checked = !groupCheckbox.checked; | ||
| return; | ||
| } | ||
|
|
||
| let groupId = groupCheckbox.dataset.groupId; | ||
| fetch('/admin/credential/toggle-group/' + groupId + '/' + (groupCheckbox.checked ? 1 : 0), { method: 'post' }) | ||
| .then((response) => { | ||
| if (response.status === 200) { | ||
| let checkboxes = document.querySelectorAll('.lle-credential-checkbox-group-' + groupId + '-credential'); | ||
| checkboxes.forEach((checkbox) => { | ||
| checkbox.checked = groupCheckbox.checked; | ||
| }); | ||
|
|
||
| let sectionCheckboxes = document.querySelectorAll('.lle-credential-checkbox-group-' + groupId + '-section'); | ||
| sectionCheckboxes.forEach((sectionCheckbox) => { | ||
| sectionCheckbox.checked = groupCheckbox.checked; | ||
| }); | ||
|
|
||
| showToast("Success", "#1CC88A"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. le message est toujours en anglais ? |
||
| } else { | ||
| groupCheckbox.checked = !groupCheckbox.checked; | ||
|
|
||
| showToast("Error", "#E74A3B"); | ||
| } | ||
| }); | ||
| }); | ||
| }); | ||
| } | ||
|
|
||
| function checkAllCredentialsOfSection() { | ||
| const sectionCheckboxes = document.querySelectorAll('.lle-credential-checkbox-group-section'); | ||
| sectionCheckboxes.forEach((sectionCheckbox) => { | ||
| sectionCheckbox.addEventListener('click', () => { | ||
| let shouldCheck = window.confirm(sectionCheckbox.dataset.confirmMessage); | ||
| if (!shouldCheck) { | ||
| sectionCheckbox.checked = !sectionCheckbox.checked; | ||
| return; | ||
| } | ||
|
|
||
| let groupId = sectionCheckbox.dataset.groupId; | ||
| let sectionName = sectionCheckbox.dataset.sectionName; | ||
| fetch('/admin/credential/toggle-section/' + sectionName + '/' + groupId + '/' + (sectionCheckbox.checked ? 1 : 0), { method: 'post' }) | ||
| .then((response) => { | ||
| if (response.status === 200) { | ||
| let checkboxes = document.querySelectorAll('.lle-credential-checkbox-group-' + groupId + '-section-' + sectionName + '-credential'); | ||
| checkboxes.forEach((checkbox) => { | ||
| checkbox.checked = sectionCheckbox.checked; | ||
| }); | ||
|
|
||
| showToast("Success", "#1CC88A"); | ||
| } else { | ||
| sectionCheckbox.checked = !sectionCheckbox.checked; | ||
|
|
||
| showToast("Error", "#E74A3B"); | ||
| } | ||
| }); | ||
|
|
||
| checkGroups(); | ||
| }); | ||
| }); | ||
| } | ||
|
|
||
| function checkCredential() { | ||
| const credentialCheckboxes = document.querySelectorAll('.lle-credential-checkbox'); | ||
| credentialCheckboxes.forEach((credentialCheckbox) => { | ||
| credentialCheckbox.addEventListener('click', () => { | ||
| let groupId = credentialCheckbox.dataset.groupId; | ||
| let credentialId = credentialCheckbox.dataset.credentialId; | ||
| fetch('/admin/credential/toggle-credential/' + credentialId + '/' + groupId + '/' + (credentialCheckbox.checked ? 1 : 0), { method: 'post' }) | ||
| .then((response) => { | ||
| if (response.status === 200) { | ||
| showToast("Success", "#1CC88A"); | ||
| } else { | ||
| credentialCheckbox.checked = !credentialCheckbox.checked; | ||
|
|
||
| showToast("Error", "#E74A3B"); | ||
| } | ||
| }); | ||
|
|
||
| checkSections(); | ||
| checkGroups(); | ||
| }); | ||
| }); | ||
| } | ||
|
|
||
| function enableCredentialByStatus() { | ||
| const credentialsByStatus = document.querySelectorAll('.lle-credential-checkbox-status-list'); | ||
| credentialsByStatus.forEach((credentialByStatus) => { | ||
| credentialByStatus.addEventListener('click', () => { | ||
| let groupId = credentialByStatus.dataset.groupId; | ||
| let credentialId = credentialByStatus.dataset.credentialId; | ||
| fetch('/admin/credential/allowed-status/' + credentialId + '/' + groupId + '/' + (credentialByStatus.checked ? 1 : 0), { method: 'post' }) | ||
| .then((response) => { | ||
| if (response.status === 200) { | ||
| let statusList = document.querySelector('.lle-credential-group-' + groupId + '-credential-' + credentialId + '-show-status'); | ||
| if (statusList.classList.contains('d-none')) { | ||
| statusList.classList.remove('d-none'); | ||
| } else { | ||
| statusList.classList.add('d-none'); | ||
| } | ||
|
|
||
| showToast("Success", "#1CC88A"); | ||
| } else { | ||
| credentialByStatus.checked = !credentialByStatus.checked; | ||
|
|
||
| showToast("Error", "#E74A3B"); | ||
| } | ||
| }); | ||
| }); | ||
| }); | ||
| } | ||
|
|
||
| function checkCredentialByStatus() { | ||
| const credentialStatusCheckboxes = document.querySelectorAll('.lle-credential-checkbox-group-credential-status'); | ||
| credentialStatusCheckboxes.forEach((credentialStatusCheckbox) => { | ||
| credentialStatusCheckbox.addEventListener('click', () => { | ||
| let groupId = credentialStatusCheckbox.dataset.groupId; | ||
| let credentialId = credentialStatusCheckbox.dataset.credentialId; | ||
| let credentialStatus = credentialStatusCheckbox.dataset.credentialStatus; | ||
| fetch('/admin/credential/allowed-by-status/' + credentialId + '/' + groupId + '/' + credentialStatus + '/' + (credentialStatusCheckbox.checked ? 1 : 0), { method: 'post' }) | ||
| .then((response) => { | ||
| if (response.status === 200) { | ||
| showToast("Success", "#1CC88A"); | ||
| } else { | ||
| credentialStatusCheckbox.checked = !credentialStatusCheckbox.checked; | ||
|
|
||
| showToast("Error", "#E74A3B"); | ||
| } | ||
| }); | ||
| }); | ||
| }); | ||
| } | ||
|
|
||
| function showToast(text, color) { | ||
| Toastify({ | ||
| text: text, | ||
| duration: 1500, | ||
| style: { | ||
| background: color, | ||
| padding: '15px 20px', | ||
| fontSize: '17px', | ||
| }, | ||
| }).showToast(); | ||
| } | ||
This file contains hidden or 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,27 @@ | ||
| @import 'toastify-js/src/toastify.css'; | ||
|
|
||
| #lle-credential-matrice { | ||
| .card-header { | ||
| background-color: #cccccc; | ||
| } | ||
|
|
||
| tbody { | ||
| tr { | ||
| th:first-child { | ||
| width: 450px; | ||
| } | ||
| } | ||
|
|
||
| tr:first-child { | ||
| .groups { | ||
| height: 200px; | ||
| display: flex; | ||
| justify-content: center; | ||
|
|
||
| span { | ||
| writing-mode: vertical-lr; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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,22 @@ | ||
| { | ||
| "devDependencies": { | ||
| "@symfony/webpack-encore": "^1.5.0", | ||
| "eslint": "^7.29.0", | ||
| "file-loader": "^6.2.0", | ||
| "jest": "^26.6.3", | ||
| "prettier": "^2.3.1", | ||
| "sass-loader": "^11.1.1" | ||
| }, | ||
| "license": "MIT", | ||
| "private": true, | ||
| "scripts": { | ||
| "dev": "encore dev", | ||
| "watch": "encore dev --watch", | ||
| "build": "encore production" | ||
| }, | ||
| "dependencies": { | ||
| "@popperjs/core": "^2.9.2", | ||
| "bootstrap": "^5.0.2", | ||
| "toastify-js": "^1.12.0" | ||
| } | ||
| } |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
du coup on part du principe qu'on met /admin en préfixe. bon j'imagine que c'était déjà le cas en v1