Skip to content

Commit

Permalink
refactor: move org and repo secrets modules to match elm land route s…
Browse files Browse the repository at this point in the history
…tructure
  • Loading branch information
plyr4 committed Feb 1, 2024
1 parent d6533ae commit 32e5264
Show file tree
Hide file tree
Showing 13 changed files with 437 additions and 437 deletions.
2 changes: 1 addition & 1 deletion src/elm/Components/Repo.elm
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ view shared { toggleFavoriteMsg, org, repo, favorites, filtered } =
[ class "button"
, class "-outline"
, Util.testAttribute "repo-secrets"
, Route.Path.href <| Route.Path.Org_Repo_Secrets { org = org, repo = repo, engine = "native" }
, Route.Path.href <| Route.Path.SecretsEngine_RepoOrg_Repo_ { org = org, repo = repo, engine = "native" }
]
[ text "Secrets" ]
, a
Expand Down
6 changes: 3 additions & 3 deletions src/elm/Components/Secrets.elm
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,10 @@ editSecretHref engine type_ secret =
Route.Path.href <|
case type_ of
Vela.OrgSecret ->
Route.Path.Org_SecretsEdit_ { org = secret.org, name = secret.name, engine = engine }
Route.Path.SecretsEngine_OrgOrg_Edit_ { org = secret.org, name = secret.name, engine = engine }

Vela.RepoSecret ->
Route.Path.Org_Repo_SecretsEdit_ { org = secret.org, repo = secret.repo, name = secret.name, engine = engine }
Route.Path.SecretsEngine_RepoOrg_Repo_Edit_ { org = secret.org, repo = secret.repo, name = secret.name, engine = engine }

