Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: client/cmd/logdog_annotee/link.go

Issue 1916813002: Annotee: Add project name support. (Closed) Base URL: https://github.com/luci/luci-go@logdog-project-collector-butler
Patch Set: Better URL generation. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | client/cmd/logdog_annotee/main.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package main
6
7 import (
8 "fmt"
9 "net/url"
10 "strings"
11
12 "github.com/luci/luci-go/common/config"
13 "github.com/luci/luci-go/common/logdog/types"
14 )
15
16 type coordinatorLinkGenerator struct {
17 base types.StreamName
18 project config.ProjectName
19 prefix types.StreamName
20 }
21
22 func (g *coordinatorLinkGenerator) canGenerateLinks() bool {
23 return (g.base != "" && g.prefix != "")
24 }
25
26 func (g *coordinatorLinkGenerator) GetLink(names ...types.StreamName) string {
27 links := make([]string, len(names))
28 for i, n := range names {
29 streamName := string(g.prefix.Join(n))
30 proj := g.project
31 if proj == "" {
32 proj = "_"
33 }
34 links[i] = fmt.Sprintf("s=%s", url.QueryEscape(fmt.Sprintf("%s/% s", proj, streamName)))
35 }
36 return fmt.Sprintf("https://%s.appspot.com/v/?%s", g.base, strings.Join( links, "&"))
37 }
OLDNEW
« no previous file with comments | « no previous file | client/cmd/logdog_annotee/main.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698