[JIRA] (JENKINS-60766) Credential icon names should be extracted as string constants

0 views
Skip to first unread message

chris+jenkins@chriskilding.com (JIRA)

unread,
Jan 14, 2020, 10:39:08 AM1/14/20
to jenkinsc...@googlegroups.com
Chris Kilding created an issue
 
Jenkins / Improvement JENKINS-60766
Credential icon names should be extracted as string constants
Issue Type: Improvement Improvement
Assignee: Unassigned
Components: credentials-plugin
Created: 2020-01-14 15:38
Priority: Minor Minor
Reporter: Chris Kilding

I would like my credential provider's implementations of the standard credential types to use the same icons as the built-in disk credentials provider, since this follows user expectations. (Indeed a user of my provider has filed a bug because they differ.)

But although the credential icons seem to be provided centrally, the icon class name strings are not available centrally (as static constants). Instead they are returned inline in the disk credentials provider descriptors. For example:

public class UsernamePasswordCredentialsImpl 
    extends BaseStandardCredentials
    implements StandardUsernamePasswordCredentials {

    // ...

    @Extension(ordinal = 1)
    public static class DescriptorImpl extends BaseStandardCredentialsDescriptor {

        @Override
        public String getIconClassName() {
            // We can't access this from downstream providers
            return "icon-credentials-userpass";
        }
    }

This means the only way to use those strings in downstream credential providers is to copy and paste them. Icon rendering will break if the name strings change in future.

Solution: The icon class names should be available as public static string constants somewhere in the credentials plugin.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

chris+jenkins@chriskilding.com (JIRA)

unread,
Jan 14, 2020, 10:50:07 AM1/14/20
to jenkinsc...@googlegroups.com
Chris Kilding commented on Improvement JENKINS-60766
 
Re: Credential icon names should be extracted as string constants

I suppose the same also applies to the credential display names (which are also inlined in the credential descriptor methods), if we want downstream credential providers to be able to share them as well. The i18n makes that a bit trickier.

Reply all
Reply to author
Forward
0 new messages