Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-58526] Feature/more icons #4

Merged
merged 6 commits into from
Jul 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/images/gitlab-commit.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/images/gitlab-mr.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/images/gitlab-tag.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,9 @@ protected List<Action> retrieveActions(@NonNull SCMHead head, SCMHeadEvent event
null,
branchUrl
));
result.add(new GitLabLink("gitlab-branch", branchUrl));
GitLabLink gitLabLink = new GitLabLink("gitlab-branch", branchUrl);
gitLabLink.setDisplayName("Branch");
result.add(gitLabLink);
if (head.getName().equals(gitlabProject.getDefaultBranch())) {
result.add(new PrimaryInstanceMetadataAction());
}
Expand All @@ -482,7 +484,9 @@ protected List<Action> retrieveActions(@NonNull SCMHead head, SCMHeadEvent event
null,
mergeUrl
));
result.add(new GitLabLink("gitlab-branch", mergeUrl));
GitLabLink gitLabLink = new GitLabLink("gitlab-mr", mergeUrl);
gitLabLink.setDisplayName("Merge Request");
result.add(gitLabLink);
} else if(head instanceof GitLabTagSCMHead) {
String tagUrl = UriTemplate.buildFromTemplate(GitLabHelper.getServerUrlFromName(serverName)+'/'+projectPath)
.path("tree")
Expand All @@ -495,7 +499,9 @@ protected List<Action> retrieveActions(@NonNull SCMHead head, SCMHeadEvent event
null,
tagUrl
));
result.add(new GitLabLink("gitlab-branch", tagUrl));
GitLabLink gitLabLink = new GitLabLink("gitlab-tag", tagUrl);
gitLabLink.setDisplayName("Tag");
result.add(gitLabLink);
}
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,19 @@ public static Size byDimensions(String dimensions) {
public static final String ICON_PROJECT = "gitlab-project";
public static final String ICON_BRANCH = "gitlab-branch";
public static final String ICON_GITLAB = "gitlab-logo";
public static final String ICON_COMMIT = "gitlab-commit";
public static final String ICON_MR = "gitlab-mr";
public static final String ICON_TAG = "gitlab-tag";
private static final String ICON_PATH = "plugin/gitlab-branch-source/images/";

@Initializer
public static void initialize() {
addIcon(ICON_GITLAB);
addIcon(ICON_PROJECT);
addIcon(ICON_BRANCH);
addIcon(ICON_COMMIT);
addIcon(ICON_MR);
addIcon(ICON_TAG);
}

public static String iconFileName(String name, Size size) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import org.jenkins.ui.icon.IconSpec;
import org.kohsuke.stapler.Stapler;

import static org.apache.commons.lang.StringUtils.defaultIfBlank;

/**
* Link to GitLab
*/
Expand All @@ -25,9 +27,16 @@ public class GitLabLink implements Action, IconSpec {
@NonNull
private final String url;

private String displayName;

public GitLabLink(@NonNull String iconClassName, @NonNull String url) {
this.iconClassName = iconClassName;
this.url = url;
this.displayName = "";
}

public void setDisplayName(@NonNull String displayName) {
this.displayName = displayName;
}

@NonNull
Expand Down Expand Up @@ -56,7 +65,7 @@ public String getIconFileName() {

@Override
public String getDisplayName() {
return "GitLab";
return defaultIfBlank(displayName, "GitLab");
}

@Override
Expand Down
Binary file added src/main/webapp/images/16x16/gitlab-commit.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/webapp/images/16x16/gitlab-mr.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/webapp/images/16x16/gitlab-tag.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/webapp/images/24x24/gitlab-commit.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/webapp/images/24x24/gitlab-mr.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/webapp/images/24x24/gitlab-tag.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/webapp/images/32x32/gitlab-commit.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/webapp/images/32x32/gitlab-mr.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/webapp/images/32x32/gitlab-tag.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/webapp/images/48x48/gitlab-commit.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/webapp/images/48x48/gitlab-mr.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/webapp/images/48x48/gitlab-tag.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.