Skip to content

Commit cc33581

Browse files
committed
clean up
1 parent 869e9c7 commit cc33581

File tree

6 files changed

+97
-82
lines changed

6 files changed

+97
-82
lines changed

Makefile

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: pgadmin-start pgadmin-stop download-wikidata-dump extract-wikidata-dump db-truncate db-dump db-restore run-download-pipeline run-import-pipeline export-positions-csv export-locations-csv index-dump index-restore
1+
.PHONY: pgadmin-start pgadmin-stop download-wikidata-dump extract-wikidata-dump db-truncate db-dump db-restore run-download-pipeline run-import-pipeline export-positions-csv export-locations-csv index-dump index-dump-restore index-snapshot index-snapshot-restore
22

33
# Start pgAdmin4 container for database inspection
44
pgadmin-start:
@@ -116,7 +116,7 @@ index-dump:
116116
done
117117

118118
# Restore search index from local file
119-
index-restore:
119+
index-dump-restore:
120120
@echo "Restoring Meilisearch from dumps/meilisearch.dump..."
121121
@if [ ! -f dumps/meilisearch.dump ]; then \
122122
echo "Error: dumps/meilisearch.dump not found. Run 'make index-dump' first."; \
@@ -131,3 +131,49 @@ index-restore:
131131
meilisearch --import-dump /dumps/meilisearch.dump
132132
@docker compose up -d meilisearch
133133
@echo "Meilisearch restored successfully from dumps/meilisearch.dump"
134+
135+
# Create search index snapshot (faster than dump, same version only)
136+
index-snapshot:
137+
@mkdir -p dumps
138+
@echo "Creating Meilisearch snapshot in dumps/..."
139+
@. ./.env && \
140+
TASK_UID=$$(curl -s -X POST "http://localhost:7700/snapshots" \
141+
-H "Authorization: Bearer $$MEILI_MASTER_KEY" | jq -r '.taskUid') && \
142+
trap 'echo "Cancelling snapshot task..."; curl -s -X POST "http://localhost:7700/tasks/cancel?uids=$$TASK_UID" -H "Authorization: Bearer $$MEILI_MASTER_KEY" > /dev/null; exit 1' INT && \
143+
echo "Snapshot task started (taskUid: $$TASK_UID). Waiting for completion..." && \
144+
while true; do \
145+
STATUS=$$(curl -s "http://localhost:7700/tasks/$$TASK_UID" \
146+
-H "Authorization: Bearer $$MEILI_MASTER_KEY" | jq -r '.status'); \
147+
if [ "$$STATUS" = "succeeded" ]; then \
148+
echo "Snapshot created successfully in dumps/"; \
149+
ls -lh dumps/*.snapshot 2>/dev/null || echo "Snapshot file created"; \
150+
break; \
151+
elif [ "$$STATUS" = "failed" ]; then \
152+
echo "Snapshot failed!"; \
153+
curl -s "http://localhost:7700/tasks/$$TASK_UID" \
154+
-H "Authorization: Bearer $$MEILI_MASTER_KEY" | jq '.error'; \
155+
exit 1; \
156+
fi; \
157+
sleep 1; \
158+
done
159+
160+
# Restore search index from snapshot (same version only)
161+
index-snapshot-restore:
162+
@echo "Restoring Meilisearch from snapshot..."
163+
@SNAPSHOT=$$(ls -t dumps/*.snapshot 2>/dev/null | head -1); \
164+
if [ -z "$$SNAPSHOT" ]; then \
165+
echo "Error: No snapshot found in dumps/. Run 'make index-snapshot' first."; \
166+
exit 1; \
167+
fi; \
168+
echo "Using snapshot: $$SNAPSHOT"
169+
@docker compose stop meilisearch
170+
@docker volume rm poliloom_meilisearch_data || true
171+
@SNAPSHOT=$$(ls -t dumps/*.snapshot 2>/dev/null | head -1) && \
172+
. ./.env && docker run --rm \
173+
-v poliloom_meilisearch_data:/meili_data \
174+
-v $(PWD)/dumps:/dumps \
175+
-e MEILI_MASTER_KEY=$$MEILI_MASTER_KEY \
176+
getmeili/meilisearch:v1.29 \
177+
meilisearch --import-snapshot /dumps/$$(basename $$SNAPSHOT)
178+
@docker compose up -d meilisearch
179+
@echo "Meilisearch restored successfully from snapshot"

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ services:
1111
- MEILI_ENV=production
1212
- MEILI_MASTER_KEY=${MEILI_MASTER_KEY}
1313
- MEILI_DUMP_DIR=/dumps
14+
- MEILI_SNAPSHOT_DIR=/dumps
1415
healthcheck:
1516
test: ["CMD", "curl", "-f", "http://localhost:7700/health"]
1617
interval: 10s

poliloom-gui/src/app/globals.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
--accent-foreground-hover: var(--color-blue-700);
4646
--accent-muted: var(--color-blue-100);
4747
--accent-muted-hover: var(--color-blue-200);
48-
--accent-light: var(--color-blue-300);
48+
--accent-light: var(--color-blue-400);
4949
--accent-border-hover: var(--color-blue-300);
5050
--accent-on-muted: var(--color-blue-900);
5151
--accent-on-solid: var(--color-white);
@@ -149,7 +149,7 @@
149149
--accent-foreground-hover: var(--color-blue-300);
150150
--accent-muted: color-mix(in srgb, var(--color-blue-500) 15%, transparent);
151151
--accent-muted-hover: color-mix(in srgb, var(--color-blue-500) 25%, transparent);
152-
--accent-light: var(--color-blue-600);
152+
--accent-light: var(--color-blue-800);
153153
--accent-border-hover: var(--color-blue-400);
154154
--accent-on-muted: var(--color-blue-200);
155155
--accent-on-solid: var(--color-white);

poliloom-gui/src/components/entity/AddPropertyForm.tsx

Lines changed: 45 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,24 @@ import { useState } from 'react'
44
import { Property, PropertyType } from '@/types'
55
import { Input } from '@/components/ui/Input'
66
import { Button } from '@/components/ui/Button'
7+
import { Select } from '@/components/ui/Select'
78
import { EntitySelector } from './EntitySelector'
89

10+
const precisionOptions = [
11+
{ value: '11', label: 'Day' },
12+
{ value: '10', label: 'Month' },
13+
{ value: '9', label: 'Year' },
14+
]
15+
16+
const propertyTypeOptions = [
17+
{ value: '', label: 'Select a property type...' },
18+
{ value: PropertyType.P569, label: 'Birth Date (P569)' },
19+
{ value: PropertyType.P570, label: 'Death Date (P570)' },
20+
{ value: PropertyType.P39, label: 'Position Held (P39)' },
21+
{ value: PropertyType.P19, label: 'Place of Birth (P19)' },
22+
{ value: PropertyType.P27, label: 'Country of Citizenship (P27)' },
23+
]
24+
925
interface AddPropertyFormProps {
1026
onAddProperty: (property: Property) => void
1127
}
@@ -205,35 +221,20 @@ export function AddPropertyForm({ onAddProperty }: AddPropertyFormProps) {
205221
</div>
206222

207223
{/* Property Type Selector */}
208-
<div>
209-
<label
210-
htmlFor="propertyType"
211-
className="block text-sm font-medium text-foreground-secondary mb-1"
212-
>
213-
Property Type
214-
</label>
215-
<select
216-
id="propertyType"
217-
value={propertyType}
218-
onChange={(e) => {
219-
setPropertyType(e.target.value as PropertyType)
220-
// Reset form fields when type changes
221-
setDateValue('')
222-
setSelectedEntity(null)
223-
setStartDate('')
224-
setEndDate('')
225-
}}
226-
className="w-full px-3 py-2 border border-border-strong rounded-md focus:outline-none focus:ring-2 focus:ring-accent focus:border-transparent bg-surface text-foreground"
227-
required
228-
>
229-
<option value="">Select a property type...</option>
230-
<option value={PropertyType.P569}>Birth Date (P569)</option>
231-
<option value={PropertyType.P570}>Death Date (P570)</option>
232-
<option value={PropertyType.P39}>Position Held (P39)</option>
233-
<option value={PropertyType.P19}>Place of Birth (P19)</option>
234-
<option value={PropertyType.P27}>Country of Citizenship (P27)</option>
235-
</select>
236-
</div>
224+
<Select
225+
label="Property Type"
226+
options={propertyTypeOptions}
227+
value={propertyType}
228+
onChange={(value) => {
229+
setPropertyType(value as PropertyType)
230+
// Reset form fields when type changes
231+
setDateValue('')
232+
setSelectedEntity(null)
233+
setStartDate('')
234+
setEndDate('')
235+
}}
236+
required
237+
/>
237238

