From cb6fca813b70bbd0445d3f976c19e0d3642bdfd8 Mon Sep 17 00:00:00 2001 From: Joona Haavisto Date: Mon, 27 Jan 2025 11:04:14 +0200 Subject: [PATCH 1/5] Korjattu massamuutos tila listaa --- .../mass_review/virkailija_mass_review_view.cljs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/cljs/ataru/virkailija/application/mass_review/virkailija_mass_review_view.cljs b/src/cljs/ataru/virkailija/application/mass_review/virkailija_mass_review_view.cljs index f84e01a223..0fa3d97ff1 100644 --- a/src/cljs/ataru/virkailija/application/mass_review/virkailija_mass_review_view.cljs +++ b/src/cljs/ataru/virkailija/application/mass_review/virkailija_mass_review_view.cljs @@ -69,17 +69,20 @@ haku-header (subscribe [:application/list-heading-data-for-haku]) review-state-counts (subscribe [:state-query [:application :review-state-counts]]) loading? (subscribe [:application/fetching-applications?]) - tutu-form-visible? (subscribe [:payment/tutu-form-selected?]) + form-key @(subscribe [:application/selected-form-key]) + tutu-form? @(subscribe [:payment/tutu-form? form-key]) + astu-form? @(subscribe [:payment/astu-form? form-key]) allowed? (subscribe [:application/mass-information-request-allowed?]) - processing-states (if @tutu-form-visible? - review-states/application-hakukohde-processing-states - review-states/application-hakukohde-processing-states-normal) + processing-states (cond + tutu-form? review-states/application-hakukohde-processing-states-tutu + astu-form? review-states/application-hakukohde-processing-states-astu + :else review-states/application-hakukohde-processing-states-normal) all-states (reduce (fn [acc [state _]] - (assoc acc state 0)) + (assoc acc state (get @review-state-counts state 0))) {} processing-states)] (fn [] - (let [from-states (merge all-states @review-state-counts)] + (let [from-states all-states] [:span.application-handling__mass-edit-review-states-container [:a.application-handling__mass-edit-review-states-link.editor-form__control-button.editor-form__control-button--enabled.editor-form__control-button--variable-width {:on-click (when @allowed? #(dispatch [:application/set-mass-update-popup-visibility true])) From 420a7f5d7b450e3d5ad0be3f5a58b35ce6091f35 Mon Sep 17 00:00:00 2001 From: Joona Haavisto Date: Mon, 27 Jan 2025 12:44:15 +0200 Subject: [PATCH 2/5] ubuntu latest timezone korjaus --- .github/actions/prepare-clojure-env/action.yml | 7 ++++--- .github/workflows/build.yml | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/actions/prepare-clojure-env/action.yml b/.github/actions/prepare-clojure-env/action.yml index e2f005f84e..b818cc5e8b 100644 --- a/.github/actions/prepare-clojure-env/action.yml +++ b/.github/actions/prepare-clojure-env/action.yml @@ -9,9 +9,10 @@ runs: java-version: '17' distribution: 'corretto' - - uses: MathRobin/timezone-action@v1.1 - with: - timezoneLinux: "Europe/Helsinki" + - name: Set timezone to Europe/Helsinki + run: | + sudo timedatectl set-timezone Europe/Helsinki + echo "Europe/Helsinki" | sudo tee /etc/timezone - name: Install clojure tools uses: DeLaGuardo/setup-clojure@12.5 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 925d68f764..d9077327af 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ env: jobs: test-integration: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -72,7 +72,7 @@ jobs: ./bin/cibuild.sh run-browser-tests-integration test-spec-and-mocha: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -112,7 +112,7 @@ jobs: ./bin/cibuild.sh run-spec-and-mocha-tests build: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 From dc56cff42ddcd231a0ca02fcd22249d9453fbe98 Mon Sep 17 00:00:00 2001 From: Joona Haavisto Date: Mon, 27 Jan 2025 12:58:27 +0200 Subject: [PATCH 3/5] =?UTF-8?q?Lis=C3=A4tty=20shell?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/actions/prepare-clojure-env/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/prepare-clojure-env/action.yml b/.github/actions/prepare-clojure-env/action.yml index b818cc5e8b..b68080ba46 100644 --- a/.github/actions/prepare-clojure-env/action.yml +++ b/.github/actions/prepare-clojure-env/action.yml @@ -10,6 +10,7 @@ runs: distribution: 'corretto' - name: Set timezone to Europe/Helsinki + shell: bash run: | sudo timedatectl set-timezone Europe/Helsinki echo "Europe/Helsinki" | sudo tee /etc/timezone From 68d672769a2295d9c73dea6c93cac69f95a095c4 Mon Sep 17 00:00:00 2001 From: Joona Haavisto Date: Tue, 28 Jan 2025 12:49:28 +0200 Subject: [PATCH 4/5] AppArmor disablointi testi --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d9077327af..e123abfd49 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -106,6 +106,7 @@ jobs: docker run -d --name ataru-test-db -p 5433:5432 -e POSTGRES_DB=ataru-test -e POSTGRES_PASSWORD=oph -e POSTGRES_USER=oph $(docker build -f ./test-postgres/Dockerfile --build-arg POSTGRESQL_VERSION=15 -q .) docker run -d --name ataru-test-redis -p 6380:6379 $REGISTRY/ecr-public/docker/library/redis:7 docker run -d --name ataru-test-ftpd -p 2221:21 -p 30000-30009:30000-30009 $REGISTRY/utility/hiekkalaatikko:ataru-test-ftpd + echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns - name: Run Spec and Mocha tests run: | From 8048e0f6b1050bcd02ea44ac6d9bea597d69c313 Mon Sep 17 00:00:00 2001 From: Joona Haavisto Date: Tue, 4 Feb 2025 14:26:48 +0200 Subject: [PATCH 5/5] uudelleen nimetty tilalista ja poistettu turha let --- .../virkailija_mass_review_view.cljs | 162 +++++++++--------- 1 file changed, 80 insertions(+), 82 deletions(-) diff --git a/src/cljs/ataru/virkailija/application/mass_review/virkailija_mass_review_view.cljs b/src/cljs/ataru/virkailija/application/mass_review/virkailija_mass_review_view.cljs index 0fa3d97ff1..a4ddcf4eb1 100644 --- a/src/cljs/ataru/virkailija/application/mass_review/virkailija_mass_review_view.cljs +++ b/src/cljs/ataru/virkailija/application/mass_review/virkailija_mass_review_view.cljs @@ -69,90 +69,88 @@ haku-header (subscribe [:application/list-heading-data-for-haku]) review-state-counts (subscribe [:state-query [:application :review-state-counts]]) loading? (subscribe [:application/fetching-applications?]) - form-key @(subscribe [:application/selected-form-key]) - tutu-form? @(subscribe [:payment/tutu-form? form-key]) - astu-form? @(subscribe [:payment/astu-form? form-key]) + form-key (subscribe [:application/selected-form-key]) + tutu-form? (subscribe [:payment/tutu-form? @form-key]) + astu-form? (subscribe [:payment/astu-form? @form-key]) allowed? (subscribe [:application/mass-information-request-allowed?]) - processing-states (cond - tutu-form? review-states/application-hakukohde-processing-states-tutu - astu-form? review-states/application-hakukohde-processing-states-astu - :else review-states/application-hakukohde-processing-states-normal) - all-states (reduce (fn [acc [state _]] - (assoc acc state (get @review-state-counts state 0))) - {} - processing-states)] + processing-states (cond + @tutu-form? review-states/application-hakukohde-processing-states-tutu + @astu-form? review-states/application-hakukohde-processing-states-astu + :else review-states/application-hakukohde-processing-states-normal) + processing-states-with-counts (->> processing-states + (map (fn [[state]] [state (get @review-state-counts state 0)])) + (into {}))] (fn [] - (let [from-states all-states] - [:span.application-handling__mass-edit-review-states-container - [:a.application-handling__mass-edit-review-states-link.editor-form__control-button.editor-form__control-button--enabled.editor-form__control-button--variable-width - {:on-click (when @allowed? #(dispatch [:application/set-mass-update-popup-visibility true])) - :class (when (not @allowed?) "application-handling__button--disabled")} - @(subscribe [:editor/virkailija-translation :mass-edit])] - (when @visible? - [:div.application-handling__mass-edit-review-states-popup.application-handling__popup - [:div.application-handling__mass-edit-review-states-title-container - [:h4.application-handling__mass-edit-review-states-title - @(subscribe [:editor/virkailija-translation :mass-edit])] - [:button.virkailija-close-button - {:on-click #(dispatch [:application/set-mass-update-popup-visibility false])} - [:i.zmdi.zmdi-close]]] - (when-let [[haku-oid hakukohde-oid _ _ _] @haku-header] - [:p - @(subscribe [:application/haku-name haku-oid]) - (when hakukohde-oid - (str ", " @(subscribe [:application/hakukohde-name hakukohde-oid])))]) - [:h4.application-handling__mass-edit-review-states-heading @(subscribe [:editor/virkailija-translation :from-state])] - - (if @from-list-open? - (into [:div.application-handling__review-state-list.application-handling__review-state-list--opened - {:on-click #(swap! from-list-open? not)}] - (opened-mass-review-state-list selected-from-review-state from-states @review-state-counts true)) - (mass-review-state-selected-row - (fn [] - (swap! from-list-open? not) - (reset! submit-button-state :submit)) - (selected-or-default-mass-review-state-label selected-from-review-state from-states @review-state-counts))) - - [:h4.application-handling__mass-edit-review-states-heading @(subscribe [:editor/virkailija-translation :to-state])] - - (if @to-list-open? - (into [:div.application-handling__review-state-list.application-handling__review-state-list--opened - {:on-click #(when (-> from-states (keys) (count) (pos?)) (swap! to-list-open? not))}] - (opened-mass-review-state-list selected-to-review-state all-states @review-state-counts false)) - (mass-review-state-selected-row - (fn [] - (swap! to-list-open? not) - (reset! submit-button-state :submit)) - (selected-or-default-mass-review-state-label selected-to-review-state all-states @review-state-counts))) - - (case @submit-button-state - :submit - (let [button-disabled? (or (= (selected-or-default-mass-review-state selected-from-review-state from-states) - (selected-or-default-mass-review-state selected-to-review-state all-states)) - @loading?)] - [:a.application-handling__link-button.application-handling__mass-edit-review-states-submit-button - {:on-click #(when-not button-disabled? (reset! submit-button-state :confirm)) - :disabled button-disabled?} - [:span - (str @(subscribe [:editor/virkailija-translation :change]) - (when @loading? " ")) - (when @loading? - [:i.zmdi.zmdi-spinner.spin])]]) - - :confirm - [:a.application-handling__link-button.application-handling__mass-edit-review-states-submit-button--confirm - {:on-click (fn [] - (let [from-state-name (selected-or-default-mass-review-state selected-from-review-state from-states) - to-state-name (selected-or-default-mass-review-state selected-to-review-state all-states)] - (dispatch [:application/mass-update-application-reviews - from-state-name - to-state-name]) - (dispatch [:application/set-mass-update-popup-visibility false]) - (reset! selected-from-review-state nil) - (reset! selected-to-review-state nil) - (reset! from-list-open? false) - (reset! to-list-open? false)))} - @(subscribe [:editor/virkailija-translation :confirm-change])])])])))) + [:span.application-handling__mass-edit-review-states-container + [:a.application-handling__mass-edit-review-states-link.editor-form__control-button.editor-form__control-button--enabled.editor-form__control-button--variable-width + {:on-click (when @allowed? #(dispatch [:application/set-mass-update-popup-visibility true])) + :class (when (not @allowed?) "application-handling__button--disabled")} + @(subscribe [:editor/virkailija-translation :mass-edit])] + (when @visible? + [:div.application-handling__mass-edit-review-states-popup.application-handling__popup + [:div.application-handling__mass-edit-review-states-title-container + [:h4.application-handling__mass-edit-review-states-title + @(subscribe [:editor/virkailija-translation :mass-edit])] + [:button.virkailija-close-button + {:on-click #(dispatch [:application/set-mass-update-popup-visibility false])} + [:i.zmdi.zmdi-close]]] + (when-let [[haku-oid hakukohde-oid _ _ _] @haku-header] + [:p + @(subscribe [:application/haku-name haku-oid]) + (when hakukohde-oid + (str ", " @(subscribe [:application/hakukohde-name hakukohde-oid])))]) + [:h4.application-handling__mass-edit-review-states-heading @(subscribe [:editor/virkailija-translation :from-state])] + + (if @from-list-open? + (into [:div.application-handling__review-state-list.application-handling__review-state-list--opened + {:on-click #(swap! from-list-open? not)}] + (opened-mass-review-state-list selected-from-review-state processing-states-with-counts @review-state-counts true)) + (mass-review-state-selected-row + (fn [] + (swap! from-list-open? not) + (reset! submit-button-state :submit)) + (selected-or-default-mass-review-state-label selected-from-review-state processing-states-with-counts @review-state-counts))) + + [:h4.application-handling__mass-edit-review-states-heading @(subscribe [:editor/virkailija-translation :to-state])] + + (if @to-list-open? + (into [:div.application-handling__review-state-list.application-handling__review-state-list--opened + {:on-click #(when (-> processing-states-with-counts (keys) (count) (pos?)) (swap! to-list-open? not))}] + (opened-mass-review-state-list selected-to-review-state processing-states-with-counts @review-state-counts false)) + (mass-review-state-selected-row + (fn [] + (swap! to-list-open? not) + (reset! submit-button-state :submit)) + (selected-or-default-mass-review-state-label selected-to-review-state processing-states-with-counts @review-state-counts))) + + (case @submit-button-state + :submit + (let [button-disabled? (or (= (selected-or-default-mass-review-state selected-from-review-state processing-states-with-counts) + (selected-or-default-mass-review-state selected-to-review-state processing-states-with-counts)) + @loading?)] + [:a.application-handling__link-button.application-handling__mass-edit-review-states-submit-button + {:on-click #(when-not button-disabled? (reset! submit-button-state :confirm)) + :disabled button-disabled?} + [:span + (str @(subscribe [:editor/virkailija-translation :change]) + (when @loading? " ")) + (when @loading? + [:i.zmdi.zmdi-spinner.spin])]]) + + :confirm + [:a.application-handling__link-button.application-handling__mass-edit-review-states-submit-button--confirm + {:on-click (fn [] + (let [from-state-name (selected-or-default-mass-review-state selected-from-review-state processing-states-with-counts) + to-state-name (selected-or-default-mass-review-state selected-to-review-state processing-states-with-counts)] + (dispatch [:application/mass-update-application-reviews + from-state-name + to-state-name]) + (dispatch [:application/set-mass-update-popup-visibility false]) + (reset! selected-from-review-state nil) + (reset! selected-to-review-state nil) + (reset! from-list-open? false) + (reset! to-list-open? false)))} + @(subscribe [:editor/virkailija-translation :confirm-change])])])]))) (defn- mass-review-notes-popup []