Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-34297

Create an Extension for Client Interface

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • saltstack-plugin
    • None

      At the moment the plug-in distinguishes a few different client interfaces (local, local_batch and runner). There are a few if's/else's in the code and Jelly, and some logic and parameters that are different per client interface.

      This logic could be replaced by the Extension API available in Jenkins. This way it would be easier to add more client interfaces, without having to add another if statement.

      e.g.

        <f:dropdownList name="clientInterfaces" title="Client Interface">
          <f:dropdownListBlock title="local" value="local" selected="${instance.clientInterface == 'local'}">
            <st:include page="local.jelly" class="com.waytta.SaltAPIBuilder"/>
          </f:dropdownListBlock>
          <f:dropdownListBlock title="local_batch" value="local_batch" selected="${instance.clientInterface == 'local_batch'}">
            <st:include page="local_batch.jelly" class="com.waytta.SaltAPIBuilder"/>
          </f:dropdownListBlock>
          <f:dropdownListBlock title="runner" value="runner" selected="${instance.clientInterface == 'runner'}">
            <st:include page="runner.jelly" class="com.waytta.SaltAPIBuilder"/>
          </f:dropdownListBlock>
        </f:dropdownList>
      

      Would become something like:

            <f:entry title="Client Interface">
                <f:hetero-list name="clientInterface" targetType="${descriptor.clientInterface}"
                     descriptors="${descriptor.getApplicableClientInterfaces(it)}" items="${instance.clientInterface}"
                     addCaption="Add action" hasHeader="true"/>
            </f:entry>
      

      And we would have to write some Java code implement the Extension in the saltstack-plugin and deprecate old constructors for XStream backward compatibility (hardest/most boring part I think?)

            mchugh19 Christian McHugh
            kinow Bruno P. Kinoshita
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: