Skip to content

Commit

Permalink
supporting "percentage fee" additional items (#1357)
Browse files Browse the repository at this point in the history
* initial work for supporting "percentage fee" additional items

* WIP list page

* WIP: preview markdown content

* WIP edit form

* add available quantity

* improve styling

* fix reservation API

* fix list + add

* fix error when defining decimal percentage

* fields validation

* edit / delete item

* fix compilation issue

* fix broken test

* reload list on save

* implement feedback; remove growl

* fix compilation errors after merge

* fix form errors

* public UI modifications

* apply suggested modifications

* fix sonar warnings
  • Loading branch information
cbellone authored Jun 23, 2024
1 parent d5c1c58 commit 17b1bc9
Show file tree
Hide file tree
Showing 78 changed files with 2,712 additions and 1,454 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/build-on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
postgresql: ['10','16']
postgresql: ['10', '15','16']
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
Expand All @@ -23,7 +23,7 @@ jobs:
restore-keys: |
${{ runner.os }}-gradlew-
- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
Expand All @@ -37,7 +37,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 'Upload Build'
if: ${{ github.repository == 'alfio-event/alf.io' && matrix.postgresql == '10'}}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: dist
path: build
Expand All @@ -49,7 +49,7 @@ jobs:
name: Push dev image
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: dist
- name: Set up QEMU
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:
name: Push PROD image
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: dist
- name: Set up QEMU
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
Expand All @@ -27,7 +27,7 @@ jobs:
# languages: go, javascript, csharp, python, cpp, java

- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ logs/
.DS_Store
out/
.clever.json
!/src/main/webapp/resources/bower_components/angular-growl-v2/build/
alfio-itest
.gradletasknamecache
public/
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ plugins {
id 'com.github.ben-manes.versions' version '0.51.0'
id 'com.github.hierynomus.license' version '0.16.1'
id 'net.researchgate.release' version '3.0.2'
id 'org.springframework.boot' version '3.3.0-RC1'
id 'org.springframework.boot' version '3.3.0'
id 'io.spring.dependency-management' version '1.1.4'
id 'org.sonarqube' version '5.0.0.4638'
// id 'net.ltgt.errorprone' version '3.1.0'
Expand Down
2 changes: 1 addition & 1 deletion frontend/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

Expand Down
37 changes: 37 additions & 0 deletions frontend/admin/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"@lit/context": "1.1.1",
"@lit/task": "1.0.0",
"@shoelace-style/shoelace": "2.15.0",
"@tanstack/lit-form": "^0.20.3",
"lit": "3.1.3"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import {customElement, property, state} from "lit/decorators.js";
import {unsafeHTML} from 'lit/directives/unsafe-html.js';
import {css, html, LitElement, TemplateResult} from "lit";
import {Task} from "@lit/task";
import {UtilService} from "../service/util.ts";
import {row} from "../styles.ts";

@customElement('alfio-display-commonmark-preview')
export class DisplayCommonMarkPreview extends LitElement {

static styles = [
row,
css`
sl-button.left::part(base) {
justify-content: start;
}
sl-button.right::part(base) {
justify-content: end;
}
`
]

@property({ type: String, attribute: 'data-button-text' })
buttonText?: string;

@property({ type: String, attribute: 'data-text' })
text?: string;

@state()
dialogOpen = false;

private task?: Task<ReadonlyArray<any>, string>;

protected render(): TemplateResult {
return html`
<div class="row">
<sl-button class="left" variant="text" target="_blank" href="https://commonmark.org/help/" size="small"><sl-icon name="markdown" slot="prefix"></sl-icon> How to format text</sl-button>
<sl-button class="right" variant="text" .disabled=${(this.text ?? '').trim().length === 0} @click=${this.openDialog} size="small"><sl-icon name="easel3" slot="prefix"></sl-icon> ${this.buttonText}</sl-button>
</div>
<sl-dialog ?open=${this.dialogOpen} label="Text Preview" style="--width: 50vw;" class="dialog-markdown-preview" >
<div style="height: 50vh; border: dashed 1px var(--sl-color-neutral-200); padding: 0 1rem;">
${this.renderText()}
</div>
<sl-button slot="footer" variant="default" @click=${this.closeDialog}>Close</sl-button>
</sl-dialog>
`;
}

private openDialog(): void {
this.dialogOpen = true;
this.task = new Task<ReadonlyArray<any>, string>(this,
async () => {
return await UtilService.renderMarkdown(this.text!);
}, () => []);
}

private closeDialog(): void {
this.dialogOpen = false;
}

private renderText(): TemplateResult {
return this.task?.render({
initial: () => html`init`,
complete: (value) => html`${unsafeHTML(value)}`
}) ?? html`error`;
}
}

declare global {
interface HTMLElementTagNameMap {
'alfio-display-commonmark-preview': DisplayCommonMarkPreview
}
}
Loading

0 comments on commit 17b1bc9

Please sign in to comment.