NIFI-259:

- Addressing some minor layout issues with the view state dialog.
- Ensuring appropriate locking when attempting to clear state.
This commit is contained in:
Matt Gilman 2016-01-13 16:57:59 -05:00
parent c65829f0cb
commit f0d8f73f26
4 changed files with 49 additions and 23 deletions

View File

@ -43,6 +43,17 @@ public class NiFiServiceFacadeLock {
}
}
@Around("within(org.apache.nifi.web.NiFiServiceFacade+) && "
+ "execution(* clear*(..))")
public Object clearLock(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
writeLock.lock();
try {
return proceedingJoinPoint.proceed();
} finally {
writeLock.unlock();
}
}
@Around("within(org.apache.nifi.web.NiFiServiceFacade+) && "
+ "execution(* delete*(..))")
public Object deleteLock(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {

View File

@ -20,13 +20,13 @@
<div class="setting">
<div class="setting-name">Name</div>
<div class="setting-field">
<span id="component-state-name"></span>
<div id="component-state-name"></div>
</div>
</div>
<div class="setting">
<div class="setting-name">Description</div>
<div class="setting-field">
<span id="component-state-description"></span>
<div id="component-state-description" class="ellipsis multiline"></div>
</div>
</div>
<div id="component-state-filter-controls">

View File

@ -23,13 +23,13 @@
position: absolute;
overflow: hidden;
width: 600px;
height: 500px;
font-size: 10px;
z-index: 1301;
display: none;
}
#component-state-description {
width: 580px;
height: 50px;
}
@ -79,10 +79,12 @@
#clear-link-container {
margin-top: 16px;
margin-bottom: 18px;
}
#clear-link.disabled {
color: #bbb;
font-style: italic;
text-decoration: none !important;
cursor: default !important;
}

View File

@ -224,27 +224,40 @@ nf.ComponentState = (function () {
// clear state link
$('#clear-link').on('click', function () {
if ($(this).hasClass('disabled') === false) {
// clear the state
var revision = nf.Client.getRevision();
var component = $('#component-state-table').data('component');
$.ajax({
type: 'POST',
url: component.uri + '/state/clear-requests',
data: {
version: revision.version,
clientId: revision.clientId
},
dataType: 'json'
}).done(function (response) {
// update the revision
nf.Client.setRevision(response.revision);
var componentStateTable = $('#component-state-table');
// clear the table
clearTable();
// ensure there is state to clear
var componentStateGrid = componentStateTable.data('gridInstance');
var stateEntryCount = componentStateGrid.getDataLength();
// reload the table with no state
loadComponentState()
}).fail(nf.Common.handleAjaxError);
if (stateEntryCount > 0) {
// clear the state
var revision = nf.Client.getRevision();
var component = componentStateTable.data('component');
$.ajax({
type: 'POST',
url: component.uri + '/state/clear-requests',
data: {
version: revision.version,
clientId: revision.clientId
},
dataType: 'json'
}).done(function (response) {
// update the revision
nf.Client.setRevision(response.revision);
// clear the table
clearTable();
// reload the table with no state
loadComponentState()
}).fail(nf.Common.handleAjaxError);
} else {
nf.Dialog.showOkDialog({
dialogContent: 'This component has no state to clear.',
overlayBackground: false
});
}
}
});
@ -336,7 +349,7 @@ nf.ComponentState = (function () {
// populate the name/description
$('#component-state-name').text(component.name);
$('#component-state-description').text(componentState.stateDescription);
$('#component-state-description').text(componentState.stateDescription).ellipsis();
// store the component
componentStateTable.data('component', component);