Introduce fomantic-ui, replacing semantic-ui

Replaced semantic-ui with the drop-in replacement fomantic-ui [0]
which is a maintained fork. The fomantic-ui used here is a custom
build [1] of the less-version _without_ google-fonts (css-only). The
javascript part of fomantic-ui is not used, and also jquery could be
dropped now.

[0] https://fomantic-ui.com
[1] https://github.com/eikek/fomantic-slim-default

Issue: #349
This commit is contained in:
Eike Kettner
2020-11-05 22:36:28 +01:00
parent d79955d574
commit 59dfae6a49
14 changed files with 157 additions and 84 deletions

View File

@ -29,9 +29,6 @@ update flags msg model =
StateResp (Ok s) ->
let
progressCmd =
List.map (\job -> Ports.setProgress ( job.id, job.progress )) s.progress
refresh =
if model.pollingInterval <= 0 || model.stopRefresh then
Cmd.none
@ -42,7 +39,7 @@ update flags msg model =
, getNewTime
]
in
( { model | state = s, stopRefresh = False }, Cmd.batch (refresh :: progressCmd) )
( { model | state = s, stopRefresh = False }, refresh )
StateResp (Err err) ->
( { model | error = Util.Http.errorToString err }, Cmd.none )

View File

@ -2,6 +2,7 @@ module Page.Queue.View exposing (view)
import Api.Model.JobDetail exposing (JobDetail)
import Api.Model.JobLogEvent exposing (JobLogEvent)
import Comp.Progress
import Comp.YesNoDimmer
import Data.Priority
import Html exposing (..)
@ -69,10 +70,7 @@ renderCompleted model =
renderProgressCard : Model -> JobDetail -> Html Msg
renderProgressCard model job =
div [ class "ui fluid card" ]
[ div [ id job.id, class "ui top attached indicating progress" ]
[ div [ class "bar" ]
[]
]
[ Comp.Progress.topAttachedIndicating job.progress
, Html.map (DimmerMsg job) (Comp.YesNoDimmer.view2 (model.cancelJobRequest == Just job.id) dimmerSettings model.deleteConfirm)
, div [ class "content" ]
[ div [ class "right floated meta" ]

View File

@ -14,6 +14,7 @@ module Page.Upload.Data exposing
import Api.Model.BasicResult exposing (BasicResult)
import Comp.Dropzone
import Dict exposing (Dict)
import File exposing (File)
import Http
import Set exposing (Set)
@ -26,7 +27,7 @@ type alias Model =
, files : List File
, completed : Set String
, errored : Set String
, loading : Set String
, loading : Dict String Int
, dropzone : Comp.Dropzone.Model
, skipDuplicates : Bool
}
@ -55,7 +56,7 @@ emptyModel =
, files = []
, completed = Set.empty
, errored = Set.empty
, loading = Set.empty
, loading = Dict.empty
, dropzone = Comp.Dropzone.init dropzoneSettings
, skipDuplicates = True
}
@ -74,7 +75,7 @@ type Msg
isLoading : Model -> File -> Bool
isLoading model file =
Set.member (makeFileId file) model.loading
Dict.member (makeFileId file) model.loading
isCompleted : Model -> File -> Bool

View File

@ -4,6 +4,7 @@ import Api
import Api.Model.ItemUploadMeta
import Comp.Dropzone
import Data.Flags exposing (Flags)
import Dict
import Http
import Page.Upload.Data exposing (..)
import Ports
@ -64,8 +65,12 @@ update sourceId flags msg model =
( cm2, _, _ ) =
Comp.Dropzone.update (Comp.Dropzone.setActive False) model.dropzone
nowLoading =
List.map (\fid -> ( fid, 0 )) fileids
|> Dict.fromList
in
( { model | loading = Set.fromList fileids, dropzone = cm2 }, uploads, tracker )
( { model | loading = nowLoading, dropzone = cm2 }, uploads, tracker )
SingleUploadResp fileid (Ok res) ->
let
@ -85,13 +90,13 @@ update sourceId flags msg model =
load =
if fileid == uploadAllTracker then
Set.empty
Dict.empty
else
Set.remove fileid model.loading
Dict.remove fileid model.loading
in
( { model | completed = compl, errored = errs, loading = load }
, Ports.setProgress ( fileid, 100 )
, Cmd.none
, Sub.none
)
@ -102,10 +107,10 @@ update sourceId flags msg model =
load =
if fileid == uploadAllTracker then
Set.empty
Dict.empty
else
Set.remove fileid model.loading
Dict.remove fileid model.loading
in
( { model | errored = errs, loading = load }, Cmd.none, Sub.none )
@ -121,17 +126,17 @@ update sourceId flags msg model =
_ ->
0
updateBars =
if percent == 0 then
Cmd.none
else if model.singleItem then
Ports.setAllProgress ( uploadAllTracker, percent )
newLoading =
if model.singleItem then
Dict.insert uploadAllTracker percent model.loading
else
Ports.setProgress ( fileid, percent )
Dict.insert fileid percent model.loading
in
( model, updateBars, Sub.none )
( { model | loading = newLoading }
, Cmd.none
, Sub.none
)
Clear ->
( emptyModel, Cmd.none, Sub.none )

View File

@ -1,6 +1,8 @@
module Page.Upload.View exposing (view)
import Comp.Dropzone
import Comp.Progress
import Dict
import File exposing (File)
import Html exposing (..)
import Html.Attributes exposing (..)
@ -117,6 +119,20 @@ renderUploads model =
]
getProgress : Model -> File -> Int
getProgress model file =
let
key =
if model.singleItem then
uploadAllTracker
else
makeFileId file
in
Dict.get key model.loading
|> Maybe.withDefault 0
renderFileItem : Model -> Maybe String -> File -> Html Msg
renderFileItem model mtracker file =
let
@ -147,16 +163,7 @@ renderFileItem model mtracker file =
[ text size
]
, div [ class "description" ]
[ div
[ classList
[ ( "ui small indicating progress", True )
, ( uploadAllTracker, Util.Maybe.nonEmpty mtracker )
]
, id (makeFileId file)
]
[ div [ class "bar" ]
[]
]
[ Comp.Progress.smallIndicating (getProgress model file)
]
]
]