Merge branch 'master' into fradrive/lms-type-refactor

This commit is contained in:
Steffen Jost 2023-05-26 09:25:23 +00:00
commit e29bce7b22
11 changed files with 51 additions and 117 deletions

View File

@ -4,9 +4,9 @@
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "push"'
when: always
- when: never
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_MERGE_REQUEST_ID
- if: $CI_COMMIT_TAG =~ /^v/
default:
image:
@ -26,7 +26,7 @@ stages:
- frontend:build
- backend:build
- test
- docker
- container:build
- prepare release
- release
@ -43,11 +43,6 @@ node dependencies:
- install -v -T -m 0400 "${SSH_DEPLOY_KEY}" ~/.ssh/deploy && echo "IdentityFile ~/.ssh/deploy" >> ~/.ssh/config;
- install -v -T -m 0644 "${FONTAWESOME_NPM_AUTH_FILE}" /etc/fontawesome-token
- install -v -T -m 0644 "${NIX_NETRC}" /etc/nix/netrc
- |
if [ -n "${REGISTRY_AUTHFILE}" ]; then
mkdir -p ~/.docker
install -v -T -m 0400 "${REGISTRY_AUTHFILE}" ~/.docker/config.json
fi
artifacts:
paths:
- node-dependencies.nar.xz
@ -215,49 +210,12 @@ check:
retry: 2
interruptible: true
# demo docker:
# stage: docker
# script:
# - xzcat uniworx:exe:uniworx.nar.xz | nix-store --import
# - xzcat uniworx:exe:uniworxdb.nar.xz | nix-store --import
# - source .gitlab-ci/construct-flake-url.sh
# - nix -L build -o result "${FLAKE}#uniworxDemoDocker"
# - cp -pr --reflink=auto -L result uniworx-demo.tar.gz
# before_script: *nix-before
# needs:
# - job: node dependencies # transitive
# artifacts: false
# - job: well known # transitive
# artifacts: false
# - job: frontend # tranitive
# artifacts: false
# - job: uniworx:lib:uniworx # transitive
# artifacts: false
# - job: uniworx:exe:uniworx
# artifacts: true
# - job: uniworx:exe:uniworxdb
# artifacts: true
# - job: check # sanity
# artifacts: false
# artifacts:
# paths:
# - uniworx-demo.tar.gz
# name: "${CI_JOB_NAME}-${CI_COMMIT_SHORT_SHA}"
# expire_in: "1 day"
# retry: 2
# interruptible: true
# rules:
# - if: $CI_COMMIT_REF_NAME =~ /^v[0-9].*/
# when: manual
# allow_failure: true
docker:
stage: docker
container:
stage: container:build
script:
- xzcat uniworx:exe:uniworx.nar.xz | nix-store --import
- source .gitlab-ci/construct-flake-url.sh
- nix -L build -o result "${FLAKE}#uniworxDocker"
- cp -pr --reflink=auto -L result uniworx.tar.gz
- cp -pr --reflink=auto -L $(nix build --print-out-paths "${FLAKE}#uniworxDocker") uniworx.tar.gz
before_script: *nix-before
needs:
- job: node dependencies # transitive
@ -279,19 +237,15 @@ docker:
expire_in: "1 day"
retry: 2
interruptible: true
rules:
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9].*/
when: manual
allow_failure: true
rules: &release-rules
- if: $CI_COMMIT_TAG =~ /^v/
parse changelog:
stage: prepare release
needs:
- job: node dependencies
artifacts: true
rules:
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9].*/
when: on_success
rules: *release-rules
before_script: *nix-before
script:
- xzcat node-dependencies.nar.xz | nix-store --import
@ -310,13 +264,14 @@ parse changelog:
retry: 2
interruptible: true
upload docker:
stage: docker
upload container:
variables:
GIT_STRATEGY: none
stage: release
image: quay.io/skopeo/stable:latest
script:
- xzcat uniworx:exe:uniworx.nar.xz | nix-store --import
- source .gitlab-ci/construct-flake-url.sh
- nix -L run "${FLAKE}#pushUniworxDocker"
before_script: *nix-before
- skopeo --insecure-policy copy --dest-creds "${CI_REGISTRY_USER}:${CI_JOB_TOKEN}" docker-archive://$(pwd)/uniworx.tar.gz docker://${CI_REGISTRY_IMAGE}:${VERSION}
- skopeo --insecure-policy copy --src-creds "${CI_REGISTRY_USER}:${CI_JOB_TOKEN}" --dest-creds "${CI_REGISTRY_USER}:${CI_JOB_TOKEN}" docker://${CI_REGISTRY_IMAGE}:${VERSION} docker://${CI_REGISTRY_IMAGE}:latest
needs:
- job: node dependencies # transitive
artifacts: false
@ -326,51 +281,29 @@ upload docker:
artifacts: false
- job: uniworx:lib:uniworx # transitive
artifacts: false
- job: uniworx:exe:uniworx
- job: uniworx:exe:uniworx # transitive
artifacts: false
- job: container
artifacts: true
- job: parse changelog
artifacts: true
- job: check # sanity
artifacts: false
rules:
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9].*/
when: on_success
# upload demo docker:
# stage: docker
# script:
# - xzcat uniworx:exe:uniworx.nar.xz | nix-store --import
# - xzcat uniworx:exe:uniworxdb.nar.xz | nix-store --import
# - source .gitlab-ci/construct-flake-url.sh
# - nix -L run "${FLAKE}#pushUniworxDemoDocker"
# before_script: *nix-before
# needs:
# - job: node dependencies # transitive
# artifacts: false
# - job: well known # transitive
# artifacts: false
# - job: frontend # tranitive
# artifacts: false
# - job: uniworx:lib:uniworx # transitive
# artifacts: false
# - job: uniworx:exe:uniworx
# artifacts: true
# - job: uniworx:exe:uniworxdb
# artifacts: true
# - job: check # sanity
# artifacts: false
# rules:
# - if: $CI_COMMIT_REF_NAME =~ /^v[0-9].*/
# when: on_success
rules: *release-rules
retry: 2
release:
variables:
GIT_STRATEGY: none
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9].*/
when: on_success
rules: *release-rules
script:
- release-cli create --name "${VERSION}" --tag-name $CI_COMMIT_TAG --description .current-changelog.md
- echo "Will create release ${VERSION}..."
release:
name: '$VERSION'
tag_name: '$CI_COMMIT_TAG'
description: .current-changelog.md
needs:
- job: check # sanity
artifacts: false

