[xray-connector] Extract inline script block in com/xpandit/plugins/xrayjenkins/task/XrayExportBuilder/config.jelly

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      Problem

      == Inline Script Block
      Line: 31
      ----
      <script type="text/javascript">
                  (function(Q) {
                      function toggleCredentials(ele) {
                          var isUserAuthJiraInstance = ele
                                      .find("#exportCucumber_selectInstance_${descriptor.defaultBuildID()}")
                                      .find('option:selected')
                                      .text()
                                      .indexOf("[User Auth required] ") === 0;
      
                          const $selectParent = ele
                                  .find('#exportCucumber_credentialId_${descriptor.defaultBuildID()}')
                                  .parent()
                                  .parent();
          
                          if (isUserAuthJiraInstance) {
                              $selectParent.show();
                          } else {
                              $selectParent.hide();
                          }
                      };
                      
                      setTimeout(function () {
                          Q(".export-features-wrapper").each(function () {
                              const wrapperID = Q(this).attr("id");
                              Q(this).removeClass("export-features-wrapper");
                              var ele = Q(Q("#" + wrapperID)
                                  .parents('.xray-export-feature')
                                  .get(0));
                      
                              toggleCredentials(ele);
                              ele.find("#exportCucumber_selectInstance_${descriptor.defaultBuildID()}")
                                  .change(function () {
                                      toggleCredentials(ele);
                                  });
                                  
                              setTimeout(function() {
                                  toggleCredentials(ele);
                              }, 1000);
                          });
                      }, 500);
                  })(jQuery);
              </script>
      ----
      

      Solution

      https://www.jenkins.io/doc/developer/security/csp/#inline-javascript-blocks

            Assignee:
            Unassigned
            Reporter:
            Basil Crow
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: