-
Notifications
You must be signed in to change notification settings - Fork 538
feat: Flux App Listing #5250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
feat: Flux App Listing #5250
Changes from 13 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
57e2b33
app list logic completed and proto is yet to generate
6852607
resolved the proto file issue
RajeevRanjan27 71dbc35
modified the proto and go routine call handling
RajeevRanjan27 8e74bfd
corrected the proto file datatype changes
RajeevRanjan27 8a8f760
applied the list of flux apps in given cluster
ae6f68a
resolved the conversations
3bf74dd
incorporated the review changes
27a0d9b
modified the fluxhandler and handlled the errros
668a1ad
resolved the coversations
5f3a04b
implemented the flush for streaming the data to client
41ee5d5
resolve the conflicts
53dc30a
incorporated comments
7d71b8c
Merge branch 'main' into flux-app-list
6137d5c
Added the spec file for fluxcd App listing
60fc2e2
Merge branch 'main' into flux-app-list
693ad55
Merge branch 'main' into flux-app-list
eb3befc
added the app type in the struct
RajeevRanjan27 87f0611
changed the fluxAppType data type
RajeevRanjan27 8f8b4a9
resolve
RajeevRanjan27 78df27f
resolve
RajeevRanjan27 80251ff
redefined the query params to process with
RajeevRanjan27 0c24d05
specs for flux app list added
RajeevRanjan27 134e08c
Merge branch 'main' into flux-app-list
RajeevRanjan27 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package fluxApplication | ||
|
||
import ( | ||
"errors" | ||
"github.com/devtron-labs/devtron/api/restHandler/common" | ||
"github.com/devtron-labs/devtron/pkg/auth/authorisation/casbin" | ||
"github.com/devtron-labs/devtron/pkg/fluxApplication" | ||
"go.uber.org/zap" | ||
"net/http" | ||
) | ||
|
||
type FluxApplicationRestHandler interface { | ||
ListFluxApplications(w http.ResponseWriter, r *http.Request) | ||
//GetApplicationDetail(w http.ResponseWriter, r *http.Request) | ||
} | ||
|
||
type FluxApplicationRestHandlerImpl struct { | ||
fluxApplicationService fluxApplication.FluxApplicationService | ||
logger *zap.SugaredLogger | ||
enforcer casbin.Enforcer | ||
} | ||
|
||
func NewFluxApplicationRestHandlerImpl(fluxApplicationService fluxApplication.FluxApplicationService, | ||
logger *zap.SugaredLogger, enforcer casbin.Enforcer) *FluxApplicationRestHandlerImpl { | ||
return &FluxApplicationRestHandlerImpl{ | ||
fluxApplicationService: fluxApplicationService, | ||
logger: logger, | ||
enforcer: enforcer, | ||
} | ||
|
||
} | ||
|
||
func (handler *FluxApplicationRestHandlerImpl) ListFluxApplications(w http.ResponseWriter, r *http.Request) { | ||
|
||
//handle super-admin RBAC | ||
token := r.Header.Get("token") | ||
if ok := handler.enforcer.Enforce(token, casbin.ResourceGlobal, casbin.ActionGet, "*"); !ok { | ||
common.WriteJsonResp(w, errors.New("unauthorized"), nil, http.StatusForbidden) | ||
return | ||
} | ||
v := r.URL.Query() | ||
clusterIdString := v.Get("clusterIds") | ||
RajeevRanjan27 marked this conversation as resolved.
Show resolved
Hide resolved
RajeevRanjan27 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
var clusterIds []int | ||
var err error | ||
//handling when the clusterIds string is not empty , if it is empty then it will fetch for all the active cluster | ||
if len(clusterIdString) > 0 { | ||
clusterIds, err = common.ExtractIntArrayQueryParam(w, r, "clusterIds") | ||
if err != nil { | ||
handler.logger.Errorw("error in getting cluster ids", "error", err, "clusterIds", clusterIds) | ||
RajeevRanjan27 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return | ||
RajeevRanjan27 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} | ||
handler.fluxApplicationService.ListFluxApplications(r.Context(), clusterIds, w) | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package fluxApplication | ||
|
||
import ( | ||
"github.com/gorilla/mux" | ||
) | ||
|
||
type FluxApplicationRouter interface { | ||
InitFluxApplicationRouter(fluxApplicationRouter *mux.Router) | ||
} | ||
|
||
type FluxApplicationRouterImpl struct { | ||
fluxApplicationRestHandler FluxApplicationRestHandler | ||
} | ||
|
||
func NewFluxApplicationRouterImpl(fluxApplicationRestHandler FluxApplicationRestHandler) *FluxApplicationRouterImpl { | ||
return &FluxApplicationRouterImpl{ | ||
fluxApplicationRestHandler: fluxApplicationRestHandler, | ||
} | ||
} | ||
|
||
func (impl *FluxApplicationRouterImpl) InitFluxApplicationRouter(fluxApplicationRouter *mux.Router) { | ||
fluxApplicationRouter.Path(""). | ||
Methods("GET"). | ||
HandlerFunc(impl.fluxApplicationRestHandler.ListFluxApplications) | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package fluxApplication | ||
|
||
import ( | ||
"github.com/devtron-labs/devtron/pkg/fluxApplication" | ||
"github.com/google/wire" | ||
) | ||
|
||
var FluxApplicationWireSet = wire.NewSet( | ||
fluxApplication.NewFluxApplicationServiceImpl, | ||
wire.Bind(new(fluxApplication.FluxApplicationService), new(*fluxApplication.FluxApplicationServiceImpl)), | ||
|
||
NewFluxApplicationRestHandlerImpl, | ||
wire.Bind(new(FluxApplicationRestHandler), new(*FluxApplicationRestHandlerImpl)), | ||
|
||
NewFluxApplicationRouterImpl, | ||
wire.Bind(new(FluxApplicationRouter), new(*FluxApplicationRouterImpl)), | ||
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.