diff --git a/src/elm/Components/Form.elm b/src/elm/Components/Form.elm index c99b36aac..3370096e6 100644 --- a/src/elm/Components/Form.elm +++ b/src/elm/Components/Form.elm @@ -19,9 +19,9 @@ import Vela viewInput : - { title : Maybe String + { id_ : String + , title : Maybe String , subtitle : Maybe (Html msg) - , id_ : String , val : String , placeholder_ : String , classList_ : List ( String, Bool ) @@ -31,7 +31,7 @@ viewInput : , disabled_ : Bool } -> Html msg -viewInput { title, subtitle, id_, val, placeholder_, classList_, rows_, wrap_, msg, disabled_ } = +viewInput { id_, title, subtitle, val, placeholder_, classList_, rows_, wrap_, msg, disabled_ } = section [ class "form-control" , class "-stack" @@ -51,15 +51,16 @@ viewInput { title, subtitle, id_, val, placeholder_, classList_, rows_, wrap_, m , Maybe.Extra.unwrap Util.attrNone wrap wrap_ , onInput msg , disabled disabled_ + , Util.testAttribute id_ ] [] ] viewTextarea : - { title : Maybe String + { id_ : String + , title : Maybe String , subtitle : Maybe (Html msg) - , id_ : String , val : String , placeholder_ : String , classList_ : List ( String, Bool ) @@ -69,7 +70,7 @@ viewTextarea : , disabled_ : Bool } -> Html msg -viewTextarea { title, subtitle, id_, val, placeholder_, classList_, rows_, wrap_, msg, disabled_ } = +viewTextarea { id_, title, subtitle, val, placeholder_, classList_, rows_, wrap_, msg, disabled_ } = section [ class "form-control" , class "-stack" @@ -89,13 +90,15 @@ viewTextarea { title, subtitle, id_, val, placeholder_, classList_, rows_, wrap_ , Maybe.Extra.unwrap Util.attrNone wrap wrap_ , onInput msg , disabled disabled_ + , Util.testAttribute id_ ] [] ] viewCheckbox : - { title : String + { id_ : String + , title : String , subtitle : Maybe (Html msg) , field : String , state : Bool @@ -103,7 +106,7 @@ viewCheckbox : , disabled_ : Bool } -> Html msg -viewCheckbox { title, subtitle, field, state, msg, disabled_ } = +viewCheckbox { id_, title, subtitle, field, state, msg, disabled_ } = div [ class "form-control" , Util.testAttribute <| "checkbox-" ++ field @@ -114,6 +117,7 @@ viewCheckbox { title, subtitle, field, state, msg, disabled_ } = , checked state , onCheck msg , disabled disabled_ + , Util.testAttribute id_ ] [] , label [ class "form-label", for <| "checkbox-" ++ field ] @@ -122,7 +126,8 @@ viewCheckbox { title, subtitle, field, state, msg, disabled_ } = viewRadio : - { title : String + { id_ : String + , title : String , subtitle : Maybe (Html msg) , value : String , field : String @@ -130,7 +135,7 @@ viewRadio : , disabled_ : Bool } -> Html msg -viewRadio { title, subtitle, value, field, msg, disabled_ } = +viewRadio { id_, title, subtitle, value, field, msg, disabled_ } = div [ class "form-control", Util.testAttribute <| "radio-" ++ field ] [ input [ type_ "radio" @@ -138,6 +143,7 @@ viewRadio { title, subtitle, value, field, msg, disabled_ } = , checked (value == field) , onClick msg , disabled disabled_ + , Util.testAttribute id_ ] [] , label [ class "form-label", for <| "radio-" ++ field ] @@ -145,23 +151,24 @@ viewRadio { title, subtitle, value, field, msg, disabled_ } = ] -viewSubtitle : Maybe (Html msg) -> Html msg -viewSubtitle subtitle = - Maybe.Extra.unwrap (text "") (\s -> span [] [ text <| " ", s ]) subtitle - - -viewButton : { msg : msg, text_ : String, classList_ : List ( String, Bool ), disabled_ : Bool } -> Html msg -viewButton { msg, text_, classList_, disabled_ } = +viewButton : { id_ : String, msg : msg, text_ : String, classList_ : List ( String, Bool ), disabled_ : Bool } -> Html msg +viewButton { id_, msg, text_, classList_, disabled_ } = button [ class "button" , class "-outline" , onClick msg , disabled disabled_ , classList classList_ + , Util.testAttribute id_ ] [ text text_ ] +viewSubtitle : Maybe (Html msg) -> Html msg +viewSubtitle subtitle = + Maybe.Extra.unwrap (text "") (\s -> span [] [ text <| " ", s ]) subtitle + + viewAllowEvents : Shared.Model -> @@ -180,6 +187,7 @@ viewAllowEvents shared { msg, allowEvents } = , state = allowEvents.push.branch , msg = msg { allowEvents = allowEvents, event = "allow_push_branch" } , disabled_ = False + , id_ = "allow-events-push-branch" } , viewCheckbox { title = "Tag" @@ -188,6 +196,7 @@ viewAllowEvents shared { msg, allowEvents } = , state = allowEvents.push.tag , msg = msg { allowEvents = allowEvents, event = "allow_push_tag" } , disabled_ = False + , id_ = "allow-events-push-tag" } ] , h3 [ class "settings-subtitle" ] [ text "Delete" ] @@ -199,6 +208,7 @@ viewAllowEvents shared { msg, allowEvents } = , state = allowEvents.push.deleteBranch , msg = msg { allowEvents = allowEvents, event = "allow_push_delete_branch" } , disabled_ = False + , id_ = "allow-events-push-delete-branch" } , viewCheckbox { title = "Tag" @@ -207,6 +217,7 @@ viewAllowEvents shared { msg, allowEvents } = , state = allowEvents.push.deleteTag , msg = msg { allowEvents = allowEvents, event = "allow_push_delete_tag" } , disabled_ = False + , id_ = "allow-events-push-delete-tag" } ] , h3 [ class "settings-subtitle" ] [ text "Pull Request" ] @@ -218,6 +229,7 @@ viewAllowEvents shared { msg, allowEvents } = , state = allowEvents.pull.opened , msg = msg { allowEvents = allowEvents, event = "allow_pull_opened" } , disabled_ = False + , id_ = "allow-events-pull-opened" } , viewCheckbox { title = "Synchronize" @@ -226,6 +238,7 @@ viewAllowEvents shared { msg, allowEvents } = , state = allowEvents.pull.synchronize , msg = msg { allowEvents = allowEvents, event = "allow_pull_synchronize" } , disabled_ = False + , id_ = "allow-events-pull-synchronize" } , viewCheckbox { title = "Edited" @@ -234,6 +247,7 @@ viewAllowEvents shared { msg, allowEvents } = , state = allowEvents.pull.edited , msg = msg { allowEvents = allowEvents, event = "allow_pull_edited" } , disabled_ = False + , id_ = "allow-events-pull-edited" } , viewCheckbox { title = "Reopened" @@ -242,6 +256,7 @@ viewAllowEvents shared { msg, allowEvents } = , state = allowEvents.pull.reopened , msg = msg { allowEvents = allowEvents, event = "allow_pull_reopened" } , disabled_ = False + , id_ = "allow-events-pull-reopened" } ] , h3 [ class "settings-subtitle" ] [ text "Deployments" ] @@ -253,6 +268,7 @@ viewAllowEvents shared { msg, allowEvents } = , state = allowEvents.deploy.created , msg = msg { allowEvents = allowEvents, event = "allow_deploy_created" } , disabled_ = False + , id_ = "allow-events-deploy-created" } ] , h3 [ class "settings-subtitle" ] [ text "Comment" ] @@ -264,6 +280,7 @@ viewAllowEvents shared { msg, allowEvents } = , state = allowEvents.comment.created , msg = msg { allowEvents = allowEvents, event = "allow_comment_created" } , disabled_ = False + , id_ = "allow-events-comment-created" } , viewCheckbox { title = "Edited" @@ -272,6 +289,7 @@ viewAllowEvents shared { msg, allowEvents } = , state = allowEvents.comment.edited , msg = msg { allowEvents = allowEvents, event = "allow_comment_edited" } , disabled_ = False + , id_ = "allow-events-comment-edited" } ] ] diff --git a/src/elm/Components/Logs.elm b/src/elm/Components/Logs.elm index edc59f7e6..25e01d816 100644 --- a/src/elm/Components/Logs.elm +++ b/src/elm/Components/Logs.elm @@ -163,7 +163,7 @@ viewLine pushUrlHashMsg resourceType resourceNumber shift focus logLine lineNumb ] [ div [ class "wrapper" - , Util.testAttribute <| String.join "-" [ "log", "line", resourceType, resourceNumber, String.fromInt lineNumber ] + , Util.testAttribute <| String.join "-" [ "log", "line", resourceNumber, String.fromInt lineNumber ] , class <| Focus.lineRangeStyles (String.toInt resourceNumber) lineNumber focus ] [ td [] @@ -173,7 +173,7 @@ viewLine pushUrlHashMsg resourceType resourceNumber shift focus logLine lineNumb { hash = Focus.toString <| Focus.updateLineRange shift (String.toInt resourceNumber) lineNumber focus } - , Util.testAttribute <| String.join "-" [ "log", "line", "num", resourceType, resourceNumber, String.fromInt lineNumber ] + , Util.testAttribute <| String.join "-" [ "log", "line", "num", resourceNumber, String.fromInt lineNumber ] , Focus.toAttr { group = String.toInt resourceNumber , a = Just lineNumber @@ -182,12 +182,12 @@ viewLine pushUrlHashMsg resourceType resourceNumber shift focus logLine lineNumb , class "line-number" , class "button" , class "-link" - , attribute "aria-label" <| "focus " ++ resourceType ++ " " ++ resourceNumber + , attribute "aria-label" <| "focus log for resource " ++ resourceNumber ] [ span [] [ text <| String.fromInt lineNumber ] ] ] , td [ class "break-text", class "overflow-auto" ] - [ code [ Util.testAttribute <| String.join "-" [ "log", "data", resourceType, resourceNumber, String.fromInt lineNumber ] ] + [ code [ Util.testAttribute <| String.join "-" [ "log", "data", resourceNumber, String.fromInt lineNumber ] ] [ logLine.view ] ] @@ -356,12 +356,12 @@ viewJumpToBottomButton props = , attribute "data-tooltip" "jump to bottom" , Util.testAttribute <| "jump-to-bottom-" ++ props.resourceNumber , onClick <| props.msgs.focusOn { target = Logs.bottomTrackerFocusId props.resourceNumber } - , attribute "aria-label" <| "jump to bottom of logs for " ++ props.resourceType ++ " " ++ props.resourceNumber + , attribute "aria-label" <| "jump to bottom of logs for resource " ++ props.resourceNumber ] [ FeatherIcons.arrowDown |> FeatherIcons.toHtml [ attribute "role" "img" - , attribute "aria-label" <| "jump to the bottom of logs for " ++ props.resourceType ++ " " ++ props.resourceNumber + , attribute "aria-label" <| "jump to the bottom of logs for resource " ++ props.resourceNumber ] ] @@ -377,12 +377,12 @@ viewJumpToTopButton props = , attribute "data-tooltip" "jump to top" , Util.testAttribute <| "jump-to-top-" ++ props.resourceNumber , onClick <| props.msgs.focusOn { target = Logs.topTrackerFocusId props.resourceNumber } - , attribute "aria-label" <| "jump to top of logs for " ++ props.resourceType ++ " " ++ props.resourceNumber + , attribute "aria-label" <| "jump to top of logs for resource " ++ props.resourceNumber ] [ FeatherIcons.arrowUp |> FeatherIcons.toHtml [ attribute "role" "img" - , attribute "aria-label" <| "jump to the top of logs for " ++ props.resourceType ++ " " ++ props.resourceNumber + , attribute "aria-label" <| "jump to the top of logs for resource " ++ props.resourceNumber ] ] @@ -407,9 +407,9 @@ viewDownloadButton props log = , Util.attrIf logEmpty <| Util.ariaHidden , Util.testAttribute <| "download-logs-" ++ props.resourceNumber , onClick <| props.msgs.download { filename = fileName, content = log.rawData, map = Util.base64Decode } - , attribute "aria-label" <| "download logs for " ++ props.resourceType ++ " " ++ props.resourceNumber + , attribute "aria-label" <| "download logs for resource " ++ props.resourceNumber ] - [ text <| "download " ++ props.resourceType ++ " logs" ] + [ text <| "download resource logs" ] {-| viewFollowButton : renders button for following logs @@ -425,13 +425,13 @@ viewFollowButton props = ( tooltip, icon, toFollow ) = if following == 0 then - ( "start following " ++ props.resourceType ++ " logs", FeatherIcons.play, num ) + ( "start following resource logs", FeatherIcons.play, num ) else if following == num then - ( "stop following " ++ props.resourceType ++ " logs", FeatherIcons.pause, 0 ) + ( "stop following resource logs", FeatherIcons.pause, 0 ) else - ( "start following " ++ props.resourceType ++ " logs", FeatherIcons.play, num ) + ( "start following resource logs", FeatherIcons.play, num ) in button [ class "button" @@ -440,11 +440,11 @@ viewFollowButton props = , attribute "data-tooltip" tooltip , Util.testAttribute <| "follow-logs-" ++ props.resourceNumber , onClick <| props.msgs.follow { number = toFollow } - , attribute "aria-label" <| tooltip ++ " for " ++ props.resourceType ++ " " ++ props.resourceNumber + , attribute "aria-label" <| tooltip ++ " for resource " ++ props.resourceNumber ] [ icon |> FeatherIcons.toHtml [ attribute "role" "img" - , attribute "aria-label" <| "follow logs for " ++ props.resourceType ++ " " ++ props.resourceNumber + , attribute "aria-label" <| "follow logs for resource " ++ props.resourceNumber ] ] diff --git a/src/elm/Components/Repo.elm b/src/elm/Components/Repo.elm index 3f9b0043b..d8e306c88 100644 --- a/src/elm/Components/Repo.elm +++ b/src/elm/Components/Repo.elm @@ -63,7 +63,7 @@ view shared { toggleFavoriteMsg, org, repo, favorites, filtered } = [ class "button" , class "-outline" , Util.testAttribute "repo-hooks" - , Route.Path.href <| Route.Path.Org_Repo_Audit { org = org, repo = repo } + , Route.Path.href <| Route.Path.Org_Repo_Hooks { org = org, repo = repo } ] [ text "Audit" ] , a diff --git a/src/elm/Components/ScheduleForm.elm b/src/elm/Components/ScheduleForm.elm index 2d4320ff7..76e3b94f3 100644 --- a/src/elm/Components/ScheduleForm.elm +++ b/src/elm/Components/ScheduleForm.elm @@ -3,7 +3,7 @@ SPDX-License-Identifier: Apache-2.0 --} -module Components.ScheduleForm exposing (viewCronHelp, viewEnabledInput, viewHelp, viewSubmitButton) +module Components.ScheduleForm exposing (viewCronHelp, viewEnabledInput, viewHelp, viewSchedulesNotAllowedWarning, viewSubmitButton) import Components.Form import Html @@ -75,6 +75,7 @@ viewEnabledInput { msg, value, disabled_ } = , subtitle = Nothing , msg = msg "yes" , disabled_ = disabled_ + , id_ = "schedule-active-yes" } , Components.Form.viewRadio { value = Util.boolToYesNo value @@ -83,6 +84,7 @@ viewEnabledInput { msg, value, disabled_ } = , subtitle = Nothing , msg = msg "no" , disabled_ = disabled_ + , id_ = "schedule-active-no" } ] ] @@ -112,3 +114,10 @@ viewSubmitButton { msg, disabled_ } = ] [ text "Submit" ] ] + + +viewSchedulesNotAllowedWarning : Html msg +viewSchedulesNotAllowedWarning = + span [ class "not-allowed", Util.testAttribute "repo-schedule-not-allowed" ] + [ text "Sorry, Administrators have not enabled Schedules for this repository." + ] diff --git a/src/elm/Components/SecretForm.elm b/src/elm/Components/SecretForm.elm index 4b176b1e4..00a1e285d 100644 --- a/src/elm/Components/SecretForm.elm +++ b/src/elm/Components/SecretForm.elm @@ -147,6 +147,7 @@ viewAllowCommandsInput { msg, value, disabled_ } = , subtitle = Nothing , msg = msg "yes" , disabled_ = disabled_ + , id_ = "secret-allow-commands-yes" } , Components.Form.viewRadio { value = Util.boolToYesNo value @@ -155,6 +156,7 @@ viewAllowCommandsInput { msg, value, disabled_ } = , subtitle = Nothing , msg = msg "no" , disabled_ = disabled_ + , id_ = "secret-allow-commands-no" } ] ] diff --git a/src/elm/Components/Secrets.elm b/src/elm/Components/Secrets.elm index 865585751..553404726 100644 --- a/src/elm/Components/Secrets.elm +++ b/src/elm/Components/Secrets.elm @@ -196,7 +196,7 @@ viewSharedSecrets shared props = -} tableHeaders : Components.Table.Columns tableHeaders = - [ ( Just "table-icon", "" ) + [ ( Just "table-icon", "copy" ) , ( Nothing, "name" ) , ( Nothing, "key" ) , ( Nothing, "type" ) @@ -265,14 +265,25 @@ viewSecret engine type_ copyMsg secret = , scope "row" , class "break-word" ] - [ Components.Table.viewListCell (enabledAllowEventsToList secret.allowEvents) "no events" [] + [ Components.Table.viewListCell + { dataLabel = "events" + , items = enabledAllowEventsToList secret.allowEvents + , none = "no events" + , itemWrapperClassList = [] + } ] , td [ attribute "data-label" "images" , scope "row" , class "break-word" ] - [ Components.Table.viewListCell secret.images "all images" [ ( "secret-image", True ) ] ] + [ Components.Table.viewListCell + { dataLabel = "images" + , items = secret.images + , none = "all images" + , itemWrapperClassList = [ ( "secret-image", True ) ] + } + ] , Components.Table.viewItemCell { dataLabel = "allow command" , parentClassList = [] diff --git a/src/elm/Components/Table.elm b/src/elm/Components/Table.elm index 581d9a5e6..2b4899aa7 100644 --- a/src/elm/Components/Table.elm +++ b/src/elm/Components/Table.elm @@ -103,7 +103,18 @@ view { label, testLabel, noRows, columns, rows, headerElement } = , Maybe.withDefault (text "") headerElement ] ] - , thead [] [ tr [] <| List.map (\( className, col ) -> th [ class <| Maybe.withDefault "" className, scope "col" ] [ text <| String.Extra.toTitleCase col ]) columns ] + , thead [] + [ tr [] <| + List.map + (\( className, col ) -> + th + [ class <| Maybe.withDefault "" className + , scope "col" + ] + [ text <| String.Extra.toTitleCase col ] + ) + columns + ] , viewFooter noRows numRows numColumns , tbody [] <| List.map (\row_ -> row_.display row_.data) rows ] @@ -122,11 +133,12 @@ viewFooter noRows numRows numColumns = {-| viewListCell : takes list of items, text for none and className and renders a table cell -} -viewListCell : List String -> String -> List ( String, Bool ) -> Html msg -viewListCell items none itemWrapperClassList = +viewListCell : { dataLabel : String, items : List String, none : String, itemWrapperClassList : List ( String, Bool ) } -> Html msg +viewListCell { dataLabel, items, none, itemWrapperClassList } = if List.length items == 0 then span [ class "single-item" + , Util.testAttribute <| "cell-list-item-" ++ dataLabel ] [ text none ] @@ -135,7 +147,10 @@ viewListCell items none itemWrapperClassList = |> List.sort |> List.map (\item -> - div [ classList itemWrapperClassList ] + div + [ classList itemWrapperClassList + , Util.testAttribute <| "cell-list-item-" ++ dataLabel + ] [ span [ class "list-item" ] [ text item ] @@ -152,7 +167,7 @@ viewListItemCell { dataLabel, parentClassList, itemWrapperClassList, itemClassLi [ attribute "data-label" dataLabel , class "break-word" , classList parentClassList - , scope "row" + , Util.testAttribute <| "cell-" ++ dataLabel ] [ div [ classList itemWrapperClassList ] [ span @@ -172,7 +187,7 @@ viewItemCell { dataLabel, parentClassList, itemClassList, children } = [ attribute "data-label" dataLabel , class "break-word" , classList parentClassList - , scope "row" + , Util.testAttribute <| "cell-" ++ dataLabel ] [ span [ class "single-item" @@ -191,6 +206,7 @@ viewIconCell { dataLabel, parentClassList, itemWrapperClassList, itemClassList, , class "break-word" , class "table-icon" , classList parentClassList + , Util.testAttribute <| "cell-" ++ dataLabel ] [ div [ classList itemWrapperClassList diff --git a/src/elm/Components/Tabs.elm b/src/elm/Components/Tabs.elm index bbb9ff61e..2c4819632 100644 --- a/src/elm/Components/Tabs.elm +++ b/src/elm/Components/Tabs.elm @@ -228,7 +228,7 @@ viewRepoTabs shared props = , show = showSchedules } , { name = "Audit" - , toPath = Route.Path.Org_Repo_Audit { org = props.org, repo = props.repo } + , toPath = Route.Path.Org_Repo_Hooks { org = props.org, repo = props.repo } , isAlerting = auditAlerting , show = True } diff --git a/src/elm/Main.elm b/src/elm/Main.elm index cd6b866e9..8b78f8602 100644 --- a/src/elm/Main.elm +++ b/src/elm/Main.elm @@ -35,13 +35,13 @@ import Pages.NotFound_ import Pages.Org_ import Pages.Org_.Builds import Pages.Org_.Repo_ -import Pages.Org_.Repo_.Audit import Pages.Org_.Repo_.Build_ import Pages.Org_.Repo_.Build_.Graph import Pages.Org_.Repo_.Build_.Pipeline import Pages.Org_.Repo_.Build_.Services import Pages.Org_.Repo_.Deployments import Pages.Org_.Repo_.Deployments.Add +import Pages.Org_.Repo_.Hooks import Pages.Org_.Repo_.Schedules import Pages.Org_.Repo_.Schedules.Add import Pages.Org_.Repo_.Schedules.Edit_ @@ -522,6 +522,30 @@ initPageAndLayout model = } ) + Route.Path.Org_Repo_Tags params -> + runWhenAuthenticatedWithLayout + model + (\user -> + let + page : Page.Page Pages.Org_.Repo_.Model Pages.Org_.Repo_.Msg + page = + Pages.Org_.Repo_.page user model.shared (Route.fromUrl params model.url) + + ( pageModel, pageEffect ) = + Page.init page () + in + { page = + Tuple.mapBoth + (Main.Pages.Model.Org_Repo_ params) + (Effect.map Main.Pages.Msg.Org_Repo_ >> fromPageEffect model) + ( pageModel, pageEffect ) + , layout = + Page.layout pageModel page + |> Maybe.map (Layouts.map (Main.Pages.Msg.Org_Repo_ >> Page)) + |> Maybe.map (initLayout model) + } + ) + Route.Path.Org_Repo_Deployments params -> runWhenAuthenticatedWithLayout model @@ -642,26 +666,26 @@ initPageAndLayout model = } ) - Route.Path.Org_Repo_Audit params -> + Route.Path.Org_Repo_Hooks params -> runWhenAuthenticatedWithLayout model (\user -> let - page : Page.Page Pages.Org_.Repo_.Audit.Model Pages.Org_.Repo_.Audit.Msg + page : Page.Page Pages.Org_.Repo_.Hooks.Model Pages.Org_.Repo_.Hooks.Msg page = - Pages.Org_.Repo_.Audit.page user model.shared (Route.fromUrl params model.url) + Pages.Org_.Repo_.Hooks.page user model.shared (Route.fromUrl params model.url) ( pageModel, pageEffect ) = Page.init page () in { page = Tuple.mapBoth - (Main.Pages.Model.Org_Repo_Audit params) - (Effect.map Main.Pages.Msg.Org_Repo_Audit >> fromPageEffect model) + (Main.Pages.Model.Org_Repo_Hooks params) + (Effect.map Main.Pages.Msg.Org_Repo_Hooks >> fromPageEffect model) ( pageModel, pageEffect ) , layout = Page.layout pageModel page - |> Maybe.map (Layouts.map (Main.Pages.Msg.Org_Repo_Audit >> Page)) + |> Maybe.map (Layouts.map (Main.Pages.Msg.Org_Repo_Hooks >> Page)) |> Maybe.map (initLayout model) } ) @@ -1360,14 +1384,14 @@ updateFromPage msg model = (Page.update (Pages.Org_.Repo_.Schedules.Edit_.page user model.shared (Route.fromUrl params model.url)) pageMsg pageModel) ) - ( Main.Pages.Msg.Org_Repo_Audit pageMsg, Main.Pages.Model.Org_Repo_Audit params pageModel ) -> + ( Main.Pages.Msg.Org_Repo_Hooks pageMsg, Main.Pages.Model.Org_Repo_Hooks params pageModel ) -> runWhenAuthenticated model (\user -> Tuple.mapBoth - (Main.Pages.Model.Org_Repo_Audit params) - (Effect.map Main.Pages.Msg.Org_Repo_Audit >> fromPageEffect model) - (Page.update (Pages.Org_.Repo_.Audit.page user model.shared (Route.fromUrl params model.url)) pageMsg pageModel) + (Main.Pages.Model.Org_Repo_Hooks params) + (Effect.map Main.Pages.Msg.Org_Repo_Hooks >> fromPageEffect model) + (Page.update (Pages.Org_.Repo_.Hooks.page user model.shared (Route.fromUrl params model.url)) pageMsg pageModel) ) ( Main.Pages.Msg.Org_Repo_Settings pageMsg, Main.Pages.Model.Org_Repo_Settings params pageModel ) -> @@ -1669,11 +1693,11 @@ toLayoutFromPage model = |> Maybe.andThen (Page.layout pageModel) |> Maybe.map (Layouts.map (Main.Pages.Msg.Org_Repo_SchedulesEdit_ >> Page)) - Main.Pages.Model.Org_Repo_Audit params pageModel -> + Main.Pages.Model.Org_Repo_Hooks params pageModel -> Route.fromUrl params model.url - |> toAuthProtectedPage model Pages.Org_.Repo_.Audit.page + |> toAuthProtectedPage model Pages.Org_.Repo_.Hooks.page |> Maybe.andThen (Page.layout pageModel) - |> Maybe.map (Layouts.map (Main.Pages.Msg.Org_Repo_Audit >> Page)) + |> Maybe.map (Layouts.map (Main.Pages.Msg.Org_Repo_Hooks >> Page)) Main.Pages.Model.Org_Repo_Settings params pageModel -> Route.fromUrl params model.url @@ -1896,11 +1920,11 @@ subscriptions model = ) (Auth.onPageLoad model.shared (Route.fromUrl () model.url)) - Main.Pages.Model.Org_Repo_Audit params pageModel -> + Main.Pages.Model.Org_Repo_Hooks params pageModel -> Auth.Action.subscriptions (\user -> - Page.subscriptions (Pages.Org_.Repo_.Audit.page user model.shared (Route.fromUrl params model.url)) pageModel - |> Sub.map Main.Pages.Msg.Org_Repo_Audit + Page.subscriptions (Pages.Org_.Repo_.Hooks.page user model.shared (Route.fromUrl params model.url)) pageModel + |> Sub.map Main.Pages.Msg.Org_Repo_Hooks |> Sub.map Page ) (Auth.onPageLoad model.shared (Route.fromUrl () model.url)) @@ -2316,11 +2340,11 @@ viewPage model = ) (Auth.onPageLoad model.shared (Route.fromUrl () model.url)) - Main.Pages.Model.Org_Repo_Audit params pageModel -> + Main.Pages.Model.Org_Repo_Hooks params pageModel -> Auth.Action.view (\user -> - Page.view (Pages.Org_.Repo_.Audit.page user model.shared (Route.fromUrl params model.url)) pageModel - |> View.map Main.Pages.Msg.Org_Repo_Audit + Page.view (Pages.Org_.Repo_.Hooks.page user model.shared (Route.fromUrl params model.url)) pageModel + |> View.map Main.Pages.Msg.Org_Repo_Hooks |> View.map Page ) (Auth.onPageLoad model.shared (Route.fromUrl () model.url)) @@ -2636,11 +2660,11 @@ toPageUrlHookCmd model routes = ) (Auth.onPageLoad model.shared (Route.fromUrl () model.url)) - Main.Pages.Model.Org_Repo_Audit params pageModel -> + Main.Pages.Model.Org_Repo_Hooks params pageModel -> Auth.Action.command (\user -> - Page.toUrlMessages routes (Pages.Org_.Repo_.Audit.page user model.shared (Route.fromUrl params model.url)) - |> List.map Main.Pages.Msg.Org_Repo_Audit + Page.toUrlMessages routes (Pages.Org_.Repo_.Hooks.page user model.shared (Route.fromUrl params model.url)) + |> List.map Main.Pages.Msg.Org_Repo_Hooks |> List.map Page |> toCommands ) @@ -2950,6 +2974,9 @@ isAuthProtected routePath = Route.Path.Org_Repo_Pulls _ -> True + Route.Path.Org_Repo_Tags _ -> + True + Route.Path.Org_Repo_Deployments _ -> True @@ -2965,7 +2992,7 @@ isAuthProtected routePath = Route.Path.Org_Repo_SchedulesEdit_ _ -> True - Route.Path.Org_Repo_Audit _ -> + Route.Path.Org_Repo_Hooks _ -> True Route.Path.Org_Repo_Settings _ -> diff --git a/src/elm/Main/Pages/Model.elm b/src/elm/Main/Pages/Model.elm index 4da551063..c989203d9 100644 --- a/src/elm/Main/Pages/Model.elm +++ b/src/elm/Main/Pages/Model.elm @@ -13,13 +13,13 @@ import Pages.NotFound_ import Pages.Org_ import Pages.Org_.Builds import Pages.Org_.Repo_ -import Pages.Org_.Repo_.Audit import Pages.Org_.Repo_.Build_ import Pages.Org_.Repo_.Build_.Graph import Pages.Org_.Repo_.Build_.Pipeline import Pages.Org_.Repo_.Build_.Services import Pages.Org_.Repo_.Deployments import Pages.Org_.Repo_.Deployments.Add +import Pages.Org_.Repo_.Hooks import Pages.Org_.Repo_.Schedules import Pages.Org_.Repo_.Schedules.Add import Pages.Org_.Repo_.Schedules.Edit_ @@ -48,7 +48,7 @@ type Model | Org_Repo_Schedules { org : String, repo : String } Pages.Org_.Repo_.Schedules.Model | Org_Repo_SchedulesAdd { org : String, repo : String } Pages.Org_.Repo_.Schedules.Add.Model | Org_Repo_SchedulesEdit_ { org : String, repo : String, name : String } Pages.Org_.Repo_.Schedules.Edit_.Model - | Org_Repo_Audit { org : String, repo : String } Pages.Org_.Repo_.Audit.Model + | Org_Repo_Hooks { org : String, repo : String } Pages.Org_.Repo_.Hooks.Model | Org_Repo_Settings { org : String, repo : String } Pages.Org_.Repo_.Settings.Model | Org_Repo_Build_ { org : String, repo : String, buildNumber : String } Pages.Org_.Repo_.Build_.Model | Org_Repo_Build_Services { org : String, repo : String, buildNumber : String } Pages.Org_.Repo_.Build_.Services.Model diff --git a/src/elm/Main/Pages/Msg.elm b/src/elm/Main/Pages/Msg.elm index 4ad904729..23ea4df78 100644 --- a/src/elm/Main/Pages/Msg.elm +++ b/src/elm/Main/Pages/Msg.elm @@ -13,13 +13,13 @@ import Pages.NotFound_ import Pages.Org_ import Pages.Org_.Builds import Pages.Org_.Repo_ -import Pages.Org_.Repo_.Audit import Pages.Org_.Repo_.Build_ import Pages.Org_.Repo_.Build_.Graph import Pages.Org_.Repo_.Build_.Pipeline import Pages.Org_.Repo_.Build_.Services import Pages.Org_.Repo_.Deployments import Pages.Org_.Repo_.Deployments.Add +import Pages.Org_.Repo_.Hooks import Pages.Org_.Repo_.Schedules import Pages.Org_.Repo_.Schedules.Add import Pages.Org_.Repo_.Schedules.Edit_ @@ -48,7 +48,7 @@ type Msg | Org_Repo_Schedules Pages.Org_.Repo_.Schedules.Msg | Org_Repo_SchedulesAdd Pages.Org_.Repo_.Schedules.Add.Msg | Org_Repo_SchedulesEdit_ Pages.Org_.Repo_.Schedules.Edit_.Msg - | Org_Repo_Audit Pages.Org_.Repo_.Audit.Msg + | Org_Repo_Hooks Pages.Org_.Repo_.Hooks.Msg | Org_Repo_Settings Pages.Org_.Repo_.Settings.Msg | Org_Repo_Build_ Pages.Org_.Repo_.Build_.Msg | Org_Repo_Build_Services Pages.Org_.Repo_.Build_.Services.Msg diff --git a/src/elm/Pages/Account/Settings.elm b/src/elm/Pages/Account/Settings.elm index 3eeb457c7..e78bbfbb7 100644 --- a/src/elm/Pages/Account/Settings.elm +++ b/src/elm/Pages/Account/Settings.elm @@ -110,7 +110,7 @@ update msg model = -- ALERTS AddAlertCopiedToClipboard contentCopied -> ( model - , Effect.addAlertSuccess { content = contentCopied, addToastIfUnique = False } + , Effect.addAlertSuccess { content = "'" ++ contentCopied ++ "' copied to clipboard.", addToastIfUnique = False } ) diff --git a/src/elm/Pages/Org_.elm b/src/elm/Pages/Org_.elm index a9b0757e2..b6eaf81c8 100644 --- a/src/elm/Pages/Org_.elm +++ b/src/elm/Pages/Org_.elm @@ -175,7 +175,7 @@ subscriptions model = view : Shared.Model -> Route { org : String } -> Model -> View Msg view shared route model = - { title = "Repos" + { title = "Repos" ++ Util.pageToString (Dict.get "page" route.query) , body = [ Html.caption [ class "builds-caption" diff --git a/src/elm/Pages/Org_/Builds.elm b/src/elm/Pages/Org_/Builds.elm index f5c1dbea8..6212fa208 100644 --- a/src/elm/Pages/Org_/Builds.elm +++ b/src/elm/Pages/Org_/Builds.elm @@ -279,7 +279,7 @@ view shared route model = , showHideActionsMenus = ShowHideActionsMenus } in - { title = "Builds" + { title = "Builds" ++ Util.pageToString (Dict.get "page" route.query) , body = [ caption [ class "builds-caption" diff --git a/src/elm/Pages/Org_/Repo_.elm b/src/elm/Pages/Org_/Repo_.elm index 8b26250f6..75a079789 100644 --- a/src/elm/Pages/Org_/Repo_.elm +++ b/src/elm/Pages/Org_/Repo_.elm @@ -54,7 +54,12 @@ toLayout user route model = Layouts.Default_Repo { navButtons = [] , utilButtons = [] - , helpCommands = [] + , helpCommands = + [ { name = "List Builds" + , content = "vela get builds --help" + , docs = Just "builds/get" + } + ] , crumbs = [ ( "Overview", Just Route.Path.Home ) , ( route.params.org, Just <| Route.Path.Org_ { org = route.params.org } ) @@ -318,7 +323,7 @@ view shared route model = , showHideActionsMenus = ShowHideActionsMenus } in - { title = "Builds" + { title = "Builds" ++ Util.pageToString (Dict.get "page" route.query) , body = [ caption [ class "builds-caption" diff --git a/src/elm/Pages/Org_/Repo_/Build_.elm b/src/elm/Pages/Org_/Repo_/Build_.elm index 1a1b3178b..273c973ba 100644 --- a/src/elm/Pages/Org_/Repo_/Build_.elm +++ b/src/elm/Pages/Org_/Repo_/Build_.elm @@ -494,14 +494,13 @@ view shared route model = ] , div [ class "steps" ] [ div [ class "-items", Util.testAttribute "steps" ] <| - List.map (viewStep shared model route) <| - List.sortBy .number <| - RemoteData.withDefault [] model.steps - - -- if hasStages steps then - -- viewStages model msgs rm steps - -- else - -- List.map viewStep<| steps + if hasStages steps then + viewStages shared model route steps + + else + List.map (viewStep shared model route) <| + List.sortBy .number <| + RemoteData.withDefault [] model.steps ] ] @@ -514,6 +513,36 @@ view shared route model = } +{-| viewStages : takes model and build model and renders steps grouped by stages +-} +viewStages : Shared.Model -> Model -> Route { org : String, repo : String, buildNumber : String } -> List Vela.Step -> List (Html Msg) +viewStages shared model route steps = + steps + |> List.map .stage + |> List.Extra.unique + |> List.map + (\stage -> + steps + |> List.filter + (\step -> + (stage == "init" && (step.stage == "init" || step.stage == "clone")) + || (stage /= "clone" && step.stage == stage) + ) + |> viewStage shared model route stage + ) + + +viewStage : Shared.Model -> Model -> Route { org : String, repo : String, buildNumber : String } -> String -> List Vela.Step -> Html Msg +viewStage shared model route stage steps = + div + [ class "stage", Util.testAttribute <| "stage" ] + [ viewStageDivider stage + , steps + |> List.map (\step -> viewStep shared model route step) + |> div [ Util.testAttribute <| "stage-" ++ stage ] + ] + + viewStep : Shared.Model -> Model -> Route { org : String, repo : String, buildNumber : String } -> Vela.Step -> Html Msg viewStep shared model route step = div @@ -564,6 +593,29 @@ viewStep shared model route step = ] +{-| viewStageDivider : renders divider between stage +-} +viewStageDivider : String -> Html msg +viewStageDivider stage = + if stage /= "init" && stage /= "clone" then + div [ class "divider", Util.testAttribute <| "stage-divider-" ++ stage ] + [ div [] [ text stage ] ] + + else + text "" + + +{-| hasStages : takes steps and returns true if the pipeline contain stages +-} +hasStages : List Vela.Step -> Bool +hasStages steps = + steps + |> List.filter (\s -> s.stage /= "") + |> List.head + |> Maybe.Extra.unwrap "" .stage + |> (\stage -> stage /= "") + + viewLogs : Shared.Model -> Model -> Route { org : String, repo : String, buildNumber : String } -> Vela.Step -> WebData Vela.Log -> Html Msg viewLogs shared model route step log = case step.status of diff --git a/src/elm/Pages/Org_/Repo_/Deployments.elm b/src/elm/Pages/Org_/Repo_/Deployments.elm index 4878e8cd6..0f7c9d3b4 100644 --- a/src/elm/Pages/Org_/Repo_/Deployments.elm +++ b/src/elm/Pages/Org_/Repo_/Deployments.elm @@ -78,7 +78,7 @@ toLayout user route model = ] , helpCommands = [ { name = "List Deployments" - , content = "vela view deployments --help" + , content = "vela get deployments --help" , docs = Just "deployment/get" } , { name = "Add Deployment" @@ -228,7 +228,7 @@ subscriptions model = view : Shared.Model -> Route { org : String, repo : String } -> Model -> View Msg view shared route model = - { title = "Deployments" + { title = "Deployments" ++ Util.pageToString (Dict.get "page" route.query) , body = [ viewDeployments shared model route , Components.Pager.view model.pager Components.Pager.defaultLabels GotoPage @@ -305,7 +305,7 @@ deploymentsToRows shared repo deployments = -} tableHeaders : Components.Table.Columns tableHeaders = - [ ( Just "table-icon", "" ) + [ ( Just "table-icon", "status" ) , ( Nothing, "number" ) , ( Nothing, "target" ) , ( Nothing, "commit" ) @@ -314,7 +314,7 @@ tableHeaders = , ( Nothing, "builds" ) , ( Nothing, "created by" ) , ( Nothing, "created at" ) - , ( Nothing, "" ) + , ( Nothing, "redeploy" ) ] diff --git a/src/elm/Pages/Org_/Repo_/Deployments/Add.elm b/src/elm/Pages/Org_/Repo_/Deployments/Add.elm index d395024a7..425191283 100644 --- a/src/elm/Pages/Org_/Repo_/Deployments/Add.elm +++ b/src/elm/Pages/Org_/Repo_/Deployments/Add.elm @@ -9,7 +9,7 @@ import Auth import Components.Form import Dict import Effect exposing (Effect) -import Html exposing (Html, button, code, div, em, h2, label, p, section, span, strong, text) +import Html exposing (button, code, div, em, h2, label, p, section, span, strong, text) import Html.Attributes exposing (class, disabled, for, id) import Html.Events exposing (onClick) import Http @@ -344,7 +344,86 @@ view shared route model = , wrap_ = Just "soft" , msg = TaskOnInput } - , viewParametersInput model + , section [] + [ div + [ id "parameter-select" + , class "form-control" + , class "-stack" + , class "parameters-container" + ] + [ label + [ for "parameter-select" + , class "form-label" + ] + [ strong [] [ text "Add Parameters" ] + , span + [ class "field-description" ] + [ em [] [ text "(Optional)" ] + ] + ] + , div [ class "parameters-inputs" ] + [ Components.Form.viewInput + { title = Nothing + , subtitle = Nothing + , id_ = "parameter-key" + , val = model.parameterKey + , placeholder_ = "key" + , classList_ = [ ( "parameter-input", True ) ] + , disabled_ = False + , rows_ = Just 2 + , wrap_ = Just "soft" + , msg = ParameterKeyOnInput + } + , Components.Form.viewInput + { title = Nothing + , subtitle = Nothing + , id_ = "parameter-value" + , val = model.parameterValue + , placeholder_ = "value" + , classList_ = [ ( "parameter-input", True ) ] + , disabled_ = False + , rows_ = Just 2 + , wrap_ = Just "soft" + , msg = ParameterValueOnInput + } + , button + [ class "button" + , class "-outline" + , class "add-parameter" + , onClick <| AddParameter + , Util.testAttribute "add-parameter-button" + , disabled <| String.length model.parameterKey == 0 || String.length model.parameterValue == 0 + ] + [ text "Add" + ] + ] + ] + , div [ class "parameters", Util.testAttribute "parameters-list" ] <| + if List.length model.parameters > 0 then + let + viewParameter parameter = + div [ class "parameter", class "chevron" ] + [ button + [ class "button" + , class "-outline" + , onClick <| RemoveParameter parameter + ] + [ text "remove" + ] + , div [ class "name" ] [ text (parameter.key ++ "=" ++ parameter.value) ] + ] + in + List.map viewParameter <| List.reverse model.parameters + + else + [ div [ class "no-parameters" ] + [ div + [ class "none" + ] + [ code [] [ text "no parameters defined" ] ] + ] + ] + ] , div [ class "help" ] [ text "Need help? Visit our " , Html.a @@ -369,88 +448,3 @@ view shared route model = ] ] } - - -viewParametersInput : Model -> Html Msg -viewParametersInput model = - section [] - [ div - [ id "parameter-select" - , class "form-control" - , class "-stack" - , class "parameters-container" - ] - [ label - [ for "parameter-select" - , class "form-label" - ] - [ strong [] [ text "Add Parameters" ] - , span - [ class "field-description" ] - [ em [] [ text "(Optional)" ] - ] - ] - , div [ class "parameters-inputs" ] - [ Components.Form.viewInput - { title = Nothing - , subtitle = Nothing - , id_ = "parameter-key" - , val = model.parameterKey - , placeholder_ = "key" - , classList_ = [ ( "parameter-input", True ) ] - , disabled_ = False - , rows_ = Just 2 - , wrap_ = Just "soft" - , msg = ParameterKeyOnInput - } - , Components.Form.viewInput - { title = Nothing - , subtitle = Nothing - , id_ = "parameter-value" - , val = model.parameterValue - , placeholder_ = "value" - , classList_ = [ ( "parameter-input", True ) ] - , disabled_ = False - , rows_ = Just 2 - , wrap_ = Just "soft" - , msg = ParameterValueOnInput - } - , button - [ class "button" - , class "-outline" - , class "add-parameter" - , onClick <| AddParameter - , Util.testAttribute "add-parameter-button" - , disabled <| String.length model.parameterKey == 0 || String.length model.parameterValue == 0 - ] - [ text "Add" - ] - ] - ] - , div [ class "parameters", Util.testAttribute "parameters-list" ] <| - if List.length model.parameters > 0 then - List.map viewParameter <| List.reverse model.parameters - - else - [ div [ class "no-parameters" ] - [ div - [ class "none" - ] - [ code [] [ text "no parameters defined" ] ] - ] - ] - ] - - -viewParameter : Vela.KeyValuePair -> Html Msg -viewParameter parameter = - div [ class "parameter", class "chevron" ] - [ button - [ class "button" - , class "-outline" - , onClick <| RemoveParameter parameter - ] - [ text "remove" - ] - , div [ class "name" ] [ text (parameter.key ++ "=" ++ parameter.value) ] - ] diff --git a/src/elm/Pages/Org_/Repo_/Audit.elm b/src/elm/Pages/Org_/Repo_/Hooks.elm similarity index 97% rename from src/elm/Pages/Org_/Repo_/Audit.elm rename to src/elm/Pages/Org_/Repo_/Hooks.elm index 4b6b3ad6d..61bd2d8f9 100644 --- a/src/elm/Pages/Org_/Repo_/Audit.elm +++ b/src/elm/Pages/Org_/Repo_/Hooks.elm @@ -3,7 +3,7 @@ SPDX-License-Identifier: Apache-2.0 --} -module Pages.Org_.Repo_.Audit exposing (..) +module Pages.Org_.Repo_.Hooks exposing (..) import Ansi.Log import Api.Pagination @@ -45,6 +45,7 @@ import Route.Path import Shared import Time import Utils.Ansi +import Utils.Errors as Errors import Utils.Helpers as Util import Utils.Interval as Interval import Vela @@ -138,8 +139,8 @@ update shared route msg model = ) Err error -> - ( model - , Effect.none + ( { model | hooks = Errors.toFailure error } + , Effect.handleHttpError { httpError = error } ) RedeliverRepoHook options -> @@ -217,7 +218,7 @@ subscriptions model = view : Shared.Model -> Route { org : String, repo : String } -> Model -> View Msg view shared route model = - { title = "Audit" + { title = "Audit" ++ Util.pageToString (Dict.get "page" route.query) , body = [ viewHooks shared model model.hooks , Components.Pager.view model.pager Components.Pager.defaultLabels GotoPage @@ -287,7 +288,7 @@ hooksToRows now hooks redeliverHook = -} tableHeaders : Components.Table.Columns tableHeaders = - [ ( Just "table-icon", "" ) + [ ( Just "table-icon", "status" ) , ( Nothing, "source" ) , ( Nothing, "created" ) , ( Nothing, "host" ) diff --git a/src/elm/Pages/Org_/Repo_/Schedules.elm b/src/elm/Pages/Org_/Repo_/Schedules.elm index 74f0a83bd..168a22d66 100644 --- a/src/elm/Pages/Org_/Repo_/Schedules.elm +++ b/src/elm/Pages/Org_/Repo_/Schedules.elm @@ -9,6 +9,7 @@ import Api.Pagination import Auth import Components.Loading import Components.Pager +import Components.ScheduleForm import Components.Table import Dict import Effect exposing (Effect) @@ -71,6 +72,7 @@ toLayout user route model = type alias Model = { schedules : WebData (List Vela.Schedule) , pager : List WebLink + , repoSchedulesAllowed : Bool } @@ -78,6 +80,7 @@ init : Shared.Model -> Route { org : String, repo : String } -> () -> ( Model, E init shared route () = ( { schedules = RemoteData.Loading , pager = [] + , repoSchedulesAllowed = Util.checkScheduleAllowlist route.params.org route.params.repo shared.velaScheduleAllowlist } , Effect.batch [ Effect.getRepoSchedules @@ -175,7 +178,7 @@ subscriptions model = view : Shared.Model -> Route { org : String, repo : String } -> Model -> View Msg view shared route model = - { title = "Schedules" + { title = "Schedules" ++ Util.pageToString (Dict.get "page" route.query) , body = [ viewRepoSchedules shared model route.params.org route.params.repo , Components.Pager.view model.pager Components.Pager.defaultLabels GotoPage @@ -188,11 +191,8 @@ view shared route model = viewRepoSchedules : Shared.Model -> Model -> String -> String -> Html Msg viewRepoSchedules shared model org repo = let - schedulesAllowed = - Util.checkScheduleAllowlist org repo shared.velaScheduleAllowlist - actions = - if schedulesAllowed then + if model.repoSchedulesAllowed then Just <| div [ class "buttons" ] [ a @@ -218,7 +218,7 @@ viewRepoSchedules shared model org repo = Nothing ( noRowsView, rows ) = - if schedulesAllowed then + if model.repoSchedulesAllowed then case model.schedules of RemoteData.Success s -> ( text "No schedules found for this repo" @@ -247,7 +247,7 @@ viewRepoSchedules shared model org repo = ( Components.Loading.viewSmallLoader, [] ) else - ( viewSchedulesNotAllowedSpan + ( Components.ScheduleForm.viewSchedulesNotAllowedWarning , [] ) @@ -359,12 +359,3 @@ viewSchedule zone org repo schedule = addKey : Vela.Schedule -> Vela.Schedule addKey schedule = { schedule | org = schedule.org ++ "/" ++ schedule.repo ++ "/" ++ schedule.name } - - -{-| viewSchedulesNotAllowedSpan : renders a warning that schedules have not been enabled for the current repository. --} -viewSchedulesNotAllowedSpan : Html msg -viewSchedulesNotAllowedSpan = - span [ class "not-allowed", Util.testAttribute "repo-schedule-not-allowed" ] - [ text "Sorry, Administrators have not enabled Schedules for this repository." - ] diff --git a/src/elm/Pages/Org_/Repo_/Schedules/Add.elm b/src/elm/Pages/Org_/Repo_/Schedules/Add.elm index b7b20342e..00cf31d8a 100644 --- a/src/elm/Pages/Org_/Repo_/Schedules/Add.elm +++ b/src/elm/Pages/Org_/Repo_/Schedules/Add.elm @@ -27,7 +27,7 @@ import View exposing (View) page : Auth.User -> Shared.Model -> Route { org : String, repo : String } -> Page Model Msg page user shared route = Page.new - { init = init shared + { init = init shared route , update = update shared route , subscriptions = subscriptions , view = view shared route @@ -65,15 +65,17 @@ type alias Model = , entry : String , enabled : Bool , branch : String + , repoSchedulesAllowed : Bool } -init : Shared.Model -> () -> ( Model, Effect Msg ) -init shared () = +init : Shared.Model -> Route { org : String, repo : String } -> () -> ( Model, Effect Msg ) +init shared route () = ( { name = "" , entry = "" , enabled = True , branch = "" + , repoSchedulesAllowed = Util.checkScheduleAllowlist route.params.org route.params.repo shared.velaScheduleAllowlist } , Effect.none ) @@ -176,11 +178,20 @@ subscriptions model = view : Shared.Model -> Route { org : String, repo : String } -> Model -> View Msg view shared route model = + let + formDisabled = + not model.repoSchedulesAllowed + in { title = "Add Schedule" , body = [ div [ class "manage-schedule", Util.testAttribute "manage-schedule" ] [ div [] [ h2 [] [ text <| String.Extra.toTitleCase <| "add repo schedule" ] + , if not model.repoSchedulesAllowed then + Components.ScheduleForm.viewSchedulesNotAllowedWarning + + else + text "" , div [ class "schedule-form" ] [ Components.Form.viewInput { title = Just "Name" @@ -192,24 +203,24 @@ view shared route model = , rows_ = Nothing , wrap_ = Nothing , msg = NameOnInput - , disabled_ = False + , disabled_ = formDisabled } , Components.Form.viewTextarea { title = Just "Cron Expression" , subtitle = Just <| Components.ScheduleForm.viewCronHelp shared.time - , id_ = "cron" + , id_ = "entry" , val = model.entry , placeholder_ = "0 0 * * * (runs at 12:00 AM in UTC)" , classList_ = [ ( "schedule-cron", True ) ] , rows_ = Just 2 , wrap_ = Just "soft" , msg = EntryOnInput - , disabled_ = False + , disabled_ = formDisabled } , Components.ScheduleForm.viewEnabledInput { msg = EnabledOnClick , value = model.enabled - , disabled_ = False + , disabled_ = formDisabled } , Components.Form.viewInput { title = Just "Branch" @@ -219,19 +230,22 @@ view shared route model = [ class "field-description" ] [ em [] [ text "(Leave blank to use default branch)" ] ] - , id_ = "branch" + , id_ = "branch-name" , val = model.branch , placeholder_ = "Branch Name" , classList_ = [ ( "branch-name", True ) ] , rows_ = Nothing , wrap_ = Nothing , msg = BranchOnInput - , disabled_ = False + , disabled_ = formDisabled } , Components.ScheduleForm.viewHelp shared.velaDocsURL - , Components.ScheduleForm.viewSubmitButton + , Components.Form.viewButton { msg = SubmitForm - , disabled_ = False + , id_ = "submit" + , text_ = "Submit" + , classList_ = [] + , disabled_ = formDisabled } ] ] diff --git a/src/elm/Pages/Org_/Repo_/Schedules/Edit_.elm b/src/elm/Pages/Org_/Repo_/Schedules/Edit_.elm index c989cc264..fe557184f 100644 --- a/src/elm/Pages/Org_/Repo_/Schedules/Edit_.elm +++ b/src/elm/Pages/Org_/Repo_/Schedules/Edit_.elm @@ -76,6 +76,7 @@ type alias Model = , enabled : Bool , branch : String , confirmingDelete : Bool + , repoSchedulesAllowed : Bool } @@ -87,15 +88,20 @@ init shared route () = , enabled = True , branch = "" , confirmingDelete = False + , repoSchedulesAllowed = Util.checkScheduleAllowlist route.params.org route.params.repo shared.velaScheduleAllowlist } - , Effect.getRepoSchedule - { baseUrl = shared.velaAPIBaseURL - , session = shared.session - , onResponse = GetRepoScheduleResponse - , org = route.params.org - , repo = route.params.repo - , name = route.params.name - } + , if Util.checkScheduleAllowlist route.params.org route.params.repo shared.velaScheduleAllowlist then + Effect.getRepoSchedule + { baseUrl = shared.velaAPIBaseURL + , session = shared.session + , onResponse = GetRepoScheduleResponse + , org = route.params.org + , repo = route.params.repo + , name = route.params.name + } + + else + Effect.none ) @@ -263,18 +269,35 @@ subscriptions model = view : Shared.Model -> Route { org : String, repo : String, name : String } -> Model -> View Msg view shared route model = + let + schedulesAllowed = + Util.checkScheduleAllowlist route.params.org route.params.repo shared.velaScheduleAllowlist + + formDisabled = + not schedulesAllowed || (not <| RemoteData.isSuccess model.schedule) + in { title = "Add Schedule" , body = [ div [ class "manage-schedule", Util.testAttribute "manage-schedule" ] [ div [] [ h2 [] [ text <| String.Extra.toTitleCase <| "update repo schedule" ] + , if not model.repoSchedulesAllowed then + Components.ScheduleForm.viewSchedulesNotAllowedWarning + + else + text "" , div [ class "schedule-form" ] [ Components.Form.viewInput { title = Just "Name" , subtitle = Nothing , id_ = "name" , val = RemoteData.unwrap "" .name model.schedule - , placeholder_ = "loading..." + , placeholder_ = + if model.repoSchedulesAllowed then + "loading..." + + else + "Schedule Name" , classList_ = [ ( "schedule-name", True ) ] , rows_ = Nothing , wrap_ = Nothing @@ -284,19 +307,19 @@ view shared route model = , Components.Form.viewTextarea { title = Just "Cron Expression" , subtitle = Just <| Components.ScheduleForm.viewCronHelp shared.time - , id_ = "cron" + , id_ = "entry" , val = model.entry , placeholder_ = "0 0 * * * (runs at 12:00 AM in UTC)" , classList_ = [ ( "schedule-cron", True ) ] , rows_ = Just 2 , wrap_ = Just "soft" , msg = EntryOnInput - , disabled_ = not <| RemoteData.isSuccess model.schedule + , disabled_ = formDisabled } , Components.ScheduleForm.viewEnabledInput { msg = EnabledOnClick , value = model.enabled - , disabled_ = not <| RemoteData.isSuccess model.schedule + , disabled_ = formDisabled } , Components.Form.viewInput { title = Just "Branch" @@ -306,14 +329,14 @@ view shared route model = [ class "field-description" ] [ em [] [ text "(Leave blank to use default branch)" ] ] - , id_ = "branch" + , id_ = "branch-name" , val = model.branch , placeholder_ = "Branch Name" , classList_ = [ ( "branch-name", True ) ] , rows_ = Nothing , wrap_ = Nothing , msg = BranchOnInput - , disabled_ = not <| RemoteData.isSuccess model.schedule + , disabled_ = formDisabled } , Components.ScheduleForm.viewHelp shared.velaDocsURL , div [ class "buttons" ] @@ -321,14 +344,16 @@ view shared route model = { msg = SubmitForm , text_ = "Submit" , classList_ = [] - , disabled_ = not <| RemoteData.isSuccess model.schedule + , disabled_ = formDisabled + , id_ = "submit" } , if not model.confirmingDelete then Components.Form.viewButton { msg = ClickDelete , text_ = "Delete" , classList_ = [] - , disabled_ = not <| RemoteData.isSuccess model.schedule + , disabled_ = formDisabled + , id_ = "delete" } else @@ -336,14 +361,16 @@ view shared route model = { msg = CancelDelete , text_ = "Cancel" , classList_ = [] - , disabled_ = not <| RemoteData.isSuccess model.schedule + , disabled_ = formDisabled + , id_ = "delete-cancel" } , if model.confirmingDelete then Components.Form.viewButton { msg = ConfirmDelete , text_ = "Confirm" , classList_ = [ ( "-secret-delete-confirm", True ) ] - , disabled_ = not <| RemoteData.isSuccess model.schedule + , disabled_ = formDisabled + , id_ = "delete-confirm" } else diff --git a/src/elm/Pages/Org_/Repo_/Settings.elm b/src/elm/Pages/Org_/Repo_/Settings.elm index 7606634af..4148036cf 100644 --- a/src/elm/Pages/Org_/Repo_/Settings.elm +++ b/src/elm/Pages/Org_/Repo_/Settings.elm @@ -102,7 +102,7 @@ type Msg | DisableRepo { repo : Vela.Repository } | DisableRepoResponse { repo : Vela.Repository } (Result (Http.Detailed.Error String) ( Http.Metadata, String )) | RepairRepo { repo : Vela.Repository } - | RepairRepoResponse (Result (Http.Detailed.Error String) ( Http.Metadata, String )) + | RepairRepoResponse { repo : Vela.Repository } (Result (Http.Detailed.Error String) ( Http.Metadata, String )) | ChownRepo { repo : Vela.Repository } | ChownRepoResponse (Result (Http.Detailed.Error String) ( Http.Metadata, String )) | AllowEventsUpdate { allowEvents : Vela.AllowEvents, event : String } Bool @@ -356,13 +356,13 @@ update shared route msg model = , Effect.repairRepo { baseUrl = shared.velaAPIBaseURL , session = shared.session - , onResponse = RepairRepoResponse + , onResponse = RepairRepoResponse options , org = route.params.org , repo = route.params.repo } ) - RepairRepoResponse response -> + RepairRepoResponse options response -> case response of Ok ( _, result ) -> ( model @@ -584,7 +584,7 @@ update shared route msg model = -- ALERTS AddAlertCopiedToClipboard contentCopied -> ( model - , Effect.addAlertSuccess { content = contentCopied, addToastIfUnique = False } + , Effect.addAlertSuccess { content = "'" ++ contentCopied ++ "' copied to clipboard.", addToastIfUnique = False } ) -- REFRESH @@ -666,6 +666,7 @@ viewAccess repo msg = , field = "private" , msg = msg "private" , disabled_ = False + , id_ = "access-private" } , Components.Form.viewRadio { title = "Any" @@ -674,6 +675,7 @@ viewAccess repo msg = , field = "public" , msg = msg "public" , disabled_ = False + , id_ = "access-public" } ] ] @@ -694,6 +696,7 @@ viewForkPolicy repo msg = , field = "fork-always" , msg = msg "fork-always" , disabled_ = False + , id_ = "fork-policy-always" } , Components.Form.viewRadio { title = "Require Admin Approval When Contributor Is Read Only" @@ -702,6 +705,7 @@ viewForkPolicy repo msg = , field = "fork-no-write" , msg = msg "fork-no-write" , disabled_ = False + , id_ = "fork-no-write" } , Components.Form.viewRadio { title = "Never Require Admin Approval" @@ -710,6 +714,7 @@ viewForkPolicy repo msg = , field = "never" , msg = msg "never" , disabled_ = False + , id_ = "fork-policy-never" } ] ] @@ -1100,7 +1105,6 @@ viewEnableButton disableRepoMsg enableRepoMsg repo = , baseTestAttribute , class "repo-disable-confirm" , onClick disableRepoMsg - , class "-secret-delete-confirm" ] [ text "Really Disable?" ] @@ -1177,6 +1181,7 @@ viewPipelineType repo msg = , subtitle = Nothing , msg = msg "yaml" , disabled_ = False + , id_ = "type-yaml" } , Components.Form.viewRadio { value = repo.pipeline_type @@ -1185,6 +1190,7 @@ viewPipelineType repo msg = , subtitle = Nothing , msg = msg "go" , disabled_ = False + , id_ = "type-go" } , Components.Form.viewRadio { value = repo.pipeline_type @@ -1193,6 +1199,7 @@ viewPipelineType repo msg = , subtitle = Nothing , msg = msg "starlark" , disabled_ = False + , id_ = "type-starlark" } ] ] diff --git a/src/elm/Pages/Secrets/Engine_/Org/Org_.elm b/src/elm/Pages/Secrets/Engine_/Org/Org_.elm index cd3f83eeb..cb6e4f7d7 100644 --- a/src/elm/Pages/Secrets/Engine_/Org/Org_.elm +++ b/src/elm/Pages/Secrets/Engine_/Org/Org_.elm @@ -174,7 +174,7 @@ update shared route msg model = -- ALERTS AddAlertCopiedToClipboard contentCopied -> ( model - , Effect.addAlertSuccess { content = contentCopied, addToastIfUnique = False } + , Effect.addAlertSuccess { content = "'" ++ contentCopied ++ "' copied to clipboard.", addToastIfUnique = False } ) -- REFRESH @@ -219,7 +219,7 @@ subscriptions model = view : Shared.Model -> Route { engine : String, org : String } -> Model -> View Msg view shared route model = - { title = "Secrets" + { title = "Secrets" ++ Util.pageToString (Dict.get "page" route.query) , body = [ Components.Secrets.viewOrgSecrets shared { msgs = diff --git a/src/elm/Pages/Secrets/Engine_/Org/Org_/Add.elm b/src/elm/Pages/Secrets/Engine_/Org/Org_/Add.elm index f9ad19304..71503062c 100644 --- a/src/elm/Pages/Secrets/Engine_/Org/Org_/Add.elm +++ b/src/elm/Pages/Secrets/Engine_/Org/Org_/Add.elm @@ -49,7 +49,7 @@ toLayout user route model = , crumbs = [ ( "Overview", Just Route.Path.Home ) , ( route.params.org, Just <| Route.Path.Org_ { org = route.params.org } ) - , ( "Secrets", Just <| Route.Path.SecretsEngine_OrgOrg_ { org = route.params.org, engine = route.params.engine } ) + , ( "Org Secrets", Just <| Route.Path.SecretsEngine_OrgOrg_ { org = route.params.org, engine = route.params.engine } ) , ( "Add", Nothing ) ] , repo = Nothing @@ -265,6 +265,7 @@ view shared route model = , text_ = "Submit" , classList_ = [] , disabled_ = False + , id_ = "submit" } ] ] diff --git a/src/elm/Pages/Secrets/Engine_/Org/Org_/Edit_.elm b/src/elm/Pages/Secrets/Engine_/Org/Org_/Edit_.elm index 25b06381e..1cd39e3eb 100644 --- a/src/elm/Pages/Secrets/Engine_/Org/Org_/Edit_.elm +++ b/src/elm/Pages/Secrets/Engine_/Org/Org_/Edit_.elm @@ -50,7 +50,7 @@ toLayout user route model = , crumbs = [ ( "Overview", Just Route.Path.Home ) , ( route.params.org, Just <| Route.Path.Org_ { org = route.params.org } ) - , ( "Secrets", Just <| Route.Path.SecretsEngine_OrgOrg_ { org = route.params.org, engine = route.params.engine } ) + , ( "Org Secrets", Just <| Route.Path.SecretsEngine_OrgOrg_ { org = route.params.org, engine = route.params.engine } ) , ( "Edit", Nothing ) , ( route.params.name, Nothing ) ] @@ -347,6 +347,7 @@ view shared route model = , text_ = "Submit" , classList_ = [] , disabled_ = not <| RemoteData.isSuccess model.secret + , id_ = "submit" } , if not model.confirmingDelete then Components.Form.viewButton @@ -354,6 +355,7 @@ view shared route model = , text_ = "Delete" , classList_ = [] , disabled_ = not <| RemoteData.isSuccess model.secret + , id_ = "delete" } else @@ -362,6 +364,7 @@ view shared route model = , text_ = "Cancel" , classList_ = [] , disabled_ = not <| RemoteData.isSuccess model.secret + , id_ = "delete-cancel" } , if model.confirmingDelete then Components.Form.viewButton @@ -369,6 +372,7 @@ view shared route model = , text_ = "Confirm" , classList_ = [ ( "-secret-delete-confirm", True ) ] , disabled_ = not <| RemoteData.isSuccess model.secret + , id_ = "delete-confirm" } else diff --git a/src/elm/Pages/Secrets/Engine_/Repo/Org_/Repo_.elm b/src/elm/Pages/Secrets/Engine_/Repo/Org_/Repo_.elm index 49b2982d8..422761663 100644 --- a/src/elm/Pages/Secrets/Engine_/Repo/Org_/Repo_.elm +++ b/src/elm/Pages/Secrets/Engine_/Repo/Org_/Repo_.elm @@ -177,7 +177,7 @@ update shared route msg model = -- ALERTS AddAlertCopiedToClipboard contentCopied -> ( model - , Effect.addAlertSuccess { content = contentCopied, addToastIfUnique = False } + , Effect.addAlertSuccess { content = "'" ++ contentCopied ++ "' copied to clipboard.", addToastIfUnique = False } ) -- REFRESH @@ -222,7 +222,7 @@ subscriptions model = view : Shared.Model -> Route { engine : String, org : String, repo : String } -> Model -> View Msg view shared route model = - { title = "Secrets" + { title = "Secrets" ++ Util.pageToString (Dict.get "page" route.query) , body = [ Components.Secrets.viewRepoSecrets shared { msgs = diff --git a/src/elm/Pages/Secrets/Engine_/Repo/Org_/Repo_/Add.elm b/src/elm/Pages/Secrets/Engine_/Repo/Org_/Repo_/Add.elm index 92257bf2c..b62d332fa 100644 --- a/src/elm/Pages/Secrets/Engine_/Repo/Org_/Repo_/Add.elm +++ b/src/elm/Pages/Secrets/Engine_/Repo/Org_/Repo_/Add.elm @@ -50,7 +50,7 @@ toLayout user route model = [ ( "Overview", Just Route.Path.Home ) , ( route.params.org, Just <| Route.Path.Org_ { org = route.params.org } ) , ( route.params.repo, Just <| Route.Path.Org_Repo_ { org = route.params.org, repo = route.params.repo } ) - , ( "Secrets", Just <| Route.Path.SecretsEngine_RepoOrg_Repo_ { org = route.params.org, repo = route.params.repo, engine = route.params.engine } ) + , ( "Repo Secrets", Just <| Route.Path.SecretsEngine_RepoOrg_Repo_ { org = route.params.org, repo = route.params.repo, engine = route.params.engine } ) , ( "Add", Nothing ) ] , repo = Nothing @@ -267,6 +267,7 @@ view shared route model = , text_ = "Submit" , classList_ = [] , disabled_ = False + , id_ = "submit" } ] ] diff --git a/src/elm/Pages/Secrets/Engine_/Repo/Org_/Repo_/Edit_.elm b/src/elm/Pages/Secrets/Engine_/Repo/Org_/Repo_/Edit_.elm index eb6edc42f..6674847f3 100644 --- a/src/elm/Pages/Secrets/Engine_/Repo/Org_/Repo_/Edit_.elm +++ b/src/elm/Pages/Secrets/Engine_/Repo/Org_/Repo_/Edit_.elm @@ -51,7 +51,7 @@ toLayout user route model = [ ( "Overview", Just Route.Path.Home ) , ( route.params.org, Just <| Route.Path.Org_ { org = route.params.org } ) , ( route.params.repo, Just <| Route.Path.Org_Repo_ { org = route.params.org, repo = route.params.repo } ) - , ( "Secrets", Just <| Route.Path.SecretsEngine_RepoOrg_Repo_ { org = route.params.org, repo = route.params.repo, engine = route.params.engine } ) + , ( "Repo Secrets", Just <| Route.Path.SecretsEngine_RepoOrg_Repo_ { org = route.params.org, repo = route.params.repo, engine = route.params.engine } ) , ( "Edit", Nothing ) , ( route.params.name, Nothing ) ] @@ -350,6 +350,7 @@ view shared route model = , text_ = "Submit" , classList_ = [] , disabled_ = not <| RemoteData.isSuccess model.secret + , id_ = "submit" } , if not model.confirmingDelete then Components.Form.viewButton @@ -357,6 +358,7 @@ view shared route model = , text_ = "Delete" , classList_ = [] , disabled_ = not <| RemoteData.isSuccess model.secret + , id_ = "delete" } else @@ -365,6 +367,7 @@ view shared route model = , text_ = "Cancel" , classList_ = [] , disabled_ = not <| RemoteData.isSuccess model.secret + , id_ = "delete-cancel" } , if model.confirmingDelete then Components.Form.viewButton @@ -372,6 +375,7 @@ view shared route model = , text_ = "Confirm" , classList_ = [ ( "-secret-delete-confirm", True ) ] , disabled_ = not <| RemoteData.isSuccess model.secret + , id_ = "delete-confirm" } else diff --git a/src/elm/Pages/Secrets/Engine_/Shared/Org_/Team_.elm b/src/elm/Pages/Secrets/Engine_/Shared/Org_/Team_.elm index 5848d047a..e818019f2 100644 --- a/src/elm/Pages/Secrets/Engine_/Shared/Org_/Team_.elm +++ b/src/elm/Pages/Secrets/Engine_/Shared/Org_/Team_.elm @@ -149,7 +149,7 @@ update shared route msg model = -- ALERTS AddAlertCopiedToClipboard contentCopied -> ( model - , Effect.addAlertSuccess { content = contentCopied, addToastIfUnique = False } + , Effect.addAlertSuccess { content = "'" ++ contentCopied ++ "' copied to clipboard.", addToastIfUnique = False } ) -- REFRESH @@ -183,7 +183,7 @@ subscriptions model = view : Shared.Model -> Route { engine : String, org : String, team : String } -> Model -> View Msg view shared route model = - { title = "Secrets" + { title = "Secrets" ++ Util.pageToString (Dict.get "page" route.query) , body = [ Components.Secrets.viewSharedSecrets shared { msgs = diff --git a/src/elm/Pages/Secrets/Engine_/Shared/Org_/Team_/Add.elm b/src/elm/Pages/Secrets/Engine_/Shared/Org_/Team_/Add.elm index 059a5e551..4e524c501 100644 --- a/src/elm/Pages/Secrets/Engine_/Shared/Org_/Team_/Add.elm +++ b/src/elm/Pages/Secrets/Engine_/Shared/Org_/Team_/Add.elm @@ -51,7 +51,7 @@ toLayout user route model = [ ( "Overview", Just Route.Path.Home ) , ( route.params.org, Just <| Route.Path.Org_ { org = route.params.org } ) , ( route.params.team, Nothing ) - , ( "Secrets", Just <| Route.Path.SecretsEngine_SharedOrg_Team_ { engine = route.params.engine, org = route.params.org, team = route.params.team } ) + , ( "Shared Secrets", Just <| Route.Path.SecretsEngine_SharedOrg_Team_ { engine = route.params.engine, org = route.params.org, team = route.params.team } ) , ( "Add", Nothing ) ] , repo = Nothing @@ -293,6 +293,7 @@ view shared route model = , text_ = "Submit" , classList_ = [] , disabled_ = False + , id_ = "submit" } ] ] diff --git a/src/elm/Pages/Secrets/Engine_/Shared/Org_/Team_/Edit_.elm b/src/elm/Pages/Secrets/Engine_/Shared/Org_/Team_/Edit_.elm index c2a5e09eb..e3cd02aa9 100644 --- a/src/elm/Pages/Secrets/Engine_/Shared/Org_/Team_/Edit_.elm +++ b/src/elm/Pages/Secrets/Engine_/Shared/Org_/Team_/Edit_.elm @@ -51,7 +51,7 @@ toLayout user route model = [ ( "Overview", Just Route.Path.Home ) , ( route.params.org, Just <| Route.Path.Org_ { org = route.params.org } ) , ( route.params.team, Nothing ) - , ( "Secrets", Just <| Route.Path.SecretsEngine_SharedOrg_Team_ { engine = route.params.engine, org = route.params.org, team = route.params.team } ) + , ( "Shared Secrets", Just <| Route.Path.SecretsEngine_SharedOrg_Team_ { engine = route.params.engine, org = route.params.org, team = route.params.team } ) , ( "Edit", Nothing ) , ( route.params.name, Nothing ) ] @@ -350,6 +350,7 @@ view shared route model = , text_ = "Submit" , classList_ = [] , disabled_ = not <| RemoteData.isSuccess model.secret + , id_ = "submit" } , if not model.confirmingDelete then Components.Form.viewButton @@ -357,6 +358,7 @@ view shared route model = , text_ = "Delete" , classList_ = [] , disabled_ = not <| RemoteData.isSuccess model.secret + , id_ = "delete" } else @@ -365,6 +367,7 @@ view shared route model = , text_ = "Cancel" , classList_ = [] , disabled_ = not <| RemoteData.isSuccess model.secret + , id_ = "delete-cancel" } , if model.confirmingDelete then Components.Form.viewButton @@ -372,6 +375,7 @@ view shared route model = , text_ = "Confirm" , classList_ = [ ( "-secret-delete-confirm", True ) ] , disabled_ = not <| RemoteData.isSuccess model.secret + , id_ = "delete-confirm" } else diff --git a/src/elm/Route/Path.elm b/src/elm/Route/Path.elm index 96ba74d07..a5d0ca30a 100644 --- a/src/elm/Route/Path.elm +++ b/src/elm/Route/Path.elm @@ -22,12 +22,13 @@ type Path | Org_Builds { org : String } | Org_Repo_ { org : String, repo : String } | Org_Repo_Pulls { org : String, repo : String } + | Org_Repo_Tags { org : String, repo : String } | Org_Repo_Deployments { org : String, repo : String } | Org_Repo_DeploymentsAdd { org : String, repo : String } | Org_Repo_Schedules { org : String, repo : String } | Org_Repo_SchedulesAdd { org : String, repo : String } | Org_Repo_SchedulesEdit_ { org : String, repo : String, name : String } - | Org_Repo_Audit { org : String, repo : String } + | Org_Repo_Hooks { org : String, repo : String } | Org_Repo_Settings { org : String, repo : String } | Org_Repo_Build_ { org : String, repo : String, buildNumber : String } | Org_Repo_Build_Services { org : String, repo : String, buildNumber : String } @@ -134,8 +135,8 @@ fromString urlPath = } |> Just - org :: repo :: "audit" :: [] -> - Org_Repo_Audit + org :: repo :: "hooks" :: [] -> + Org_Repo_Hooks { org = org , repo = repo } @@ -155,6 +156,13 @@ fromString urlPath = } |> Just + org :: repo :: "tags" :: [] -> + Org_Repo_Tags + { org = org + , repo = repo + } + |> Just + org :: repo :: buildNumber :: [] -> Org_Repo_Build_ { org = org @@ -304,6 +312,9 @@ toString path = Org_Repo_Pulls params -> [ params.org, params.repo, "?event=pull_request" ] + Org_Repo_Tags params -> + [ params.org, params.repo, "?event=tag" ] + Org_Repo_Deployments params -> [ params.org, params.repo, "deployments" ] @@ -319,8 +330,8 @@ toString path = Org_Repo_SchedulesEdit_ params -> [ params.org, params.repo, "schedules", params.name ] - Org_Repo_Audit params -> - [ params.org, params.repo, "audit" ] + Org_Repo_Hooks params -> + [ params.org, params.repo, "hooks" ] Org_Repo_Settings params -> [ params.org, params.repo, "settings" ] diff --git a/src/elm/Utils/Helpers.elm b/src/elm/Utils/Helpers.elm index 3efd92da4..5366f15e1 100644 --- a/src/elm/Utils/Helpers.elm +++ b/src/elm/Utils/Helpers.elm @@ -532,18 +532,28 @@ base64Decode inStr = {-| pageToString : small helper to turn page number to a string to display in crumbs -} -pageToString : Maybe Int -> String +pageToString : Maybe String -> String pageToString maybePage = - case maybePage of - Nothing -> - "" + maybePage + |> Maybe.map String.toInt + |> Maybe.withDefault Nothing + |> Maybe.Extra.unwrap "" + (\num -> + if num > 1 then + " (page " ++ String.fromInt num ++ ")" - Just num -> - if num > 1 then - " (page " ++ String.fromInt num ++ ")" + else + "" + ) - else - "" + + +-- case Maybe.map String.toInt maybePage of +-- Nothing -> +-- "" +-- Just (Just num) -> +-- _ -> +-- "" {-| buildRefURL : drops '.git' off the clone url and concatenates tree + ref diff --git a/src/scss/_table.scss b/src/scss/_table.scss index ff7b6e729..2df4b7b91 100644 --- a/src/scss/_table.scss +++ b/src/scss/_table.scss @@ -99,7 +99,7 @@ td .key .list-item { } .table-base .source-id .list-item { - max-width: 22rem; + max-width: 24rem; } .table-base tr.-success {