Skip to content

Commit

Permalink
simplify by using 'optional' update of filesButtons
Browse files Browse the repository at this point in the history
  • Loading branch information
qqmyers committed Jul 28, 2020
1 parent 398459c commit dc19fdc
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
2 changes: 0 additions & 2 deletions src/main/webapp/dataset.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -807,8 +807,6 @@
</div>
<!-- Create/Save Dataset Button Panel BTM editMode -->
<div class="button-block" jsf:rendered="#{!empty DatasetPage.editMode}">
<!-- completionButtons panel needed to mirror panel in editdatafiles.xhtml - AllUploadsFinished has to update the buttons there so an element of the same name is needed here, despite the fact that no button update is needed in dataset create mode -->
<p:outputPanel id="completionButtons"></p:outputPanel>
<p:commandButton id="save" styleClass="btn btn-default" value="#{DatasetPage.editMode == 'CREATE' ? bundle['file.addBtn'] : bundle.saveChanges}" onclick="checkNewlyRestricted();PF('blockDatasetForm').show();"/>
<p:commandButton id="cancel" styleClass="btn btn-link" value="#{bundle.cancel}" action="#{DatasetPage.cancel}" process="@this" update="@form" rendered="#{DatasetPage.editMode != 'CREATE'}" oncomplete="javascript:bind_bsui_components();">
<f:setPropertyActionListener target="#{DatasetPage.selectedTabIndex}" value="#{DatasetPage.editMode == 'METADATA' ? 1 : DatasetPage.selectedTabIndex}"/>
Expand Down
6 changes: 3 additions & 3 deletions src/main/webapp/editFilesFragment.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
disabled="#{lockedFromEdits || !(datasetPage || EditDatafilesPage.showFileUploadComponent()) }"
listener="#{EditDatafilesPage.handleFileUpload}"
process="filesTable"
update=":datasetForm:filesTable, @([id$=completionButtons])"
update=":datasetForm:filesTable, @([id$=filesButtons])"
label="#{bundle['file.selectToAddBtn']}"
oncomplete="javascript:bind_bsui_components();uploadFinished(PF('fileUploadWidget'));"
onstart="javascript:uploadWidgetDropRemoveMsg();uploadStarted();"
Expand Down Expand Up @@ -282,7 +282,7 @@

<p:commandButton id="updateEditDataFilesButtonsForUpload" action="#{EditDatafilesPage.uploadFinished()}" update="datasetForm:editDataFilesButtons" rendered="#{showFileButtonUpdate}" style="display:none"/>
<p:commandButton id="updateEditDataFilesButtonsForDelete" action="#{EditDatafilesPage.deleteFilesCompleted()}" update="datasetForm:editDataFilesButtons" rendered="#{showFileButtonUpdate}" style="display:none"/>
<p:commandButton id="AllUploadsFinished" action="#{EditDatafilesPage.uploadFinished()}" update="datasetForm:completionButtons,datasetForm:contentOfHttpPanel,datasetForm:fileUpload,datasetForm:dropBoxUserButton,datasetForm:uploadMessage,datasetForm:rsyncPanel,datasetForm:filesCounts,datasetForm:filesTable" oncomplete="javascript:bind_bsui_components();javascript:uploadWidgetDropMsg();" style="display:none"/>
<p:commandButton id="AllUploadsFinished" action="#{EditDatafilesPage.uploadFinished()}" update="@([id$=filesButtons]),datasetForm:contentOfHttpPanel,datasetForm:fileUpload,datasetForm:dropBoxUserButton,datasetForm:uploadMessage,datasetForm:rsyncPanel,datasetForm:filesCounts,datasetForm:filesTable" oncomplete="javascript:bind_bsui_components();javascript:uploadWidgetDropMsg();" style="display:none"/>
<p:commandButton id="dropBoxUploadFinished" action="#{EditDatafilesPage.uploadFinished()}" update="datasetForm:fileUpload,datasetForm:dropBoxUserButton,datasetForm:dropBoxUploadMessage,datasetForm:rsyncPanel,datasetForm:filesCounts,datasetForm:filesTable" style="display:none"/>
<p:commandButton id="allDeletesFinished" action="#{EditDatafilesPage.deleteFilesCompleted()}" update="datasetForm:fileUpload,datasetForm:dropBoxUserButton,datasetForm:uploadMessage,datasetForm:rsyncPanel,datasetForm:filesCounts,datasetForm:filesTable" oncomplete="javascript:bind_bsui_components();javascript:uploadWidgetDropMsg();" style="display:none"/>
<!-- ????? TODO: How scalable are all these hidden update buttons ????? -->
Expand All @@ -292,7 +292,7 @@
datasetForm:uploadMessage,
datasetForm:filesCounts,
datasetForm:filesTable,
datasetForm:completionButtons
datasetForm:filesButtons
????? -->

</div>
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/editdatafiles.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<!-- Create/Save Dataset Button Panel -->
<ui:fragment id="editDataFilesButtons">
<div class="button-block">
<p:outputPanel id="completionButtons">
<p:outputPanel id="filesButtons">
<div jsf:rendered="#{!(empty EditDatafilesPage.fileMetadatas and (datasetPage || EditDatafilesPage.showFileUploadFragment()))}">
<button id="savebutton" class="btn btn-default" onclick="checkNewlyRestricted();" type='button'>
#{bundle.saveChanges}
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/filesFragment.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
</div>
</div>
<div class="col-xs-7 text-right">
<p:outputPanel id="completionButtons">
<p:outputPanel id="filesButtons">
<!-- 4.2.1: replaced permissionsWrapper.canIssueUpdateDatasetCommand(DatasetPage.dataset) with DatasetPage.canUpdateDataset() -->
<!-- tab-header pull-right -->
<div jsf:id="uploadComputeBlock" class="button-block pull-right no-margin-top"
Expand Down

0 comments on commit dc19fdc

Please sign in to comment.