Vela.SharedSecret ->
Route.Path.Org_Secrets { org = secret.org, engine = engine }
Route.Path.SecretsEngine_OrgOrg_ { org = secret.org, engine = engine }
4 changes: 2 additions & 2 deletions src/elm/Components/Tabs.elm
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ viewOrgTabs props =
}
, { name = "Secrets"
, currentPath = props.currentPath
, toPath = Route.Path.Org_Secrets { org = props.org, engine = "native" }
, toPath = Route.Path.SecretsEngine_OrgOrg_ { org = props.org, engine = "native" }
, isAlerting = False
, show = True
}
Expand Down Expand Up @@ -190,7 +190,7 @@ viewRepoTabs shared props =
, { name = "Secrets"
, currentPath = props.currentPath
, toPath =
Route.Path.Org_Repo_Secrets
Route.Path.SecretsEngine_RepoOrg_Repo_
{ org = props.org
, repo = props.repo
, engine = "native"
Expand Down
746 changes: 373 additions & 373 deletions src/elm/Main.elm

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions src/elm/Main/Pages/Model.elm
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ import Pages.Org_.Repo_.Deployments.Add
import Pages.Org_.Repo_.Schedules
import Pages.Org_.Repo_.Schedules.Add
import Pages.Org_.Repo_.Schedules.Edit_
import Pages.Org_.Repo_.Secrets
import Pages.Org_.Repo_.Secrets.Add
import Pages.Org_.Repo_.Secrets.Edit_
import Pages.Org_.Repo_.Settings
import Pages.Org_.Secrets
import Pages.Org_.Secrets.Add
import Pages.Org_.Secrets.Edit_
import Pages.Secrets.Engine_.Org.Org_
import Pages.Secrets.Engine_.Org.Org_.Add
import Pages.Secrets.Engine_.Org.Org_.Edit_
import Pages.Secrets.Engine_.Repo.Org_.Repo_
import Pages.Secrets.Engine_.Repo.Org_.Repo_.Add
import Pages.Secrets.Engine_.Repo.Org_.Repo_.Edit_


type Model
Expand All @@ -39,9 +39,6 @@ type Model
| Home Pages.Home.Model
| Org_ { org : String } Pages.Org_.Model
| Org_Builds { org : String } Pages.Org_.Builds.Model
| Org_Secrets { org : String, engine : String } Pages.Org_.Secrets.Model
| Org_SecretsAdd { org : String, engine : String } Pages.Org_.Secrets.Add.Model
| Org_SecretsEdit_ { org : String, name : String, engine : String } Pages.Org_.Secrets.Edit_.Model
| Org_Repo_ { org : String, repo : String } Pages.Org_.Repo_.Model
| Org_Repo_Deployments { org : String, repo : String } Pages.Org_.Repo_.Deployments.Model
| Org_Repo_DeploymentsAdd { org : String, repo : String } Pages.Org_.Repo_.Deployments.Add.Model
Expand All @@ -50,13 +47,16 @@ type 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_Settings { org : String, repo : String } Pages.Org_.Repo_.Settings.Model
| Org_Repo_Secrets { org : String, repo : String, engine : String } Pages.Org_.Repo_.Secrets.Model
| Org_Repo_SecretsAdd { org : String, repo : String, engine : String } Pages.Org_.Repo_.Secrets.Add.Model
| Org_Repo_SecretsEdit_ { org : String, repo : String, name : String, engine : String } Pages.Org_.Repo_.Secrets.Edit_.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
| Org_Repo_Build_Pipeline { org : String, repo : String, buildNumber : String } Pages.Org_.Repo_.Build_.Pipeline.Model
| Org_Repo_Build_Graph { org : String, repo : String, buildNumber : String } Pages.Org_.Repo_.Build_.Graph.Model
| SecretsEngine_OrgOrg_ { org : String, engine : String } Pages.Secrets.Engine_.Org.Org_.Model
| SecretsEngine_OrgOrg_Add { org : String, engine : String } Pages.Secrets.Engine_.Org.Org_.Add.Model
| SecretsEngine_OrgOrg_Edit_ { org : String, name : String, engine : String } Pages.Secrets.Engine_.Org.Org_.Edit_.Model
| SecretsEngine_RepoOrg_Repo_ { org : String, repo : String, engine : String } Pages.Secrets.Engine_.Repo.Org_.Repo_.Model
| SecretsEngine_RepoOrg_Repo_Add { org : String, repo : String, engine : String } Pages.Secrets.Engine_.Repo.Org_.Repo_.Add.Model
| SecretsEngine_RepoOrg_Repo_Edit_ { org : String, repo : String, name : String, engine : String } Pages.Secrets.Engine_.Repo.Org_.Repo_.Edit_.Model
| NotFound_ Pages.NotFound_.Model
| Redirecting_
| Loading_
| NotFound_ Pages.NotFound_.Model
24 changes: 12 additions & 12 deletions src/elm/Main/Pages/Msg.elm
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ import Pages.Org_.Repo_.Deployments.Add
import Pages.Org_.Repo_.Schedules
import Pages.Org_.Repo_.Schedules.Add
import Pages.Org_.Repo_.Schedules.Edit_
import Pages.Org_.Repo_.Secrets
import Pages.Org_.Repo_.Secrets.Add
import Pages.Org_.Repo_.Secrets.Edit_
import Pages.Org_.Repo_.Settings
import Pages.Org_.Secrets
import Pages.Org_.Secrets.Add
import Pages.Org_.Secrets.Edit_
import Pages.Secrets.Engine_.Org.Org_
import Pages.Secrets.Engine_.Org.Org_.Add
import Pages.Secrets.Engine_.Org.Org_.Edit_
import Pages.Secrets.Engine_.Repo.Org_.Repo_
import Pages.Secrets.Engine_.Repo.Org_.Repo_.Add
import Pages.Secrets.Engine_.Repo.Org_.Repo_.Edit_


type Msg
Expand All @@ -39,9 +39,6 @@ type Msg
| Home Pages.Home.Msg
| Org_ Pages.Org_.Msg
| Org_Builds Pages.Org_.Builds.Msg
| Org_Secrets Pages.Org_.Secrets.Msg
| Org_SecretsAdd Pages.Org_.Secrets.Add.Msg
| Org_SecretsEdit_ Pages.Org_.Secrets.Edit_.Msg
| Org_Repo_ Pages.Org_.Repo_.Msg
| Org_Repo_Deployments Pages.Org_.Repo_.Deployments.Msg
| Org_Repo_DeploymentsAdd Pages.Org_.Repo_.Deployments.Add.Msg
Expand All @@ -50,11 +47,14 @@ type Msg
| Org_Repo_SchedulesEdit_ Pages.Org_.Repo_.Schedules.Edit_.Msg
| Org_Repo_Audit Pages.Org_.Repo_.Audit.Msg
| Org_Repo_Settings Pages.Org_.Repo_.Settings.Msg
| Org_Repo_Secrets Pages.Org_.Repo_.Secrets.Msg
| Org_Repo_SecretsAdd Pages.Org_.Repo_.Secrets.Add.Msg
| Org_Repo_SecretsEdit_ Pages.Org_.Repo_.Secrets.Edit_.Msg
| Org_Repo_Build_ Pages.Org_.Repo_.Build_.Msg
| Org_Repo_Build_Services Pages.Org_.Repo_.Build_.Services.Msg
| Org_Repo_Build_Pipeline Pages.Org_.Repo_.Build_.Pipeline.Msg
| Org_Repo_Build_Graph Pages.Org_.Repo_.Build_.Graph.Msg
| SecretsEngine_OrgOrg_ Pages.Secrets.Engine_.Org.Org_.Msg
| SecretsEngine_OrgOrg_Add Pages.Secrets.Engine_.Org.Org_.Add.Msg
| SecretsEngine_OrgOrg_Edit_ Pages.Secrets.Engine_.Org.Org_.Edit_.Msg
| SecretsEngine_RepoOrg_Repo_ Pages.Secrets.Engine_.Repo.Org_.Repo_.Msg
| SecretsEngine_RepoOrg_Repo_Add Pages.Secrets.Engine_.Repo.Org_.Repo_.Add.Msg
| SecretsEngine_RepoOrg_Repo_Edit_ Pages.Secrets.Engine_.Repo.Org_.Repo_.Edit_.Msg
| NotFound_ Pages.NotFound_.Msg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SPDX-License-Identifier: Apache-2.0
--}


module Pages.Org_.Secrets exposing (Model, Msg, page, view)
module Pages.Secrets.Engine_.Org.Org_ exposing (Model, Msg, page, view)

import Api.Pagination
import Auth
Expand Down Expand Up @@ -194,7 +194,7 @@ view shared route model =
, class "button-with-icon"
, Util.testAttribute "add-org-secret"
, Route.Path.href <|
Route.Path.Org_SecretsAdd { org = route.params.org, engine = route.params.engine }
Route.Path.SecretsEngine_OrgOrg_Add { org = route.params.org, engine = route.params.engine }
]
[ text "Add Org Secret"
, FeatherIcons.plus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SPDX-License-Identifier: Apache-2.0
--}


