Skip to content

Commit

Permalink
fix(ui): display tags in desc order and fix autocomplete payload (#3251)
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Coenen <benjamin.coenen@corp.ovh.com>
  • Loading branch information
bnjjj authored and yesnault committed Aug 23, 2018
1 parent 23d3c5a commit f6c30c5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
10 changes: 6 additions & 4 deletions engine/vcs/github/client_tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,13 @@ func (g *githubClient) Tags(ctx context.Context, fullname string) ([]sdk.VCSTag,
g.Cache.SetWithTTL(cache.Key("vcs", "github", "tags", g.OAuthToken, "/repos/"+fullname+"/tags"), tags, 61*60)

tagsResult := make([]sdk.VCSTag, len(tags))
for i, tag := range tags {
tagsResult[i] = sdk.VCSTag{
Tag: strings.Replace(tag.Ref, "refs/tags/", "", 1),
Sha: tag.Object.Sha,
j := 0
for i := len(tags) - 1; i >= 0; i-- {
tagsResult[j] = sdk.VCSTag{
Tag: strings.Replace(tags[i].Ref, "refs/tags/", "", 1),
Sha: tags[i].Object.Sha,
}
j++
}

return tagsResult, nil
Expand Down
7 changes: 6 additions & 1 deletion ui/resources/cds-hint.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,15 @@
} else {
lastIndexOfComma += (lastIndexOfPrefix + prefix.length + 1);
}
var inc = 0;

if (text.indexOf(prefix + ' ') !== -1) {
inc = 1;
}

return {
list: payloadCompletionList,
from: { line: cur.line, ch: lastIndexOfPrefix + prefix.length + 1},
from: { line: cur.line, ch: lastIndexOfPrefix + prefix.length + inc},
to: CodeMirror.Pos(cur.line, lastIndexOfComma)
};
});
Expand Down

0 comments on commit f6c30c5

Please sign in to comment.