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

web: archived pipelines UI beyond Dashboard #5760

Merged
merged 5 commits into from
Jun 22, 2020
Merged
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
3 changes: 3 additions & 0 deletions web/assets/css/utils.less
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@

ul {
-webkit-padding-start: 0;
-moz-padding-start: 0;
-khtml-padding-start: 0;
-o-padding-start: 0;
}

.ptn, .pvn, .pan { padding-top: 0; }
Expand Down
148 changes: 85 additions & 63 deletions web/elm/src/Build/Header/Header.elm
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import Message.Subscription
, Interval(..)
, Subscription(..)
)
import RemoteData exposing (WebData)
import Routes
import StrictEvents exposing (DeltaMode(..))
import Time
Expand All @@ -49,78 +50,99 @@ header session model =
, Views.Duration (duration session model)
]
, rightWidgets =
[ Views.Button
(if Concourse.BuildStatus.isRunning model.status then
Just
{ type_ = Views.Abort
, isClickable = True
, backgroundShade =
if
if isPipelineArchived session.pipelines model.job then
[]

else
[ Views.Button
(if Concourse.BuildStatus.isRunning model.status then
Just
{ type_ = Views.Abort
, isClickable = True
, backgroundShade =
if
HoverState.isHovered
AbortBuildButton
session.hovered
then
Views.Dark

else
Views.Light
, backgroundColor = Concourse.BuildStatus.BuildStatusFailed
, tooltip = False
}

else if model.job /= Nothing then
let
isHovered =
HoverState.isHovered
AbortBuildButton
RerunBuildButton
session.hovered
then
Views.Dark

else
Views.Light
, backgroundColor = Concourse.BuildStatus.BuildStatusFailed
, tooltip = False
}

else if model.job /= Nothing then
let
isHovered =
HoverState.isHovered
RerunBuildButton
session.hovered
in
Just
{ type_ = Views.Rerun
, isClickable = True
, backgroundShade =
if isHovered then
Views.Dark

else
Views.Light
, backgroundColor = model.status
, tooltip = isHovered
}
in
Just
{ type_ = Views.Rerun
, isClickable = True
, backgroundShade =
if isHovered then
Views.Dark

else
Views.Light
, backgroundColor = model.status
, tooltip = isHovered
}

else
Nothing
)
, Views.Button
(if model.job /= Nothing then
let
isHovered =
HoverState.isHovered
TriggerBuildButton
session.hovered
in
Just
{ type_ = Views.Trigger
, isClickable = not model.disableManualTrigger
, backgroundShade =
if isHovered then
Views.Dark

else
Views.Light
, backgroundColor = model.status
, tooltip = isHovered && model.disableManualTrigger
}
else
Nothing
)
, Views.Button
(if model.job /= Nothing then
let
isHovered =
HoverState.isHovered
TriggerBuildButton
session.hovered
in
Just
{ type_ = Views.Trigger
, isClickable = not model.disableManualTrigger
, backgroundShade =
if isHovered then
Views.Dark

else
Views.Light
, backgroundColor = model.status
, tooltip = isHovered && model.disableManualTrigger
}

else
Nothing
)
]
else
Nothing
)
]
, backgroundColor = model.status
, tabs = tabs model
}


isPipelineArchived :
WebData (List Concourse.Pipeline)
-> Maybe Concourse.JobIdentifier
-> Bool
isPipelineArchived pipelines jobId =
case jobId of
Just { pipelineName, teamName } ->
pipelines
|> RemoteData.withDefault []
|> List.Extra.find (\p -> p.name == pipelineName && p.teamName == teamName)
|> Maybe.map .archived
|> Maybe.withDefault False

Nothing ->
False


tabs : Model r -> List Views.BuildTab
tabs model =
model.history
Expand Down
1 change: 1 addition & 0 deletions web/elm/src/Dashboard/Styles.elm
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,7 @@ searchInput screenSize =
, style "background-repeat" "no-repeat"
, style "background-position" "12px 8px"
, style "height" "30px"
, style "min-height" "30px"
, style "padding" "0 42px"
, style "border" <| "1px solid " ++ Colors.inputOutline
, style "color" Colors.dashboardText
Expand Down
129 changes: 78 additions & 51 deletions web/elm/src/Job/Job.elm
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import Html.Events
)
import Http
import Job.Styles as Styles
import List.Extra
import Login.Login as Login
import Message.Callback exposing (Callback(..))
import Message.Effects exposing (Effect(..))
Expand Down Expand Up @@ -441,6 +442,12 @@ tooltip _ _ =