module Pages.Org_.Secrets.Add exposing (Model, Msg, page, view)
module Pages.Secrets.Engine_.Org.Org_.Add exposing (Model, Msg, page, view)

import Auth
import Components.Form
Expand Down Expand Up @@ -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.Org_Secrets { org = route.params.org, engine = route.params.engine } )
, ( "Secrets", Just <| Route.Path.SecretsEngine_OrgOrg_ { org = route.params.org, engine = route.params.engine } )
, ( "Add", Nothing )
]
, repo = Nothing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SPDX-License-Identifier: Apache-2.0
--}


module Pages.Org_.Secrets.Edit_ exposing (Model, Msg, page, view)
module Pages.Secrets.Engine_.Org.Org_.Edit_ exposing (Model, Msg, page, view)

import Auth
import Components.Form
Expand Down Expand Up @@ -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.Org_Secrets { org = route.params.org, engine = route.params.engine } )
, ( "Secrets", Just <| Route.Path.SecretsEngine_OrgOrg_ { org = route.params.org, engine = route.params.engine } )
, ( "Edit", Nothing )
, ( route.params.name, Nothing )
]
Expand Down Expand Up @@ -165,7 +165,7 @@ update shared route msg model =
, addToastIfUnique = True
}
, Effect.pushPath <|
Route.Path.Org_Secrets
Route.Path.SecretsEngine_OrgOrg_
{ org = route.params.org
, engine = route.params.engine
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SPDX-License-Identifier: Apache-2.0
--}


