Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug excel restore building block details #560

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
414 changes: 223 additions & 191 deletions src/Client/OfficeInterop/OfficeInterop.fs

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions src/Client/SidebarComponents/Navbar.fs
Original file line number Diff line number Diff line change
Expand Up @@ -267,15 +267,15 @@ let private QuickAccessList toggleMetdadataModal model (dispatch: Messages.Msg -
],
(fun _ -> SpreadsheetInterface.RemoveBuildingBlock |> InterfaceMsg |> dispatch)
)
//QuickAccessButton.create(
// "Get Building Block Information",
// [
// Html.i [prop.className "fa-solid fa-question pr-1"]
// Html.span model.BuildingBlockDetailsState.CurrentRequestState.toStringMsg
// Html.i [prop.className "fa-solid fa-table-columns"]
// ],
// (fun _ -> SpreadsheetInterface.EditBuildingBlock |> InterfaceMsg |> dispatch)
//)
QuickAccessButton.Main(
"Get Building Block Information",
React.fragment [
Html.i [prop.className "fa-solid fa-question pr-1"]
//Html.span model.BuildingBlockDetailsState.CurrentRequestState.toStringMsg
Html.i [prop.className "fa-solid fa-table-columns"]
],
(fun _ -> SpreadsheetInterface.GetBuildingBlockDetails |> InterfaceMsg |> dispatch)
)
]
|> React.fragment

Expand Down
1 change: 1 addition & 0 deletions src/Client/States/OfficeInteropState.fs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type Msg =
| AddTemplate of ArcTable
| JoinTable of ArcTable * options: TableJoinOptions option
| RemoveBuildingBlock
| GetBuildingBlockDetails
| UpdateUnitForCells
| AutoFitTable of hideRefCols:bool
// Term search functions
Expand Down
1 change: 1 addition & 0 deletions src/Client/States/SpreadsheetInterface.fs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type Msg =
| UpdateArcFile of ArcFiles
/// Inserts TermMinimal to selected fields of one column
| InsertOntologyAnnotation of OntologyAnnotation
| GetBuildingBlockDetails
| InsertFileNames of string list
| ImportXlsx of byte []
| ImportJson of {|importState: SelectiveImportModalState; importedFile: ArcFiles|}
Expand Down
17 changes: 17 additions & 0 deletions src/Client/Update/InterfaceUpdate.fs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,23 @@ module Interface =
Spreadsheet.DeleteColumn (distinct.[0]) |> SpreadsheetMsg |> Cmd.ofMsg
model, cmd
| _ -> failwith "not implemented"
| GetBuildingBlockDetails ->
match host with
| Some Swatehost.Excel ->
let cmd = OfficeInterop.GetBuildingBlockDetails |> OfficeInteropMsg |> Cmd.ofMsg
model, cmd
//| Some Swatehost.Browser | Some Swatehost.ARCitect ->
// if Set.isEmpty model.SpreadsheetModel.SelectedCells then failwith "No column selected"
// let selectedColumns, _ = model.SpreadsheetModel.SelectedCells |> Set.toArray |> Array.unzip
// let distinct = selectedColumns |> Array.distinct
// let cmd =
// if distinct.Length <> 1 then
// let msg = Failure("Please select one column only if you want to use `Remove Building Block`.")
// GenericError (Cmd.none,msg) |> DevMsg |> Cmd.ofMsg
// else
// Spreadsheet.DeleteColumn (distinct.[0]) |> SpreadsheetMsg |> Cmd.ofMsg
// model, cmd
| _ -> failwith "not implemented"
| AddDataAnnotation data ->
match host with
| Some Swatehost.Excel ->
Expand Down
11 changes: 10 additions & 1 deletion src/Client/Update/OfficeInteropUpdate.fs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,15 @@ module OfficeInterop =
(curry GenericError Cmd.none >> DevMsg)
state, model, cmd

| GetBuildingBlockDetails ->
let cmd =
Cmd.OfPromise.either
OfficeInterop.Core.getCompositeColumnDetails
()
(curry GenericInteropLogs Cmd.none >> DevMsg)
(curry GenericError Cmd.none >> DevMsg)
state, model, cmd