View File

@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
## [27.4.6](https://gitlab2.rz.ifi.lmu.de/uni2work/uni2work/compare/v27.4.5...v27.4.6) (2023-05-24)
## [27.4.5](https://gitlab2.rz.ifi.lmu.de/uni2work/uni2work/compare/v27.4.4...v27.4.5) (2023-05-23)
## [27.4.4](https://gitlab2.rz.ifi.lmu.de/uni2work/uni2work/compare/v27.4.3...v27.4.4) (2023-05-20)
## [27.4.3](https://gitlab2.rz.ifi.lmu.de/uni2work/uni2work/compare/v27.4.2...v27.4.3) (2023-05-12)

View File

@ -124,14 +124,6 @@
haskellFlake = pkgs.uniworx.flake {};
mkPushDocker = { imageName, dockerImage, defaultRegistry ? "docker://registry.uniworx.de/fradrive/fradrive" }: pkgs.writeScriptBin "push-${dockerImage.imageName}" ''
#!${pkgs.zsh}/bin/zsh -xe
target=''${1:-${defaultRegistry}/${imageName}:${dockerImage.imageTag}}
[[ -n "''${1}" ]] && shift
${pkgs.skopeo}/bin/skopeo --tmpdir ''${TMPDIR:-/var/tmp} ''${@} --insecure-policy copy docker-archive://${dockerImage} ''${target}
'';
inherit (pkgs.lib) recursiveUpdate;
in {
packages = haskellFlake.packages // {
@ -139,8 +131,6 @@
};
apps = haskellFlake.apps // {
pushUniworxDemoDocker = flake-utils.lib.mkApp { drv = mkPushDocker { imageName = "uniworx-demo"; dockerImage = pkgs.uniworxDemoDocker; }; };
pushUniworxDocker = flake-utils.lib.mkApp { drv = mkPushDocker { imageName = "uniworx"; dockerImage = pkgs.uniworxDocker; }; };
calculateMaterializedSha = flake-utils.lib.mkApp { drv = pkgs.uniworx.stack-nix.passthru.calculateMaterializedSha; exePath = ""; };
jqChangelogJson = flake-utils.lib.mkApp { drv = pkgs.jqChangelogJson; };
};

View File

