-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathTemplateMetadata.fs
61 lines (48 loc) · 1.7 KB
/
TemplateMetadata.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
module TemplateMetadata
open Fable.React
open Fable.React.Props
open Fulma
open Fulma.Extensions.Wikiki
open Fable.FontAwesome
open Fable.Core.JsInterop
open Elmish
open Shared
open ExcelColors
open Model
open Messages
open TemplateMetadata
open ProtocolTemplateTypes
let update (msg:Msg) (currentModel: Messages.Model) : Messages.Model * Cmd<Messages.Msg> =
match msg with
| CreateTemplateMetadataWorksheet metadataFieldsOpt ->
let cmd =
Cmd.OfPromise.either
OfficeInterop.TemplateMetadataFunctions.createTemplateMetadataWorksheet
(metadataFieldsOpt)
(curry GenericLog Cmd.none >> Dev)
(curry GenericError Cmd.none >> Dev)
currentModel, cmd
open Messages
let defaultMessageEle (model:Model) dispatch =
mainFunctionContainer [
Field.div [][
Help.help [][
str "Use this function to create a prewritten template metadata worksheet."
]
]
Field.div [][
Button.a [
Button.OnClick(fun e -> CreateTemplateMetadataWorksheet TemplateMetadata.root |> TemplateMetadataMsg |> dispatch)
Button.IsFullWidth
Button.Color IsInfo
][
str "Create metadata"
]
]
]
let newNameMainElement (model:Messages.Model) dispatch =
Content.content [] [
Label.label [Label.Size Size.IsLarge; Label.Props [Style [Color model.SiteStyleState.ColorMode.Accent]]][ str "Template Metadata"]
Label.label [Label.Props [Style [Color model.SiteStyleState.ColorMode.Accent]]] [str "Create template metadata worksheet"]
defaultMessageEle model dispatch
]