238239
{/* Date input for birth/death dates */}
239240
{(propertyType === PropertyType.P569 || propertyType === PropertyType.P570) && (
@@ -253,15 +254,11 @@ export function AddPropertyForm({ onAddProperty }: AddPropertyFormProps) {
253254
className="flex-1"
254255
required
255256
/>
256-
<select
257-
value={datePrecision}
258-
onChange={(e) => setDatePrecision(Number(e.target.value))}
259-
className="px-3 py-2 border border-border-strong rounded-md focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent bg-surface text-foreground"
260-
>
261-
<option value={11}>Day</option>
262-
<option value={10}>Month</option>
263-
<option value={9}>Year</option>
264-
</select>
257+
<Select
258+
options={precisionOptions}
259+
value={String(datePrecision)}
260+
onChange={(value) => setDatePrecision(Number(value))}
261+
/>
265262
</div>
266263
</div>
267264
)}
@@ -321,16 +318,12 @@ export function AddPropertyForm({ onAddProperty }: AddPropertyFormProps) {
321318
onChange={(e) => setStartDate(e.target.value)}
322319
className="flex-1"
323320
/>
324-
<select
325-
value={startDatePrecision}
326-
onChange={(e) => setStartDatePrecision(Number(e.target.value))}
327-
className="px-3 py-2 border border-border-strong rounded-md focus:outline-none focus:ring-2 focus:ring-accent focus:border-transparent bg-surface text-foreground"
321+
<Select
322+
options={precisionOptions}
323+
value={String(startDatePrecision)}
324+
onChange={(value) => setStartDatePrecision(Number(value))}
328325
disabled={!startDate}
329-
>
330-
<option value={11}>Day</option>
331-
<option value={10}>Month</option>
332-
<option value={9}>Year</option>
333-
</select>
326+
/>
334327
</div>
335328
</div>
336329

@@ -350,16 +343,12 @@ export function AddPropertyForm({ onAddProperty }: AddPropertyFormProps) {
350343
onChange={(e) => setEndDate(e.target.value)}
351344
className="flex-1"
352345
/>
353-
<select
354-
value={endDatePrecision}
355-
onChange={(e) => setEndDatePrecision(Number(e.target.value))}
356-
className="px-3 py-2 border border-border-strong rounded-md focus:outline-none focus:ring-2 focus:ring-accent focus:border-transparent bg-surface text-foreground"
346+
<Select
347+
options={precisionOptions}
348+
value={String(endDatePrecision)}
349+
onChange={(value) => setEndDatePrecision(Number(value))}
357350
disabled={!endDate}
358-
>
359-
<option value={11}>Day</option>
360-
<option value={10}>Month</option>
361-
<option value={9}>Year</option>
362-
</select>
351+
/>
363352
</div>
364353
</div>
365354
</div>

poliloom-gui/src/components/layout/Hero.tsx

Lines changed: 0 additions & 21 deletions
This file was deleted.

poliloom-gui/src/components/ui/Spinner.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export function Spinner() {
22
return (
3-
<div className="animate-spin rounded-full h-6 w-6 border-2 border-b-indigo-600 border-t-transparent border-l-transparent border-r-transparent" />
3+
<div className="animate-spin rounded-full h-6 w-6 border-2 border-b-accent border-t-transparent border-l-transparent border-r-transparent" />
44
)
55
}
66

0 commit comments

Comments
 (0)