From 3349097582840d4336c3039e278d0f8e1b944746 Mon Sep 17 00:00:00 2001 From: DieMyst Date: Fri, 12 Mar 2021 18:05:13 +0300 Subject: [PATCH] add spinners to bp page and module page --- src/BlueprintPage/View.elm | 6 +++--- src/Blueprints/View.elm | 2 +- src/Instances/View.elm | 2 +- src/ModulePage/View.elm | 5 +++-- src/Modules/View.elm | 2 +- src/NodePage/View.elm | 21 +++++++++++++++------ 6 files changed, 24 insertions(+), 14 deletions(-) diff --git a/src/BlueprintPage/View.elm b/src/BlueprintPage/View.elm index 7be235f..a4845fe 100644 --- a/src/BlueprintPage/View.elm +++ b/src/BlueprintPage/View.elm @@ -8,13 +8,13 @@ import Html.Attributes exposing (attribute) import Html.Events exposing (onClick) import Info exposing (getBlueprintDescription) import Instances.View -import Interface.View exposing (interfaceView) import List.Unique exposing (..) import Model exposing (Model) import Modules.Model exposing (Module) import Msg exposing (Msg(..)) import Palette exposing (classes, darkRed, redFont) import Service.Model exposing (Interface) +import SpinnerView exposing (spinner) view : Model -> String -> Html Msg @@ -41,8 +41,8 @@ view model id = ] Nothing -> - div [ classes "cf ph2-ns" ] - [] + div [ classes "cf ph2-ns mt6" ] + (spinner model) blueprintToInfo : Model -> String -> Maybe BlueprintViewInfo diff --git a/src/Blueprints/View.elm b/src/Blueprints/View.elm index fbfc6b5..d40be8b 100644 --- a/src/Blueprints/View.elm +++ b/src/Blueprints/View.elm @@ -35,7 +35,7 @@ view model = List.map viewService filtered finalView = - if List.length servicesView == 0 then + if List.isEmpty servicesView then spinner model else diff --git a/src/Instances/View.elm b/src/Instances/View.elm index 54e7db2..1632663 100644 --- a/src/Instances/View.elm +++ b/src/Instances/View.elm @@ -48,7 +48,7 @@ view model filter = |> List.concat finalView = - if List.length instances == 0 then + if List.isEmpty instances then Html.div [] (spinner model) else diff --git a/src/ModulePage/View.elm b/src/ModulePage/View.elm index 1643070..c1d5632 100644 --- a/src/ModulePage/View.elm +++ b/src/ModulePage/View.elm @@ -11,6 +11,7 @@ import Model exposing (Model) import ModulePage.Model exposing (ModuleViewInfo) import Modules.Model exposing (Module) import Palette exposing (classes, redFont) +import SpinnerView exposing (spinner) view : Model -> String -> Html msg @@ -41,8 +42,8 @@ view model id = ] Nothing -> - div [ classes "cf ph2-ns" ] - [] + div [ classes "cf ph2-ns mt6" ] + (spinner model) moduleToInfo : Dict String Module -> String -> Maybe ModuleViewInfo diff --git a/src/Modules/View.elm b/src/Modules/View.elm index 70e3744..0f56814 100644 --- a/src/Modules/View.elm +++ b/src/Modules/View.elm @@ -118,7 +118,7 @@ view model = List.map viewService info finalView = - if List.length modulesView == 0 then + if List.isEmpty modulesView then spinner model else diff --git a/src/NodePage/View.elm b/src/NodePage/View.elm index 77b2e42..8b9bcab 100644 --- a/src/NodePage/View.elm +++ b/src/NodePage/View.elm @@ -5,6 +5,7 @@ import Html exposing (Html, div, p, table, tbody, td, text, th, thead, tr) import Html.Attributes exposing (attribute) import Model exposing (Model) import Palette exposing (classes, redFont) +import SpinnerView exposing (spinner) type alias Node = @@ -19,13 +20,21 @@ view model = let nodes = modelToNodes model + + finalView = + if List.isEmpty nodes then + spinner model + + else + [ div [ classes "fl w-100 cf ph2-ns" ] + [ div [ classes "fl w-100 mb2 pt4 pb4" ] + [ div [ redFont, classes "f1 fw4 pt3" ] [ text "Network Nodes" ] + ] + , div [ classes "fl w-100 mt2 mb4 bg-white br3" ] [ nodesView nodes ] + ] + ] in - div [ classes "fl w-100 cf ph2-ns" ] - [ div [ classes "fl w-100 mb2 pt4 pb4" ] - [ div [ redFont, classes "f1 fw4 pt3" ] [ text "Network Nodes" ] - ] - , div [ classes "fl w-100 mt2 mb4 bg-white br3" ] [ nodesView nodes ] - ] + div [] finalView modelToNodes : Model -> List Node