Enhance MediaWiki import functionality with category normalization and skill attributes
Deploy Development / deploy (push) Successful in 38s
Test Suite / pytest-backend (push) Successful in 40s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 12s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m17s
Test Suite / pytest-backend (pull_request) Successful in 35s
Test Suite / lint-backend (pull_request) Successful in 0s
Test Suite / build-frontend (pull_request) Successful in 12s
Test Suite / k6 /health Baseline (pull_request) Successful in 33s
Test Suite / playwright-tests (pull_request) Successful in 1m8s
Deploy Development / deploy (push) Successful in 38s
Test Suite / pytest-backend (push) Successful in 40s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 12s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m17s
Test Suite / pytest-backend (pull_request) Successful in 35s
Test Suite / lint-backend (pull_request) Successful in 0s
Test Suite / build-frontend (pull_request) Successful in 12s
Test Suite / k6 /health Baseline (pull_request) Successful in 33s
Test Suite / playwright-tests (pull_request) Successful in 1m8s
- Introduced `_normalize_mw_category` function to clean category names for API calls, ensuring consistent handling of category prefixes. - Updated `SmwClient` methods to utilize normalized category names, improving data retrieval accuracy. - Added `_wiki_category_or_default` function to provide default categories based on import type, enhancing user experience during imports. - Integrated new fields `karate_relevance` and `relevance_level` into various admin components, allowing for better skill management. - Incremented app version to 0.8.145 and updated changelog to reflect these changes.
This commit is contained in:
1 parent
949a77fe38
commit
623af621b4
11 files changed
+407
-34
No files matched your search
@@ -10,6 +10,13 @@ const WIKI_IMPORT_TABS = [
|
||||
{ id: 'history', label: 'Historie', icon: History },
|
||||
]
|
||||
|
||||
/** MediaWiki-Kategorienamen ohne Präfix „Kategorie:“ — karatetrainer.net aktueller Stand */
|
||||
function defaultWikiCategory(importType) {
|
||||
if (importType === 'skill') return 'Fähigkeitsbeschreibung'
|
||||
if (importType === 'method') return 'Methodenbeschreibung'
|
||||
return 'Übungen'
|
||||
}
|
||||
|
||||
export default function MediaWikiImportPage() {
|
||||
const [activeTab, setActiveTab] = useState('preview')
|
||||
const [loading, setLoading] = useState(false)
|
||||
@@ -169,7 +176,11 @@ export default function MediaWikiImportPage() {
|
||||
</label>
|
||||
<select
|
||||
value={previewType}
|
||||
onChange={(e) => setPreviewType(e.target.value)}
|
||||
onChange={(e) => {
|
||||
const t = e.target.value
|
||||
setPreviewType(t)
|
||||
setPreviewCategory(defaultWikiCategory(t))
|
||||
}}
|
||||
style={{
|
||||
width: '100%',
|
||||
padding: '12px',
|
||||
@@ -315,7 +326,11 @@ export default function MediaWikiImportPage() {
|
||||
</label>
|
||||
<select
|
||||
value={executeType}
|
||||
onChange={(e) => setExecuteType(e.target.value)}
|
||||
onChange={(e) => {
|
||||
const t = e.target.value
|
||||
setExecuteType(t)
|
||||
setExecuteCategory(defaultWikiCategory(t))
|
||||
}}
|
||||
style={{
|
||||
width: '100%',
|
||||
padding: '12px',
|
||||
|
||||
@@ -52,7 +52,9 @@ function SkillsPage() {
|
||||
description: '',
|
||||
importance: 3,
|
||||
keywords: [],
|
||||
status: 'active'
|
||||
status: 'active',
|
||||
karate_relevance: '',
|
||||
relevance_level: ''
|
||||
})
|
||||
} else {
|
||||
setFormData({
|
||||
@@ -102,10 +104,20 @@ function SkillsPage() {
|
||||
|
||||
try {
|
||||
if (modalType === 'skill') {
|
||||
const raw = { ...formData }
|
||||
raw.karate_relevance =
|
||||
typeof raw.karate_relevance === 'string' && raw.karate_relevance.trim()
|
||||
? raw.karate_relevance.trim()
|
||||
: null
|
||||
raw.relevance_level =
|
||||
raw.relevance_level === '' || raw.relevance_level == null || raw.relevance_level === undefined
|
||||
? null
|
||||
: Number(raw.relevance_level)
|
||||
|
||||
if (editing) {
|
||||
await api.updateSkill(editing.id, formData)
|
||||
await api.updateSkill(editing.id, raw)
|
||||
} else {
|
||||
await api.createSkill(formData)
|
||||
await api.createSkill(raw)
|
||||
}
|
||||
} else {
|
||||
if (editing) {
|
||||
@@ -394,6 +406,41 @@ function SkillsPage() {
|
||||
/>
|
||||
</div>
|
||||
|
||||
{modalType === 'skill' && (
|
||||
<>
|
||||
<div className="form-row">
|
||||
<label className="form-label">Karate-Relevanz (Wiki)</label>
|
||||
<textarea
|
||||
className="form-input"
|
||||
rows={3}
|
||||
value={formData.karate_relevance || ''}
|
||||
onChange={(e) => updateFormField('karate_relevance', e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
<div className="form-row">
|
||||
<label className="form-label">Relevanzgrad (Wiki, 1–3)</label>
|
||||
<select
|
||||
className="form-input"
|
||||
value={
|
||||
formData.relevance_level === null ||
|
||||
formData.relevance_level === undefined ||
|
||||
formData.relevance_level === ''
|
||||
? ''
|
||||
: String(formData.relevance_level)
|
||||
}
|
||||
onChange={(e) =>
|
||||
updateFormField('relevance_level', e.target.value === '' ? '' : e.target.value)
|
||||
}
|
||||
>
|
||||
<option value="">– nicht gesetzt –</option>
|
||||
<option value="1">1</option>
|
||||
<option value="2">2</option>
|
||||
<option value="3">3</option>
|
||||
</select>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
{modalType === 'skill' && (
|
||||
<div className="form-row">
|
||||
<label className="form-label">Wichtigkeit (1-5)</label>
|
||||
|
||||
Reference in new issue
Block a user