Skip to content

Commit 246ef05

Browse files
authored
Merge pull request #1453 from ds-wizard/hotfix/4.23.2
Hotfix 4.23.2
2 parents 38a248a + 564a1d2 commit 246ef05

File tree

4 files changed

+136
-28
lines changed

4 files changed

+136
-28
lines changed

app-wizard/elm/Wizard/Pages/KMEditor/Editor/Common/EditorBranch.elm

Lines changed: 77 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@ module Wizard.Pages.KMEditor.Editor.Common.EditorBranch exposing
66
, editorRoute
77
, filterDeleted
88
, filterDeletedWith
9+
, filterExistingAnswers
10+
, filterExistingChapters
11+
, filterExistingChoices
12+
, filterExistingExperts
13+
, filterExistingIntegrations
14+
, filterExistingMetrics
15+
, filterExistingPhases
16+
, filterExistingQuestions
17+
, filterExistingReferences
18+
, filterExistingResourceCollections
19+
, filterExistingResourcePages
20+
, filterExistingTags
921
, getActiveQuestionUuid
1022
, getAllUuids
1123
, getChapterUuid
@@ -172,18 +184,72 @@ filterDeleted =
172184

173185
filterDeletedWith : (a -> String) -> EditorBranch -> List a -> List a
174186
filterDeletedWith toUuid editorBranch =
175-
let
176-
allUuids =
177-
getAllUuids editorBranch
187+
List.filter (not << flip isDeleted editorBranch << toUuid)
178188

179-
isGood item =
180-
let
181-
uuid =
182-
toUuid item
183-
in
184-
List.member uuid allUuids && not (isDeleted uuid editorBranch)
185-
in
186-
List.filter isGood
189+
190+
filterExistingChapters : EditorBranch -> List String -> List String
191+
filterExistingChapters editorBranch =
192+
filterExisting editorBranch.branch.knowledgeModel.entities.chapters
193+
194+
195+
filterExistingQuestions : EditorBranch -> List String -> List String
196+
filterExistingQuestions editorBranch =
197+
filterExisting editorBranch.branch.knowledgeModel.entities.questions
198+
199+
200+
filterExistingAnswers : EditorBranch -> List String -> List String
201+
filterExistingAnswers editorBranch =
202+
filterExisting editorBranch.branch.knowledgeModel.entities.answers
203+
204+
205+
filterExistingChoices : EditorBranch -> List String -> List String
206+
filterExistingChoices editorBranch =
207+
filterExisting editorBranch.branch.knowledgeModel.entities.choices
208+
209+
210+
filterExistingExperts : EditorBranch -> List String -> List String
211+
filterExistingExperts editorBranch =
212+
filterExisting editorBranch.branch.knowledgeModel.entities.experts
213+
214+
215+
filterExistingReferences : EditorBranch -> List String -> List String
216+
filterExistingReferences editorBranch =
217+
filterExisting editorBranch.branch.knowledgeModel.entities.references
218+
219+
220+
filterExistingIntegrations : EditorBranch -> List String -> List String
221+
filterExistingIntegrations editorBranch =
222+
filterExisting editorBranch.branch.knowledgeModel.entities.integrations
223+
224+
225+
filterExistingResourceCollections : EditorBranch -> List String -> List String
226+
filterExistingResourceCollections editorBranch =
227+
filterExisting editorBranch.branch.knowledgeModel.entities.resourceCollections
228+
229+
230+
filterExistingResourcePages : EditorBranch -> List String -> List String
231+
filterExistingResourcePages editorBranch =
232+
filterExisting editorBranch.branch.knowledgeModel.entities.resourcePages
233+
234+
235+
filterExistingTags : EditorBranch -> List String -> List String
236+
filterExistingTags editorBranch =
237+
filterExisting editorBranch.branch.knowledgeModel.entities.tags
238+
239+
240+
filterExistingMetrics : EditorBranch -> List String -> List String
241+
filterExistingMetrics editorBranch =
242+
filterExisting editorBranch.branch.knowledgeModel.entities.metrics
243+
244+
245+
filterExistingPhases : EditorBranch -> List String -> List String
246+
filterExistingPhases editorBranch =
247+
filterExisting editorBranch.branch.knowledgeModel.entities.phases
248+
249+
250+
filterExisting : Dict String a -> List String -> List String
251+
filterExisting entitiesDict =
252+
List.filter (\entityUuid -> Dict.member entityUuid entitiesDict)
187253

188254

189255
isQuestionDeletedInHierarchy : String -> EditorBranch -> Bool

app-wizard/elm/Wizard/Pages/KMEditor/Editor/Components/KMEditor.elm

