Reworked how search error works with repository table [SCI-5961]

This commit is contained in:
Martin Artnik 2021-09-06 10:12:10 +02:00
parent 5f21e3296e
commit 206ba3d79c
3 changed files with 25 additions and 1 deletions

View file

@ -4,10 +4,28 @@
@import "constants";
.repository-table {
position: relative;
.dataTables_filter {
float: right;
}
.repository-table-error {
background: $color-white;
display: none;
height: 200px;
padding: 1em;
position: absolute;
text-align: center;
top: 176px;
width: 100%;
z-index: 1;
&.active {
display: block;
}
}
// hack only for firefox
@-moz-document url-prefix() {
input.form-control[type="file"] {

View file

@ -34,6 +34,7 @@ window.initBMTFilter = () => {
this.reloadDataTable();
},
clearFilters() {
this.clearSearchError();
this.dataTableElement.removeAttr('data-external-ids');
this.reloadDataTable();
},
@ -41,10 +42,14 @@ window.initBMTFilter = () => {
$(this.$el).closest('.dropdown').removeClass('open');
},
reloadDataTable() {
this.clearSearchError();
this.dataTableElement.DataTable().ajax.reload();
},
handleSearchError(error) {
setTimeout(() => $('.dataTables_empty').html(error), 100);
$('.repository-table-error').addClass('active').html(error);
},
clearSearchError() {
$('.repository-table-error').removeClass('active').html('');
}
}
});

View file

@ -1,4 +1,5 @@
<div class="repository-table">
<div class="repository-table-error"></div>
<table id="repository-table-<%= repository.id %>" class="table"
data-current-uri="<%= request.original_url %>"
data-repository-id="<%= repository.id %>"