diff --git a/src/elm/Alerts.elm b/src/elm/Alerts.elm index 9468ca54d..b1dc1f725 100644 --- a/src/elm/Alerts.elm +++ b/src/elm/Alerts.elm @@ -34,7 +34,6 @@ type alias Destination = type Alert = Success String String (Maybe Link) - | Warning String String | Error String String @@ -50,9 +49,6 @@ view copy toast = Success title message link -> wrapAlert "-success" title message link Nothing - Warning title message -> - wrapAlert "-warning" title message Nothing Nothing - Error title message -> wrapAlert "-error" title message Nothing <| Just copy diff --git a/src/elm/Api.elm b/src/elm/Api.elm index e0554f409..cb416cd71 100644 --- a/src/elm/Api.elm +++ b/src/elm/Api.elm @@ -14,7 +14,6 @@ module Api exposing , deleteSecret , enableRepository , expandPipelineConfig - , getAllRepositories , getAllSecrets , getAllServices , getAllSteps @@ -47,7 +46,7 @@ module Api exposing , updateSecret ) -import Api.Endpoint as Endpoint exposing (Endpoint(..)) +import Api.Endpoint as Endpoint exposing (Endpoint) import Api.Pagination as Pagination import Auth.Jwt exposing (JwtAccessToken, decodeJwtAccessToken) import Auth.Session exposing (Session(..)) @@ -443,18 +442,6 @@ updateCurrentUser model body = |> withAuth model.session -{-| getAllRepositories : used in conjuction with 'tryAll', it retrieves all pages of the resource - - Note: the singular version of the type/decoder is needed in this case as it turns it into a list - --} -getAllRepositories : PartialModel a -> Request Repository -getAllRepositories model = - -- we using the max perPage setting of 100 to reduce the number of calls - get model.velaAPI (Endpoint.Repositories (Just 1) (Just 100)) decodeRepository - |> withAuth model.session - - {-| getRepo : fetches single repo by org and repo name -} getRepo : PartialModel a -> Org -> Repo -> Request Repository diff --git a/src/elm/Crumbs.elm b/src/elm/Crumbs.elm index 1f240a5bd..979c679bb 100644 --- a/src/elm/Crumbs.elm +++ b/src/elm/Crumbs.elm @@ -8,8 +8,8 @@ module Crumbs exposing (view) import Html exposing (Html, a, li, ol, text) import Html.Attributes exposing (attribute) -import Pages exposing (Page(..), toRoute) -import Routes exposing (Route(..)) +import Pages exposing (Page, toRoute) +import Routes import Tuple exposing (first, second) import Url exposing (percentDecode) import Util exposing (pageToString) @@ -330,16 +330,10 @@ toPath page = Pages.Login -> [] - Pages.Logout -> - [] - Pages.Settings -> [ ( "Overview", Just Pages.Overview ), ( "My Settings", Nothing ) ] Pages.NotFound -> [ overviewPage, notFoundPage ] - - Pages.Authenticate -> - [] in pages diff --git a/src/elm/Errors.elm b/src/elm/Errors.elm index a00c57a88..1a229f929 100644 --- a/src/elm/Errors.elm +++ b/src/elm/Errors.elm @@ -7,7 +7,7 @@ Use of this source code is governed by the LICENSE file in this repository. module Errors exposing (Error, addError, addErrorString, detailedErrorToString, toFailure, viewResourceError) import Html exposing (Html, div, p, text) -import Http exposing (Error(..)) +import Http import Http.Detailed import Json.Decode as Decode import RemoteData exposing (RemoteData(..), WebData) diff --git a/src/elm/Help/Commands.elm b/src/elm/Help/Commands.elm index 1b4f817f5..26d30e5c0 100644 --- a/src/elm/Help/Commands.elm +++ b/src/elm/Help/Commands.elm @@ -17,7 +17,7 @@ module Help.Commands exposing , usageDocsUrl ) -import Pages exposing (Page(..)) +import Pages exposing (Page) import String.Extra import Util exposing (anyBlank, noBlanks) import Vela @@ -29,7 +29,7 @@ import Vela , Name , Org , Repo - , SecretType(..) + , SecretType , StepNumber , secretTypeToString ) @@ -153,15 +153,9 @@ commands page = Pages.Settings -> [] - Pages.Authenticate -> - [] - Pages.Login -> [ authenticate ] - Pages.Logout -> - [] - Pages.NotFound -> [] @@ -849,12 +843,6 @@ resourceLoaded args = Pages.Login -> True - Pages.Logout -> - True - - Pages.Authenticate -> - True - Pages.NotFound -> False @@ -939,11 +927,5 @@ resourceLoading args = Pages.Login -> False - Pages.Logout -> - True - - Pages.Authenticate -> - True - Pages.NotFound -> False diff --git a/src/elm/Help/View.elm b/src/elm/Help/View.elm index bfb26d91f..2df29462f 100644 --- a/src/elm/Help/View.elm +++ b/src/elm/Help/View.elm @@ -21,7 +21,6 @@ import Help.Commands import Html exposing (Html, a, button, details, div, label, li, span, strong, summary, text) import Html.Attributes exposing (attribute, class, for, href, id, size, value) import Html.Events -import Pages exposing (Page(..)) import SvgBuilder import Util import Vela exposing (Copy) diff --git a/src/elm/Main.elm b/src/elm/Main.elm index c9359a157..bb1ea0131 100644 --- a/src/elm/Main.elm +++ b/src/elm/Main.elm @@ -66,7 +66,7 @@ import Html.Attributes , type_ ) import Html.Events exposing (onClick) -import Html.Lazy exposing (lazy, lazy2, lazy3, lazy4, lazy5, lazy7, lazy8) +import Html.Lazy exposing (lazy, lazy2, lazy3, lazy4, lazy7, lazy8) import Http import Http.Detailed import Interop @@ -75,7 +75,7 @@ import Json.Encode as Encode import Maybe import Nav exposing (viewUtil) import Pager -import Pages exposing (Page(..)) +import Pages exposing (Page) import Pages.Build.Logs exposing ( addLog @@ -89,7 +89,7 @@ import Pages.Build.Logs ) import Pages.Build.Model import Pages.Build.View -import Pages.Builds exposing (view) +import Pages.Builds import Pages.Deployments.Model import Pages.Deployments.Update exposing (initializeFormFromDeployment) import Pages.Deployments.View @@ -105,7 +105,7 @@ import Pages.Secrets.View import Pages.Settings import Pages.SourceRepos import RemoteData exposing (RemoteData(..), WebData) -import Routes exposing (Route(..)) +import Routes import String.Extra import SvgBuilder exposing (velaLogo) import Task @@ -127,14 +127,10 @@ import Vela , Build , BuildNumber , Builds - , ChownRepo , CurrentUser , Deployment , DeploymentId - , EnableRepo - , EnableRepos , EnableRepositoryPayload - , Enabling(..) , Engine , Event , Favicon @@ -149,7 +145,6 @@ import Vela , PipelineModel , PipelineTemplates , Ref - , RepairRepo , Repo , RepoModel , RepoResourceIdentifier @@ -157,7 +152,7 @@ import Vela , Repositories , Repository , Secret - , SecretType(..) + , SecretType , Secrets , ServiceNumber , Services @@ -281,7 +276,7 @@ type alias Model = type Interval = OneSecond | OneSecondHidden - | FiveSecond RefreshData + | FiveSecond | FiveSecondHidden RefreshData @@ -429,16 +424,16 @@ type Msg | OrgBuildsResponse Org (Result (Http.Detailed.Error String) ( Http.Metadata, Builds )) | BuildsResponse Org Repo (Result (Http.Detailed.Error String) ( Http.Metadata, Builds )) | DeploymentsResponse Org Repo (Result (Http.Detailed.Error String) ( Http.Metadata, List Deployment )) - | HooksResponse Org Repo (Result (Http.Detailed.Error String) ( Http.Metadata, Hooks )) - | BuildResponse Org Repo BuildNumber (Result (Http.Detailed.Error String) ( Http.Metadata, Build )) - | DeploymentResponse Org Repo DeploymentId (Result (Http.Detailed.Error String) ( Http.Metadata, Deployment )) + | HooksResponse (Result (Http.Detailed.Error String) ( Http.Metadata, Hooks )) + | BuildResponse Org Repo (Result (Http.Detailed.Error String) ( Http.Metadata, Build )) + | DeploymentResponse (Result (Http.Detailed.Error String) ( Http.Metadata, Deployment )) | StepsResponse Org Repo BuildNumber FocusFragment Bool (Result (Http.Detailed.Error String) ( Http.Metadata, Steps )) | StepLogResponse StepNumber FocusFragment Bool (Result (Http.Detailed.Error String) ( Http.Metadata, Log )) | ServicesResponse Org Repo BuildNumber (Maybe String) Bool (Result (Http.Detailed.Error String) ( Http.Metadata, Services )) | ServiceLogResponse ServiceNumber FocusFragment Bool (Result (Http.Detailed.Error String) ( Http.Metadata, Log )) - | GetPipelineConfigResponse Org Repo (Maybe Ref) FocusFragment Bool (Result (Http.Detailed.Error String) ( Http.Metadata, String )) - | ExpandPipelineConfigResponse Org Repo (Maybe Ref) FocusFragment Bool (Result (Http.Detailed.Error String) ( Http.Metadata, String )) - | GetPipelineTemplatesResponse Org Repo FocusFragment Bool (Result (Http.Detailed.Error String) ( Http.Metadata, Templates )) + | GetPipelineConfigResponse FocusFragment Bool (Result (Http.Detailed.Error String) ( Http.Metadata, String )) + | ExpandPipelineConfigResponse FocusFragment Bool (Result (Http.Detailed.Error String) ( Http.Metadata, String )) + | GetPipelineTemplatesResponse FocusFragment Bool (Result (Http.Detailed.Error String) ( Http.Metadata, Templates )) | SecretResponse (Result (Http.Detailed.Error String) ( Http.Metadata, Secret )) | AddSecretResponse (Result (Http.Detailed.Error String) ( Http.Metadata, Secret )) | AddDeploymentResponse (Result (Http.Detailed.Error String) ( Http.Metadata, Deployment )) @@ -452,7 +447,7 @@ type Msg | AdjustTime Posix | Tick Interval Posix -- Components - | AddSecretUpdate Engine Pages.Secrets.Model.Msg + | AddSecretUpdate Pages.Secrets.Model.Msg | AddDeploymentUpdate Pages.Deployments.Model.Msg -- Other | HandleError Error @@ -1435,7 +1430,7 @@ update msg model = Err error -> ( { model | repo = updateDeployments (toFailure error) rm }, addError error ) - HooksResponse _ _ response -> + HooksResponse response -> case response of Ok ( meta, hooks ) -> ( { model @@ -1450,7 +1445,7 @@ update msg model = Err error -> ( { model | repo = updateHooks (toFailure error) rm }, addError error ) - BuildResponse org repo _ response -> + BuildResponse org repo response -> case response of Ok ( _, build ) -> ( { model @@ -1466,7 +1461,7 @@ update msg model = Err error -> ( { model | repo = updateBuild (toFailure error) rm }, addError error ) - DeploymentResponse _ _ _ response -> + DeploymentResponse response -> case response of Ok ( _, deployment ) -> let @@ -1604,7 +1599,7 @@ update msg model = Err error -> ( model, addError error ) - GetPipelineConfigResponse _ _ _ lineFocus refresh response -> + GetPipelineConfigResponse lineFocus refresh response -> case response of Ok ( _, config ) -> let @@ -1643,7 +1638,7 @@ update msg model = , Errors.addError error HandleError ) - ExpandPipelineConfigResponse _ _ _ lineFocus refresh response -> + ExpandPipelineConfigResponse lineFocus refresh response -> case response of Ok ( _, config ) -> let @@ -1684,7 +1679,7 @@ update msg model = , addError error ) - GetPipelineTemplatesResponse _ _ lineFocus refresh response -> + GetPipelineTemplatesResponse lineFocus refresh response -> case response of Ok ( _, templates ) -> ( { model @@ -1822,7 +1817,7 @@ update msg model = in ( { model | time = time, favicon = favicon }, cmd ) - FiveSecond _ -> + FiveSecond -> ( model, refreshPage model ) OneSecondHidden -> @@ -1836,7 +1831,7 @@ update msg model = ( model, refreshPageHidden model data ) -- Components - AddSecretUpdate _ m -> + AddSecretUpdate m -> let ( newModel, action ) = Pages.Secrets.Update.update model m @@ -2008,7 +2003,7 @@ refreshSubscriptions model = case model.visibility of Visible -> [ every Util.oneSecondMillis <| Tick OneSecond - , every Util.fiveSecondsMillis <| Tick (FiveSecond <| refreshData model) + , every Util.fiveSecondsMillis <| Tick FiveSecond ] Hidden -> @@ -2398,48 +2393,48 @@ viewContent model = Pages.AddOrgSecret engine _ -> ( "add " ++ engine ++ " org secret" - , Html.map (\m -> AddSecretUpdate engine m) <| lazy Pages.Secrets.View.addSecret model + , Html.map AddSecretUpdate <| lazy Pages.Secrets.View.addSecret model ) Pages.AddRepoSecret engine _ _ -> ( "add " ++ engine ++ " repo secret" - , Html.map (\m -> AddSecretUpdate engine m) <| lazy Pages.Secrets.View.addSecret model + , Html.map AddSecretUpdate <| lazy Pages.Secrets.View.addSecret model ) Pages.AddSharedSecret engine _ _ -> ( "add " ++ engine ++ " shared secret" - , Html.map (\m -> AddSecretUpdate engine m) <| lazy Pages.Secrets.View.addSecret model + , Html.map AddSecretUpdate <| lazy Pages.Secrets.View.addSecret model ) Pages.OrgSecret engine org name -> ( String.join "/" [ org, name ] ++ " update " ++ engine ++ " org secret" - , Html.map (\m -> AddSecretUpdate engine m) <| lazy Pages.Secrets.View.editSecret model + , Html.map AddSecretUpdate <| lazy Pages.Secrets.View.editSecret model ) Pages.RepoSecret engine org repo name -> ( String.join "/" [ org, repo, name ] ++ " update " ++ engine ++ " repo secret" - , Html.map (\m -> AddSecretUpdate engine m) <| lazy Pages.Secrets.View.editSecret model + , Html.map AddSecretUpdate <| lazy Pages.Secrets.View.editSecret model ) Pages.SharedSecret engine org team name -> ( String.join "/" [ org, team, name ] ++ " update " ++ engine ++ " shared secret" - , Html.map (\m -> AddSecretUpdate engine m) <| lazy Pages.Secrets.View.editSecret model + , Html.map AddSecretUpdate <| lazy Pages.Secrets.View.editSecret model ) Pages.AddDeployment org repo -> ( String.join "/" [ org, repo ] ++ " add deployment" - , Html.map (\m -> AddDeploymentUpdate m) <| lazy Pages.Deployments.View.addDeployment model + , Html.map AddDeploymentUpdate <| lazy Pages.Deployments.View.addDeployment model ) Pages.PromoteDeployment org repo buildNumber -> ( String.join "/" [ org, repo, buildNumber ] ++ " promote deployment" - , Html.map (\m -> AddDeploymentUpdate m) <| lazy Pages.Deployments.View.promoteDeployment model + , Html.map AddDeploymentUpdate <| lazy Pages.Deployments.View.promoteDeployment model ) Pages.RepositoryDeployments org repo maybePage _ -> ( String.join "/" [ org, repo ] ++ " deployments" ++ Util.pageToString maybePage , div [] - [ lazy5 Pages.Deployments.View.viewDeployments model.repo.deployments model.time model.zone org repo + [ lazy3 Pages.Deployments.View.viewDeployments model.repo.deployments org repo , Pager.view model.repo.deployments.pager Pager.defaultLabels GotoPage ] ) @@ -2551,16 +2546,6 @@ viewContent model = , viewLogin ) - Pages.Logout -> - ( "Logout" - , h1 [] [ text "Logging out" ] - ) - - Pages.Authenticate -> - ( "Authentication" - , h1 [ Util.testAttribute "page-h1" ] [ text "Authenticating..." ] - ) - Pages.NotFound -> ( "404" , h1 [] [ text "Not Found" ] @@ -4145,7 +4130,7 @@ getCurrentUser model = getHooks : Model -> Org -> Repo -> Maybe Pagination.Page -> Maybe Pagination.PerPage -> Cmd Msg getHooks model org repo maybePage maybePerPage = - Api.try (HooksResponse org repo) <| Api.getHooks model maybePage maybePerPage org repo + Api.try HooksResponse <| Api.getHooks model maybePage maybePerPage org repo getRepo : Model -> Org -> Repo -> Cmd Msg @@ -4170,12 +4155,12 @@ getBuilds model org repo maybePage maybePerPage maybeEvent = getBuild : Model -> Org -> Repo -> BuildNumber -> Cmd Msg getBuild model org repo buildNumber = - Api.try (BuildResponse org repo buildNumber) <| Api.getBuild model org repo buildNumber + Api.try (BuildResponse org repo) <| Api.getBuild model org repo buildNumber getDeployment : Model -> Org -> Repo -> DeploymentId -> Cmd Msg getDeployment model org repo deploymentNumber = - Api.try (DeploymentResponse org repo deploymentNumber) <| Api.getDeployment model org repo <| Just deploymentNumber + Api.try DeploymentResponse <| Api.getDeployment model org repo <| Just deploymentNumber getDeployments : Model -> Org -> Repo -> Maybe Pagination.Page -> Maybe Pagination.PerPage -> Cmd Msg @@ -4304,21 +4289,21 @@ getSecret model engine type_ org key name = -} getPipelineConfig : Model -> Org -> Repo -> Maybe Ref -> FocusFragment -> Bool -> Cmd Msg getPipelineConfig model org repo ref lineFocus refresh = - Api.tryString (GetPipelineConfigResponse org repo ref lineFocus refresh) <| Api.getPipelineConfig model org repo ref + Api.tryString (GetPipelineConfigResponse lineFocus refresh) <| Api.getPipelineConfig model org repo ref {-| expandPipelineConfig : takes model, org, repo and ref and expands a pipeline configuration via the API. -} expandPipelineConfig : Model -> Org -> Repo -> Maybe Ref -> FocusFragment -> Bool -> Cmd Msg expandPipelineConfig model org repo ref lineFocus refresh = - Api.tryString (ExpandPipelineConfigResponse org repo ref lineFocus refresh) <| Api.expandPipelineConfig model org repo ref + Api.tryString (ExpandPipelineConfigResponse lineFocus refresh) <| Api.expandPipelineConfig model org repo ref {-| getPipelineTemplates : takes model, org, repo and ref and fetches templates used in a pipeline configuration from the API. -} getPipelineTemplates : Model -> Org -> Repo -> Maybe Ref -> FocusFragment -> Bool -> Cmd Msg getPipelineTemplates model org repo ref lineFocus refresh = - Api.try (GetPipelineTemplatesResponse org repo lineFocus refresh) <| Api.getPipelineTemplates model org repo ref + Api.try (GetPipelineTemplatesResponse lineFocus refresh) <| Api.getPipelineTemplates model org repo ref diff --git a/src/elm/Nav.elm b/src/elm/Nav.elm index c23f341f6..38ba0c555 100644 --- a/src/elm/Nav.elm +++ b/src/elm/Nav.elm @@ -26,10 +26,10 @@ import Html.Attributes , disabled ) import Html.Events exposing (onClick) -import Pages exposing (Page(..)) +import Pages exposing (Page) import Pages.Build.History import RemoteData exposing (RemoteData(..), WebData) -import Routes exposing (Route(..)) +import Routes import Time exposing (Posix, Zone) import Util import Vela diff --git a/src/elm/Pages.elm b/src/elm/Pages.elm index 876dec30e..1d0edf40c 100644 --- a/src/elm/Pages.elm +++ b/src/elm/Pages.elm @@ -8,8 +8,8 @@ module Pages exposing (Page(..), strip, toRoute) import Api.Pagination as Pagination import Focus exposing (ExpandTemplatesQuery, Fragment, RefQuery) -import Routes exposing (Route(..)) -import Vela exposing (Build, BuildNumber, Engine, Event, FocusFragment, Name, Org, Repo, Team) +import Routes exposing (Route) +import Vela exposing (BuildNumber, Engine, Event, FocusFragment, Name, Org, Repo, Team) type Page @@ -38,8 +38,6 @@ type Page | Pipeline Org Repo (Maybe RefQuery) (Maybe ExpandTemplatesQuery) (Maybe Fragment) | Settings | Login - | Logout - | Authenticate | NotFound @@ -127,13 +125,6 @@ toRoute page = Login -> Routes.Login - Logout -> - Routes.Logout - - Authenticate -> - -- this shouldn't be referenced, we'll just return login page - Routes.Login - NotFound -> Routes.NotFound @@ -218,11 +209,5 @@ strip page = Login -> Login - Logout -> - Logout - - Authenticate -> - Authenticate - NotFound -> NotFound diff --git a/src/elm/Pages/Build/History.elm b/src/elm/Pages/Build/History.elm index 125a23d5d..eae202304 100644 --- a/src/elm/Pages/Build/History.elm +++ b/src/elm/Pages/Build/History.elm @@ -2,7 +2,7 @@ module Pages.Build.History exposing (view) import Html exposing (Html, a, div, em, li, p, span, text, ul) import Html.Attributes exposing (attribute, class) -import Pages exposing (Page(..)) +import Pages exposing (Page) import RemoteData import Routes import SvgBuilder exposing (recentBuildStatusToIcon) diff --git a/src/elm/Pages/Build/Model.elm b/src/elm/Pages/Build/Model.elm index e7a4c3184..5616cdc3f 100644 --- a/src/elm/Pages/Build/Model.elm +++ b/src/elm/Pages/Build/Model.elm @@ -17,10 +17,10 @@ module Pages.Build.Model exposing ) import Browser.Navigation as Navigation -import Pages exposing (Page(..)) +import Pages exposing (Page) import RemoteData exposing (WebData) import Time exposing (Posix, Zone) -import Vela exposing (Build, BuildNumber, CurrentUser, Org, PipelineModel, Repo, RepoModel, SourceRepositories) +import Vela exposing (BuildNumber, CurrentUser, Org, PipelineModel, Repo, RepoModel, SourceRepositories) diff --git a/src/elm/Pages/Build/View.elm b/src/elm/Pages/Build/View.elm index 8c66da28d..dbd4ee17a 100644 --- a/src/elm/Pages/Build/View.elm +++ b/src/elm/Pages/Build/View.elm @@ -58,7 +58,7 @@ import Pages.Build.Model , PartialModel ) import RemoteData exposing (WebData) -import Routes exposing (Route(..)) +import Routes import String import SvgBuilder exposing (buildStatusToIcon, stepStatusToIcon) import Time exposing (Posix, Zone) @@ -139,22 +139,6 @@ wrapWithBuildPreview model msgs org repo buildNumber content = div [ Util.testAttribute "full-build" ] markdown -{-| restartBuildButton : takes org repo and build number and renders button to restart a build --} -restartBuildButton : Org -> Repo -> Build -> (Org -> Repo -> BuildNumber -> msg) -> Html msg -restartBuildButton org repo build restartBuild = - button - [ classList - [ ( "button", True ) - , ( "-outline", True ) - ] - , onClick <| restartBuild org repo <| String.fromInt build.number - , Util.testAttribute "restart-build" - ] - [ text "Restart Build" - ] - - {-| viewPreview : renders single build item preview based on current application time -} viewPreview : Msgs msgs -> List Int -> Bool -> Posix -> Zone -> Org -> Repo -> Build -> Html msgs diff --git a/src/elm/Pages/Builds.elm b/src/elm/Pages/Builds.elm index d4da2fcce..2fcb55c13 100644 --- a/src/elm/Pages/Builds.elm +++ b/src/elm/Pages/Builds.elm @@ -24,10 +24,10 @@ import Html import Html.Attributes exposing (class, href) import Pages.Build.Model exposing (Msgs) import Pages.Build.View exposing (viewPreview) -import RemoteData exposing (RemoteData(..)) +import RemoteData import Time exposing (Posix, Zone) import Util exposing (largeLoader) -import Vela exposing (BuildNumber, BuildsModel, Event, Org, Repo) +import Vela exposing (BuildsModel, Event, Org, Repo) {-| view : takes org and repo and renders build previews diff --git a/src/elm/Pages/Deployments/Form.elm b/src/elm/Pages/Deployments/Form.elm index 2f0d5814d..73128511a 100644 --- a/src/elm/Pages/Deployments/Form.elm +++ b/src/elm/Pages/Deployments/Form.elm @@ -5,8 +5,7 @@ Use of this source code is governed by the LICENSE file in this repository. module Pages.Deployments.Form exposing - ( viewAddedParameters - , viewDeployEnabled + ( viewDeployEnabled , viewHelp , viewParameterInput , viewSubmitButtons @@ -31,7 +30,7 @@ import Html ) import Html.Attributes exposing (class, disabled, for, href, id, placeholder, rows, target, value, wrap) import Html.Events exposing (onClick, onInput) -import Pages.Deployments.Model exposing (DeploymentForm, Model, Msg(..)) +import Pages.Deployments.Model exposing (DeploymentForm, Msg(..)) import RemoteData exposing (WebData) import Util exposing (testAttribute) import Vela exposing (KeyValuePair, Repository) @@ -174,15 +173,15 @@ viewParameterInput deployment = ] -viewSubmitButtons : Model msg -> Html Msg -viewSubmitButtons deploymentsModel = +viewSubmitButtons : Html Msg +viewSubmitButtons = div [ class "buttons" ] - [ viewUpdateButton deploymentsModel + [ viewUpdateButton ] -viewUpdateButton : Model msg -> Html Msg -viewUpdateButton deploymentsModel = +viewUpdateButton : Html Msg +viewUpdateButton = button [ class "button" , Util.testAttribute "add-deployment-button" diff --git a/src/elm/Pages/Deployments/Model.elm b/src/elm/Pages/Deployments/Model.elm index c48a8b005..ec2c75da9 100644 --- a/src/elm/Pages/Deployments/Model.elm +++ b/src/elm/Pages/Deployments/Model.elm @@ -10,16 +10,15 @@ module Pages.Deployments.Model exposing , Model , Msg(..) , PartialModel - , PromoteDeploymentResponse , defaultDeploymentForm ) -import Auth.Session exposing (Session(..)) +import Auth.Session exposing (Session) import Http import Http.Detailed -import Pages exposing (Page(..)) +import Pages exposing (Page) import RemoteData exposing (WebData) -import Vela exposing (Build, Deployment, KeyValuePair, Org, Repo, Repository, Team) +import Vela exposing (Deployment, KeyValuePair, Org, Repo, Repository, Team) @@ -76,10 +75,6 @@ type alias DeploymentResponse msg = Result (Http.Detailed.Error String) ( Http.Metadata, Deployment ) -> msg -type alias PromoteDeploymentResponse msg = - Result (Http.Detailed.Error String) ( Http.Metadata, Build ) -> msg - - type Msg = OnChangeStringField String String | AddParameter DeploymentForm diff --git a/src/elm/Pages/Deployments/View.elm b/src/elm/Pages/Deployments/View.elm index 6f3272d7d..7fb4e4711 100644 --- a/src/elm/Pages/Deployments/View.elm +++ b/src/elm/Pages/Deployments/View.elm @@ -4,7 +4,7 @@ Use of this source code is governed by the LICENSE file in this repository. --} -module Pages.Deployments.View exposing (addDeployment, addForm, promoteDeployment, viewDeployments) +module Pages.Deployments.View exposing (addDeployment, promoteDeployment, viewDeployments) import Errors exposing (viewResourceError) import FeatherIcons @@ -14,14 +14,13 @@ import Pages.Deployments.Form exposing (viewDeployEnabled, viewHelp, viewParamet import Pages.Deployments.Model exposing ( Model - , Msg(..) + , Msg , PartialModel ) -import RemoteData exposing (RemoteData(..)) +import RemoteData import Routes import Svg.Attributes import SvgBuilder exposing (buildStatusToIcon) -import Time exposing (Posix, Zone) import Util exposing (largeLoader) import Vela exposing (Deployment, DeploymentsModel, Org, Repo) @@ -58,7 +57,7 @@ addForm deploymentModel = , viewValueInput "Task" deployment.task "Provide the task for the deployment (default: \"deploy:vela\")" , viewParameterInput deployment , viewHelp - , viewSubmitButtons deploymentModel + , viewSubmitButtons ] @@ -120,8 +119,8 @@ viewPreview org repo deployment = {-| viewDeployments : renders a list of deployments -} -viewDeployments : DeploymentsModel -> Posix -> Zone -> Org -> Repo -> Html msg -viewDeployments deploymentsModel now zone org repo = +viewDeployments : DeploymentsModel -> Org -> Repo -> Html msg +viewDeployments deploymentsModel org repo = let addButton = a diff --git a/src/elm/Pages/Home.elm b/src/elm/Pages/Home.elm index b25da374e..c8d2cd103 100644 --- a/src/elm/Pages/Home.elm +++ b/src/elm/Pages/Home.elm @@ -28,7 +28,6 @@ import Html.Attributes ) import List import List.Extra -import Pages exposing (Page(..)) import RemoteData exposing (RemoteData(..), WebData) import Routes import Search diff --git a/src/elm/Pages/Hooks.elm b/src/elm/Pages/Hooks.elm index a8b6dbee9..3ee28bfa7 100644 --- a/src/elm/Pages/Hooks.elm +++ b/src/elm/Pages/Hooks.elm @@ -26,8 +26,7 @@ import Html.Attributes , scope ) import Pages.Build.Logs exposing (decodeAnsi) -import RemoteData exposing (RemoteData(..)) -import Routes exposing (Route(..)) +import RemoteData import SvgBuilder exposing (hookStatusToIcon) import Table import Time exposing (Posix) diff --git a/src/elm/Pages/Pipeline/Model.elm b/src/elm/Pages/Pipeline/Model.elm index 40549ccfe..e266e6fd4 100644 --- a/src/elm/Pages/Pipeline/Model.elm +++ b/src/elm/Pages/Pipeline/Model.elm @@ -7,9 +7,9 @@ Use of this source code is governed by the LICENSE file in this repository. module Pages.Pipeline.Model exposing (Download, Expand, Get, Msgs, PartialModel) import Alerts exposing (Alert) -import Auth.Session exposing (Session(..)) +import Auth.Session exposing (Session) import Browser.Navigation as Navigation -import Pages exposing (Page(..)) +import Pages exposing (Page) import RemoteData exposing (WebData) import Time exposing (Posix) import Toasty exposing (Stack) diff --git a/src/elm/Pages/Pipeline/View.elm b/src/elm/Pages/Pipeline/View.elm index d26a20765..7ba931ae9 100644 --- a/src/elm/Pages/Pipeline/View.elm +++ b/src/elm/Pages/Pipeline/View.elm @@ -28,11 +28,9 @@ import Html ) import Html.Attributes exposing (attribute, class) import Html.Events exposing (onClick) -import Pages exposing (Page(..)) import Pages.Build.Logs exposing (decodeAnsi) import Pages.Pipeline.Model exposing (Download, Expand, Get, Msgs, PartialModel) import RemoteData exposing (RemoteData(..)) -import Routes exposing (Route(..)) import Util import Vela exposing diff --git a/src/elm/Pages/RepoSettings.elm b/src/elm/Pages/RepoSettings.elm index 3e59a2a2a..e004e8adc 100644 --- a/src/elm/Pages/RepoSettings.elm +++ b/src/elm/Pages/RepoSettings.elm @@ -730,24 +730,6 @@ updateAccessTip field = text "" -{-| updatePipelineTypeTip : takes field and returns the tip to display after the label. --} -updatePipelineTypeTip : Field -> Html msg -updatePipelineTypeTip field = - case field of - "yaml" -> - text " (base pipeline will be as a YAML file)" - - "go" -> - text " (base pipeline will be as a Go template file)" - - "starlark" -> - text " (base pipeline will be as a Starlark file)" - - _ -> - text "" - - {-| msgPrefix : takes update field and returns alert prefix. -} msgPrefix : Field -> String diff --git a/src/elm/Pages/Secrets/Model.elm b/src/elm/Pages/Secrets/Model.elm index 8afc2d866..c5a60cdba 100644 --- a/src/elm/Pages/Secrets/Model.elm +++ b/src/elm/Pages/Secrets/Model.elm @@ -8,7 +8,6 @@ module Pages.Secrets.Model exposing ( AddSecretResponse , DeleteSecretResponse , DeleteSecretState(..) - , ManageSecretState(..) , Model , Msg(..) , PartialModel @@ -19,12 +18,12 @@ module Pages.Secrets.Model exposing , defaultSecretUpdate ) -import Auth.Session exposing (Session(..)) +import Auth.Session exposing (Session) import Http import Http.Detailed import LinkHeader exposing (WebLink) -import Pages exposing (Page(..)) -import RemoteData exposing (RemoteData(..), WebData) +import Pages exposing (Page) +import RemoteData exposing (WebData) import Vela exposing (Engine, Key, Org, Repo, Secret, SecretType, Secrets, Team) @@ -129,9 +128,3 @@ type DeleteSecretState = NotAsked_ | Confirm | Deleting - - -type ManageSecretState - = Choose - | Add - | Update diff --git a/src/elm/Pages/Secrets/View.elm b/src/elm/Pages/Secrets/View.elm index a80d7fc54..e60d1fd36 100644 --- a/src/elm/Pages/Secrets/View.elm +++ b/src/elm/Pages/Secrets/View.elm @@ -8,15 +8,14 @@ module Pages.Secrets.View exposing (addSecret, editSecret, viewOrgSecrets, viewR import Errors exposing (viewResourceError) import FeatherIcons -import Html exposing (Html, a, button, div, h2, h4, span, td, text, tr) -import Html.Attributes exposing (attribute, class, disabled, scope) +import Html exposing (Html, a, button, div, h2, span, td, text, tr) +import Html.Attributes exposing (attribute, class, scope) import Html.Events exposing (onClick) import Pages.Secrets.Form exposing (viewAllowCommandCheckbox, viewEventsSelect, viewHelp, viewImagesInput, viewInput, viewNameInput, viewSubmitButtons, viewValueInput) import Pages.Secrets.Model exposing - ( ManageSecretState(..) - , Model - , Msg(..) + ( Model + , Msg , PartialModel ) import RemoteData exposing (RemoteData(..)) diff --git a/src/elm/Pages/SourceRepos.elm b/src/elm/Pages/SourceRepos.elm index 7b8bf2d72..421af2b3d 100644 --- a/src/elm/Pages/SourceRepos.elm +++ b/src/elm/Pages/SourceRepos.elm @@ -35,7 +35,7 @@ import Html.Attributes ) import Html.Events exposing (onClick) import RemoteData exposing (WebData) -import Routes exposing (Route(..)) +import Routes import Search exposing ( Search diff --git a/src/elm/Util.elm b/src/elm/Util.elm index 8c0c9a41f..935fde57c 100644 --- a/src/elm/Util.elm +++ b/src/elm/Util.elm @@ -11,7 +11,6 @@ module Util exposing , base64Decode , boolToYesNo , buildBranchUrl - , dateToHumanReadable , dispatch , extractFocusIdFromRange , filterEmptyList @@ -26,7 +25,6 @@ module Util exposing , isLoading , isSuccess , largeLoader - , megabyte , mergeListsById , noBlanks , onClickPreventDefault @@ -516,43 +514,6 @@ getNameFromRef s = "" -{-| byteUnitFactor : returns the factor for doing filesize calculations. -This application uses decimal units, or units by the 1000. - -see: - --} -byteUnitFactor : Int -byteUnitFactor = - 1000 - - -{-| byte : returns a byte represented as an integer. - -see: - --} -byte : Int -byte = - 1 - - -{-| kilobyte : returns a kilobyte defined as 1000 bytes. -see: --} -kilobyte : Int -kilobyte = - byteUnitFactor * byte - - -{-| megabyte : returns a megabyte defined as 1000 kilobytes. -see: --} -megabyte : Int -megabyte = - byteUnitFactor * kilobyte - - {-| formatFilesize : returns a file size in bytes as a human readable string. Defined as a helper function to make it easier to configure bases, units etc. see: diff --git a/src/elm/Vela.elm b/src/elm/Vela.elm index a6b04d859..ce3da6f39 100644 --- a/src/elm/Vela.elm +++ b/src/elm/Vela.elm @@ -97,7 +97,6 @@ module Vela exposing , decodeSourceRepositories , decodeStep , decodeTheme - , defaultDeployments , defaultEnableRepositoryPayload , defaultFavicon , defaultPipeline @@ -1884,10 +1883,6 @@ decodeKeyValuePairs o = Just <| List.map decodeKeyValuePair <| o -type alias ParameterMap = - Dict String String - - decodeDeploymentParameters : Decoder (Maybe (List KeyValuePair)) decodeDeploymentParameters = Decode.map decodeKeyValuePairs <| Decode.keyValuePairs Decode.string