@@ -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) => {
109108const 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 */
118117const 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
0 commit comments