Skip to content

Commit

Permalink
Show message when preview returns nothing, don't allow edit operation…
Browse files Browse the repository at this point in the history
…, re #10074
  • Loading branch information
apeters committed Sep 26, 2023
1 parent d37b0b6 commit f280fc9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ define([
this.searchUrl = ko.observable();
this.caseInsensitive = ko.observable();
this.trim = ko.observable();
this.numberOfResources = ko.observable();
this.numberOfTiles = ko.observable();
this.numberOfResources = ko.observable(0);
this.numberOfTiles = ko.observable(0);
this.selectedCaseOperation = ko.observable();

this.caseOperations = [
Expand Down Expand Up @@ -94,6 +94,10 @@ define([
return ready;
});

this.allowEditOperation = ko.computed(() => {
return self.ready() && self.numberOfTiles() > 0;
})

this.addAllFormData = () => {
if (self.operation() == 'case'){
self.formData.append('operation', self.selectedCaseOperation());
Expand Down Expand Up @@ -187,7 +191,7 @@ define([
};

this.write = function() {
if (!self.ready()) {
if (!self.allowEditOperation()) {
return;
}
if (self.operation() === 'replace' && (!self.oldText() || !self.newText())){
Expand Down
1 change: 1 addition & 0 deletions arches/app/templates/javascript.htm
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,7 @@
etl-file-upload-message='{% trans "Use this workflow to upload a file with data that you want to use to create new data instances of a model." as etlFileUploadMessage %} "{{ etlFileUploadMessage|escapejs }}"'
etl-single-csv-title='{% trans "Import Format: Single .csv file" as etlSingleCSVTitle %} "{{ etlSingleCSVTitle|escapejs }}"'
bulk-data-edit-details='{% trans "Bulk Data Edit Details" as bulkDataEditDetails %} "{{ bulkDataEditDetails|escapejs }}"'
no-data-to-preview='{% trans "Nothing to update. Your data already meets your requirements." as noDataToPreview %} "{{ noDataToPreview|escapejs }}"'
resource-model-editied='{% trans "Resource Model Edited" as resourceModelEditied %} "{{ resourceModelEditied|escapejs }}"'
field-name-edited='{% trans "Field Name Edited" as fieldNameEdited %} "{{ fieldNameEdited|escapejs }}"'
edit-operation='{% trans "Edit Operation" as editOperation %} "{{ editOperation|escapejs }}"'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ <h3>
</section>
<!-- ko if: showPreview-->
<section class="etl-preview">
<!-- ko if: numberOfTiles() === 0 -->
<h3 style="margin-top: 0px;">
<span style="margin: 2px;" class="fa fa-info-circle"></span><span data-bind="text: $root.translations.noDataToPreview"></span>
</h3>
<!-- /ko -->
<!-- ko if: numberOfTiles() > 0 -->
<h3 style="margin-top: 0px;">
<span data-bind="text: $root.translations.previewCountStats(numberOfTiles()>5?5:numberOfTiles(),numberOfTiles(),numberOfResources())"></span>
</h3>
Expand Down Expand Up @@ -166,11 +172,12 @@ <h3 style="margin-top: 0px;color:red;" data-bind="if: numberOfTiles() > config.u
<!-- /ko -->
</tbody>
</table>
<!-- /ko -->
</section>
<!-- /ko -->
</div>
<div class="tabbed-workflow-footer, etl-module-footer">
<button style="margin-right: 8px;" data-bind="click: write, css: {disabled: !ready()}" class="btn btn-success">
<button style="margin-right: 8px;" data-bind="click: write, css: {disabled: !allowEditOperation()}" class="btn btn-success">
<span data-bind="text: $root.translations.start"></span>
</button>
</div>
Expand Down

0 comments on commit f280fc9

Please sign in to comment.