Skip to content

Commit

Permalink
Merge branch 'main' into 307-pdf-exporter-should-display-info-if-famo…
Browse files Browse the repository at this point in the history
…us-polar-bear-images-is-appearing
  • Loading branch information
pbezliapovich authored Jan 9, 2025
2 parents 6f642d4 + a1009e7 commit 215b92e
Show file tree
Hide file tree
Showing 28 changed files with 207 additions and 133 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/maven-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
with:
fetch-depth: 0
- name: 🧱 Set up JDK and Maven
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4
with:
distribution: adopt
java-version: 17
Expand All @@ -37,7 +37,7 @@ jobs:
run: echo "cache_key=${{ runner.os }}-mvn-${{ hashFiles('**/pom.xml') }}-${{ github.sha }}" >> $GITHUB_OUTPUT
- name: 💾 Prepare cache using cache key
id: prepare-cache
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4
with:
path: |
/home/runner/.m2
Expand Down Expand Up @@ -116,14 +116,14 @@ jobs:
COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_GPG_PASSPHRASE: ${{ secrets.COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_GPG_PASSPHRASE }}
steps:
- name: 🧱 Set up JDK and Maven
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4
with:
distribution: adopt
java-version: 17
gpg-private-key: ${{ secrets.COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_GPG_PRIVATE_KEY }}
- name: 💾 Restore cache using cache key
id: restore-cache
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4
with:
path: |
/home/runner/.m2
Expand All @@ -146,13 +146,13 @@ jobs:
GITHUB_TOKEN: ${{ github.token }}
steps:
- name: 🧱 Set up JDK and Maven
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4
with:
distribution: adopt
java-version: 17
- name: 💾 Restore cache using cache key
id: restore-cache
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4
with:
path: |
/home/runner/.m2
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/openapi-validation.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
---
name: openapi-validate
on: [push]
on:
push:
workflow_dispatch:
jobs:
check-openapi-definition:
runs-on: ubuntu-latest
name: Swagger Editor Validator Remote
steps:
- name: 📄 Checkout the repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: 🧪 Validate OpenAPI definition
uses: char0n/swagger-editor-validate@fe35d650e9fc674505607519d0d12ab4de5d415d # v1
uses: swaggerexpert/swagger-editor-validate@e8e51dbc8c18e87f96b082b18a6a7cbd3c44abd8 # v1.4.2
with:
definition-file: docs/openapi.json
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ repos:
language: pygrep
types: [text]
- repo: https://github.com/zricethezav/gitleaks
rev: v8.21.2
rev: v8.22.1
hooks:
- id: gitleaks
- repo: https://github.com/grigoriev/pre-commit-check-git-user
Expand All @@ -44,6 +44,6 @@ repos:
- id: check-git-config-user-email
args: [--templates, ^\S+\.\S+@sbb\.ch$]
- repo: https://github.com/commitizen-tools/commitizen
rev: v4.0.0
rev: v4.1.0
hooks:
- id: commitizen
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Changelog

## [8.0.0](https://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.pdf-exporter/compare/v7.5.0...v8.0.0) (2025-01-08)


### ⚠ BREAKING CHANGES

