From 74aa65bab67943ee21604eb9847722cac63a27ab Mon Sep 17 00:00:00 2001 From: Calum Mackervoy <c.mackervoy@gmail.com> Date: Wed, 18 Mar 2020 11:41:58 +0000 Subject: [PATCH 1/6] joined circle spawns in my circles --- src/scripts/index.js | 17 ++++++++++------- src/views/admin/page-admin-circles.pug | 2 ++ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/scripts/index.js b/src/scripts/index.js index acbaa413..a4cb9a2c 100644 --- a/src/scripts/index.js +++ b/src/scripts/index.js @@ -76,10 +76,10 @@ function openRightMenu() { } //auxiliary function clears cache & refreshes sib-displays for a given resource ID -function refreshSibDisplays(resourceId, clearCache = true) { +function refreshElements(resourceId, clearCache = true, selector="sib-display") { let cacheCleared = false; - Array.from(document.querySelectorAll("sib-display")) + Array.from(document.querySelectorAll(selector)) .filter(sibDisplay => sibDisplay.component.resourceId == resourceId) // keep only elements with resource == edited resource .forEach(e => { //clear cache if we were unable to before @@ -111,16 +111,16 @@ async function refreshResource(event) { //refresh all resources using the partner ID if (partnerId != null) { - refreshSibDisplays(partnerId); - refreshSibDisplays(partnerId + "members/"); + refreshElements(partnerId); + refreshElements(partnerId + "members/"); } //special cases updating users/X/circles for the left-side-menu (leaving or joining circle) let user = await document.querySelector('sib-auth').getUser(); if(resourceId.includes('circle') && user != null) { let userId = user['@id']; - refreshSibDisplays(userId + "circles/"); - refreshSibDisplays(resourceId.split('/').slice(0,4).join('/')+'/joinable/'); + refreshElements(userId + "circles/"); + refreshElements(resourceId.split('/').slice(0,4).join('/')+'/joinable/'); } //clear cache on this resource @@ -132,7 +132,10 @@ async function refreshResource(event) { } //update all displays which use this resource - refreshSibDisplays(resourceId, cacheCleared); + if(resourceId.includes('/members/')) { + refreshElements(resourceId, cacheCleared, "sib-form"); + } + refreshElements(resourceId, cacheCleared); } //auxiliary function performs a redirect diff --git a/src/views/admin/page-admin-circles.pug b/src/views/admin/page-admin-circles.pug index c4428bdc..e16b76e3 100644 --- a/src/views/admin/page-admin-circles.pug +++ b/src/views/admin/page-admin-circles.pug @@ -51,6 +51,7 @@ data-label='Leave circle' ) + //- displaying both circles on my user.. sib-display( class='table-body' @@ -82,6 +83,7 @@ submit-button='Join Circle' ) + //- ..and federated circles which I can join sib-display( class='table-body' -- GitLab From cc2ee01fc79aff668567a8877307c300d1205e66 Mon Sep 17 00:00:00 2001 From: plup <plup@plup.io> Date: Thu, 19 Mar 2020 13:15:49 +0100 Subject: [PATCH 2/6] cicd: added deploy config for nantes --- .gitlab-ci.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bd43a4cc..dd84f4b4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,7 +16,7 @@ deploy_test1: url: https://test1.startinblox.com script: - echo "$APP_CONFIG_TEST1" > config.json - - echo "$SSH_ASTRAL_KEY" | tr -d '\r' > gitlab.key && chmod 600 gitlab.key + - echo "$SSH_DEPLOY_KEY" | tr -d '\r' > gitlab.key && chmod 600 gitlab.key - npm install - npm run build - scp -i gitlab.key -o StrictHostKeyChecking=no -r dist/* test1@astral.startinblox.com:~/front/ @@ -33,7 +33,7 @@ deploy_test2: url: https://test2.startinblox.com script: - echo "$APP_CONFIG_TEST2" > config.json - - echo "$SSH_ASTRAL_KEY" | tr -d '\r' > gitlab.key && chmod 600 gitlab.key + - echo "$SSH_DEPLOY_KEY" | tr -d '\r' > gitlab.key && chmod 600 gitlab.key - npm install - npm run build - scp -i gitlab.key -o StrictHostKeyChecking=no -r dist/* test2@astral.startinblox.com:~/front/ @@ -50,7 +50,7 @@ deploy_test3: url: https://test3.startinblox.com script: - echo "$APP_CONFIG_TEST3" > config.json - - echo "$SSH_ASTRAL_KEY" | tr -d '\r' > gitlab.key && chmod 600 gitlab.key + - echo "$SSH_DEPLOY_KEY" | tr -d '\r' > gitlab.key && chmod 600 gitlab.key - npm install - npm run build - scp -i gitlab.key -o StrictHostKeyChecking=no -r dist/* test3@astral.startinblox.com:~/front/ @@ -67,7 +67,7 @@ deploy_stg1: url: https://stg1.startinblox.com script: - echo "$APP_CONFIG_STG1" > config.json - - echo "$SSH_ASTRAL_KEY" | tr -d '\r' > gitlab.key && chmod 600 gitlab.key + - echo "$SSH_DEPLOY_KEY" | tr -d '\r' > gitlab.key && chmod 600 gitlab.key - npm install - npm run build - scp -i gitlab.key -o StrictHostKeyChecking=no -r dist/* stg1@astral.startinblox.com:~/front/ @@ -84,7 +84,7 @@ deploy_stg2: url: https://stg2.startinblox.com script: - echo "$APP_CONFIG_STG2" > config.json - - echo "$SSH_ASTRAL_KEY" | tr -d '\r' > gitlab.key && chmod 600 gitlab.key + - echo "$SSH_DEPLOY_KEY" | tr -d '\r' > gitlab.key && chmod 600 gitlab.key - npm install - npm run build - scp -i gitlab.key -o StrictHostKeyChecking=no -r dist/* stg2@astral.startinblox.com:~/front/ @@ -102,7 +102,11 @@ deploy_nantes: name: nantes url: https://nantes.happy-dev.fr script: - - echo 'Not happening yet...' + - echo "$APP_CONFIG_NANTESHD" > config.json + - echo "$SSH_DEPLOY_KEY" | tr -d '\r' > gitlab.key && chmod 600 gitlab.key + - npm install + - npm run build + - scp -i gitlab.key -o StrictHostKeyChecking=no -r dist/* nantes@ssh-nantes.happy-dev.fr:~/sib/www/ only: - master when: manual -- GitLab From daa9dbf9f5a604277eb38393cb4ed3a1d76ebd0d Mon Sep 17 00:00:00 2001 From: plup <plup@plup.io> Date: Thu, 19 Mar 2020 13:44:10 +0100 Subject: [PATCH 3/6] cicd: added alpha, paris and toulouse --- .gitlab-ci.yml | 58 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 48 insertions(+), 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dd84f4b4..83c5805e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,7 +9,7 @@ stages: ## VALIDATION ## -deploy_test1: +test1: stage: integration environment: name: test1 @@ -26,7 +26,7 @@ deploy_test1: tags: - deploy -deploy_test2: +test2: stage: integration environment: name: test2 @@ -43,7 +43,7 @@ deploy_test2: tags: - deploy -deploy_test3: +test3: stage: integration environment: name: test3 @@ -60,7 +60,7 @@ deploy_test3: tags: - deploy -deploy_stg1: +stg1: stage: acceptance environment: name: stg1 @@ -77,7 +77,7 @@ deploy_stg1: tags: - deploy -deploy_stg2: +stg2: stage: acceptance environment: name: stg2 @@ -96,11 +96,28 @@ deploy_stg2: ## LIVE DEPLOYMENTS ## -deploy_nantes: +alpha: + stage: deployment + environment: + name: paris + url: https://alpha.happy-dev.fr + script: + - echo "$APP_CONFIG_ALPHA" > config.json + - echo "$SSH_DEPLOY_KEY" | tr -d '\r' > gitlab.key && chmod 600 gitlab.key + - npm install + - npm run build + - scp -i gitlab.key -o StrictHostKeyChecking=no -r dist/* alpha@ssh-alpha.happy-dev.fr:~/sib/www/ + only: + - master + when: manual + tags: + - deploy + +nantes: stage: deployment environment: name: nantes - url: https://nantes.happy-dev.fr + url: https://app.nantes.happy-dev.fr script: - echo "$APP_CONFIG_NANTESHD" > config.json - echo "$SSH_DEPLOY_KEY" | tr -d '\r' > gitlab.key && chmod 600 gitlab.key @@ -113,13 +130,34 @@ deploy_nantes: tags: - deploy -deploy_paris: +paris: stage: deployment environment: name: paris - url: https://paris.happy-dev.fr + url: https://app.paris.happy-dev.fr + script: + - echo "$APP_CONFIG_PARIS" > config.json + - echo "$SSH_DEPLOY_KEY" | tr -d '\r' > gitlab.key && chmod 600 gitlab.key + - npm install + - npm run build + - scp -i gitlab.key -o StrictHostKeyChecking=no -r dist/* paris@ssh-paris.happy-dev.fr:~/sib/www/ + only: + - master + when: manual + tags: + - deploy + +toulouse: + stage: deployment + environment: + name: toulouse + url: https://smart-toulouse.happy-dev.fr script: - - echo 'Not happening yet...' + - echo "$APP_CONFIG_TOULOUSE" > config.json + - echo "$SSH_DEPLOY_KEY" | tr -d '\r' > gitlab.key && chmod 600 gitlab.key + - npm install + - npm run build + - scp -i gitlab.key -o StrictHostKeyChecking=no -r dist/* smart-toulouse@ssh-smart-toulouse.happy-dev.fr:~/sib/www/ only: - master when: manual -- GitLab From 9a71edc41ce48ae50ccca61f0f684816af074ca8 Mon Sep 17 00:00:00 2001 From: plup <plup@plup.io> Date: Thu, 19 Mar 2020 13:47:07 +0100 Subject: [PATCH 4/6] cicd: fixed front path for alpha and toulouse --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 83c5805e..3c97a0d6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -106,7 +106,7 @@ alpha: - echo "$SSH_DEPLOY_KEY" | tr -d '\r' > gitlab.key && chmod 600 gitlab.key - npm install - npm run build - - scp -i gitlab.key -o StrictHostKeyChecking=no -r dist/* alpha@ssh-alpha.happy-dev.fr:~/sib/www/ + - scp -i gitlab.key -o StrictHostKeyChecking=no -r dist/* alpha@ssh-alpha.happy-dev.fr:~/www/ only: - master when: manual @@ -157,7 +157,7 @@ toulouse: - echo "$SSH_DEPLOY_KEY" | tr -d '\r' > gitlab.key && chmod 600 gitlab.key - npm install - npm run build - - scp -i gitlab.key -o StrictHostKeyChecking=no -r dist/* smart-toulouse@ssh-smart-toulouse.happy-dev.fr:~/sib/www/ + - scp -i gitlab.key -o StrictHostKeyChecking=no -r dist/* smart-toulouse@ssh-smart-toulouse.happy-dev.fr:~/www/ only: - master when: manual -- GitLab From e9a6739b3133b61710eae087a5962760f1c460c0 Mon Sep 17 00:00:00 2001 From: plup <plup@plup.io> Date: Thu, 19 Mar 2020 14:05:24 +0100 Subject: [PATCH 5/6] cicd: added etuc --- .gitlab-ci.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3c97a0d6..975c459a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -113,6 +113,23 @@ alpha: tags: - deploy +etuc: + stage: deployment + environment: + name: etuc + url: https://app.digitalplatformobservatory.org + script: + - echo "$APP_CONFIG_DIGITALPLATFORMOBSERVATORY" > config.json + - echo "$SSH_DEPLOY_KEY" | tr -d '\r' > gitlab.key && chmod 600 gitlab.key + - npm install + - npm run build + - scp -i gitlab.key -o StrictHostKeyChecking=no -r dist/* etuc@ssh-etuc.happy-dev.fr:~/sib/www/ + only: + - master + when: manual + tags: + - deploy + nantes: stage: deployment environment: -- GitLab From e8b0fd86fb57a44a8ad583885246f068fa6f335e Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Pasquier <contact@jbpasquier.eu> Date: Tue, 31 Mar 2020 12:55:17 +0200 Subject: [PATCH 6/6] fix: const to let --- src/scripts/index.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/scripts/index.js b/src/scripts/index.js index a4cb9a2c..618ae537 100644 --- a/src/scripts/index.js +++ b/src/scripts/index.js @@ -95,9 +95,8 @@ function refreshElements(resourceId, clearCache = true, selector="sib-display") //NOTE: this is a temporary workaround and should be replaced by a reactive storage //https://git.happy-dev.fr/startinblox/framework/sib-core/issues/524 async function refreshResource(event) { - // if of the edited resource || id of the container of the created resource - const resourceId = event.detail.resource["@id"] || event.target.dataset.src; + let resourceId = event.detail.resource["@id"] || event.target.dataset.src; let resource = document .querySelector('[data-src="' + resourceId + '"]') .component.resource.getResourceData(); @@ -106,9 +105,9 @@ async function refreshResource(event) { let partnerId = null; if (resourceId.includes("circle-members")) { partnerId = resource["http://happy-dev.fr/owl/#circle"]["@id"]; - } else if (resourceId.includes("project-members")) + } else if (resourceId.includes("project-members")) { partnerId = resource["http://happy-dev.fr/owl/#project"]["@id"]; - + } //refresh all resources using the partner ID if (partnerId != null) { refreshElements(partnerId); -- GitLab