Merge pull request #15 from archtika/devel

Fix pagination and update actions to use working tree from branch
This commit is contained in:
Thilo Hohlt
2024-09-17 21:03:19 +02:00
committed by GitHub
4 changed files with 16 additions and 13 deletions

View File

@@ -13,9 +13,11 @@ env:
jobs:
deploy:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event != 'pull_request' }}
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_branch }}
- name: Install Nix
uses: cachix/install-nix-action@v27
@@ -31,9 +33,8 @@ jobs:
- name: Deploy to demo server
run: |
nix run nixpkgs#nixos-rebuild -- switch \
--flake github:archtika/archtika/${{ github.event.workflow_run.head_branch }}#${{ github.event.workflow_run.head_branch == 'devel' && 'qs' || 'prod' }} \
--flake .#${{ github.event.workflow_run.head_branch == 'devel' && 'qs' || 'prod' }} \
--fast \
--refresh \
--build-host ${{ env.SERVER_USER }}@${{ github.event.workflow_run.head_branch == 'devel' && env.QS_SERVER_IP || env.PROD_SERVER_IP }} \
--target-host ${{ env.SERVER_USER }}@${{ github.event.workflow_run.head_branch == 'devel' && env.QS_SERVER_IP || env.PROD_SERVER_IP }} \
--use-remote-sudo

View File

@@ -11,6 +11,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref || github.ref_name }}
- name: Install Nix
uses: cachix/install-nix-action@v27

View File

@@ -7,7 +7,7 @@ export const load: PageServerLoad = async ({ parent, fetch, params, cookies, url
const resourceFilter = url.searchParams.get("logs_filter_resource");
const operationFilter = url.searchParams.get("logs_filter_operation");
const currentPage = Number.parseInt(url.searchParams.get("logs_results_page") ?? "1");
const resultOffset = currentPage === 1 ? 0 : currentPage * 50;
const resultOffset = (currentPage - 1) * 50;
const searchParams = new URLSearchParams();

View File

@@ -178,11 +178,11 @@
<div class="pagination">
<p>
{$page.url.searchParams.get("logs_results_page") ?? 1} / {Math.max(
Math.floor(data.resultChangeLogCount / 50),
Math.ceil(data.resultChangeLogCount / 50),
1
)}
</p>
<form method="GET" onsubmit={() => logsSection.scrollIntoView()}>
<form method="GET">
<input type="hidden" name="logs_results_page" value={1} />
{@render commonFilterInputs()}
<button
@@ -191,7 +191,7 @@
>First</button
>
</form>
<form method="GET" onsubmit={() => logsSection.scrollIntoView()}>
<form method="GET">
<input
type="hidden"
name="logs_results_page"
@@ -207,12 +207,12 @@
>Previous</button
>
</form>
<form method="GET" onsubmit={() => logsSection.scrollIntoView()}>
<form method="GET">
<input
type="hidden"
name="logs_results_page"
value={Math.min(
Math.max(Math.floor(data.resultChangeLogCount / 50), 1),
Math.max(Math.ceil(data.resultChangeLogCount / 50), 1),
Number.parseInt($page.url.searchParams.get("logs_results_page") ?? "1") + 1
)}
/>
@@ -220,20 +220,20 @@
<button
type="submit"
disabled={($page.url.searchParams.get("logs_results_page") ?? "1") ===
Math.max(Math.floor(data.resultChangeLogCount / 50), 1).toString()}>Next</button
Math.max(Math.ceil(data.resultChangeLogCount / 50), 1).toString()}>Next</button
>
</form>
<form method="GET" onsubmit={() => logsSection.scrollIntoView()}>
<form method="GET">
<input
type="hidden"
name="logs_results_page"
value={Math.max(Math.floor(data.resultChangeLogCount / 50), 1)}
value={Math.max(Math.ceil(data.resultChangeLogCount / 50), 1)}
/>
{@render commonFilterInputs()}
<button
type="submit"
disabled={($page.url.searchParams.get("logs_results_page") ?? "1") ===
Math.max(Math.floor(data.resultChangeLogCount / 50), 1).toString()}>Last</button
Math.max(Math.ceil(data.resultChangeLogCount / 50), 1).toString()}>Last</button
>
</form>
</div>