Merge branch 'gallery-fixes' into 'v3'

Gallery fixes

See merge request openflexure/openflexure-microscope-server!591
This commit is contained in:
Julian Stirling 2026-05-15 11:16:45 +00:00
commit 59a93c673a
4 changed files with 22 additions and 15 deletions

View file

@ -5,7 +5,7 @@ import prettierConfig from "eslint-config-prettier";
import globals from "globals"; import globals from "globals";
import pinia from "eslint-plugin-pinia"; import pinia from "eslint-plugin-pinia";
const isProd = process.env.NODE_ENV === "production"; const isDev = process.env.NODE_ENV === "development";
export default [ export default [
{ {
@ -38,8 +38,8 @@ export default [
rules: { rules: {
"prettier/prettier": "warn", "prettier/prettier": "warn",
// Environment-based rules // Environment-based rules
"no-console": isProd ? "warn" : "off", "no-console": isDev ? "off" : ["warn", { allow: ["warn", "error"] }],
"no-debugger": isProd ? "warn" : "off", "no-debugger": isDev ? "off" : "warn",
// Vue deprecations // Vue deprecations
"vue/no-deprecated-slot-attribute": "warn", "vue/no-deprecated-slot-attribute": "warn",

View file

@ -387,11 +387,4 @@ html {
padding: 0; padding: 0;
height: 100%; height: 100%;
} }
.thumbnail-fit {
max-height: 120px;
max-width: 240px;
object-fit: contain;
overflow-y: hidden;
}
</style> </style>

View file

@ -5,10 +5,11 @@
<div class="view-image uk-padding-remove uk-height-1-1"> <div class="view-image uk-padding-remove uk-height-1-1">
<img <img
id="thumbnail-stitched-image" id="thumbnail-stitched-image"
:class="[itemData?.dzi ? 'thumbnail-fit clickable' : 'thumbnail-fit disabled']"
class="thumbnail-fit" class="thumbnail-fit"
:src="thumbnailPath" :src="thumbnailPath"
onerror="this.src = '/titleiconpink.svg'" onerror="this.src = '/titleiconpink.svg'"
@click="requestViewer" @click="itemData?.dzi && requestViewer()"
/> />
</div> </div>
</div> </div>
@ -192,4 +193,19 @@ ul {
.gallery-card-title { .gallery-card-title {
text-align: center; text-align: center;
} }
.thumbnail-fit {
max-height: 120px;
max-width: 240px;
object-fit: contain;
overflow-y: hidden;
}
.clickable {
cursor: pointer;
}
.disabled {
cursor: not-allowed;
}
</style> </style>

View file

@ -61,7 +61,7 @@
</div> </div>
</div> </div>
<PaginateLinks <PaginateLinks
:total-pages="numberOfPages" :total-pages="totalPages"
:current-page="currentPage" :current-page="currentPage"
@change-page="changePage" @change-page="changePage"
/> />
@ -119,8 +119,7 @@ export default {
return null; return null;
} }
}, },
// name changed as paginateLinks has the prop totalPages totalPages() {
numberOfPages() {
return Math.ceil((this.all_items?.length || 0) / this.itemsPerPage); return Math.ceil((this.all_items?.length || 0) / this.itemsPerPage);
}, },
paginatedItems() { paginatedItems() {
@ -190,7 +189,6 @@ export default {
return b.created - a.created; return b.created - a.created;
}); });
this.all_items = all_items; this.all_items = all_items;
console.debug("Gallery size: %s", this.all_items.length);
} catch (err) { } catch (err) {
console.error("Failed to refresh gallery items."); console.error("Failed to refresh gallery items.");
console.error(err); console.error(err);