-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3267 from LiteFarmOrg/patch/3.6.5
Patch 3.6.5
- Loading branch information
Showing
207 changed files
with
12,381 additions
and
1,432 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Crowdin Download Action | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
download-translations: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
max-parallel: 1 # Should be 1 to avoid parallel builds | ||
matrix: | ||
locales: [ | ||
# Frontend core translations | ||
{ | ||
name: webapp_locales, | ||
source: packages/webapp/public/locales/en/*.json, | ||
translation: packages/webapp/public/locales/%two_letters_code%/%original_file_name%, | ||
}, | ||
# Consent Forms | ||
{ | ||
name: webapp_consent, | ||
source: packages/webapp/src/containers/Consent/locales/en/*.md, | ||
translation: packages/webapp/src/containers/Consent/locales/%two_letters_code%/%original_file_name%, | ||
}, | ||
# Backend tranlsations - skipping pdf (crop.json is copied jobs scheduler init during build) | ||
{ | ||
name: api_job_locales, | ||
source: packages/api/src/jobs/locales/en/*.json, | ||
translation: packages/api/src/jobs/locales/%two_letters_code%/%original_file_name%, | ||
}, | ||
# email templates | ||
{ | ||
name: api_email_templates, | ||
source: packages/api/src/templates/locales/en.json, | ||
translation: packages/api/src/templates/locales/%two_letters_code%.%file_extension%, | ||
}, | ||
] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Synchronize with Crowdin | ||
uses: crowdin/github-action@v2 | ||
with: | ||
upload_sources: false | ||
upload_translations: false | ||
download_translations: true | ||
skip_untranslated_strings: true | ||
export_only_approved: true | ||
source: ${{ matrix.locales.source }} # Sources pattern | ||
translation: ${{ matrix.locales.translation }} # Translations pattern | ||
localization_branch_name: l10n_crowdin_translations_${{ env.BRANCH_NAME }}_${{ matrix.locales.name }} | ||
create_pull_request: true | ||
pull_request_title: "New Crowdin translations" | ||
pull_request_body: "New Crowdin pull request with translations" | ||
pull_request_base_branch_name: ${{ env.BRANCH_NAME }} | ||
crowdin_branch_name: ${{ env.BRANCH_NAME }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.CROWDIN_TEMP_PERSONAL_TOKEN }} | ||
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} | ||
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} | ||
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} |
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,62 @@ | ||
name: Crowdin Upload Action | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- integration | ||
paths: | ||
- "**/locales/**.md" | ||
- "**/locales/**.json" | ||
|
||
jobs: | ||
synchronize-translations: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
max-parallel: 1 # Should be 1 to avoid parallel builds | ||
matrix: | ||
locales: [ | ||
# Frontend core translations | ||
{ | ||
source: packages/webapp/public/locales/en/*.json, | ||
translation: packages/webapp/public/locales/%two_letters_code%/%original_file_name%, | ||
}, | ||
# Consent Forms | ||
{ | ||
source: packages/webapp/src/containers/Consent/locales/en/*.md, | ||
translation: packages/webapp/src/containers/Consent/locales/%two_letters_code%/%original_file_name%, | ||
}, | ||
# Backend tranlsations - skipping pdf (crop.json is copied jobs scheduler init during build) | ||
{ | ||
source: packages/api/src/jobs/locales/en/*.json, | ||
translation: packages/api/src/jobs/locales/%two_letters_code%/%original_file_name%, | ||
}, | ||
# email templates | ||
{ | ||
source: packages/api/src/templates/locales/en.json, | ||
translation: packages/api/src/templates/locales/%two_letters_code%.%file_extension%, | ||
}, | ||
] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Crowdin sync | ||
uses: crowdin/github-action@v2 | ||
with: | ||
upload_sources: true | ||
upload_translations: false | ||
upload_sources_args: --preserve-hierarchy | ||
upload_translations_args: --preserve-hierarchy | ||
download_translations: false | ||
auto_approve_imported: false | ||
import_eq_suggestions: true | ||
crowdin_branch_name: ${{ env.BRANCH_NAME }} | ||
source: ${{ matrix.locales.source }} # Sources pattern | ||
translation: ${{ matrix.locales.translation }} # Translations pattern | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.CROWDIN_TEMP_PERSONAL_TOKEN }} | ||
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} | ||
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} | ||
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} |
82 changes: 82 additions & 0 deletions
82
packages/api/db/migration/20240425225219_add_npk_and_update_permissions_on_product.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 |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* | ||
* Copyright (c) 2024 LiteFarm.org | ||
* This file is part of LiteFarm. | ||
* | ||
* LiteFarm is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* LiteFarm is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
export const up = async function (knex) { | ||
await knex.schema.alterTable('product', (table) => { | ||
table.decimal('n'); | ||
table.decimal('p'); | ||
table.decimal('k'); | ||
table.enu('npk_unit', ['ratio', 'percent']); | ||
|
||
table.check( | ||
'(COALESCE(n, p, k) IS NULL AND npk_unit IS NULL) OR (COALESCE(n, p, k) IS NOT NULL AND npk_unit IS NOT NULL)', | ||
[], | ||
'npk_unit_check', | ||
); | ||
table.check( | ||
"npk_unit != 'percent' OR (npk_unit = 'percent' AND (n + p + k) <= 100)", | ||
[], | ||
'npk_percent_check', | ||
); | ||
}); | ||
|
||
// Add missing permissions for product actions | ||
await knex('permissions').insert([ | ||
{ | ||
permission_id: 169, | ||
name: 'edit:product', | ||
description: 'edit products', | ||
}, | ||
{ | ||
permission_id: 170, | ||
name: 'delete:product', | ||
description: 'delete products', | ||
}, | ||
]); | ||
|
||
await knex('rolePermissions').insert([ | ||
{ role_id: 3, permission_id: 129 }, // add worker permissions to add:product | ||
{ role_id: 1, permission_id: 169 }, | ||
{ role_id: 2, permission_id: 169 }, | ||
{ role_id: 3, permission_id: 169 }, | ||
{ role_id: 5, permission_id: 169 }, | ||
{ role_id: 1, permission_id: 170 }, | ||
{ role_id: 2, permission_id: 170 }, | ||
{ role_id: 5, permission_id: 170 }, | ||
]); | ||
}; | ||
|
||
export const down = async function (knex) { | ||
await knex('rolePermissions') | ||
.where({ | ||
role_id: 3, | ||
permission_id: 129, | ||
}) | ||
.del(); | ||
|
||
const permissions = [169, 170]; | ||
|
||
await knex('rolePermissions').whereIn('permission_id', permissions).del(); | ||
await knex('permissions').whereIn('permission_id', permissions).del(); | ||
|
||
await knex.schema.alterTable('product', (table) => { | ||
table.dropChecks(['npk_unit_check', 'npk_percent_check']); | ||
|
||
table.dropColumn('n'); | ||
table.dropColumn('p'); | ||
table.dropColumn('k'); | ||
table.dropColumn('npk_unit'); | ||
}); | ||
}; |
Oops, something went wrong.