create resource related UI changes
<li>
<a data-toggle="tooltip" data-placement="left"
title="A shortcut (or reference) to an external web application that functions with HydroShare data resources."
- data-modal-title="Create a App Connector"
+ data-modal-title="Create an App Connector"
data-modal-input-title="Enter the name for the new app connector."
data-value="ToolResource">
<img src="{% static 'img/resource-icons/webapp48x48.png' %}"
</div>
<br>
<input id="input-title" class="form-control textinput textInput" maxlength="300"
- name="value" type="text" placeholder="Resource Title" value="">
+ name="value" type="text" placeholder="Title" value="">
</div>
</div>
<div class="modal-footer">
formData.append("csrfmiddlewaretoken", csrftoken);
formData.append("title", title);
formData.append("resource-type", type);
+ let contentType;
+ if (type === "CompositeResource") {
+ contentType = "resource";
+ }
+ else if (type === "CollectionResource") {
+ contentType = "collection";
+ }
+ else {
+ contentType = "app connector";
+ }
- customAlert("Creating your resource", "Please wait...", "success", -1); // Persistent alert
+ const alertTitle = "Creating your " + contentType;
+ customAlert(alertTitle, "Please wait...", "success", -1); // Persistent alert
$("html").css("cursor", "progress");
+ const errorMsg = "Failed to create " + contentType + ".";
+
$.ajax({
type: "POST",
data: formData,
else {
console.log(response);
$(".custom-alert").alert('close'); // Dismiss previous alert
- customAlert("Error", 'Failed to create resource.', "error", 6000);
+ customAlert("Error", errorMsg, "error", 6000);
$("html").css("cursor", "initial");
$(".navbar-inverse .res-dropdown").toggleClass("disabled", false);
}
error: function (response) {
console.log(response);
$(".custom-alert").alert('close'); // Dismiss previous alert
- customAlert("Error", 'Failed to create resource.', "error", 6000);
+ customAlert("Error", errorMsg, "error", 6000);
$("html").css("cursor", "initial");
$(".navbar-inverse .res-dropdown").toggleClass("disabled", false);
}