@ -32,6 +32,7 @@ QualificationUserNoRenewal: Läuft ohne Benachrichtigung aus
QualificationUserNone: Für diese Person sind keine Qualifikationen registriert.
QualificationBlockReason: Entzugsbegründung
QualificationBlockNotify: Benachrichtigung verschicken
QualificationBlockRemoveSupervisor: Alle Ansprechpartner löschen
QualificationExpired: Ungültig seit
LmsUser: Inhaber
LmsURL: Link ELearning
@ -47,7 +48,7 @@ TableLmsStarted: Begonnen
TableLmsReceived: Letzte Rückmeldung
TableLmsNotified: Versand Benachrichtigung
TableLmsNotifiedTooltip: Benachrichtigungen werden erst versendet wenn das LMS bestätigt die Eröffnung des ELearning für den Benutzer bestätigt hat, was ein paar Stunden dauern kann!
TableLmsEnded: Beended
TableLmsEnded: Beendet
TableLmsStatus: Status ELearning
TableLmsStatusTooltip mbMonth@(Maybe Int): Zeigt #{maybeToMessage "bis zu " (fmap (flip pluralDEeN "Monat") mbMonth) " nach Abschluss"} den letzten Zustand eines ELearnings an:
TableLmsStatusDay: Datum letzte Statusänderung ELearning

View File

@ -32,6 +32,7 @@ QualificationUserNoRenewal: Expires without further notification
QualificationUserNone: No registered qualifications for this person.
QualificationBlockReason: Reason for revoking
QualificationBlockNotify: Send notification
QualificationBlockRemoveSupervisor: Remove all supervisors
QualificationExpired: Expired on
LmsUser: Licensee
LmsURL: Link E-learning

View File

@ -1,3 +1,3 @@
{
"version": "27.4.4"
"version": "27.4.6"
}

View File

@ -1,3 +1,3 @@
{
"version": "27.4.4"
"version": "27.4.6"
}

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "uni2work",
"version": "27.4.4",
"version": "27.4.6",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "uni2work",
"version": "27.4.4",
"version": "27.4.6",
"description": "",
"keywords": [],
"author": "",

View File

@ -1,5 +1,5 @@
name: uniworx
version: 27.4.4
version: 27.4.6
dependencies:
- base
- yesod

View File

@ -269,7 +269,7 @@ data QualificationTableActionData
= QualificationActExpireData
| QualificationActUnexpireData
| QualificationActBlockSupervisorData
| QualificationActBlockData { qualTableActBlockReason :: Text, qualTableActNotify :: Bool }
| QualificationActBlockData { qualTableActBlockReason :: Text, qualTableActNotify :: Bool, qualTableActRemoveSupervisors :: Bool }
| QualificationActUnblockData
| QualificationActRenewData
| QualificationActGrantData { qualTableActGrantUntil :: Day }
@ -286,6 +286,11 @@ isBlockAct QualificationActBlockData{} = True
isBlockAct QualificationActUnblockData = True
isBlockAct _ = False
blockActRemoveSupervisors :: QualificationTableActionData -> Bool
blockActRemoveSupervisors QualificationActBlockSupervisorData = True
blockActRemoveSupervisors QualificationActBlockData{qualTableActRemoveSupervisors=res} = res
blockActRemoveSupervisors _ = False
qualificationTableQuery :: QualificationId -> (_ -> E.SqlExpr (E.Value Bool)) -> QualificationTableExpr
-> E.SqlQuery ( E.SqlExpr (Entity QualificationUser)
, E.SqlExpr (Entity User)
@ -491,7 +496,8 @@ postQualificationR sid qsh = do
[ singletonMap QualificationActUnblock $ pure QualificationActUnblockData -- Admin-only actions
, singletonMap QualificationActBlock $ QualificationActBlockData
<$> apreq textField (fslI MsgQualificationBlockReason) Nothing
<*> areq (boolField . Just $ SomeMessage MsgBoolIrrelevant) (fslI MsgQualificationBlockNotify) (Just False)
<*> areq (boolField . Just $ SomeMessage MsgBoolIrrelevant) (fslI MsgQualificationBlockNotify) (Just False)
<*> areq (boolField . Just $ SomeMessage MsgBoolIrrelevant) (fslI MsgQualificationBlockRemoveSupervisor) (Just False)
, singletonMap QualificationActRenew $ pure QualificationActRenewData
, singletonMap QualificationActGrant $ QualificationActGrantData
<$> apopt dayField (fslI MsgLmsQualificationValidUntil) dayExpiry
@ -562,8 +568,7 @@ postQualificationR sid qsh = do
_ -> False
oks <- runDB $ do
deleteWhere [UserSupervisorUser <-. selUserIds]
deleteWhere [UserCompanyUser <-. selUserIds]
when (blockActRemoveSupervisors action) $ deleteWhere [UserSupervisorUser <-. selUserIds]
qualificationUserBlocking qid selUserIds notify qubr
let nrq = length selectedUsers
warnLevel = if