| UpdateUnitForCells ->
let cmd =
Cmd.OfPromise.either
Expand Down Expand Up @@ -136,7 +145,7 @@ module OfficeInterop =
| RectifyTermColumns ->
let cmd =
Cmd.OfPromise.either
OfficeInterop.Core.rectifyTermColumns
OfficeInterop.Core.Main.rectifyTermColumns
()
(curry GenericInteropLogs Cmd.none >> DevMsg)
(curry GenericError Cmd.none >> DevMsg)
Expand Down
126 changes: 126 additions & 0 deletions src/Client/public/manifest.production.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<OfficeApp xmlns="http://schemas.microsoft.com/office/appforoffice/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0" xmlns:ov="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="TaskPaneApp">
<Id>5d6f5462-3401-48ec-9406-d12882e9ad83</Id>
<Version>1.0.0</Version>
<ProviderName>Computational Systems Biology</ProviderName>
<DefaultLocale>en-US</DefaultLocale>
<DisplayName DefaultValue="Swate"/>
<Description DefaultValue="Utility functions to annotate data in a fast and safe way."/>
<IconUrl DefaultValue="https://swate-alpha.nfdi4plants.org/assets/swate_32x32.png"/>
<HighResolutionIconUrl DefaultValue="https://swate-alpha.nfdi4plants.org/assets/swate_80x80.png"/>
<SupportUrl DefaultValue="https://github.com/nfdi4plants/Swate/issues"/>
<AppDomains>
<AppDomain>bio.uni-kl.de</AppDomain>
</AppDomains>
<Hosts>
<Host Name="Workbook"/>
</Hosts>
<DefaultSettings>
<SourceLocation DefaultValue="https://swate-alpha.nfdi4plants.org?is_swatehost=2"/>
</DefaultSettings>
<Permissions>ReadWriteDocument</Permissions>
<VersionOverrides xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">
<Hosts>
<Host xsi:type="Workbook">
<DesktopFormFactor>
<GetStarted>
<Title resid="GetStarted.Title"/>
<Description resid="GetStarted.Description"/>
<LearnMoreUrl resid="GetStarted.LearnMoreUrl"/>
</GetStarted>
<ExtensionPoint xsi:type="PrimaryCommandSurface">
<OfficeTab id="TabData">
<Group id="SwateCommands">
<Label resid="SwateCommands.Label"/>
<Icon>
<bt:Image size="16" resid="Icon.16x16"/>
<bt:Image size="20" resid="Icon.20x20"/>
<bt:Image size="24" resid="Icon.24x24"/>
<bt:Image size="32" resid="Icon.32x32"/>
<bt:Image size="40" resid="Icon.40x40"/>
<bt:Image size="48" resid="Icon.48x48"/>
<bt:Image size="64" resid="Icon.64x64"/>
<bt:Image size="80" resid="Icon.80x80"/>
<bt:Image size="96" resid="Icon.96x96"/>
</Icon>
<Control xsi:type="Button" id="Swate">
<Label resid="Swate.Label"/>
<Supertip>
<Title resid="Swate.Label"/>
<Description resid="Swate.Tooltip"/>
</Supertip>
<Icon>
<bt:Image size="16" resid="Icon.16x16"/>
<bt:Image size="20" resid="Icon.20x20"/>
<bt:Image size="24" resid="Icon.24x24"/>
<bt:Image size="32" resid="Icon.32x32"/>
<bt:Image size="40" resid="Icon.40x40"/>
<bt:Image size="48" resid="Icon.48x48"/>
<bt:Image size="64" resid="Icon.64x64"/>
<bt:Image size="80" resid="Icon.80x80"/>
<bt:Image size="96" resid="Icon.96x96"/>
</Icon>
<Action xsi:type="ShowTaskpane">
<TaskpaneId>ButtonId2</TaskpaneId>
<SourceLocation resid="Swate.Url"/>
</Action>
</Control>
<!--<Control xsi:type="Button" id="Swate.Experts">
<Label resid="Swate.Experts.Label"/>
<Supertip>
<Title resid="Swate.Experts.Label"/>
<Description resid="Swate.Experts.Tooltip"/>
</Supertip>
<Icon>
<bt:Image size="16" resid="IconE.16x16"/>
<bt:Image size="20" resid="IconE.20x20"/>
<bt:Image size="24" resid="IconE.24x24"/>
<bt:Image size="32" resid="IconE.32x32"/>
<bt:Image size="40" resid="IconE.40x40"/>
<bt:Image size="48" resid="IconE.48x48"/>
<bt:Image size="64" resid="IconE.64x64"/>
<bt:Image size="80" resid="IconE.80x80"/>
<bt:Image size="96" resid="IconE.96x96"/>
</Icon>
<Action xsi:type="ShowTaskpane">
<TaskpaneId>ButtonId1</TaskpaneId>
<SourceLocation resid="Swate.Experts.Url"/>
</Action>
</Control>-->
</Group>
</OfficeTab>
</ExtensionPoint>
</DesktopFormFactor>
</Host>
</Hosts>
<Resources>
<bt:Images>
<bt:Image id="Icon.16x16" DefaultValue="https://swate-alpha.nfdi4plants.org/assets/swate_16x16.png"/>
<bt:Image id="Icon.20x20" DefaultValue="https://swate-alpha.nfdi4plants.org/assets/swate_20x20.png"/>
<bt:Image id="Icon.24x24" DefaultValue="https://swate-alpha.nfdi4plants.org/assets/swate_24x24.png"/>
<bt:Image id="Icon.32x32" DefaultValue="https://swate-alpha.nfdi4plants.org/assets/swate_32x32.png"/>
<bt:Image id="Icon.40x40" DefaultValue="https://swate-alpha.nfdi4plants.org/assets/swate_40x40.png"/>
<bt:Image id="Icon.48x48" DefaultValue="https://swate-alpha.nfdi4plants.org/assets/swate_48x48.png"/>
<bt:Image id="Icon.64x64" DefaultValue="https://swate-alpha.nfdi4plants.org/assets/swate_64x64.png"/>
<bt:Image id="Icon.80x80" DefaultValue="https://swate-alpha.nfdi4plants.org/assets/swate_80x80.png"/>
<bt:Image id="Icon.96x96" DefaultValue="https://swate-alpha.nfdi4plants.org/assets/swate_96x96.png"/>
</bt:Images>
<bt:Urls>
<bt:Url id="GetStarted.LearnMoreUrl" DefaultValue="https://go.microsoft.com/fwlink/?LinkId=276812"/>
<bt:Url id="Swate.Url" DefaultValue="https://swate-alpha.nfdi4plants.org?is_swatehost=2"/>
<!--<bt:Url id="Swate.Experts.Url" DefaultValue="https://swate-alpha.nfdi4plants.org/#Experts/JsonExport"/>-->
</bt:Urls>
<bt:ShortStrings>
<bt:String id="GetStarted.Title" DefaultValue="Get started annotating your data for greater good!"/>
<bt:String id="SwateCommands.Label" DefaultValue="Swate"/>
<bt:String id="Swate.Label" DefaultValue="Swate"/>
<bt:String id="Swate.Experts.Label" DefaultValue="Experts"/>
</bt:ShortStrings>
<bt:LongStrings>
<bt:String id="GetStarted.Description" DefaultValue="Swate was loaded succesfully. Go to the DATA tab and click the 'Swate' button to get started."/>
<bt:String id="Swate.Tooltip" DefaultValue="Open a task pane to gain full access to the Swate user functionality."/>
<bt:String id="Swate.Experts.Tooltip" DefaultValue="Open a task pane to gain full access to advanced, in-depth Swate functionalities."/>
</bt:LongStrings>
</Resources>
</VersionOverrides>
</OfficeApp>
2 changes: 1 addition & 1 deletion tests/Client/Client.Tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ let all =
#if FABLE_COMPILER // This preprocessor directive makes editor happy
Shared.Tests.shared
#endif
OfficeAddin.Tests.Main
OfficeAddIn.AnnotationTable.Successful.Main
client
]

Expand Down
2 changes: 1 addition & 1 deletion tests/Client/Client.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="OfficeAddin.Tests.fs" />
<Compile Include="OfficeAddIn/AnnotationTable/SuccessfulTests.fs" />
<Compile Include="Client.Tests.fs" />
</ItemGroup>
<ItemGroup>
Expand Down
Loading