Skip to content

Commit

Permalink
ui overhaul #2 incompatible data diff
Browse files Browse the repository at this point in the history
  • Loading branch information
eimfach committed Aug 26, 2020
1 parent 7be238c commit 4417a61
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 6 deletions.
2 changes: 2 additions & 0 deletions _posts/2019-09-05-project-atlantic.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ date: '2018-08-29 10:26'
- [ ] Move 'Manage Tags' and 'Tagged Records' Sections into Tagging Section accessible via NavBar Icon

9. Integrate `elm-program-test`
- [Discourse Presentation](https://discourse.elm-lang.org/t/elm-program-test-3-0-0-new-docs-support-for-http-and-ports/4235)
- [Guide](https://elm-program-test.netlify.app)

### Backlog

Expand Down
6 changes: 6 additions & 0 deletions fixtures/another-with-spaces.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Date; Description ; Description2; Value
06.01.2019; Invoice No 345; Client: ABC; -5,00
07.01.2019; Invoice No 4314; Client: ABC; -20,00
08.01.2019; Invoice No 2314; Client: ABC; -13,00
09.01.2019; Invoice No 423; Client: ABC; -20,00
10.01.2019; Invoice No 4534; Client: ABC;-3,00
6 changes: 6 additions & 0 deletions fixtures/standard-part-irregular.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Date;Descriptio;Description2;Valu
06.01.2019;Invoice No 345;Client: ABC;-5,00
07.01.2019;Invoice No 4314;Client: ABC;-20,00
08.01.2019;Invoice No 2314;Client: ABC;-13,00
09.01.2019;Invoice No 423;Client: ABC;-20,00
10.01.2019;Invoice No 4534;Client: ABC;-3,00
6 changes: 6 additions & 0 deletions fixtures/yet-another-with-spaces.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Date ; Description; Description2; Value
06.01.2019; Invoice No 345; Client: ABC; -5,00
07.01.2019; Invoice No 4314; Client: ABC; -20,00
08.01.2019; Invoice No 2314; Client: ABC; -13,00
09.01.2019; Invoice No 423; Client: ABC; -20,00
10.01.2019; Invoice No 4534; Client: ABC;-3,00
51 changes: 45 additions & 6 deletions src/elm/Main.elm
Original file line number Diff line number Diff line change
Expand Up @@ -858,18 +858,57 @@ viewModalContent locale modalContent =
ViewDropIrregularRecords headers irregularRecords _ ->
div
[]
[ h4 [] [ text <| Locale.translateIrregularRowsText locale (List.length irregularRecords) ++ " :" ]
[ h5 [] [ text <| Locale.translateIrregularRowsText locale (List.length irregularRecords) ++ " :" ]
, viewRecords Table.Unresponsive headers irregularRecords
, h4 [] [ text <| Locale.translateAskForDrop locale ]
, h5 [] [ text <| Locale.translateAskForDrop locale ]
]

ViewIncompatibleData validHeaders unvalidHeaders ->
let
validHeadersWithSemicolons =
setCSVSemicolonsInList validHeaders

unValidHeadersWithSemicolons =
setCSVSemicolonsInList unvalidHeaders

viewColumns textClass headerText =
String.toList headerText
|> List.foldl
(\char result ->
if char == ' ' then
List.append result [ span [ style "borderBottom" "1px dotted blue" ] [ text " " ] ]

else
List.append result [ span [ class textClass ] [ text <| String.fromChar char ] ]
)
[]
in
div
[]
[ h4 [] [ text <| Locale.translateIncompatibleDataIntro locale ]
, viewRecords Table.Unresponsive validHeaders []
, h4 [] [ text <| Locale.translateIncompatibleDataComparison locale ]
, viewRecords Table.Unresponsive unvalidHeaders []
[ h5 [] [ text <| Locale.translateIncompatibleDataIntro locale ]
, div [ style "whiteSpace" "pre" ]
(validHeadersWithSemicolons
|> List.map (viewColumns "uk-text-success")
|> List.concat
)
, h5 [] [ text <| Locale.translateIncompatibleDataComparison locale ]
, div [ style "whiteSpace" "pre" ]
(unValidHeadersWithSemicolons
|> List.indexedMap
(\i header ->
case ListExtra.getAt i validHeadersWithSemicolons of
Just validHeader ->
if validHeader == header then
viewColumns "uk-text-success" header

else
viewColumns "uk-text-danger" header

Nothing ->
viewColumns "uk-text-danger" header
)
|> List.concat
)
]

ViewWorkingData headers records ->
Expand Down

0 comments on commit 4417a61

Please sign in to comment.