Merge pull request #3458 from xyz-li/app-fix
Fix nil pointer and missing router
This commit is contained in:
@@ -200,11 +200,14 @@ func (conf *Config) ToMap() map[string]bool {
|
||||
}
|
||||
|
||||
if name == "openpitrix" {
|
||||
if conf.OpenPitrixOptions.IsEmpty() {
|
||||
// openpitrix is always true
|
||||
result[name] = true
|
||||
if conf.OpenPitrixOptions == nil {
|
||||
result["openpitrix.appstore"] = false
|
||||
} else {
|
||||
result["openpitrix.appstore"] = true
|
||||
result["openpitrix.appstore"] = conf.OpenPitrixOptions.AppStoreConfIsEmpty()
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
if c.Field(i).IsNil() {
|
||||
@@ -240,10 +243,6 @@ func (conf *Config) stripEmptyOptions() {
|
||||
conf.LdapOptions = nil
|
||||
}
|
||||
|
||||
if conf.OpenPitrixOptions != nil && conf.OpenPitrixOptions.IsEmpty() {
|
||||
conf.OpenPitrixOptions = nil
|
||||
}
|
||||
|
||||
if conf.NetworkOptions != nil && conf.NetworkOptions.IsEmpty() {
|
||||
conf.NetworkOptions = nil
|
||||
}
|
||||
|
||||
@@ -455,6 +455,21 @@ func AddToContainer(c *restful.Container, ksInfomrers informers.InformerFactory,
|
||||
DataFormat("limit=%d,page=%d").
|
||||
DefaultValue("limit=10,page=1")))
|
||||
|
||||
webservice.Route(webservice.GET("/workspaces/{workspace}/applications").
|
||||
To(handler.ListApplications).
|
||||
Returns(http.StatusOK, api.StatusOK, models.PageableResponse{}).
|
||||
Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}).
|
||||
Doc("List all applications within the specified workspace").
|
||||
Param(webservice.QueryParameter(params.ConditionsParam, "query conditions, connect multiple conditions with commas, equal symbol for exact query, wave symbol for fuzzy query e.g. name~a").
|
||||
Required(false).
|
||||
DataFormat("key=value,key~value").
|
||||
DefaultValue("")).
|
||||
Param(webservice.PathParameter("workspace", "the workspace of the project.").Required(true)).
|
||||
Param(webservice.QueryParameter(params.PagingParam, "paging query, e.g. limit=100,page=1").
|
||||
Required(false).
|
||||
DataFormat("limit=%d,page=%d").
|
||||
DefaultValue("limit=10,page=1")))
|
||||
|
||||
webservice.Route(webservice.GET("/workspaces/{workspace}/clusters/{cluster}/applications").
|
||||
To(handler.ListApplications).
|
||||
Returns(http.StatusOK, api.StatusOK, models.PageableResponse{}).
|
||||
@@ -464,7 +479,8 @@ func AddToContainer(c *restful.Container, ksInfomrers informers.InformerFactory,
|
||||
Required(false).
|
||||
DataFormat("key=value,key~value").
|
||||
DefaultValue("")).
|
||||
Param(webservice.PathParameter("namespace", "the name of the project.").Required(true)).
|
||||
Param(webservice.PathParameter("workspace", "the workspace of the project.").Required(true)).
|
||||
Param(webservice.PathParameter("cluster", "the cluster of the project.").Required(true)).
|
||||
Param(webservice.QueryParameter(params.PagingParam, "paging query, e.g. limit=100,page=1").
|
||||
Required(false).
|
||||
DataFormat("limit=%d,page=%d").
|
||||
@@ -479,7 +495,7 @@ func AddToContainer(c *restful.Container, ksInfomrers informers.InformerFactory,
|
||||
Required(false).
|
||||
DataFormat("key=value,key~value").
|
||||
DefaultValue("")).
|
||||
Param(webservice.PathParameter("namespace", "the name of the project.").Required(true)).
|
||||
Param(webservice.PathParameter("cluster", "the cluster of the project.").Required(true)).
|
||||
Param(webservice.QueryParameter(params.PagingParam, "paging query, e.g. limit=100,page=1").
|
||||
Required(false).
|
||||
DataFormat("limit=%d,page=%d").
|
||||
@@ -494,6 +510,7 @@ func AddToContainer(c *restful.Container, ksInfomrers informers.InformerFactory,
|
||||
Required(false).
|
||||
DataFormat("key=value,key~value").
|
||||
DefaultValue("")).
|
||||
Param(webservice.PathParameter("workspace", "the workspace of the project.").Required(true)).
|
||||
Param(webservice.PathParameter("cluster", "the name of the cluster.").Required(true)).
|
||||
Param(webservice.PathParameter("namespace", "the name of the project").Required(true)).
|
||||
Param(webservice.QueryParameter(params.PagingParam, "paging query, e.g. limit=100,page=1").
|
||||
|
||||
@@ -39,7 +39,7 @@ func (s *Options) Validate() []error {
|
||||
return errors
|
||||
}
|
||||
|
||||
func (s *Options) IsEmpty() bool {
|
||||
func (s *Options) AppStoreConfIsEmpty() bool {
|
||||
return s.S3Options == nil || s.S3Options.Endpoint == ""
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user