diff --git a/src/routes/team/+page.svelte b/src/routes/team/+page.svelte index 5a674fca..702ad55c 100644 --- a/src/routes/team/+page.svelte +++ b/src/routes/team/+page.svelte @@ -27,7 +27,29 @@ let team_array = []; let filter_value = ''; let team = data.result; - team_array = team; + team_array = team.reverse(); + team_array = team_array.sort(compare); + team_array.sort( + (/** @type {{ related_org: string; }} */ a, /** @type {{ related_org: string; }} */ b) => + // b.last_name.toLowerCase() - a.last_name.toLowerCase() || + + (b.related_org === 'GERICS') - (a.related_org === 'GERICS') || + (b.related_org === 'Uni Jena') - (a.related_org === 'Uni Jena') || + (b.related_org === 'WITS-GCI') - (a.related_org === 'WITS-GCI') || + (b.related_org === 'NUST') - (a.related_org === 'NUST') || + (b.related_org === 'Gobabeb') - (a.related_org === 'Gobabeb') + ); + + function compare(a, b) { + if (a.last_name < b.last_name) { + return -1; + } + if (a.last_name > b.last_name) { + return 1; + } + return 0; + } + // team_array = team_array.filter((team) => team.org =="Uni Jena") /** diff --git a/src/routes/water_budget/+page.svelte b/src/routes/water_budget/+page.svelte index e814329f..2dd09ec5 100644 --- a/src/routes/water_budget/+page.svelte +++ b/src/routes/water_budget/+page.svelte @@ -36,6 +36,8 @@ "wget --input-file 'http://127.0.0.1:8000/climate/get_climate_txt?hash=21cd9c90faad4dc19b73c8c0ae75d51a'"; let wget_add_args = '-r -H -N --cut-dirs=2'; + let type = 'water_budget'; + // set default search type // select_search_type('collection'); @@ -103,7 +105,8 @@ } async function fetch_foldercontent() { - const custom_url = "https://leutra.geogr.uni-jena.de/backend_geoportal/climate/get_content" + const custom_url = + 'https://leutra.geogr.uni-jena.de/backend_geoportal/climate/get_content?type=' + type; try { const res = await fetch(custom_url, { @@ -130,6 +133,14 @@ console.log(error); } } + let search_term = ''; + function filter_folder_data() { + //folder_data.filter(( /** @type {(string | string[])[]} */ data) => data[0].includes(search_term)); + const folder_data_new = Object.values(folder_data).filter((item) => + item[0].includes(search_term) + ); + folder_data = folder_data_new; + } /** * @param {{ srcElement: { value: string; checked: any; }; }} e @@ -148,7 +159,8 @@ // the response of this request is a string containing a wget request with the // mentioned hash, that should download all selected files from our server async function handle_checkbox_submit() { - const custom_url = 'https://leutra.geogr.uni-jena.de/backend_geoportal/climate/select_for_wget'; + const custom_url = + 'https://leutra.geogr.uni-jena.de/backend_geoportal/climate/select_for_wget?type=' + type; let checked_boxes = []; for (let i = 0; i < folder_checkbox_bools.length; i++) { @@ -180,53 +192,84 @@ } } + /** + * @param {string} new_type + */ + function set_type(new_type) { + if (new_type == 'water_budget') { + font_bold_ind = ''; + font_bold_col = 'font-bold'; + type = new_type; + } else if (new_type == 'water_budget_bias') { + font_bold_col = ''; + font_bold_ind = 'font-bold'; + type = new_type; + } + fetch_foldercontent(); + } + // array with current geo_data['facets']['file_id'] +
+ + +
+
+ +
+ {#if folder_data != null}
-
- Filename -
-
- Filesize -
-
- Last modified -
-
- Download Link -
+
Filename
+
Filesize
+
Last modified
+
Download Link
{#each Object.values(folder_data['content']) as datapoint, i} - -
- -  {datapoint[0]} -
- -
- {datapoint[1]} -
- -
- {datapoint[2]} -
- -
-  download -
+ {#if datapoint[0].toLowerCase().includes(search_term.toLowerCase())} + +
+ +  {datapoint[0]} +
+ +
+ {datapoint[1]} +
+ +
+ {datapoint[2]} +
+ +
+  download +
+ {/if} {/each} Generate wget link
{:else}