Lines changed: 56 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,10 @@ viewKnowledgeModelEditor { appState, wrapMsg, eventMsg, model, editorBranch } km
759759
Input.reorderable
760760
{ name = "chapters"
761761
, label = gettext "Chapters" appState.locale
762-
, items = EditorBranch.filterDeleted editorBranch km.chapterUuids
762+
, items =
763+
km.chapterUuids
764+
|> EditorBranch.filterDeleted editorBranch
765+
|> EditorBranch.filterExistingChapters editorBranch
763766
, entityUuid = kmUuid
764767
, getReorderableState = flip Dict.get model.reorderableStates
765768
, toMsg = compose2 wrapMsg ReorderableMsg
@@ -776,7 +779,10 @@ viewKnowledgeModelEditor { appState, wrapMsg, eventMsg, model, editorBranch } km
776779
Input.reorderable
777780
{ name = "metrics"
778781
, label = gettext "Metrics" appState.locale
779-
, items = EditorBranch.filterDeleted editorBranch km.metricUuids
782+
, items =
783+
km.metricUuids
784+
|> EditorBranch.filterDeleted editorBranch
785+
|> EditorBranch.filterExistingMetrics editorBranch
780786
, entityUuid = kmUuid
781787
, getReorderableState = flip Dict.get model.reorderableStates
782788
, toMsg = compose2 wrapMsg ReorderableMsg
@@ -793,7 +799,10 @@ viewKnowledgeModelEditor { appState, wrapMsg, eventMsg, model, editorBranch } km
793799
Input.reorderable
794800
{ name = "phases"
795801
, label = gettext "Phases" appState.locale
796-
, items = EditorBranch.filterDeleted editorBranch km.phaseUuids
802+
, items =
803+
km.phaseUuids
804+
|> EditorBranch.filterDeleted editorBranch
805+
|> EditorBranch.filterExistingPhases editorBranch
797806
, entityUuid = kmUuid
798807
, getReorderableState = flip Dict.get model.reorderableStates
799808
, toMsg = compose2 wrapMsg ReorderableMsg
@@ -810,7 +819,10 @@ viewKnowledgeModelEditor { appState, wrapMsg, eventMsg, model, editorBranch } km
810819
Input.reorderable
811820
{ name = "tags"
812821
, label = gettext "Question Tags" appState.locale
813-
, items = EditorBranch.filterDeleted editorBranch km.tagUuids
822+
, items =
823+
km.tagUuids
824+
|> EditorBranch.filterDeleted editorBranch
825+
|> EditorBranch.filterExistingTags editorBranch
814826
, entityUuid = kmUuid
815827
, getReorderableState = flip Dict.get model.reorderableStates
816828
, toMsg = compose2 wrapMsg ReorderableMsg
@@ -827,7 +839,10 @@ viewKnowledgeModelEditor { appState, wrapMsg, eventMsg, model, editorBranch } km
827839
Input.reorderable
828840
{ name = "integrations"
829841
, label = gettext "Integrations" appState.locale
830-
, items = EditorBranch.filterDeleted editorBranch km.integrationUuids
842+
, items =
843+
km.integrationUuids
844+
|> EditorBranch.filterDeleted editorBranch
845+
|> EditorBranch.filterExistingIntegrations editorBranch
831846
, entityUuid = kmUuid
832847
, getReorderableState = flip Dict.get model.reorderableStates
833848
, toMsg = compose2 wrapMsg ReorderableMsg
@@ -844,7 +859,10 @@ viewKnowledgeModelEditor { appState, wrapMsg, eventMsg, model, editorBranch } km
844859
Input.reorderable
845860
{ name = "resourceCollections"
846861
, label = gettext "Resource Collections" appState.locale
847-
, items = EditorBranch.filterDeleted editorBranch km.resourceCollectionUuids
862+
, items =
863+
km.resourceCollectionUuids
864+
|> EditorBranch.filterDeleted editorBranch
865+
|> EditorBranch.filterExistingResourceCollections editorBranch
848866
, entityUuid = kmUuid
849867
, getReorderableState = flip Dict.get model.reorderableStates
850868
, toMsg = compose2 wrapMsg ReorderableMsg
@@ -933,7 +951,10 @@ viewChapterEditor { appState, wrapMsg, eventMsg, model, editorBranch } chapter =
933951
Input.reorderable
934952
{ name = "questions"
935953
, label = gettext "Questions" appState.locale
936-
, items = EditorBranch.filterDeleted editorBranch chapter.questionUuids
954+
, items =
955+
chapter.questionUuids
956+
|> EditorBranch.filterDeleted editorBranch
957+
|> EditorBranch.filterExistingQuestions editorBranch
937958
, entityUuid = chapter.uuid
938959
, getReorderableState = flip Dict.get model.reorderableStates
939960
, toMsg = compose2 wrapMsg ReorderableMsg
@@ -1179,7 +1200,10 @@ viewQuestionEditor { appState, wrapMsg, eventMsg, model, editorBranch } question
11791200
Input.reorderable
11801201
{ name = "references"
11811202
, label = gettext "References" appState.locale
1182-
, items = EditorBranch.filterDeleted editorBranch <| Question.getReferenceUuids question
1203+
, items =
1204+
Question.getReferenceUuids question
1205+
|> EditorBranch.filterDeleted editorBranch
1206+
|> EditorBranch.filterExistingReferences editorBranch
11831207
, entityUuid = questionUuid
11841208
, getReorderableState = flip Dict.get model.reorderableStates
11851209
, toMsg = compose2 wrapMsg ReorderableMsg
@@ -1196,7 +1220,10 @@ viewQuestionEditor { appState, wrapMsg, eventMsg, model, editorBranch } question
11961220
Input.reorderable
11971221
{ name = "experts"
11981222
, label = gettext "Experts" appState.locale
1199-
, items = EditorBranch.filterDeleted editorBranch <| Question.getExpertUuids question
1223+
, items =
1224+
Question.getExpertUuids question
1225+
|> EditorBranch.filterDeleted editorBranch
1226+
|> EditorBranch.filterExistingExperts editorBranch
12001227
, entityUuid = questionUuid
12011228
, getReorderableState = flip Dict.get model.reorderableStates
12021229
, toMsg = compose2 wrapMsg ReorderableMsg
@@ -1234,7 +1261,10 @@ viewQuestionEditor { appState, wrapMsg, eventMsg, model, editorBranch } question
12341261
Input.reorderable
12351262
{ name = "answers"
12361263
, label = gettext "Answers" appState.locale
1237-
, items = EditorBranch.filterDeleted editorBranch <| Question.getAnswerUuids question
1264+
, items =
1265+
Question.getAnswerUuids question
1266+
|> EditorBranch.filterDeleted editorBranch
1267+
|> EditorBranch.filterExistingAnswers editorBranch
12381268
, entityUuid = questionUuid
12391269
, getReorderableState = flip Dict.get model.reorderableStates
12401270
, toMsg = compose2 wrapMsg ReorderableMsg
@@ -1266,7 +1296,10 @@ viewQuestionEditor { appState, wrapMsg, eventMsg, model, editorBranch } question
12661296
Input.reorderable
12671297
{ name = "questions"
12681298
, label = gettext "Questions" appState.locale
1269-
, items = EditorBranch.filterDeleted editorBranch <| Question.getItemTemplateQuestionUuids question
1299+
, items =
1300+
Question.getItemTemplateQuestionUuids question
1301+
|> EditorBranch.filterDeleted editorBranch
1302+
|> EditorBranch.filterExistingQuestions editorBranch
12701303
, entityUuid = questionUuid
12711304
, getReorderableState = flip Dict.get model.reorderableStates
12721305
, toMsg = compose2 wrapMsg ReorderableMsg
@@ -1421,7 +1454,10 @@ viewQuestionEditor { appState, wrapMsg, eventMsg, model, editorBranch } question
14211454
Input.reorderable
14221455
{ name = "choices"
14231456
, label = gettext "Choices" appState.locale
1424-
, items = EditorBranch.filterDeleted editorBranch <| Question.getChoiceUuids question
1457+
, items =
1458+
Question.getChoiceUuids question
1459+
|> EditorBranch.filterDeleted editorBranch
1460+
|> EditorBranch.filterExistingChoices editorBranch
14251461
, entityUuid = questionUuid
14261462
, getReorderableState = flip Dict.get model.reorderableStates
14271463
, toMsg = compose2 wrapMsg ReorderableMsg
@@ -2706,7 +2742,10 @@ viewAnswerEditor { appState, wrapMsg, eventMsg, model, editorBranch } answer =
27062742
Input.reorderable
27072743
{ name = "questions"
27082744
, label = gettext "Follow-Up Questions" appState.locale
2709-
, items = EditorBranch.filterDeleted editorBranch answer.followUpUuids
2745+
, items =
2746+
answer.followUpUuids
2747+
|> EditorBranch.filterDeleted editorBranch
2748+
|> EditorBranch.filterExistingQuestions editorBranch
27102749
, entityUuid = answer.uuid
27112750
, getReorderableState = flip Dict.get model.reorderableStates
27122751
, toMsg = compose2 wrapMsg ReorderableMsg
@@ -3054,7 +3093,10 @@ viewResourceCollectionEditor { appState, wrapMsg, eventMsg, model, editorBranch
30543093
Input.reorderable
30553094
{ name = "resourcePages"
30563095
, label = gettext "Resource Pages" appState.locale
3057-
, items = EditorBranch.filterDeleted editorBranch resourceCollection.resourcePageUuids
3096+
, items =
3097+
resourceCollection.resourcePageUuids
3098+
|> EditorBranch.filterDeleted editorBranch
3099+
|> EditorBranch.filterExistingResourcePages editorBranch
30583100
, entityUuid = resourceCollection.uuid
30593101
, getReorderableState = flip Dict.get model.reorderableStates
30603102
, toMsg = compose2 wrapMsg ReorderableMsg

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "engine-frontend",
3-
"version": "4.23.1",
3+
"version": "4.23.2",
44
"repository": "https://github.com/ds-wizard/engine-frontend",
55
"license": "Apache-2.0",
66
"scripts": {

0 commit comments

Comments
 (0)