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

[sofy-ai] Extract inline script block in sofy/jenkins/plugin/ViewWebTestRunResults/index.jelly

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: Minor Minor
    • sofy-ai-plugin

      Problem

      == Inline Script Block
      Line: 10
      ----
      <script>
                      let id = '${it.webTestRun.webTestRunID}';
                      let token = '${it.apiToken}';
      
                      fetch("https://api.sofy.ai/v1/websites/testresults/summary?testrunid=" + id, {
                          headers: {
                              "SubscriptionKey": token
                          }
                      }).then(res => res.json()
                      )
                      .
                      then(data => data[0] || data
                      )
                      .
                      then((summary) => {
                          document.getElementById('performance_td').innerHTML = summary.Audit_Performance_Score + "%";
                      document.getElementById('bestpractice_td').innerHTML = summary.Audit_BestPractices_Score + "%";
                      document.getElementById('progressive_td').innerHTML = summary.Audit_Progressive_Score + "%";
                      document.getElementById('seo_td').innerHTML = summary.Audit_SEO_Score + "%";
                      document.getElementById('accessibility_td').innerHTML = summary.Audit_Accessibility_Score + "%";
                      })
                      .
                      catch(e => console.log(e)
                      )
                      ;
                  </script>
      ----
      

      Solution

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

            Unassigned Unassigned
            basil Basil Crow
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: