Skip to content

Commit 826ea91

Browse files
committed
cleanup
1 parent 7c89951 commit 826ea91

5 files changed

Lines changed: 23 additions & 19 deletions

File tree

lib/public/views/Runs/Overview/exportTriggerAndModal.js

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ import { h } from '/js/src/index.js';
1717
/**
1818
* Export form component, containing the fields to export, the export type and the export button
1919
*
20-
* @param {RunsOverviewModel} exportModel the runsOverviewModel
21-
* @param {array} runs the runs to export
20+
* @param {DataExportModel} exportModel export model
2221
* @param {ModalHandler} modalHandler The modal handler, used to dismiss modal after export
2322
*
2423
* @return {vnode[]} the form component
@@ -54,13 +53,13 @@ const exportForm = (exportModel, modalHandler) => {
5453
}, name)),
5554
]);
5655

57-
const exportTypeSelectionHeader = [
58-
h('.form-check-label.f4.mt1', 'Export type'),
59-
h('.form-check-label.f6', 'Select output format'),
56+
const exportTypeSelectionLabels = [
57+
h('label.form-check-label.f4.mt1', 'Export type'),
58+
h('label.form-check-label.f6', 'Select output format'),
6059
];
6160

6261
const exportTypeSelect = h('.flex-row.g3', exportTypes.map((exportType) => {
63-
const id = `runs-export-type-${exportType}`;
62+
const id = `data-export-type-${exportType}`;
6463
return h('.form-check', [
6564
h('input.form-check-input', {
6665
id,
@@ -84,23 +83,23 @@ const exportForm = (exportModel, modalHandler) => {
8483
await exportModel.createExport();
8584
modalHandler.dismiss();
8685
},
87-
}, dataAvailable ? 'Export' : 'Loading data');
86+
}, dataAvailable ? 'Export' : 'Loading data...');
8887

8988
const dataLength = exportModel.items.match({ Success: ({ length } = {}) => length, Other: () => null });
9089
const { totalExistingItemsCount } = exportModel;
9190

9291
const truncatedDataInfo = dataLength && dataLength < totalExistingItemsCount
9392
? h(
9493
'#truncated-export-warning.warning',
95-
`The data export is limited to ${dataLength} entries, only the last data will be exported`,
94+
`The data export is limited to ${dataLength} entries, only the most recent data will be exported`,
9695
)
9796
: null;
9897

9998
return [
100-
dataAvailable ? truncatedDataInfo : spinner({ size: 2, absolute: false }),
99+
truncatedDataInfo,
101100
fieldsSelectionLabels,
102101
fieldsSelection,
103-
exportTypeSelectionHeader,
102+
exportTypeSelectionLabels,
104103
exportTypeSelect,
105104
exportBtn,
106105
];
@@ -109,16 +108,21 @@ const exportForm = (exportModel, modalHandler) => {
109108
const errorDisplay = () => h('.danger', 'Data fetching failed');
110109

111110
/**
112-
* A function to construct the exports runs screen
111+
* A function to construct the exports data screen
113112
*
114-
* @param {ExportModel} exportModel pass the model to access the defined functions
113+
* @param {DataExportModel} exportModel pass the model to access the defined functions
115114
* @param {ModalHandler} modalHandler The modal handler, used to dismiss modal after export
116115
* @return {Component} Return the view of the inputs
117116
*/
118117
const exportModal = (exportModel, modalHandler) => {
119118
exportModel.callForData();
119+
const dataLoading = exportModel.items.match({ Loading: () => true, Other: () => false });
120+
120121
return h('div#export-data-modal', [
121-
h('h2', 'Export data'),
122+
h('.flex-row', [
123+
h('h2.w-50', 'Export data'),
124+
dataLoading ? h('.w-50', spinner({ size: 2, absolute: false })) : null,
125+
]),
122126
exportModel.items.match({
123127
NotAsked: () => errorDisplay(),
124128
Failure: () => errorDisplay(),
@@ -130,7 +134,7 @@ const exportModal = (exportModel, modalHandler) => {
130134
/**
131135
* Builds a button which will open popover for data export
132136
*
133-
* @param {ExportModel} exportModel runs overview model
137+
* @param {DataExportModel} exportModel export model
134138
* @param {ModelModel} modalModel modal model
135139
* @param {object} [displayConfiguration] additional display options
136140
* @param {boolean} [displayConfiguration.autoMarginLeft = true] if true margin left is set to auto, otherwise not

test/public/runs/overview.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const { runService } = require('../../../lib/server/services/run/RunService.js')
4646

4747
const { expect } = chai;
4848

49-
const EXPORT_RUNS_TRIGGER_SELECTOR = '#export-runs-trigger';
49+
const EXPORT_RUNS_TRIGGER_SELECTOR = '#export-data-trigger';
5050

5151
module.exports = () => {
5252
let page;
@@ -885,7 +885,7 @@ module.exports = () => {
885885
const truncatedExportWarning = await page.waitForSelector('#export-runs-modal #truncated-export-warning');
886886
expect(await truncatedExportWarning.evaluate((warning) => warning.innerText))
887887
.to
888-
.equal('The runs export is limited to 100 entries, only the last runs will be exported (sorted by run number)');
888+
.equal('The data export is limited to 100 entries, only the most recent data will be exported');
889889
});
890890

891891
it('should successfully display disabled runs export button when there is no runs available', async () => {

test/public/runs/runsPerDataPass.overview.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ module.exports = () => {
268268

269269
// First export
270270
await pressElement(page, '#actions-dropdown-button .popover-trigger', true);
271-
await pressElement(page, '#export-runs-trigger');
271+
await pressElement(page, '#export-data-trigger');
272272
await page.waitForSelector('#export-runs-modal');
273273
await page.waitForSelector('#send:disabled');
274274
await page.waitForSelector('.form-control');

test/public/runs/runsPerLhcPeriod.overview.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ module.exports = () => {
179179
await waitForTableLength(page, 4);
180180
});
181181

182-
const EXPORT_RUNS_TRIGGER_SELECTOR = '#export-runs-trigger';
182+
const EXPORT_RUNS_TRIGGER_SELECTOR = '#export-data-trigger';
183183

184184
it('should successfully export all runs per lhc Period', async () => {
185185
await page.evaluate(() => {

test/public/runs/runsPerSimulationPass.overview.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ module.exports = () => {
191191
});
192192

193193
it('should successfully export runs', async () => {
194-
const EXPORT_RUNS_TRIGGER_SELECTOR = '#export-runs-trigger';
194+
const EXPORT_RUNS_TRIGGER_SELECTOR = '#export-data-trigger';
195195

196196
const targetFileName = 'runs.json';
197197

0 commit comments

Comments
 (0)