Skip to content

Commit 121040f

Browse files
committed
Add look and feel config to document context
1 parent db9b241 commit 121040f

File tree

5 files changed

+30
-4
lines changed

5 files changed

+30
-4
lines changed

shared-common/src/Shared/DocumentTemplate/Constant/DocumentTemplate.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module Shared.DocumentTemplate.Constant.DocumentTemplate where
33
import Shared.Common.Model.Common.SemVer2Tuple
44

55
documentTemplateMetamodelVersion :: SemVer2Tuple
6-
documentTemplateMetamodelVersion = SemVer2Tuple 17 0
6+
documentTemplateMetamodelVersion = SemVer2Tuple 17 1
77

88
isDocumentTemplateSupported :: SemVer2Tuple -> Bool
99
isDocumentTemplateSupported metamodelVersion

wizard-server/src/Wizard/Database/Migration/Development/Document/Data/Documents.hs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,15 @@ doc1Content =
6868
dmp1 :: DocumentContext
6969
dmp1 =
7070
DocumentContext
71-
{ config = DocumentContextConfig {clientUrl = "https://example.com/wizard"}
71+
{ config =
72+
DocumentContextConfig
73+
{ clientUrl = "https://example.com/wizard"
74+
, appTitle = Nothing
75+
, appTitleShort = Nothing
76+
, illustrationsColor = Nothing
77+
, primaryColor = Nothing
78+
, logoUrl = Nothing
79+
}
7280
, document =
7381
DocumentContextDocument
7482
{ uuid = doc1.uuid

wizard-server/src/Wizard/Model/Document/DocumentContext.hs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ data DocumentContext = DocumentContext
3232

3333
data DocumentContextConfig = DocumentContextConfig
3434
{ clientUrl :: String
35+
, appTitle :: Maybe String
36+
, appTitleShort :: Maybe String
37+
, illustrationsColor :: Maybe String
38+
, primaryColor :: Maybe String
39+
, logoUrl :: Maybe String
3540
}
3641
deriving (Show, Eq, Generic)
3742

wizard-server/src/Wizard/Service/Document/Context/DocumentContextMapper.hs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import Wizard.Model.Tenant.Config.TenantConfig
1919
import Wizard.Model.User.User
2020
import Wizard.Service.KnowledgeModel.Package.KnowledgeModelPackageMapper
2121
import qualified Wizard.Service.User.UserMapper as USR_Mapper
22+
import WizardLib.Public.Model.Tenant.Config.TenantConfig
2223

2324
toDocumentContext
2425
:: Document
@@ -34,14 +35,23 @@ toDocumentContext
3435
-> Report
3536
-> KnowledgeModelPackage
3637
-> TenantConfigOrganization
38+
-> TenantConfigLookAndFeel
3739
-> Maybe User
3840
-> Maybe User
3941
-> [DocumentContextUserPerm]
4042
-> [DocumentContextUserGroupPerm]
4143
-> DocumentContext
42-
toDocumentContext doc appClientUrl project phaseUuid replies labels mProjectVersion projectVersionDtos projectFiles km report pkg org mProjectCreatedBy mDocCreatedBy users groups =
44+
toDocumentContext doc appClientUrl project phaseUuid replies labels mProjectVersion projectVersionDtos projectFiles km report pkg org lookAndFeel mProjectCreatedBy mDocCreatedBy users groups =
4345
DocumentContext
44-
{ config = DocumentContextConfig {clientUrl = appClientUrl}
46+
{ config =
47+
DocumentContextConfig
48+
{ clientUrl = appClientUrl
49+
, appTitle = lookAndFeel.appTitle
50+
, appTitleShort = lookAndFeel.appTitleShort
51+
, illustrationsColor = lookAndFeel.illustrationsColor
52+
, primaryColor = lookAndFeel.primaryColor
53+
, logoUrl = lookAndFeel.logoUrl
54+
}
4555
, document =
4656
DocumentContextDocument
4757
{ uuid = doc.uuid

wizard-server/src/Wizard/Service/Document/Context/DocumentContextService.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import Wizard.Service.Project.Compiler.ProjectCompilerService
3434
import Wizard.Service.Report.ReportGenerator
3535
import Wizard.Service.Tenant.TenantHelper
3636
import qualified Wizard.Service.User.UserMapper as USR_Mapper
37+
import WizardLib.Public.Database.DAO.Tenant.Config.TenantConfigLookAndFeelDAO
3738
import WizardLib.Public.Database.DAO.User.UserGroupDAO
3839
import WizardLib.Public.Model.User.UserGroup
3940
import qualified WizardLib.Public.Service.User.Group.UserGroupMapper as UGR_Mapper
@@ -44,6 +45,7 @@ createDocumentContext doc pkg kmEditorEvents project mReplies = do
4445
mProjectCreatedBy <- forM project.creatorUuid findUserByUuid
4546
mDocCreatedBy <- forM doc.createdBy findUserByUuid
4647
tcOrganization <- findTenantConfigOrganization
48+
tcLookAndFeel <- findTenantConfigLookAndFeel
4749
clientUrl <- getClientUrl
4850
now <- liftIO getCurrentTime
4951
(phaseUuid, replies, labels) <-
@@ -83,6 +85,7 @@ createDocumentContext doc pkg kmEditorEvents project mReplies = do
8385
report
8486
pkg
8587
tcOrganization
88+
tcLookAndFeel
8689
mProjectCreatedBy
8790
mDocCreatedBy
8891
users

0 commit comments

Comments
 (0)