@@ -33,6 +33,10 @@ class Index extends Component
3333
3434 public Collection $ services ;
3535
36+ public Collection $ allProjects ;
37+
38+ public Collection $ allEnvironments ;
39+
3640 public array $ parameters ;
3741
3842 public function mount ()
@@ -50,6 +54,33 @@ public function mount()
5054 ->firstOrFail ();
5155
5256 $ this ->project = $ project ;
57+
58+ // Load projects and environments for breadcrumb navigation (avoids inline queries in view)
59+ $ this ->allProjects = Project::ownedByCurrentTeamCached ();
60+ $ this ->allEnvironments = $ project ->environments ()
61+ ->with ([
62+ 'applications.additional_servers ' ,
63+ 'applications.destination.server ' ,
64+ 'services ' ,
65+ 'services.destination.server ' ,
66+ 'postgresqls ' ,
67+ 'postgresqls.destination.server ' ,
68+ 'redis ' ,
69+ 'redis.destination.server ' ,
70+ 'mongodbs ' ,
71+ 'mongodbs.destination.server ' ,
72+ 'mysqls ' ,
73+ 'mysqls.destination.server ' ,
74+ 'mariadbs ' ,
75+ 'mariadbs.destination.server ' ,
76+ 'keydbs ' ,
77+ 'keydbs.destination.server ' ,
78+ 'dragonflies ' ,
79+ 'dragonflies.destination.server ' ,
80+ 'clickhouses ' ,
81+ 'clickhouses.destination.server ' ,
82+ ])->get ();
83+
5384 $ this ->environment = $ environment ->loadCount ([
5485 'applications ' ,
5586 'redis ' ,
@@ -71,11 +102,13 @@ public function mount()
71102 'destination.server.settings ' ,
72103 'settings ' ,
73104 ])->get ()->sortBy ('name ' );
74- $ this ->applications = $ this ->applications ->map (function ($ application ) {
105+ $ projectUuid = $ this ->project ->uuid ;
106+ $ environmentUuid = $ this ->environment ->uuid ;
107+ $ this ->applications = $ this ->applications ->map (function ($ application ) use ($ projectUuid , $ environmentUuid ) {
75108 $ application ->hrefLink = route ('project.application.configuration ' , [
76- 'project_uuid ' => data_get ( $ application , ' environment.project.uuid ' ) ,
77- 'environment_uuid ' => data_get ( $ application , ' environment.uuid ' ) ,
78- 'application_uuid ' => data_get ( $ application, ' uuid ' ) ,
109+ 'project_uuid ' => $ projectUuid ,
110+ 'environment_uuid ' => $ environmentUuid ,
111+ 'application_uuid ' => $ application-> uuid ,
79112 ]);
80113
81114 return $ application ;
@@ -98,11 +131,11 @@ public function mount()
98131 'tags ' ,
99132 'destination.server.settings ' ,
100133 ])->get ()->sortBy ('name ' );
101- $ this ->{$ property } = $ this ->{$ property }->map (function ($ db ) {
134+ $ this ->{$ property } = $ this ->{$ property }->map (function ($ db ) use ( $ projectUuid , $ environmentUuid ) {
102135 $ db ->hrefLink = route ('project.database.configuration ' , [
103- 'project_uuid ' => $ this -> project -> uuid ,
136+ 'project_uuid ' => $ projectUuid ,
104137 'database_uuid ' => $ db ->uuid ,
105- 'environment_uuid ' => data_get ( $ this -> environment , ' uuid ' ) ,
138+ 'environment_uuid ' => $ environmentUuid ,
106139 ]);
107140
108141 return $ db ;
@@ -114,11 +147,11 @@ public function mount()
114147 'tags ' ,
115148 'destination.server.settings ' ,
116149 ])->get ()->sortBy ('name ' );
117- $ this ->services = $ this ->services ->map (function ($ service ) {
150+ $ this ->services = $ this ->services ->map (function ($ service ) use ( $ projectUuid , $ environmentUuid ) {
118151 $ service ->hrefLink = route ('project.service.configuration ' , [
119- 'project_uuid ' => data_get ( $ service , ' environment.project.uuid ' ) ,
120- 'environment_uuid ' => data_get ( $ service , ' environment.uuid ' ) ,
121- 'service_uuid ' => data_get ( $ service, ' uuid ' ) ,
152+ 'project_uuid ' => $ projectUuid ,
153+ 'environment_uuid ' => $ environmentUuid ,
154+ 'service_uuid ' => $ service-> uuid ,
122155 ]);
123156
124157 return $ service ;
0 commit comments