Skip to content

Commit

Permalink
Merge pull request #1308 from ds-wizard/hotfix/4.14.1
Browse files Browse the repository at this point in the history
Hotfix 4.14.1 (develop)
  • Loading branch information
janslifka authored Jan 14, 2025
2 parents eb7a49e + aa65f78 commit 6e2e01e
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 32 deletions.
6 changes: 6 additions & 0 deletions engine-shared/elm/Shared/Auth/Permission.elm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module Shared.Auth.Permission exposing
, packageManagementWrite
, questionnaire
, questionnaireAction
, questionnaireFile
, questionnaireImporter
, questionnaireTemplate
, settings
Expand Down Expand Up @@ -87,6 +88,11 @@ questionnaireImporter =
"QTN_IMPORTER_PERM"


questionnaireFile : String
questionnaireFile =
"QTN_FILE_PERM"


settings : String
settings =
"CFG_PERM"
Expand Down
1 change: 1 addition & 0 deletions engine-shared/elm/Shared/Auth/Role.elm
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module Shared.Auth.Role exposing
( admin
, dataSteward
, options
, researcher
, switch
Expand Down
6 changes: 6 additions & 0 deletions engine-shared/elm/Shared/Data/UserInfo.elm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module Shared.Data.UserInfo exposing
( UserInfo
, decoder
, isAdmin
, isDataSteward
, toUserSuggestion
)

Expand Down Expand Up @@ -43,6 +44,11 @@ isAdmin =
Maybe.map (.role >> (==) Role.admin) >> Maybe.withDefault False


isDataSteward : Maybe UserInfo -> Bool
isDataSteward =
Maybe.map (.role >> (==) Role.dataSteward) >> Maybe.withDefault False


toUserSuggestion : UserInfo -> UserSuggestion
toUserSuggestion userInfo =
{ uuid = userInfo.uuid
Expand Down
17 changes: 17 additions & 0 deletions engine-wizard/elm/Wizard/Common/Feature.elm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ module Wizard.Common.Feature exposing
, documentTemplatesImport
, documentTemplatesView
, documentsView
, isAdmin
, isDataSteward
, isDefaultLanguage
, knowledgeModelEditorCancelMigration
, knowledgeModelEditorContinueMigration
Expand Down Expand Up @@ -52,6 +54,7 @@ module Wizard.Common.Feature exposing
, projectCreateMigration
, projectDelete
, projectDocumentsView
, projectFiles
, projectImporters
, projectMetrics
, projectOpen
Expand Down Expand Up @@ -379,6 +382,15 @@ projectCommentPrivate appState questionnaire =



-- Project Files


projectFiles : AppState -> Bool
projectFiles =
adminOr Perm.questionnaireFile



-- Project Actions


Expand Down Expand Up @@ -557,6 +569,11 @@ dev appState =
-- Helpers


isDataSteward : AppState -> Bool
isDataSteward appState =
UserInfo.isDataSteward appState.config.user


isAdmin : AppState -> Bool
isAdmin appState =
UserInfo.isAdmin appState.config.user
Expand Down
51 changes: 34 additions & 17 deletions engine-wizard/elm/Wizard/Common/Menu/View.elm
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ type alias GroupItemData =
, id : String
, route : Route
, isActive : Route -> Bool
, isVisible : AppState -> Bool
}


Expand Down Expand Up @@ -100,11 +101,13 @@ menuItems appState =
, id = "knowledge-models-list"
, route = Routes.knowledgeModelsIndex
, isActive = Routes.isKnowledgeModelsIndex
, isVisible = always True
}
, { title = gettext "Editors" appState.locale
, id = "knowledge-models-editors"
, route = Routes.kmEditorIndex
, isActive = Routes.isKmEditorIndex
, isVisible = always True
}
]
}
Expand All @@ -120,11 +123,13 @@ menuItems appState =
, id = "documents-list"
, route = Routes.documentTemplatesIndex
, isActive = Routes.isDocumentTemplatesIndex
, isVisible = always True
}
, { title = gettext "Editors" appState.locale
, id = "document-editors"
, route = Routes.documentTemplateEditorsIndex
, isActive = Routes.isDocumentTemplateEditorsIndex
, isVisible = always True
}
]
}
Expand All @@ -134,46 +139,48 @@ menuItems appState =
, id = "projects"
, route = Routes.projectsIndex appState
, isActive = Routes.isProjectsIndex
, isVisible = \a -> Feature.projectsView a && not (Feature.projectImporters a)
, isVisible = \a -> not (Feature.isDataSteward a || Feature.isAdmin a)
}
, MenuGroup
{ title = gettext "Projects" appState.locale
, icon = faSetFw "menu.projects" appState
, id = "projects"
, route = Routes.projectsIndex appState
, isActive = Routes.isProjectSubroute
, isVisible = \a -> Feature.projectsView a && Feature.projectImporters a
, isVisible = \a -> Feature.isDataSteward a || Feature.isAdmin a
, items =
[ { title = gettext "List" appState.locale
, id = "projects-list"
, route = Routes.projectsIndex appState
, isActive = Routes.isProjectsIndex
, isVisible = Feature.projectsView
}
, { title = gettext "Files" appState.locale
, id = "projects-files"
, route = Routes.projectFilesIndex
, isActive = Routes.isProjectFilesIndex
, isVisible = Feature.projectFiles
}
, { title = gettext "Documents" appState.locale
, id = "documents"
, route = Routes.documentsIndex
, isActive = Routes.isDocumentsIndex
, isVisible = Feature.documentsView
}
, { title = gettext "Actions" appState.locale
, id = "projects-actions"
, route = Routes.projectActionsIndex
, isActive = Routes.isProjectActionsIndex
, isVisible = always False
}
, { title = gettext "Importers" appState.locale
, id = "projects-importers"
, route = Routes.projectImportersIndex
, isActive = Routes.isProjectImportersIndex
, isVisible = Feature.projectImporters
}
]
}
, MenuItem
{ title = gettext "Documents" appState.locale
, icon = faSetFw "menu.documents" appState
, id = "documents"
, route = Routes.documentsIndex
, isActive = Routes.isDocumentsIndex
, isVisible = Feature.documentsView
}
, MenuGroup
{ title = gettext "Dev" appState.locale
, icon = faSetFw "menu.dev" appState
Expand All @@ -186,11 +193,13 @@ menuItems appState =
, id = "dev-operations"
, route = Routes.devOperations
, isActive = Routes.isDevOperations
, isVisible = always True
}
, { title = gettext "Persistent Commands" appState.locale
, id = "dev-persistent-commands"
, route = Routes.persistentCommandsIndex
, isActive = Routes.isPersistentCommandsIndex
, isVisible = always True
}
]
}
Expand All @@ -206,6 +215,7 @@ menuItems appState =
, id = "system-settings"
, route = Routes.settingsDefault
, isActive = Routes.isSettingsRoute
, isVisible = always True
}
:: (if Admin.isEnabled appState.config.admin then
[]
Expand All @@ -215,13 +225,15 @@ menuItems appState =
, id = "users"
, route = Routes.usersIndex
, isActive = Routes.isUsersIndex
, isVisible = always True
}
]
)
++ [ { title = gettext "Locales" appState.locale
, id = "system-locales"
, route = Routes.localesIndex
, isActive = Routes.isLocalesRoute
, isVisible = always True
}
]
}
Expand Down Expand Up @@ -411,12 +423,17 @@ defaultMenuItem model item =
MenuGroup menuGroup ->
let
viewGroupItem groupItem =
li [ classList [ ( "active", groupItem.isActive model.appState.route ) ] ]
[ linkTo model.appState
groupItem.route
[]
[ text groupItem.title ]
]
if groupItem.isVisible model.appState then
Just <|
li [ classList [ ( "active", groupItem.isActive model.appState.route ) ] ]
[ linkTo model.appState
groupItem.route
[]
[ text groupItem.title ]
]

