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

[openstack-cloud] Extract inline script blocks in jenkins/plugins/openstack/compute/JCloudsCloud/computerSet.jelly

      Problems

      == Inline Script Block
      Line: 17
      ----
      <script>
                                  var templates = [];
                                  Behaviour.register({
                                      ".jclouds-provision-button" : function (e) {
                                          var notification = document.getElementById("os-notifications")
                                          var submitHandler = function(type, args, item) {
                                              fetch("${rootURL}/cloud/"+item.value.cloud+"/provision", {
                                                  method: "POST",
                                                  headers: crumb.wrap({}),
                                                  body: new URLSearchParams({ name: item.value.template })
                                              }).then((rsp) => {
                                                  if (!rsp.ok) {
                                                      rsp.text().then((responseText) => {
                                                          alert('Provisioning failed: ' + responseText)
                                                          console.log('Provisioning failed: ' + rsp.status + " " + rsp.statusText + ": " + responseText)
                                                      })
                                                  } else {
                                                      hoverNotification('Provisioning started', notification);
                                                  }
                                              });
                                          };
                                          var items = templates[e.name].map(function (template) {
                                              return {
                                                  text: template,
                                                  value: {template: template, cloud: e.name},
                                                  onclick: {fn: submitHandler}
                                              }
                                          });
                                          var menu = new YAHOO.widget.Button(e, { type: "menu", menu: items, name: "name" });
                                      }
                                  });
                              </script>
      ----
      
      == Inline Script Block
      Line: 50
      ----
      <script>
                              templates["${it.name}"] = [
                                  <j:forEach var="t" items="${it.templates}">
                                      "${t.name}",
                                  </j:forEach>
                              ];
                          </script>
      ----
      

      Solution

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

          [JENKINS-74277] [openstack-cloud] Extract inline script blocks in jenkins/plugins/openstack/compute/JCloudsCloud/computerSet.jelly

          Basil Crow created issue -
          Basil Crow made changes -
          Assignee Original: Oliver Gondža [ olivergondza ]
          Basil Crow made changes -
          Description Original: h4. Problems

          {noformat}
          == Inline Script Block
          Line: 17
          ----
          <script>
                                      var templates = [];
                                      Behaviour.register({
                                          ".jclouds-provision-button" : function (e) {
                                              var notification = document.getElementById("os-notifications")
                                              var submitHandler = function(type, args, item) {
                                                  fetch("${rootURL}/cloud/"+item.value.cloud+"/provision", {
                                                      method: "POST",
                                                      headers: crumb.wrap({}),
                                                      body: new URLSearchParams({ name: item.value.template })
                                                  }).then((rsp) => {
                                                      if (!rsp.ok) {
                                                          rsp.text().then((responseText) => {
                                                              alert('Provisioning failed: ' + responseText)
                                                              console.log('Provisioning failed: ' + rsp.status + " " + rsp.statusText + ": " + responseText)
                                                          })
                                                      } else {
                                                          hoverNotification('Provisioning started', notification);
                                                      }
                                                  });
                                              };
                                              var items = templates[e.name].map(function (template) {
                                                  return {
                                                      text: template,
                                                      value: {template: template, cloud: e.name},
                                                      onclick: {fn: submitHandler}
                                                  }
                                              });
                                              var menu = new YAHOO.widget.Button(e, { type: "menu", menu: items, name: "name" });
                                          }
                                      });
                                  </script>
          ----

          == Inline Script Block
          Line: 50
          ----
          <script>
                                  templates["${it.name}"] = [
                                      <j:forEach var="t" items="${it.templates}">
                                          "${t.name}",
                                      </j:forEach>
                                  ];
                              </script>
          ----

          == Inline Script Block
          Line: 17
          ----
          <script>
                                      var templates = [];
                                      Behaviour.register({
                                          ".jclouds-provision-button" : function (e) {
                                              var notification = document.getElementById("os-notifications")
                                              var submitHandler = function(type, args, item) {
                                                  fetch("${rootURL}/cloud/"+item.value.cloud+"/provision", {
                                                      method: "POST",
                                                      headers: crumb.wrap({}),
                                                      body: new URLSearchParams({ name: item.value.template })
                                                  }).then((rsp) => {
                                                      if (!rsp.ok) {
                                                          rsp.text().then((responseText) => {
                                                              alert('Provisioning failed: ' + responseText)
                                                              console.log('Provisioning failed: ' + rsp.status + " " + rsp.statusText + ": " + responseText)
                                                          })
                                                      } else {
                                                          hoverNotification('Provisioning started', notification);
                                                      }
                                                  });
                                              };
                                              var items = templates[e.name].map(function (template) {
                                                  return {
                                                      text: template,
                                                      value: {template: template, cloud: e.name},
                                                      onclick: {fn: submitHandler}
                                                  }
                                              });
                                              var menu = new YAHOO.widget.Button(e, { type: "menu", menu: items, name: "name" });
                                          }
                                      });
                                  </script>
          ----

          == Inline Script Block
          Line: 50
          ----
          <script>
                                  templates["${it.name}"] = [
                                      <j:forEach var="t" items="${it.templates}">
                                          "${t.name}",
                                      </j:forEach>
                                  ];
                              </script>
          ----
          {noformat}

          h4. Solution

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

          {noformat}
          == Inline Script Block
          Line: 17
          ----
          <script>
                                      var templates = [];
                                      Behaviour.register({
                                          ".jclouds-provision-button" : function (e) {
                                              var notification = document.getElementById("os-notifications")
                                              var submitHandler = function(type, args, item) {
                                                  fetch("${rootURL}/cloud/"+item.value.cloud+"/provision", {
                                                      method: "POST",
                                                      headers: crumb.wrap({}),
                                                      body: new URLSearchParams({ name: item.value.template })
                                                  }).then((rsp) => {
                                                      if (!rsp.ok) {
                                                          rsp.text().then((responseText) => {
                                                              alert('Provisioning failed: ' + responseText)
                                                              console.log('Provisioning failed: ' + rsp.status + " " + rsp.statusText + ": " + responseText)
                                                          })
                                                      } else {
                                                          hoverNotification('Provisioning started', notification);
                                                      }
                                                  });
                                              };
                                              var items = templates[e.name].map(function (template) {
                                                  return {
                                                      text: template,
                                                      value: {template: template, cloud: e.name},
                                                      onclick: {fn: submitHandler}
                                                  }
                                              });
                                              var menu = new YAHOO.widget.Button(e, { type: "menu", menu: items, name: "name" });
                                          }
                                      });
                                  </script>
          ----

          == Inline Script Block
          Line: 50
          ----
          <script>
                                  templates["${it.name}"] = [
                                      <j:forEach var="t" items="${it.templates}">
                                          "${t.name}",
                                      </j:forEach>
                                  ];
                              </script>
          ----
          {noformat}

          h4. 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: