Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Commit 421f6a0

Browse files
committed
Prepare 'no data found' view
1 parent a5a6e26 commit 421f6a0

3 files changed

Lines changed: 37 additions & 19 deletions

File tree

app/public/styles/ehevi/custom.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,7 @@
4242
.ehevi .text-primary {
4343
color: var(--primary);
4444
}
45+
46+
.ehevi .zeroMargin {
47+
margin: 0 !important;
48+
}

app/public/views/userView/data/table/noDataView.js

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,34 +35,37 @@ const modes = {
3535
waiting: 1,
3636
};
3737

38-
export default function noDataView(
39-
model, dataPointer,
40-
) {
38+
export default function noDataView(model, dataPointer, anyFiltersActive) {
4139
const [mode, setMode] = useState(modes.waiting);
40+
4241
const goBackBtn = h('button.btn.btn-primary.m3', {
4342
onclick: () => model.removeCurrentData(),
4443
}, 'Go back');
44+
4545
const reloadBtn = h('button.btn.btn-primary.m3', {
4646
onclick: async () => {
4747
if (mode() === modes.waiting) {
4848
await model.sync();
49-
50-
/*
51-
* Await model.fetchedData.reqForData(true);
52-
* model.notify();
53-
* document.location.reload(true);
54-
*/
5549
} else {
5650
model.fetchedData.reqForData(true);
5751
}
5852
setMode(modes.requested);
5953
},
6054
}, 'Reload');
61-
const noDataMessage = h('h3', 'No data found');
55+
56+
const clearFiltersBtn = h('button.btn.btn-secondary.m3', {
57+
onclick: () => {
58+
model.goToDefaultPageUrl(dataPointer.page);
59+
},
60+
}, 'Clear filters');
61+
62+
const noDataMessage = h('h3', 'Nothing found');
6263
const noDataExplanation = h('h5', `${
63-
dataPointer.page === pageNames.periods
64-
? 'Please synchronize with outer services'
65-
: 'There is no data to be displayed here'
64+
anyFiltersActive
65+
? 'There is no data that matches your request'
66+
: dataPointer.page === pageNames.periods
67+
? 'Please synchronize with outer services'
68+
: 'There is no data to be displayed here'
6669
}`);
6770

6871
const noPeriodsView = h('.loginDiv.top-100', [
@@ -79,9 +82,20 @@ export default function noDataView(
7982
goBackBtn,
8083
]);
8184

82-
return dataPointer.page === pageNames.periods
83-
? mode() === modes.requested
84-
? 'loading'
85-
: noPeriodsView
86-
: noDataView;
85+
const noMatchingDataView = h('.loginDiv.top-100', [
86+
h('.nothing-found-90'),
87+
noDataMessage,
88+
noDataExplanation,
89+
h('.flex-row',
90+
clearFiltersBtn,
91+
goBackBtn),
92+
]);
93+
94+
return anyFiltersActive
95+
? noMatchingDataView
96+
: dataPointer.page === pageNames.periods
97+
? mode() === modes.requested
98+
? 'loading'
99+
: noPeriodsView
100+
: noDataView;
87101
}

app/public/views/userView/data/table/tablePanel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export default function tablePanel(model, runs, detectors) {
128128
]),
129129
data.rows.length > 15 ? pager(model, data) : ''))
130130
: ''
131-
: noDataView(model, dataPointer),
131+
: noDataView(model, dataPointer, anyFiltersActive),
132132
h('.modal', { id: 'pageSettingsModal' },
133133
h('.modal-content.abs-center.p3', {
134134
id: 'pageSettingsModalContent',

0 commit comments

Comments
 (0)