Skip to content

Commit

Permalink
fix gtheque filter
Browse files Browse the repository at this point in the history
  • Loading branch information
ikit committed Nov 12, 2022
1 parent 12945d0 commit 1da15f5
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 11 deletions.
18 changes: 14 additions & 4 deletions absg-client/src/views/Gtheque/Theques.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
prepend-icon="fa-search"
placeholder="Rechercher"
style="max-width: 300px;"
@change="applyFilter()"
/>

<v-spacer />
Expand Down Expand Up @@ -64,7 +65,7 @@
class="albumCollection"
>
<v-expansion-panel
v-for="c of collections"
v-for="c of displayedCollections"
:key="c.id"
>
<v-expansion-panel-header>
Expand Down Expand Up @@ -214,11 +215,12 @@ import { format } from 'date-fns';
export default {
data: () => ({
collections: [],
displayedCollections: [],
types: [
{ key: "COMIC", label: "Bandes dessinées", icon: "fas fa-book" },
{ key: "BOOK", label: "Romans", icon: "fas fa-book" },
{ key: "MANGA", label: "Manga", icon: "fas fa-book" },
{ key: "VINYL", lavel: "Vinyls", icon: "fas fa-compact-disc" },
{ key: "VINYL", label: "Vinyls", icon: "fas fa-compact-disc" },
{ key: "BOARDGAME", label: "Jeux de sociétés", icon: "fas fa-chess-knight" },
{ key: "LEGO", label: "Légo", icon: "fas fa-cubes" },
{ key: "WINE", label: "Cave", icon: "fas fa-wine-glass-alt" },
Expand All @@ -245,12 +247,12 @@ export default {
mounted () {
const path = this.$route.params.path;
console.log("Path: " + path)
setTimeout(() => this.changeCollection("COMIC"));
axios.get(`/api/gtheque/`).then(response => {
this.collections = parseAxiosResponse(response).map(e => ({
...e,
cssStatus: this.computeCssStatus(e)
}));
this.changeCollection("COMIC");
console.log(this.collections);
});
},
Expand All @@ -270,9 +272,17 @@ export default {
},
changeCollection: function(colKey) {
this.selectedType = this.types.find(t => t.key === colKey);
this.applyFilter();
},
applyFilter: function() {
const tokens = this.filter.search ? this.filter.search.split(" ").map(t => t.toLowerCase()) : [];
this.displayedCollections = this.collections.filter(c =>
c.type === this.selectedType.key &&
(tokens.length === 0 || tokens.some(t => c.title.toLowerCase().indexOf(t) >= 0)
));
},
switchItem: function (item) {
item.ok = !item.ok;
item.ok = !item.ok;
for (const c of this.collections) {
c.count = c.items.filter(i => i.ok).length;
c.cssStatus = this.computeCssStatus(c)
Expand Down
1 change: 0 additions & 1 deletion absg-core/src/controllers/GThequeController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export class GThequeController {
@Get("/grenary")
getGrenary() {
const r = gthequeService.getGrenaryFiles();
console.log(r[0].content);
return r;
}

Expand Down
3 changes: 1 addition & 2 deletions absg-core/src/controllers/PhotoAlbumController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,10 @@ export class PhotoAlbumController {
"/photos/",
`${"absg_" + id.toString().padStart(4, "0")}/RAW.zip`
);
console.log(filePath);

if (!fs.existsSync(filePath)) {
// On crée le zip
console.log("File not exists");
console.log("TODO File not exists");
}
await new Promise<void>((resolve, reject) => {
response.sendFile(filePath, (err: any) => {
Expand Down
1 change: 0 additions & 1 deletion absg-core/src/services/GThequeService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class GThequeService {
return list
.filter(f => f !== null)
.sort((a, b) => {
console.log(a, b)
// On trie par ordre les dossier avant les fichiers
if (a.type === "folder" && b.type !== "folder") {
return -1;
Expand Down
7 changes: 4 additions & 3 deletions absg-core/src/wss.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import * as WebSocket from "ws";
import { logger } from "./middleware/logger";

const port = process.env.WS_PORT;
const wss = new WebSocket.Server({ port });

// wss.on("connection", () => {
// logger.debug("WS client connection established");
// });
wss.on("connection", () => {
logger.info(`Websocket has started on port ${process.env.WS_PORT}.`);
});

export default wss;

0 comments on commit 1da15f5

Please sign in to comment.