entryFor builds the page entry for a shortcut, or returns false if the shortcut is unknown.
(name, baseURL, appID, displayAppID string)
| 275 | // entryFor builds the page entry for a shortcut, or returns false if the |
| 276 | // shortcut is unknown. |
| 277 | func entryFor(name, baseURL, appID, displayAppID string) (pageEntry, bool) { |
| 278 | if resource, ok := resourceURLs[name]; ok { |
| 279 | url := resource.Default |
| 280 | if appID != "" && resource.AppPath != "" { |
| 281 | url = fmt.Sprintf("%s/apps/%s/%s", baseURL, appID, resource.AppPath) |
| 282 | } |
| 283 | return pageEntry{Shortcut: name, URL: url}, true |
| 284 | } |
| 285 | |
| 286 | if target, ok := dashboardTargets[name]; ok { |
| 287 | return pageEntry{ |
| 288 | Shortcut: name, |
| 289 | URL: dashboardURL(baseURL, displayAppID, target), |
| 290 | RequiresLogin: true, |
| 291 | }, true |
| 292 | } |
| 293 | |
| 294 | return pageEntry{}, false |
| 295 | } |
| 296 | |
| 297 | // allEntries returns every shortcut, sorted by name. |
| 298 | func (opts *OpenOptions) allEntries() []pageEntry { |
no test coverage detected