mirror of
https://github.com/portainer/portainer.git
synced 2025-07-25 00:09:40 +02:00
feat(endpoints): UX enhancements (#1943)
* feat(endpoints): add details about endpoints in datatable * feat(endpoint-details): add the ability to inspect/update azure endpoint * feat(endpoint-selector): disable placeholder selection
This commit is contained in:
parent
bfc49574b7
commit
9bb885629a
10 changed files with 122 additions and 39 deletions
|
@ -68,13 +68,16 @@ type (
|
|||
}
|
||||
|
||||
putEndpointsRequest struct {
|
||||
Name string `valid:"-"`
|
||||
URL string `valid:"-"`
|
||||
PublicURL string `valid:"-"`
|
||||
GroupID int `valid:"-"`
|
||||
TLS bool `valid:"-"`
|
||||
TLSSkipVerify bool `valid:"-"`
|
||||
TLSSkipClientVerify bool `valid:"-"`
|
||||
Name string `valid:"-"`
|
||||
URL string `valid:"-"`
|
||||
PublicURL string `valid:"-"`
|
||||
GroupID int `valid:"-"`
|
||||
TLS bool `valid:"-"`
|
||||
TLSSkipVerify bool `valid:"-"`
|
||||
TLSSkipClientVerify bool `valid:"-"`
|
||||
AzureApplicationID string `valid:"-"`
|
||||
AzureTenantID string `valid:"-"`
|
||||
AzureAuthenticationKey string `valid:"-"`
|
||||
}
|
||||
|
||||
postEndpointPayload struct {
|
||||
|
@ -143,7 +146,7 @@ func (handler *EndpointHandler) createAzureEndpoint(payload *postEndpointPayload
|
|||
|
||||
endpoint := &portainer.Endpoint{
|
||||
Name: payload.name,
|
||||
URL: payload.url,
|
||||
URL: proxy.AzureAPIBaseURL,
|
||||
Type: portainer.AzureEnvironment,
|
||||
GroupID: portainer.EndpointGroupID(payload.groupID),
|
||||
PublicURL: payload.publicURL,
|
||||
|
@ -405,8 +408,6 @@ func (handler *EndpointHandler) handleGetEndpoint(w http.ResponseWriter, r *http
|
|||
return
|
||||
}
|
||||
|
||||
endpoint.AzureCredentials = portainer.AzureCredentials{}
|
||||
|
||||
encodeJSON(w, endpoint, handler.Logger)
|
||||
}
|
||||
|
||||
|
@ -518,6 +519,18 @@ func (handler *EndpointHandler) handlePutEndpoint(w http.ResponseWriter, r *http
|
|||
endpoint.GroupID = portainer.EndpointGroupID(req.GroupID)
|
||||
}
|
||||
|
||||
if endpoint.Type == portainer.AzureEnvironment {
|
||||
if req.AzureApplicationID != "" {
|
||||
endpoint.AzureCredentials.ApplicationID = req.AzureApplicationID
|
||||
}
|
||||
if req.AzureTenantID != "" {
|
||||
endpoint.AzureCredentials.TenantID = req.AzureTenantID
|
||||
}
|
||||
if req.AzureAuthenticationKey != "" {
|
||||
endpoint.AzureCredentials.AuthenticationKey = req.AzureAuthenticationKey
|
||||
}
|
||||
}
|
||||
|
||||
folder := strconv.Itoa(int(endpoint.ID))
|
||||
if req.TLS {
|
||||
endpoint.TLSConfig.TLS = true
|
||||
|
|
|
@ -10,7 +10,8 @@ import (
|
|||
"github.com/portainer/portainer/crypto"
|
||||
)
|
||||
|
||||
const azureAPIBaseURL = "https://management.azure.com"
|
||||
// AzureAPIBaseURL is the URL where Azure API requests will be proxied.
|
||||
const AzureAPIBaseURL = "https://management.azure.com"
|
||||
|
||||
// proxyFactory is a factory to create reverse proxies to Docker endpoints
|
||||
type proxyFactory struct {
|
||||
|
@ -28,7 +29,7 @@ func (factory *proxyFactory) newHTTPProxy(u *url.URL) http.Handler {
|
|||
}
|
||||
|
||||
func newAzureProxy(credentials *portainer.AzureCredentials) (http.Handler, error) {
|
||||
url, err := url.Parse(azureAPIBaseURL)
|
||||
url, err := url.Parse(AzureAPIBaseURL)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue