Skip to content
This repository has been archived by the owner on Aug 3, 2020. It is now read-only.

Commit

Permalink
Merge pull request #95 from mrajashree/readme
Browse files Browse the repository at this point in the history
Populate path to readme
  • Loading branch information
Craig Jellick authored Nov 30, 2016
2 parents b0aec56 + f39e6ef commit 0303724
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions service/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,11 +357,13 @@ func LoadTemplateDetails(w http.ResponseWriter, r *http.Request) {
}

if r.URL.RawQuery != "" && strings.EqualFold("image", r.URL.RawQuery) {
callToRead(catalogID, templateID, versionID, w, r)
loadFile(catalogID, templateID, versionID, manager.PathToImage, w, r)
return
}

if r.URL.RawQuery != "" && strings.EqualFold("readme", r.URL.RawQuery) {
callToRead(catalogID, templateID, versionID, w, r)
loadFile(catalogID, templateID, versionID, manager.PathToReadme, w, r)
return
}
Expand All @@ -371,6 +373,7 @@ func LoadTemplateDetails(w http.ResponseWriter, r *http.Request) {
} else {
loadTemplateMetadata(catalogID, templateID, w, r)
}

}

//loadTemplateMetadata returns template metadata for the provided templateId
Expand Down Expand Up @@ -413,6 +416,21 @@ func loadTemplateMetadata(catalogID string, templateID string, w http.ResponseWr
}
}

func callToRead(catalogID string, templateID string, versionID string, w http.ResponseWriter, r *http.Request) {
path := catalogID + "/" + templateID + "/" + versionID
log.Debugf("Request to load template version: %s", path)
rancherVersion := r.URL.Query().Get("minimumRancherVersion_lte")
if rancherVersion != "" {
log.Debugf("and if minimumRancherVersion <= %s", rancherVersion)
}
rancherVersionGte := r.URL.Query().Get("maximumRancherVersion_gte")
if rancherVersionGte != "" {
log.Debugf("and if maximumRancherVersion >= %s", rancherVersionGte)
}

manager.ReadTemplateVersion(catalogID, templateID, versionID)
}

//loadTemplateVersion returns template version details for the provided templateId/versionId
func loadTemplateVersion(catalogID string, templateID string, versionID string, w http.ResponseWriter, r *http.Request) {
//read the template version from disk
Expand Down

0 comments on commit 0303724

Please sign in to comment.