* style package weights don't work for bulk export widget ([#324](https://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.pdf-exporter/issues/324))
* support only Polarion 2410 ([#315](https://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.pdf-exporter/issues/315))

### Features

* refactor the object model and cover with unit tests ([#313](https://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.pdf-exporter/issues/313)) ([dd955b0](https://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.pdf-exporter/commit/dd955b0fb0d8577434a98d207921d4ef401762c5))
* support only Polarion 2410 ([#315](https://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.pdf-exporter/issues/315)) ([3725e4e](https://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.pdf-exporter/commit/3725e4eb6b67adb36a803164dbec2c5091c59f46)), closes [#299](https://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.pdf-exporter/issues/299)
* support WeasyPrint Service v63.1.0 ([#319](https://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.pdf-exporter/issues/319)) ([a2ebcfa](https://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.pdf-exporter/commit/a2ebcfac5e4ef9b325b8a85d5600d6903368f9cf)), closes [#300](https://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.pdf-exporter/issues/300)


### Bug Fixes

* **deps:** update dependency net.bytebuddy:byte-buddy to v1.15.11 ([#322](https://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.pdf-exporter/issues/322)) ([77309b0](https://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.pdf-exporter/commit/77309b01d2915b2f963d3fb9487a29e3309429e8))
* style package weights don't work for bulk export widget ([#324](https://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.pdf-exporter/issues/324)) ([3e7abb9](https://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.pdf-exporter/commit/3e7abb92ef5379dbed30b57f114e19d918a346fc)), closes [#317](https://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.pdf-exporter/issues/317)

## [7.5.0](https://github.com/SchweizerischeBundesbahnen/ch.sbb.polarion.extension.pdf-exporter/compare/v7.4.0...v7.5.0) (2024-12-10)


Expand Down
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,16 @@ First of all you need to inject appropriate JavaScript code into Polarion:
5. Save changes by clicking 💾 Save

Then open a project, its Live Report you wish to export, and click "Expand Tools" on top of the page.
As a result report's toolbar will appear. Click "Edit" button in a toolbar, as a result the report will be switched into an edit mode. Add an empty region on top of the report, place cursor there, choose "Generic" tag on "Widgets" sidebar on right hand side of the page, find "Export to PDF Button" widget there and click it to add to the report. Then save a report clicking 💾 in a toolbar and then return to a view mode clicking "Back" button. When you click "Export to PDF" button just added to the report, PDF Exporter view will be opened in a popup and you will be able to proceed with exporting the report to PDF. Be aware that in report's context limited set of properties are available for configuration in PDF popup, the rest of them are relevant only in Live Document context.
As a result report's toolbar will appear. Click "Edit" button in a toolbar, as a result the report will be switched into an edit mode. Add an empty region on top of the report, place cursor there, choose "PDF Export" tag on "Widgets" sidebar on right hand side of the page, find "Export to PDF Button" widget there and click it to add to the report. Then save a report clicking 💾 in a toolbar and then return to a view mode clicking "Back" button. When you click "Export to PDF" button just added to the report, PDF Exporter view will be opened in a popup and you will be able to proceed with exporting the report to PDF. Be aware that in report's context limited set of properties are available for configuration in PDF popup, the rest of them are relevant only in Live Document context.

### Bulk PDF Export
There is a possibility to export multiple documents in one run. This can be achieved with help of special widget.

Open a project where you wish do bulk export. Open its Default Space in Documents & Pages and create Live Report with name "Bulk PDF Export". Newly created report will be opened in edit mode. Change its title to "Bulk PDF Export" or whatever value you wish, then place cursor in a region you wish the widget to appear, choose "PDF Export" tag on "Widgets" sidebar on right hand side of the page, find "Bulk PDF Export" widget there and click it to add to the report. Then save a report clicking 💾 in a toolbar and then return to a view mode clicking "Back" button.

As a result you will see a table listing all Live Documents in a current project (with pagination). This widget is an extension of standard Polarion table with a data set and can be configured the similar way, for example you can specify a Lucene query to narrow list of displaying documents, change set of columns or modify soring rule.

When you are ready with filtering, sorting etc. of documents you can select multiple documents to be exported, ticking appropriate checkboxes and click Export to PDF button, a popup with export configuration will be opened. Select appropriate configuration and click Export button, new popup will be opened showing progress of exporting. When export is finished click Close button to hide popup. Also, you can click Stop button when export is in progress, in this case document which is exporting at the moment will finish and the rest which were pending will be cancelled.

### Configuring logs

Expand Down Expand Up @@ -232,7 +241,8 @@ All good so far.

### Upgrade from version 7.x.x to 8.0.0

In version 8.0.0 support for Polarion 2404 and older has been dropped. This extensions supports only Polarion 2410.
In version 8.0.0 support for Polarion 2404 and older has been dropped. This extension supports only Polarion 2410.
Recommended version of WeasyPrint Service is 63.1.0.

### Upgrade from version 6.x.x to 7.0.0

Expand Down
95 changes: 32 additions & 63 deletions docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -900,11 +900,6 @@
"description": "Images deleted successfully"
}
},
"security": [
{
"bearerAuth": []
}
],
"summary": "Deletes images in SVN linked to specified cover page within specified scope (global or certain project)",
"tags": [
"Settings"
Expand All @@ -919,11 +914,6 @@
"description": "Template names retrieved successfully"
}
},
"security": [
{
"bearerAuth": []
}
],
"summary": "Get list of cover page predefined template names",
"tags": [
"Settings"
Expand Down Expand Up @@ -955,11 +945,6 @@
"description": "Template persisted successfully"
}
},
"security": [
{
"bearerAuth": []
}
],
"summary": "Persist content of cover page predefined template",
"tags": [
"Settings"
Expand Down Expand Up @@ -1005,11 +990,6 @@
"description": "Localization file downloaded successfully"
}
},
"security": [
{
"bearerAuth": []
}
],
"summary": "Downloads localization values by name of localization settings",
"tags": [
"Settings"
Expand Down Expand Up @@ -1054,54 +1034,35 @@
"description": "Localization file uploaded successfully"
}
},
"security": [
{
"bearerAuth": []
}
],
"summary": "Uploads localization values",
"tags": [
"Settings"
]
}
},
"/api/settings/style-package/suitable-names": {
"get": {
"post": {
"operationId": "getSuitableStylePackageNames",
"parameters": [
{
"in": "query",
"name": "projectId",
"schema": {
"type": "string"
}
},
{
"in": "query",
"name": "spaceId",
"schema": {
"type": "string"
"requestBody": {
"content": {
"application/json": {
"schema": {
"items": {
"$ref": "#/components/schemas/DocIdentifier"
},
"type": "array"
}
}
},
{
"in": "query",
"name": "documentName",
"schema": {
"type": "string"
}
}
],
"description": "List of document identifiers",
"required": true
},
"responses": {
"200": {
"description": "Successfully retrieved the list of style package names"
}
},
"security": [
{
"bearerAuth": []
}
],
"summary": "Get list of style packages suitable for a document",
"summary": "Get list of style packages suitable for the specified list of documents (sorted by weight)",
"tags": [
"Settings"
]
Expand All @@ -1124,11 +1085,6 @@
"description": "Successfully retrieved the list of style package names with the weight information"
}
},
"security": [
{
"bearerAuth": []
}
],
"summary": "Get full list of available style packages for the specific scope with the weight information",
"tags": [
"Settings"
Expand Down Expand Up @@ -1158,11 +1114,6 @@
"description": "default response"
}
},
"security": [
{
"bearerAuth": []
}
],
"summary": "Update weight information for the provided style packages",
"tags": [
"Settings"
Expand Down Expand Up @@ -1665,6 +1616,24 @@
},
"type": "object"
},
"DocIdentifier": {
"description": "Unique document identifier data",
"properties": {
"documentName": {
"description": "Document name",
"type": "string"
},
"projectId": {
"description": "Project ID",
"type": "string"
},
"spaceId": {
"description": "Space ID",
"type": "string"
}
},
"type": "object"
},
"DocumentCollectionEntry": {
"description": "Details about document from collection",
"properties": {
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</parent>

<artifactId>ch.sbb.polarion.extension.pdf-exporter</artifactId>
<version>7.5.1-SNAPSHOT</version>
<version>8.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Polarion ALM extension to convert Documents to PDF files</name>
Expand Down Expand Up @@ -46,7 +46,7 @@
<properties>
<pdfbox.version>3.0.3</pdfbox.version>
<okapi.xliff.version>1.47.0</okapi.xliff.version>
<byte-buddy.version>1.15.10</byte-buddy.version>
<byte-buddy.version>1.15.11</byte-buddy.version>

<slf4j.version>1.7.36</slf4j.version>
<testcontainers.version>1.20.4</testcontainers.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import ch.sbb.polarion.extension.pdf_exporter.rest.model.conversion.DocumentType;
import ch.sbb.polarion.extension.pdf_exporter.rest.model.conversion.ExportParams;
import ch.sbb.polarion.extension.pdf_exporter.rest.model.settings.localization.Language;
import ch.sbb.polarion.extension.pdf_exporter.rest.model.settings.stylepackage.DocIdentifier;
import ch.sbb.polarion.extension.pdf_exporter.rest.model.settings.stylepackage.StylePackageModel;
import ch.sbb.polarion.extension.pdf_exporter.service.PdfExporterPolarionService;
import ch.sbb.polarion.extension.pdf_exporter.service.PolarionBaselineExecutor;
Expand Down Expand Up @@ -173,7 +174,7 @@ private Collection<SettingName> getSuitableStylePackages(@NotNull IModule module
} else {
documentName = locationPath;
}
return polarionService.getSuitableStylePackages(module.getProject().getId(), spaceId, documentName);
return polarionService.getSuitableStylePackages(List.of(new DocIdentifier(module.getProject().getId(), spaceId, documentName)));
}

private Collection<SettingName> getSettingNames(@NotNull String featureName, @NotNull String scope) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import ch.sbb.polarion.extension.generic.rest.filter.Secured;
import ch.sbb.polarion.extension.generic.service.PolarionService;
import ch.sbb.polarion.extension.generic.settings.SettingName;
import ch.sbb.polarion.extension.pdf_exporter.rest.model.settings.stylepackage.DocIdentifier;
import ch.sbb.polarion.extension.pdf_exporter.rest.model.settings.stylepackage.StylePackageWeightInfo;
import org.glassfish.jersey.media.multipart.FormDataBodyPart;

Expand Down Expand Up @@ -44,8 +45,8 @@ public void deleteImages(String coverPageName, String scope) {
}

@Override
public Collection<SettingName> getSuitableStylePackageNames(String projectId, String spaceId, String documentName) {
return polarionService.callPrivileged(() -> super.getSuitableStylePackageNames(projectId, spaceId, documentName));
public Collection<SettingName> getSuitableStylePackageNames(List<DocIdentifier> docIdentifiers) {
return polarionService.callPrivileged(() -> super.getSuitableStylePackageNames(docIdentifiers));
}

@Override
Expand Down
Loading

0 comments on commit 215b92e

Please sign in to comment.