Skip to content

Commit

Permalink
Chore: removed and cleaned up some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mtapia01 committed Jan 8, 2025
1 parent 60ad529 commit d2995c1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 40 deletions.
9 changes: 5 additions & 4 deletions src/components/ModelRun.vue
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,14 @@
<span v-if="item.modeled_type === $store.getters.region_modeling_types.LINEAR_SCALED">{{ $store.state.terms.get_term_for_locale("model_runs.types.simple") }}</span>
</template>
</v-data-table>
<v-divider></v-divider>
<Plotly :data="modification_scatter_data" :layout="modification_scatter_layout"></Plotly>
<p v-if="!has_region_modifications">No modifications to the model's region settings in this run.</p>

<v-divider></v-divider>
<h4>Crop Modifications</h4>
<v-tab>Table</v-tab>
<v-tab>Scatterplot</v-tab>
<!-- <v-tab>Table</v-tab>-->
<!-- <v-tab>Scatterplot</v-tab>-->
<v-window>
<!-- <v-window-item>-->
<v-data-table
:dense="$store.getters.user_settings('dense_tables')"
:headers="crop_modifications_headers"
Expand All @@ -237,6 +237,7 @@
<span v-if="item.max_land_area_proportion >= 0">{{ item.max_land_area_proportion }}</span>
</template>
</v-data-table>
<v-divider></v-divider>
<Plotly :data="crop_scatter_data" :layout="crop_scatter_layout"></Plotly>
</v-window>
<p v-if="!has_crop_modifications">No modifications to the model's crop settings in this run.</p>
Expand Down
58 changes: 22 additions & 36 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,43 +168,29 @@ export const stormchaser_utils = {
},

download_array_as_csv(args) {
/* Also shamelessly adapted and commented from
https://www.developintelligence.com/blog/2017/04/use-javascript-to-export-your-data-as-csv/- */
let output_data, filename, link;
let csv = stormchaser_utils.convert_array_of_objects_to_csv({ // get the CSV representation of the data
data: args.data,
lookups: args.lookups,
drop_fields: args.drop_fields
});
if (csv == null) return;

filename = args.filename || 'export.csv'; // set the filename
/* Also shamelessly adapted and commented from
https://www.developintelligence.com/blog/2017/04/use-javascript-to-export-your-data-as-csv/- */
let output_data, filename, link;
let csv = stormchaser_utils.convert_array_of_objects_to_csv({ // get the CSV representation of the data
data: args.data,
lookups: args.lookups,
drop_fields: args.drop_fields
});
if (csv == null) return;

if (!csv.match(/^data:text\/csv/i)) {
csv = 'data:text/csv;charset=utf-8,' + csv;
}
output_data = encodeURI(csv); // get the URI the browser will use to download the data
filename = args.filename || 'export.csv'; // set the filename

link = document.createElement('a'); // attach the URI to the document, hide it, and click it
link.style.display = "none";
link.setAttribute('href', output_data);
link.setAttribute('download', filename);
link.click();
},
// default_title_getter = function(stormchaser){return stormchaser.$store.getters.current_model_area.name};
// function set_window_title(title, stormchaser){
// document.title = `${default_title_getter(stormchaser)}: ${title}` || default_title_getter(stormchaser);
// }

// utils = {
// model_run_status_text,
// regions_as_geojson,
// download_regions_as_shapefile,
// download_array_as_csv,
// set_window_title
// }
if (!csv.match(/^data:text\/csv/i)) {
csv = 'data:text/csv;charset=utf-8,' + csv;
}
output_data = encodeURI(csv); // get the URI the browser will use to download the data

link = document.createElement('a'); // attach the URI to the document, hide it, and click it
link.style.display = "none";
link.setAttribute('href', output_data);
link.setAttribute('download', filename);
link.click();
},
}
// make the function available within Vue objects
// const app = createApp({})
// Object.defineProperty(app.config.globalProperties, '$stormchaser_utils', {value: utils});


0 comments on commit d2995c1

Please sign in to comment.