module Pages.Org_.Repo_.Secrets exposing (Model, Msg, page, view)
module Pages.Secrets.Engine_.Repo.Org_.Repo_ exposing (Model, Msg, page, view)

import Api.Pagination
import Auth
Expand Down Expand Up @@ -238,7 +238,7 @@ view shared route model =
, class "button-with-icon"
, Util.testAttribute "add-repo-secret"
, Route.Path.href <|
Route.Path.Org_Repo_SecretsAdd { org = route.params.org, repo = route.params.repo, engine = route.params.engine }
Route.Path.SecretsEngine_RepoOrg_Repo_Add { org = route.params.org, repo = route.params.repo, engine = route.params.engine }
]
[ text "Add Repo Secret"
, FeatherIcons.plus
Expand All @@ -260,7 +260,7 @@ view shared route model =
[ class "button"
, class "-outline"
, Route.Path.href <|
Route.Path.Org_Secrets { org = route.params.org, engine = route.params.engine }
Route.Path.SecretsEngine_OrgOrg_ { org = route.params.org, engine = route.params.engine }
, Util.testAttribute "manage-org-secrets"
]
[ text "Manage Org Secrets" ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SPDX-License-Identifier: Apache-2.0
--}


module Pages.Org_.Repo_.Secrets.Add exposing (Model, Msg, page, view)
module Pages.Secrets.Engine_.Repo.Org_.Repo_.Add exposing (Model, Msg, page, view)

import Auth
import Components.Form
Expand Down Expand Up @@ -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.Org_Repo_Secrets { org = route.params.org, repo = route.params.repo, engine = route.params.engine } )
, ( "Secrets", Just <| Route.Path.SecretsEngine_RepoOrg_Repo_ { org = route.params.org, repo = route.params.repo, engine = route.params.engine } )
, ( "Add", Nothing )
]
, repo = Nothing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SPDX-License-Identifier: Apache-2.0
--}


module Pages.Org_.Repo_.Secrets.Edit_ exposing (Model, Msg, page, view)
module Pages.Secrets.Engine_.Repo.Org_.Repo_.Edit_ exposing (Model, Msg, page, view)

