diff --git a/backend/src-common/src/main/java/com/siemens/sw360/datahandler/db/ComponentDatabaseHandler.java b/backend/src-common/src/main/java/com/siemens/sw360/datahandler/db/ComponentDatabaseHandler.java
index fe94981cd..47c5913dd 100644
--- a/backend/src-common/src/main/java/com/siemens/sw360/datahandler/db/ComponentDatabaseHandler.java
+++ b/backend/src-common/src/main/java/com/siemens/sw360/datahandler/db/ComponentDatabaseHandler.java
@@ -511,6 +511,7 @@ public RequestStatus deleteComponent(String id, User user) throws SW360Exception
assertNotNull(component);
final Set releaseIds = component.getReleaseIds();
+ if (releaseIds!=null && releaseIds.size()>0) return RequestStatus.IN_USE;
if (checkIfInUse(releaseIds)) return RequestStatus.IN_USE;
diff --git a/frontend/sw360-portlet/src/main/webapp/html/components/detail.jsp b/frontend/sw360-portlet/src/main/webapp/html/components/detail.jsp
index 66cd6dfa6..9fb640f79 100644
--- a/frontend/sw360-portlet/src/main/webapp/html/components/detail.jsp
+++ b/frontend/sw360-portlet/src/main/webapp/html/components/detail.jsp
@@ -6,6 +6,7 @@
~ which accompanies this distribution, and is available at
~ http://www.eclipse.org/legal/epl-v10.html
--%>
+
<%@include file="/html/init.jsp" %>
<%@ taglib prefix="sw360" uri="/WEB-INF/customTags.tld" %>
diff --git a/frontend/sw360-portlet/src/main/webapp/html/components/edit.jsp b/frontend/sw360-portlet/src/main/webapp/html/components/edit.jsp
index 3fb6495d6..e2617b6d8 100644
--- a/frontend/sw360-portlet/src/main/webapp/html/components/edit.jsp
+++ b/frontend/sw360-portlet/src/main/webapp/html/components/edit.jsp
@@ -75,12 +75,11 @@
?' +
- '
The component contains
' +
- '
linked releases
' +
- '
attachments
' +
- '', deleteComponent)"
+ '
The component contains
attachments
'
+ , deleteComponent)"
value="Delete "
disabled="disabled" title="Deletion is disabled as the component is used."
+ disabled="disabled" title="Deletion is disabled as the component contains releases."
>
diff --git a/frontend/sw360-portlet/src/main/webapp/html/components/includes/components/clearingStatus.jspf b/frontend/sw360-portlet/src/main/webapp/html/components/includes/components/clearingStatus.jspf
index c2539916a..899e470b0 100644
--- a/frontend/sw360-portlet/src/main/webapp/html/components/includes/components/clearingStatus.jspf
+++ b/frontend/sw360-portlet/src/main/webapp/html/components/includes/components/clearingStatus.jspf
@@ -61,7 +61,7 @@
});
- oTable = $('#releasesTable').dataTable({
+ oTable = $('#releasesTable').DataTable({
"sPaginationType": "full_numbers",
"aaData": result,
"aoColumns": [
@@ -70,7 +70,7 @@
{"sTitle": "Clearing state"},
{"sTitle": "Clearing report"},
{"sTitle": "Mainline state"},
- {"sTitle": "Action"}
+ {"sTitle": "Actions"}
]
});
@@ -79,7 +79,7 @@
}
- //This can not be document ready function as liferay definitions need to be loaded first
+ <%--This can not be document ready function as liferay definitions need to be loaded first--%>
$(window).load(function () {
createClearingTable();
});
@@ -95,14 +95,14 @@
releaseId: id
},
success: function (data) {
- if (data.result == 'SUCCESS')
+ if (data.result == 'SUCCESS') {
oTable.row('#' + id).remove().draw();
+ }
else if (data.result == 'SENT_TO_MODERATOR') {
$.alert("You may not delete the release, but a request was sent to a moderator!");
} else if (data.result == 'IN_USE') {
- $.alert("The release is used by another component (release) or project");
- }
- else {
+ $.alert("I could not delete the release, since it is used by another component (release) or project");
+ } else {
$.alert("I could not delete the release!");
}
},
diff --git a/frontend/sw360-portlet/src/main/webapp/html/components/view.jsp b/frontend/sw360-portlet/src/main/webapp/html/components/view.jsp
index c6a1a6879..b3a7ebf21 100644
--- a/frontend/sw360-portlet/src/main/webapp/html/components/view.jsp
+++ b/frontend/sw360-portlet/src/main/webapp/html/components/view.jsp
@@ -277,8 +277,7 @@
$('#componentsTable_last').hide();
}
- function deleteComponent(id, name, linkedReleasesSize, attachmentsSize) {
-
+ function deleteComponent(id, name, numberOfReleases, attachmentsSize) {
function deleteComponentInternal() {
jQuery.ajax({
type: 'POST',
@@ -287,6 +286,7 @@
data: {
componentid: id
},
+
success: function (data) {
if (data.result == 'SUCCESS') {
oTable.row('#' + id).remove().draw();
@@ -294,8 +294,10 @@
else if (data.result == 'SENT_TO_MODERATOR') {
$.alert("You may not delete the component, but a request was sent to a moderator!");
}
- else {
- $.alert("I could not delete the component!");
+ else if (data.result == 'IN_USE') {
+ $.alert("I could not delete the component, since it is in use.");
+ } else {
+ $.alert("I could not delete the component.");
}
},
error: function () {
@@ -304,14 +306,15 @@
});
}
- var confirmMessage = "Do you really want to delete the component " + name + " ?";
- confirmMessage += (attachmentsSize > 0 || linkedReleasesSize > 0) ? "
" : "";
-
- deleteConfirmed(confirmMessage, deleteComponentInternal);
+ if (numberOfReleases > 0) {
+ $.alert("The component cannot be deleted, since it contains releases. Please delete the releases first.");
+ } else {
+ var confirmMessage = "Do you really want to delete the component " + name + " ?";
+ confirmMessage += (attachmentsSize > 0) ? "
The component " + name + " contains
" + attachmentsSize + " attachments
" : "";
+ deleteConfirmed(confirmMessage, deleteComponentInternal);
+ }
}
+
diff --git a/frontend/sw360-portlet/src/main/webapp/html/projects/view.jsp b/frontend/sw360-portlet/src/main/webapp/html/projects/view.jsp
index 8831c8a0a..a56a52523 100644
--- a/frontend/sw360-portlet/src/main/webapp/html/projects/view.jsp
+++ b/frontend/sw360-portlet/src/main/webapp/html/projects/view.jsp
@@ -218,12 +218,12 @@
$('#exportbutton').click(exportExcel);
$('.filterInput').on('input', function() {
$('#exportExcelButton').prop('disabled', true);
- //when filters are actually applied, page is refreshed and exportExcelButton enabled automatically
+ <%--when filters are actually applied, page is refreshed and exportExcelButton enabled automatically--%>
});
});
function useSearch(buttonId) {
- //we only want to search names starting with the value in the search box
+ <%-- we only want to search names starting with the value in the search box--%>
var val = $.fn.dataTable.util.escapeRegex($('#' + buttonId).val());
oTable.columns(0).search('^' + val, true).draw();
}
@@ -337,7 +337,7 @@
fillClearingFormAndOpenDialog(projectId);
}
- function deleteProject(projectId, name) {
+ function deleteProject(projectId, name, linkedProjectsSize, linkedReleasesSize, attachmentsSize) {
function deleteProjectInternal() {
jQuery.ajax({
@@ -354,7 +354,7 @@
else if (data.result == 'SENT_TO_MODERATOR') {
$.alert("You may not delete the project, but a request was sent to a moderator!");
} else if (data.result == 'IN_USE') {
- $.alert("The project is used by another project!");
+ $.alert("The project cannot be deleted, since it is used by another project!");
}
else {
$.alert("I could not delete the project!");
@@ -366,7 +366,6 @@
});
}
- }
var confirmMessage = "Do you really want to delete the project " + name + " ?";
confirmMessage += (linkedProjectsSize > 0 || linkedReleasesSize > 0 || attachmentsSize > 0) ? "