viewMainJobsSection : Session -> Model -> Html Message
viewMainJobsSection session model =
let
archived =
isPipelineArchived
session.pipelines
model.jobIdentifier
in
Html.div
[ class "with-fixed-header"
, style "flex-grow" "1"
Expand Down Expand Up @@ -470,68 +477,76 @@ viewMainJobsSection session model =
]
[ Html.div
[ style "display" "flex" ]
[ Html.button
([ id "pause-toggle"
, onMouseEnter <| Hover <| Just ToggleJobButton
[ if archived then
Html.text ""

else
Html.button
([ id "pause-toggle"
, onMouseEnter <| Hover <| Just ToggleJobButton
, onMouseLeave <| Hover Nothing
, onClick <| Click ToggleJobButton
]
++ (Styles.triggerButton False toggleHovered <|
headerBuildStatus job.finishedBuild
)
)
[ Icon.icon
{ sizePx = 40
, image =
Assets.CircleOutlineIcon <|
if job.paused then
Assets.PlayCircleIcon

else
Assets.PauseCircleIcon
}
(Styles.icon toggleHovered)
]
, Html.h1 []
[ Html.span
[ class "build-name" ]
[ Html.text job.name ]
]
]
, if archived then
Html.text ""

else
Html.button
([ class "trigger-build"
, onLeftClick <| Click TriggerBuildButton
, attribute "aria-label" "Trigger Build"
, attribute "title" "Trigger Build"
, onMouseEnter <| Hover <| Just TriggerBuildButton
, onMouseLeave <| Hover Nothing
, onClick <| Click ToggleJobButton
]
++ (Styles.triggerButton False toggleHovered <|
++ (Styles.triggerButton job.disableManualTrigger triggerHovered <|
headerBuildStatus job.finishedBuild
)
)
<|
[ Icon.icon
{ sizePx = 40
, image =
Assets.CircleOutlineIcon <|
if job.paused then
Assets.PlayCircleIcon

else
Assets.PauseCircleIcon
, image = Assets.AddCircleIcon |> Assets.CircleOutlineIcon
}
(Styles.icon toggleHovered)
]
, Html.h1 []
[ Html.span
[ class "build-name" ]
[ Html.text job.name ]
(Styles.icon <|
triggerHovered
&& not job.disableManualTrigger
)
]
]
, Html.button
([ class "trigger-build"
, onLeftClick <| Click TriggerBuildButton
, attribute "aria-label" "Trigger Build"
, attribute "title" "Trigger Build"
, onMouseEnter <| Hover <| Just TriggerBuildButton
, onMouseLeave <| Hover Nothing
]
++ (Styles.triggerButton job.disableManualTrigger triggerHovered <|
headerBuildStatus job.finishedBuild
)
)
<|
[ Icon.icon
{ sizePx = 40
, image = Assets.AddCircleIcon |> Assets.CircleOutlineIcon
}
(Styles.icon <|
triggerHovered
&& not job.disableManualTrigger
)
]
++ (if job.disableManualTrigger && triggerHovered then
[ Html.div
Styles.triggerTooltip
[ Html.text <|
"manual triggering disabled "
++ "in job config"
++ (if job.disableManualTrigger && triggerHovered then
[ Html.div
Styles.triggerTooltip
[ Html.text <|
"manual triggering disabled "
++ "in job config"
]
]
]

else
[]
)
else
[]
)
]
, Html.div
[ id "pagination-header"
Expand Down Expand Up @@ -572,6 +587,18 @@ viewMainJobsSection session model =
]


isPipelineArchived :
WebData (List Concourse.Pipeline)
-> Concourse.JobIdentifier
-> Bool
isPipelineArchived pipelines { pipelineName, teamName } =
pipelines
|> RemoteData.withDefault []
|> List.Extra.find (\p -> p.name == pipelineName && p.teamName == teamName)
|> Maybe.map .archived
|> Maybe.withDefault False


headerBuildStatus : Maybe Concourse.Build -> BuildStatus
headerBuildStatus finishedBuild =
case finishedBuild of
Expand Down
Loading