import Auth
import Components.Form
Expand Down Expand Up @@ -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.Org_Repo_Secrets { org = route.params.org, repo = route.params.repo, engine = route.params.engine } )
, ( "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 )
]
Expand Down Expand Up @@ -170,7 +170,7 @@ update shared route msg model =
, addToastIfUnique = True
}
, Effect.pushPath <|
Route.Path.Org_Repo_Secrets
Route.Path.SecretsEngine_RepoOrg_Repo_
{ org = route.params.org
, repo = route.params.repo
, engine = route.params.engine
Expand Down
36 changes: 18 additions & 18 deletions src/elm/Route/Path.elm
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ type Path
| AccountSourceRepos
| Org_ { org : String }
| Org_Builds { org : String }
| Org_Secrets { org : String, engine : String }
| Org_SecretsAdd { org : String, engine : String }
| Org_SecretsEdit_ { org : String, name : String, engine : String }
| SecretsEngine_OrgOrg_ { org : String, engine : String }
| SecretsEngine_OrgOrg_Add { org : String, engine : String }
| SecretsEngine_OrgOrg_Edit_ { org : String, name : String, engine : String }
| Org_Repo_ { org : String, repo : String }
| Org_Repo_Deployments { org : String, repo : String }
| Org_Repo_DeploymentsAdd { org : String, repo : String }
Expand All @@ -31,9 +31,9 @@ type Path
| Org_Repo_SchedulesEdit_ { org : String, repo : String, name : String }
| Org_Repo_Audit { org : String, repo : String }
| Org_Repo_Settings { org : String, repo : String }
| Org_Repo_Secrets { org : String, repo : String, engine : String }
| Org_Repo_SecretsAdd { org : String, repo : String, engine : String }
| Org_Repo_SecretsEdit_ { org : String, repo : String, name : String, engine : String }
| SecretsEngine_RepoOrg_Repo_ { org : String, repo : String, engine : String }
| SecretsEngine_RepoOrg_Repo_Add { org : String, repo : String, engine : String }
| SecretsEngine_RepoOrg_Repo_Edit_ { org : String, repo : String, name : String, engine : String }
| Org_Repo_Build_ { org : String, repo : String, buildNumber : String }
| Org_Repo_Build_Services { org : String, repo : String, buildNumber : String }
| Org_Repo_Build_Pipeline { org : String, repo : String, buildNumber : String }
Expand Down Expand Up @@ -88,21 +88,21 @@ fromString urlPath =
|> Just

"-" :: "secrets" :: engine :: "org" :: org :: [] ->
Org_Secrets
SecretsEngine_OrgOrg_
{ org = org
, engine = engine
}
|> Just

"-" :: "secrets" :: engine :: "org" :: org :: "add" :: [] ->
Org_SecretsAdd
SecretsEngine_OrgOrg_Add
{ org = org
, engine = engine
}
|> Just

"-" :: "secrets" :: engine :: "org" :: org :: name :: [] ->
Org_SecretsEdit_
SecretsEngine_OrgOrg_Edit_
{ org = org
, name = name
, engine = engine
Expand Down Expand Up @@ -167,23 +167,23 @@ fromString urlPath =
|> Just

"-" :: "secrets" :: engine :: "repo" :: org :: repo :: [] ->
Org_Repo_Secrets
SecretsEngine_RepoOrg_Repo_
{ org = org
, repo = repo
, engine = engine
}
|> Just

"-" :: "secrets" :: engine :: "repo" :: org :: repo :: "add" :: [] ->
Org_Repo_SecretsAdd
SecretsEngine_RepoOrg_Repo_Add
{ org = org
, repo = repo
, engine = engine
}
|> Just

"-" :: "secrets" :: engine :: "repo" :: org :: repo :: name :: [] ->
Org_Repo_SecretsEdit_
SecretsEngine_RepoOrg_Repo_Edit_
{ org = org
, repo = repo
, name = name
Expand Down Expand Up @@ -262,13 +262,13 @@ toString path =
Org_Builds params ->
[ params.org, "builds" ]

Org_Secrets params ->
SecretsEngine_OrgOrg_ params ->
[ "-", "secrets", params.engine, "org", params.org ]

Org_SecretsAdd params ->
SecretsEngine_OrgOrg_Add params ->
[ "-", "secrets", params.engine, "org", params.org, "add" ]

Org_SecretsEdit_ params ->
SecretsEngine_OrgOrg_Edit_ params ->
[ "-", "secrets", params.engine, "org", params.org, params.name ]

Org_Repo_ params ->
Expand All @@ -295,13 +295,13 @@ toString path =
Org_Repo_Settings params ->
[ params.org, params.repo, "settings" ]

Org_Repo_Secrets params ->
SecretsEngine_RepoOrg_Repo_ params ->
[ "-", "secrets", params.engine, "repo", params.org, params.repo ]

Org_Repo_SecretsAdd params ->
SecretsEngine_RepoOrg_Repo_Add params ->
[ "-", "secrets", params.engine, "repo", params.org, params.repo, "add" ]

Org_Repo_SecretsEdit_ params ->
SecretsEngine_RepoOrg_Repo_Edit_ params ->
[ "-", "secrets", params.engine, "repo", params.org, params.repo, params.name ]

Org_Repo_Build_ params ->
Expand Down

0 comments on commit 32e5264

Please sign in to comment.