function loadOsType()

in plugin-azure-server/src/main/resources/buildServerResources/images.vm.js [1381:1413]


  function loadOsType(newUrl) {
    var imageUrl = newUrl || self.image().imageUrl();
    if (!imageUrl) {
      return;
    }

    var url = getBasePath() +
      "&resource=osType" +
      "&imageUrl=" + encodeURIComponent(imageUrl) +
      "&region=" + self.image().region();

    self.loadingOsType(true);

    $.post(url, getCredentials()).then(function (response) {
      var $response = $j(response);
      var errors = getErrors($response);
      if (errors) {
        self.image().imageUrl.setError(errors);
        return;
      } else {
        self.image().imageUrl.clearError();
      }

      var osType = $response.find("osType").text();
      self.osType(osType);
      self.image().osType(osType);
    }, function (error) {
      self.errorResources("Failed to load data: " + error.message);
      console.log(error);
    }).always(function () {
      self.loadingOsType(false);
    });
  }