else
Nothing

submenuClass =
if not model.appState.session.sidebarCollapsed && menuGroup.isActive model.appState.route then
Expand Down Expand Up @@ -457,7 +474,7 @@ defaultMenuItem model item =
, span [ class "sidebar-link" ] [ text menuGroup.title ]
]
, div ([ class "submenu", class submenuClass, class submenuExtraClass ] ++ submenuStyle)
[ ul [] (submenuHeading :: List.map viewGroupItem menuGroup.items) ]
[ ul [] (submenuHeading :: List.filterMap viewGroupItem menuGroup.items) ]
]

MenuItem menuItem ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ iconSet =
, ( "menu.collapse", "fas fa-angle-double-left" )
, ( "menu.dashboard", "fas fa-home" )
, ( "menu.dev", "fas fa-laptop-code" )
, ( "menu.documents", "fas fa-layer-group" )
, ( "menu.knowledgeModels", "fas fa-sitemap" )
, ( "menu.language", "fas fa-language" )
, ( "menu.logout", "fas fa-sign-out-alt" )
Expand Down
24 changes: 13 additions & 11 deletions engine-wizard/elm/Wizard/Routes.elm
Original file line number Diff line number Diff line change
Expand Up @@ -747,21 +747,23 @@ projectsImport uuid importerId =

isProjectSubroute : Route -> Bool
isProjectSubroute route =
case route of
ProjectsRoute _ ->
True
isDocumentsIndex route
|| (case route of
ProjectsRoute _ ->
True

ProjectActionsRoute _ ->
True
ProjectActionsRoute _ ->
True

ProjectImportersRoute _ ->
True
ProjectImportersRoute _ ->
True

ProjectFilesRoute _ ->
True
ProjectFilesRoute _ ->
True

_ ->
False
_ ->
False
)


projectsFileDownload : Uuid -> Uuid -> Route
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "engine-frontend",
"version": "4.14.0",
"version": "4.14.1",
"repository": "https://github.com/ds-wizard/engine-frontend",
"license": "Apache-2.0",
"scripts": {
Expand Down

0 comments on commit 6e2e01e

Please sign in to comment.