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

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

    • 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

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

          Basil Crow created issue -
          Basil Crow made changes -
          Assignee Original: Waqas Maqsood [ sofy_waqas ]
          Basil Crow made changes -
          Description Original: h4. Problems

          {noformat}
          == 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>
          ----

          == 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>
          ----
          {noformat}

          h4. Solution

          [https://www.jenkins.io/doc/developer/security/csp/#inline-javascript-blocks]
          New: h4. Problem

          {noformat}
          == 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>
          ----
          {noformat}

          h4. Solution

          [https://www.jenkins.io/doc/developer/security/csp/#inline-javascript-blocks]
          Summary Original: [sofy-ai] Extract inline script blocks in sofy/jenkins/plugin/ViewWebTestRunResults/index.jelly New: [sofy-ai] Extract inline script block in sofy/jenkins/plugin/ViewWebTestRunResults/index.jelly

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

              Created:
              Updated: