Compare commits
1 Commits
feature-au
...
feature-pa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
87427a60a8 |
69
.github/workflows/translate-strings.yml
vendored
69
.github/workflows/translate-strings.yml
vendored
@@ -1,69 +0,0 @@
|
|||||||
name: Generate Translation Strings
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- dev
|
|
||||||
jobs:
|
|
||||||
generate-translate-strings:
|
|
||||||
name: Generate Translation Strings
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.PNGX_BOT_PAT }}
|
|
||||||
ref: ${{ github.head_ref }}
|
|
||||||
- name: Set up Python
|
|
||||||
id: setup-python
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
- name: Install system dependencies
|
|
||||||
run: |
|
|
||||||
sudo apt-get update -qq
|
|
||||||
sudo apt-get install -qq --no-install-recommends gettext
|
|
||||||
- name: Install uv
|
|
||||||
uses: astral-sh/setup-uv@v5
|
|
||||||
with:
|
|
||||||
enable-cache: true
|
|
||||||
- name: Install backend python dependencies
|
|
||||||
run: |
|
|
||||||
uv sync \
|
|
||||||
--group dev \
|
|
||||||
--frozen
|
|
||||||
- name: Generate backend translation strings
|
|
||||||
run: cd src/ && uv run manage.py makemessages -l en_US -i "samples*"
|
|
||||||
- name: Install pnpm
|
|
||||||
uses: pnpm/action-setup@v4
|
|
||||||
with:
|
|
||||||
version: 10
|
|
||||||
- name: Use Node.js 20
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 20.x
|
|
||||||
cache: 'pnpm'
|
|
||||||
cache-dependency-path: 'src-ui/pnpm-lock.yaml'
|
|
||||||
- name: Cache frontend dependencies
|
|
||||||
id: cache-frontend-deps
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
~/.pnpm-store
|
|
||||||
~/.cache
|
|
||||||
key: ${{ runner.os }}-frontenddeps-${{ hashFiles('src-ui/pnpm-lock.yaml') }}
|
|
||||||
- name: Install frontend dependencies
|
|
||||||
if: steps.cache-frontend-deps.outputs.cache-hit != 'true'
|
|
||||||
run: cd src-ui && pnpm install
|
|
||||||
- name: Re-link Angular cli
|
|
||||||
run: cd src-ui && pnpm link @angular/cli
|
|
||||||
- name: Generate frontend translation strings
|
|
||||||
run: |
|
|
||||||
cd src-ui
|
|
||||||
pnpm run ng extract-i18n
|
|
||||||
- name: Commit changes
|
|
||||||
uses: stefanzweifel/git-auto-commit-action@v5
|
|
||||||
with:
|
|
||||||
file_pattern: 'src-ui/messages.xlf src/locale/en_US/LC_MESSAGES/django.po'
|
|
||||||
commit_message: "Auto translate strings"
|
|
||||||
commit_user_name: "GitHub Actions"
|
|
||||||
commit_author: "GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com>"
|
|
||||||
@@ -451,11 +451,11 @@ describe('DocumentDetailComponent', () => {
|
|||||||
initNormally()
|
initNormally()
|
||||||
component.title = 'Foo Bar'
|
component.title = 'Foo Bar'
|
||||||
const closeSpy = jest.spyOn(component, 'close')
|
const closeSpy = jest.spyOn(component, 'close')
|
||||||
const updateSpy = jest.spyOn(documentService, 'update')
|
const patchSpy = jest.spyOn(documentService, 'patch')
|
||||||
const toastSpy = jest.spyOn(toastService, 'showInfo')
|
const toastSpy = jest.spyOn(toastService, 'showInfo')
|
||||||
updateSpy.mockImplementation((o) => of(doc))
|
patchSpy.mockImplementation((o) => of(doc))
|
||||||
component.save(true)
|
component.save(true)
|
||||||
expect(updateSpy).toHaveBeenCalled()
|
expect(patchSpy).toHaveBeenCalled()
|
||||||
expect(closeSpy).toHaveBeenCalled()
|
expect(closeSpy).toHaveBeenCalled()
|
||||||
expect(toastSpy).toHaveBeenCalledWith(
|
expect(toastSpy).toHaveBeenCalledWith(
|
||||||
'Document "Doc 3" saved successfully.'
|
'Document "Doc 3" saved successfully.'
|
||||||
@@ -466,11 +466,11 @@ describe('DocumentDetailComponent', () => {
|
|||||||
initNormally()
|
initNormally()
|
||||||
component.title = 'Foo Bar'
|
component.title = 'Foo Bar'
|
||||||
const closeSpy = jest.spyOn(component, 'close')
|
const closeSpy = jest.spyOn(component, 'close')
|
||||||
const updateSpy = jest.spyOn(documentService, 'update')
|
const patchSpy = jest.spyOn(documentService, 'patch')
|
||||||
const toastSpy = jest.spyOn(toastService, 'showInfo')
|
const toastSpy = jest.spyOn(toastService, 'showInfo')
|
||||||
updateSpy.mockImplementation((o) => of(doc))
|
patchSpy.mockImplementation((o) => of(doc))
|
||||||
component.save()
|
component.save()
|
||||||
expect(updateSpy).toHaveBeenCalled()
|
expect(patchSpy).toHaveBeenCalled()
|
||||||
expect(closeSpy).not.toHaveBeenCalled()
|
expect(closeSpy).not.toHaveBeenCalled()
|
||||||
expect(toastSpy).toHaveBeenCalledWith(
|
expect(toastSpy).toHaveBeenCalledWith(
|
||||||
'Document "Doc 3" saved successfully.'
|
'Document "Doc 3" saved successfully.'
|
||||||
@@ -482,12 +482,12 @@ describe('DocumentDetailComponent', () => {
|
|||||||
initNormally()
|
initNormally()
|
||||||
component.title = 'Foo Bar'
|
component.title = 'Foo Bar'
|
||||||
const closeSpy = jest.spyOn(component, 'close')
|
const closeSpy = jest.spyOn(component, 'close')
|
||||||
const updateSpy = jest.spyOn(documentService, 'update')
|
const patchSpy = jest.spyOn(documentService, 'patch')
|
||||||
const toastSpy = jest.spyOn(toastService, 'showError')
|
const toastSpy = jest.spyOn(toastService, 'showError')
|
||||||
const error = new Error('failed to save')
|
const error = new Error('failed to save')
|
||||||
updateSpy.mockImplementation(() => throwError(() => error))
|
patchSpy.mockImplementation(() => throwError(() => error))
|
||||||
component.save()
|
component.save()
|
||||||
expect(updateSpy).toHaveBeenCalled()
|
expect(patchSpy).toHaveBeenCalled()
|
||||||
expect(closeSpy).not.toHaveBeenCalled()
|
expect(closeSpy).not.toHaveBeenCalled()
|
||||||
expect(toastSpy).toHaveBeenCalledWith(
|
expect(toastSpy).toHaveBeenCalledWith(
|
||||||
'Error saving document "Doc 3"',
|
'Error saving document "Doc 3"',
|
||||||
@@ -500,13 +500,13 @@ describe('DocumentDetailComponent', () => {
|
|||||||
initNormally()
|
initNormally()
|
||||||
component.title = 'Foo Bar'
|
component.title = 'Foo Bar'
|
||||||
const closeSpy = jest.spyOn(component, 'close')
|
const closeSpy = jest.spyOn(component, 'close')
|
||||||
const updateSpy = jest.spyOn(documentService, 'update')
|
const patchSpy = jest.spyOn(documentService, 'patch')
|
||||||
const toastSpy = jest.spyOn(toastService, 'showInfo')
|
const toastSpy = jest.spyOn(toastService, 'showInfo')
|
||||||
updateSpy.mockImplementation(() =>
|
patchSpy.mockImplementation(() =>
|
||||||
throwError(() => new Error('failed to save'))
|
throwError(() => new Error('failed to save'))
|
||||||
)
|
)
|
||||||
component.save(true)
|
component.save(true)
|
||||||
expect(updateSpy).toHaveBeenCalled()
|
expect(patchSpy).toHaveBeenCalled()
|
||||||
expect(closeSpy).toHaveBeenCalled()
|
expect(closeSpy).toHaveBeenCalled()
|
||||||
expect(toastSpy).toHaveBeenCalledWith(
|
expect(toastSpy).toHaveBeenCalledWith(
|
||||||
'Document "Doc 3" saved successfully.'
|
'Document "Doc 3" saved successfully.'
|
||||||
@@ -517,8 +517,8 @@ describe('DocumentDetailComponent', () => {
|
|||||||
initNormally()
|
initNormally()
|
||||||
const nextDocId = 100
|
const nextDocId = 100
|
||||||
component.title = 'Foo Bar'
|
component.title = 'Foo Bar'
|
||||||
const updateSpy = jest.spyOn(documentService, 'update')
|
const patchSpy = jest.spyOn(documentService, 'patch')
|
||||||
updateSpy.mockReturnValue(of(doc))
|
patchSpy.mockReturnValue(of(doc))
|
||||||
const nextSpy = jest.spyOn(documentListViewService, 'getNext')
|
const nextSpy = jest.spyOn(documentListViewService, 'getNext')
|
||||||
nextSpy.mockReturnValue(of(nextDocId))
|
nextSpy.mockReturnValue(of(nextDocId))
|
||||||
const closeSpy = jest.spyOn(openDocumentsService, 'closeDocument')
|
const closeSpy = jest.spyOn(openDocumentsService, 'closeDocument')
|
||||||
@@ -526,7 +526,7 @@ describe('DocumentDetailComponent', () => {
|
|||||||
const navigateSpy = jest.spyOn(router, 'navigate')
|
const navigateSpy = jest.spyOn(router, 'navigate')
|
||||||
|
|
||||||
component.saveEditNext()
|
component.saveEditNext()
|
||||||
expect(updateSpy).toHaveBeenCalled()
|
expect(patchSpy).toHaveBeenCalled()
|
||||||
expect(navigateSpy).toHaveBeenCalledWith(['documents', nextDocId])
|
expect(navigateSpy).toHaveBeenCalledWith(['documents', nextDocId])
|
||||||
expect
|
expect
|
||||||
})
|
})
|
||||||
@@ -536,12 +536,12 @@ describe('DocumentDetailComponent', () => {
|
|||||||
initNormally()
|
initNormally()
|
||||||
component.title = 'Foo Bar'
|
component.title = 'Foo Bar'
|
||||||
const closeSpy = jest.spyOn(component, 'close')
|
const closeSpy = jest.spyOn(component, 'close')
|
||||||
const updateSpy = jest.spyOn(documentService, 'update')
|
const patchSpy = jest.spyOn(documentService, 'patch')
|
||||||
const toastSpy = jest.spyOn(toastService, 'showError')
|
const toastSpy = jest.spyOn(toastService, 'showError')
|
||||||
const error = new Error('failed to save')
|
const error = new Error('failed to save')
|
||||||
updateSpy.mockImplementation(() => throwError(() => error))
|
patchSpy.mockImplementation(() => throwError(() => error))
|
||||||
component.saveEditNext()
|
component.saveEditNext()
|
||||||
expect(updateSpy).toHaveBeenCalled()
|
expect(patchSpy).toHaveBeenCalled()
|
||||||
expect(closeSpy).not.toHaveBeenCalled()
|
expect(closeSpy).not.toHaveBeenCalled()
|
||||||
expect(toastSpy).toHaveBeenCalledWith('Error saving document', error)
|
expect(toastSpy).toHaveBeenCalledWith('Error saving document', error)
|
||||||
})
|
})
|
||||||
@@ -965,10 +965,10 @@ describe('DocumentDetailComponent', () => {
|
|||||||
expect(fixture.debugElement.nativeElement.textContent).toContain(
|
expect(fixture.debugElement.nativeElement.textContent).toContain(
|
||||||
customFields[1].name
|
customFields[1].name
|
||||||
)
|
)
|
||||||
const updateSpy = jest.spyOn(documentService, 'update')
|
const patchSpy = jest.spyOn(documentService, 'patch')
|
||||||
component.save(true)
|
component.save(true)
|
||||||
expect(updateSpy.mock.lastCall[0].custom_fields).toHaveLength(2)
|
expect(patchSpy.mock.lastCall[0].custom_fields).toHaveLength(2)
|
||||||
expect(updateSpy.mock.lastCall[0].custom_fields[1]).toEqual({
|
expect(patchSpy.mock.lastCall[0].custom_fields[1]).toEqual({
|
||||||
field: customFields[1].id,
|
field: customFields[1].id,
|
||||||
value: null,
|
value: null,
|
||||||
})
|
})
|
||||||
@@ -985,9 +985,9 @@ describe('DocumentDetailComponent', () => {
|
|||||||
expect(
|
expect(
|
||||||
fixture.debugElement.query(By.css('form')).nativeElement.textContent
|
fixture.debugElement.query(By.css('form')).nativeElement.textContent
|
||||||
).not.toContain('Field 1')
|
).not.toContain('Field 1')
|
||||||
const updateSpy = jest.spyOn(documentService, 'update')
|
const patchSpy = jest.spyOn(documentService, 'patch')
|
||||||
component.save(true)
|
component.save(true)
|
||||||
expect(updateSpy.mock.lastCall[0].custom_fields).toHaveLength(
|
expect(patchSpy.mock.lastCall[0].custom_fields).toHaveLength(
|
||||||
initialLength - 1
|
initialLength - 1
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -797,7 +797,7 @@ export class DocumentDetailComponent
|
|||||||
this.networkActive = true
|
this.networkActive = true
|
||||||
;(document.activeElement as HTMLElement)?.dispatchEvent(new Event('change'))
|
;(document.activeElement as HTMLElement)?.dispatchEvent(new Event('change'))
|
||||||
this.documentsService
|
this.documentsService
|
||||||
.update(this.document)
|
.patch(this.document)
|
||||||
.pipe(first())
|
.pipe(first())
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next: (docValues) => {
|
next: (docValues) => {
|
||||||
@@ -851,7 +851,7 @@ export class DocumentDetailComponent
|
|||||||
this.networkActive = true
|
this.networkActive = true
|
||||||
this.store.next(this.documentForm.value)
|
this.store.next(this.documentForm.value)
|
||||||
this.documentsService
|
this.documentsService
|
||||||
.update(this.document)
|
.patch(this.document)
|
||||||
.pipe(
|
.pipe(
|
||||||
switchMap((updateResult) => {
|
switchMap((updateResult) => {
|
||||||
return this.documentListViewService
|
return this.documentListViewService
|
||||||
|
|||||||
Reference in New Issue
Block a user