-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Themes #208
Open
aswinm
wants to merge
300
commits into
testing
Choose a base branch
from
themes
base: testing
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Themes #208
Changes from 38 commits
Commits
Show all changes
300 commits
Select commit
Hold shift + click to select a range
104c5b2
Created button component
aswinm 27453a7
Add button component
aswinm 0660205
PR Comments fixes
aswinm 1b8f7f5
PR Comments fixes
aswinm dd762d7
Temporary rename
aswinm 418015f
Rename Shared to shared
aswinm ef2927e
Make branch mergeable
aswinm e59b55a
Title and Dialogue components
aswinm d050515
Close button component
aswinm 927f529
PR comments
aswinm 1502800
Formatting changes
aswinm 631ff1d
Rebase related changes
aswinm d4b9180
PR Comments
aswinm c25c838
PR Comments
aswinm fc1a4a5
Icon Button
aswinm 8bd3607
PR Comments
aswinm 8151a8c
List compoenent added
aswinm ad7a446
Update checkboxlist component
aswinm 85cf3a8
PR comments
aswinm eb457b0
Radio Button
aswinm de7e830
PR comments
aswinm 0c16b1e
Project list component
aswinm a37c413
PR comments
aswinm 814cdfe
Project list display
aswinm 26c6610
Apply state
aswinm 2b35dbc
PR comments
aswinm ed38baf
Project list styling
aswinm aa02f34
Project list Fixes
aswinm ceb299f
Data Selector component
aswinm 79ddcc5
New Project button
aswinm 541c730
Create ProjectListItem component
aswinm 47d8601
Get permalink for project in list
aswinm 1c6b457
Code refactor
aswinm 089ebf2
Load checkboxes from Meta API
aswinm c57a8ac
Comments
aswinm d58b0cb
Popup
aswinm 57d7d57
MapDecorator
aswinm 115b9c7
Bugs
mapcentia 01a4039
Layer switcher hooked up
mapcentia 0216f61
Formatting changes
aswinm b11d046
Code cleanup
aswinm f9e7473
Code cleanup
aswinm f030833
Clean up
mapcentia 9edd2dd
The two buttons "Pesticider" and "Nitrat" is now active. The last two…
mapcentia bfca812
Dashboard shell
aswinm dd0bcd1
Svgs added, ChemicalsListItem added
aswinm 354fcca
Dashboard shell
aswinm 8793bf2
React context
aswinm 3937745
Use Context to share info
aswinm 90e02fa
PlotComponent decoupling, populating checkbox list based on chart items
aswinm 29d0f4f
Delete measurement functionality
aswinm 4f05345
Remove drag and drop context code in old modal
aswinm 61440f5
Drag and drop functionality
aswinm 27563e7
Move functionality
aswinm f5a1cef
Remove profiles and plots feature
aswinm 897cb8c
Allow dashboard mode to be set from outside
aswinm 6f7c7b9
Allow adding a plot to dashboard via openDashboard function
aswinm 3be6087
Searching in chemicals list
aswinm 7ec7ff3
Accordion for chemicals list
aswinm b6a89ae
Fix issue with dashboard open
aswinm 33c9889
Top Bar
aswinm 3cc2482
Search
aswinm 36cd853
Top bar with changes
aswinm e2cf677
Subscription dialogue
aswinm 72d9f6d
Design changes
aswinm 9a2adda
Design changes to right side menu
aswinm 7a6d3ce
Merge remote-tracking branch 'origin/themes' into themes
mapcentia ee208fd
Packages
mapcentia 44cc34a
window.Calypso.render
aswinm dc9d730
Show time series now works
mapcentia d094c92
Add to dashboard in pop-up
mapcentia c8540ea
Start of "Selected" list in Dashboard
mapcentia 0f63113
Change chemicals display as per new format
aswinm 6e84df1
Enable calculations
aswinm 9fa4422
TODO
mapcentia 3cc05cc
Fix schema issue
aswinm dd304df
Merge branch 'themes' of https://github.com/mapcentia/watsonc into th…
mapcentia 0b3050d
Fix data format issue
aswinm ed3b1c9
Merge branch 'themes' of https://github.com/mapcentia/watsonc into th…
mapcentia 3cc5300
Add empty onclick to avoid warning
mapcentia 3da35e7
Add empty onclick to avoid warning
mapcentia 0b8fc3e
Make sure key is unique
mapcentia d4deefd
Use locname instead of loc_id
mapcentia d35af6e
Don't have a fixed height on buttons
mapcentia 4d8d047
Loop all time series and add them
mapcentia 9f25192
Add functionality to Ny graf button
aswinm 1a4af9c
Fetch plot layout from config
mapcentia 130904c
Use of trace object from database
mapcentia 5d118b6
More room for plots
mapcentia 05bbb6b
Bug fixes
aswinm b7d3ed9
Fix multiple deletion issues
aswinm 36954cb
Use of time-series names in pop-up and dashboard
mapcentia 7ed7c49
Merge branch 'themes' of https://github.com/mapcentia/watsonc into th…
mapcentia 1382414
Drag and drop issue fix
aswinm 0ee288d
Adjustments to the plot height
mapcentia fd232da
Open category by default and removal of hardcoded lists
mapcentia b55ceb5
Adjustments
mapcentia da86de9
Set correct name
mapcentia bacedb1
Buggy plot card dnd and sort is fixed
mapcentia 2689a36
Using data property directly
mapcentia 05b816a
Using data property directly
mapcentia da512d1
Using data property directly
mapcentia a2ef18d
Big clean up
mapcentia 199becf
Ready for lazy load
mapcentia 12f7702
Ready for lazy load
mapcentia fb92c4e
Fix
mapcentia eea8aaf
Fix
mapcentia 2a7a8b0
Fix of lazy load of all ts
mapcentia e950cfc
Fix of lazy load of all ts
mapcentia 09d0f7c
Clean up
mapcentia b8192fd
Clean up
mapcentia 0508ee9
Ready for a description
mapcentia 5da019f
Reformatted and changed fonts to Open Sans
MathiasBuus 384a055
Removed scrollbars
MathiasBuus bcc8bab
Undefined vars for full screen stripped
mapcentia 7d911a2
Fixed layout and started my stations
MathiasBuus a805670
Update DashboardContent.js
MathiasBuus 9015145
Fixed scrollbars and formatting of dashboard
MathiasBuus 140e8c0
Tilføjet fullscreen funktionalitet til plots
MathiasBuus 565b64b
Update DashboardContent.js
MathiasBuus 162118d
Added logic for session props
MathiasBuus 394ba1d
Undefined vars for full screen stripped
mapcentia 1e42979
Merge branch 'themes' of https://github.com/mapcentia/watsonc into th…
mapcentia 045df40
Dashboard is now store in snapshot, but without lazy loading data
mapcentia 17dd96f
Dashboard is now store in snapshot and lazy load data
mapcentia 24b8a8b
Merge branch 'themes' of https://github.com/mapcentia/watsonc into th…
MathiasBuus 841bad6
Dashboard is now store in snapshot and lazy load data
mapcentia 7158d6a
Added Getter for session properties
mapcentia d40f897
Added type ahead search and deleting of Valgte Datakilder
MathiasBuus 641f860
Merge branch 'themes' of https://github.com/mapcentia/watsonc into th…
MathiasBuus 07bc597
Update DashboardContent.js
MathiasBuus 2adcd6b
Relation names are now a property of plot, so they can be use in fetc…
mapcentia 49f4d1b
Merge
mapcentia c59f978
Handling of undefined
mapcentia daa2874
Colors
mapcentia 1c7f1a2
Started image carousel
MathiasBuus c72fe1e
Fixed multiple small things
MathiasBuus d662e6b
Fixed plotting
MathiasBuus 2df3d9b
Search and theme
mapcentia 2a09924
Update PlotComponent.js
MathiasBuus 362cf66
Merge branch 'themes' of https://github.com/mapcentia/watsonc into th…
MathiasBuus bb3adda
Styling and plotcomponent
MathiasBuus bb5a210
Update PlotComponent.js
MathiasBuus cab47bb
Aggregation and chemical layer functionality
MathiasBuus 96c6dd6
Cardlist layout and aggregation
MathiasBuus feaa0ce
Sum functionality
MathiasBuus 99e1c40
Bugs in source state (mixed up titles) and roboto as standard font
mapcentia ba5f12e
Font weight set to 300
mapcentia 6f07ec0
Fixed image spacing and Graph spacing
MathiasBuus 14924b1
Bug fixed
mapcentia 3bd1d6b
Merge branch 'themes' of https://github.com/mapcentia/watsonc into th…
mapcentia ecf334e
Added license functionality
MathiasBuus d832bb1
Fixed language, disable dashboard on free, and added state to searchbox
MathiasBuus 31283b8
Loading spinner, DnD for all parameters and more
MathiasBuus 93c3041
Removed unnessesary console.log
MathiasBuus 0bffd4e
Clean up
mapcentia 170d894
Merge branch 'themes' of https://github.com/mapcentia/watsonc into th…
mapcentia 4749dba
Fixed UUID and mapdecorator and chemical list with new naming convention
MathiasBuus 09ce831
Added locname to all cachedData
MathiasBuus f5ba5ff
Lazy load of sources
mapcentia 48b2172
Lazy load of sources
mapcentia a2e74c8
Merge
mapcentia 17805b7
Locname, title and unit is set all places
mapcentia ab713ad
Profile tool re-added
mapcentia d375a59
Profile tool re-added
mapcentia fd781a3
Fixed merge conflicts, styling of graph name, and fix of fullscreen
MathiasBuus 3753846
Profile tool re-added
mapcentia 50ee4d8
Save and Save As
mapcentia 528574c
Fixed SQL
mapcentia de7b5d4
Fixed merging errors
MathiasBuus ba1d2d5
Fixed plotting issue, and titles, etc
MathiasBuus dd53abd
Update DashboardPlotCard.js
MathiasBuus 60b6523
Clear dashboard function
mapcentia 949cdae
Merge branch 'themes' of https://github.com/mapcentia/watsonc into th…
mapcentia f81a998
Clear dashboard function
mapcentia 4c0fcfb
More simple flex-box grid in Dashboard header
mapcentia 4cd0401
Fixed fullscreen functionality
MathiasBuus e17d5e6
Added profiles functionality
MathiasBuus 429d70e
Fixed local endpoints
MathiasBuus 0dd68d7
Remove console log
mapcentia f87f0dd
Absolute favicon url
mapcentia b4b16d6
Merge branch 'themes' of https://github.com/mapcentia/watsonc into th…
mapcentia 16bf2b7
Colors in baselayer widget
mapcentia 7b47627
Make sure that right panel is on top on start
mapcentia 2e0d360
Fixed error when ts_id is uuid
MathiasBuus 78ab10a
Re-added sum instead of mean for precipitation
MathiasBuus 6b9e606
Show all timeseries also adds location to dashboard
MathiasBuus 4808c8f
Rollback aggregate for sum
MathiasBuus 4e54a63
Profiles in snapshot with lazy load of the data property
mapcentia 0da007b
Fixed zoom error on profiles
MathiasBuus ad9bc69
Check if undefined
mapcentia 345e1df
Merge branch 'themes' of https://github.com/mapcentia/watsonc into th…
mapcentia b1af20c
Remove of console.log
mapcentia a7b4bea
Decode base64 encoded project json
mapcentia 5708ab1
Profile features
MathiasBuus e9137ff
Merge branch 'themes' of https://github.com/mapcentia/watsonc into th…
MathiasBuus 0ea3949
New graph and new profile opens dashboard and scrolls
MathiasBuus e1ac36c
Styling i grafvindue #251
MathiasBuus 8be0501
Fixet #252
MathiasBuus 213034e
Fixed license issue for profiles
MathiasBuus 2a2fb58
Fixed #253
MathiasBuus ac77ed9
#260 Implemented my stations
MathiasBuus 22fd9cd
Added subscription logic for dashboard header
MathiasBuus 021fbdb
#257 Fixed
MathiasBuus a2bcf64
Fixed data selector layout for dashboards
MathiasBuus f666e4c
Layout changes
MathiasBuus 0d2ac15
#242 Added groups for Jupiter layers
MathiasBuus 18bb315
Hide button
mapcentia d06b06e
Layout and translations
MathiasBuus e3c99e8
More translations
MathiasBuus 72a3673
Styling af lagmenu
MathiasBuus 9a6c78a
#265 Added clearing when pressing icon
MathiasBuus 7cc3206
#264 Fixed download data button
MathiasBuus 7592136
#266 Selects data source when adding to dashboard
MathiasBuus f5602c2
Fixed groups coming in other stations than Jupiter
MathiasBuus 7732932
selectedBorehole clean up
MathiasBuus 141bfa5
#267 Added clickable icon on Jupiter boreholes
MathiasBuus 0ea3f39
Added disabled style to Start button
MathiasBuus 53fbdcd
Removed logs
MathiasBuus 7db871b
Location info in Pop up menu
MathiasBuus f7270e3
Increased size of popup
MathiasBuus d147d86
Clear Dashboard button now works
mapcentia cd7eb21
About and log in buttons removed
mapcentia 27d0a72
Navigation button text color
mapcentia 64450a2
Hide more info button and made MapDecorator bigger
MathiasBuus eb61b25
Fixed bug with DMP download
MathiasBuus 23b5388
Added timeseries info to more info.
MathiasBuus 6cc8817
Now checks if not premium for license checking
MathiasBuus edecc90
Translations
MathiasBuus 4583d68
Added state refresh of all user specific data on relog
MathiasBuus 6145d73
Added fullscreen icon and disabled some scrollbars
MathiasBuus 9acdf74
Better layout logic for precipitation and start of graph
MathiasBuus 69cc662
Added login functionality in Calypso LARGE COMMIT
MathiasBuus 47d4bac
Added Særskilte lag logic
MathiasBuus 4467b7d
Update README.md
mapcentia 62c5937
Update README.md
mapcentia a1e776f
Fixed summing of precipitation and hardcoded yaxis
MathiasBuus 566babe
Fixed sorting of hardcoded axes
MathiasBuus 7787e02
Updated names in cardlistitem
MathiasBuus eae0742
Fixed projects not showing in data selector
MathiasBuus 4c55176
Fixed not being able to plot all graphs
MathiasBuus ee09160
Changed URL for Kontakt
MathiasBuus 470fe40
Added Enter logs in
MathiasBuus b34f14b
Fixed title in Profiles and closing of them
MathiasBuus 071781a
Added aggregate to snapshots
MathiasBuus 5aa55a3
Fixed bugs with adding dashboard items to dashboard
MathiasBuus 18ad472
Only add boreholes not already in list
MathiasBuus e73202a
Fixed renaming of plots hopefully
MathiasBuus 15b2967
Update DashboardContent.js
MathiasBuus 3928234
Update show_subscriptionDialogue.js
MathiasBuus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"presets": [ | ||
[ | ||
"@babel/preset-env", | ||
{ | ||
"targets": { | ||
"node": "10" | ||
} | ||
} | ||
], | ||
"@babel/preset-react" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
|
||
export default class BaseApi { | ||
|
||
get(url = "") { | ||
try { | ||
|
||
// Default options are marked with * | ||
return fetch(url, { | ||
method: 'GET', // *GET, POST, PUT, DELETE, etc. | ||
// mode: 'cors', // no-cors, *cors, same-origin | ||
// cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached | ||
// credentials: 'same-origin', // include, *same-origin, omit | ||
// headers: { | ||
// 'Content-Type': 'application/json; charset=utf-8' | ||
// }, | ||
// redirect: 'follow', // manual, *follow, error | ||
// referrerPolicy: 'no-referrer', // no-referrer, *no-referrer-when-downgrade, origin, origin-when-cross-origin, same-origin, strict-origin, strict-origin-when-cross-origin, unsafe-url | ||
// body: JSON.stringify(query) // body data type must match "Content-Type" header | ||
}); | ||
|
||
|
||
} catch (error) { | ||
// console.log("BaseApi error", error); | ||
return ""; | ||
} | ||
} | ||
|
||
post(url = "", body = "") { | ||
|
||
try { | ||
|
||
// Default options are marked with * | ||
return fetch(url, { | ||
method: 'POST', // *GET, POST, PUT, DELETE, etc. | ||
// mode: 'cors', // no-cors, *cors, same-origin | ||
// cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached | ||
// credentials: 'same-origin', // include, *same-origin, omit | ||
headers: { | ||
'Content-Type': 'application/json; charset=utf-8' | ||
}, | ||
// redirect: 'follow', // manual, *follow, error | ||
// referrerPolicy: 'no-referrer', // no-referrer, *no-referrer-when-downgrade, origin, origin-when-cross-origin, same-origin, strict-origin, strict-origin-when-cross-origin, unsafe-url | ||
// body: JSON.stringify(query) // body data type must match "Content-Type" header | ||
body: JSON.stringify(body) | ||
}); | ||
|
||
} catch (error) { | ||
// console.log("BaseApi error", error); | ||
return ""; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import BaseApi from '../baseApi'; | ||
|
||
const metaUrl = '/api/meta/jupiter/'; | ||
|
||
export default class MetaApi { | ||
getMetaData(parameter) { | ||
const baseApi = new BaseApi(); | ||
const url = metaUrl + parameter; | ||
return baseApi.get(url).then((response) => { | ||
return response.json(); | ||
}).then((results) => { | ||
return results.data.filter((item) => item.f_table_schema == parameter).map((item) => { | ||
let value = `${item.f_table_schema}.${item.f_table_name}`; | ||
if (item.f_table_title == 'Jupiter boringer') { | ||
value = 'v:system.all'; | ||
} | ||
return { | ||
label: item.f_table_title, | ||
group: item.layergroup, | ||
value: value | ||
} | ||
}); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import BaseApi from '../baseApi'; | ||
|
||
const projectsUrl = '/api/state-snapshots/jupiter?ownerOnly=true' | ||
|
||
export default class ProjectsApi { | ||
getProjects() { | ||
const baseApi = new BaseApi(); | ||
const response = baseApi.get(projectsUrl); | ||
return response; | ||
} | ||
} |
127 changes: 127 additions & 0 deletions
127
browser/components/dataselector/DataSelectorDialogue.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
import { useState, useEffect } from 'react'; | ||
import styled from "styled-components"; | ||
import Title from '../shared/title/Title'; | ||
import CloseButton from '../shared/button/CloseButton'; | ||
import PropTypes from 'prop-types'; | ||
import Grid from '@material-ui/core/Grid'; | ||
import Card from '../shared/card/Card'; | ||
import CheckBoxList from '../shared/list/CheckBoxList'; | ||
import RadioButtonList from '../shared/list/RadioButtonList'; | ||
import Button from '../shared/button/Button'; | ||
import ButtonGroup from '../shared/button/ButtonGroup'; | ||
import ProjectList from './ProjectList'; | ||
import PredefinedDatasourceViews from './PredefinedDatasourceViews'; | ||
import { Variants } from '../shared/constants/variants'; | ||
import { Size } from '../shared/constants/size'; | ||
import { Align } from '../shared/constants/align'; | ||
import { hexToRgbA } from '../../helpers/colors'; | ||
import {WATER_LEVEL_KEY} from '../../constants'; | ||
import MetaApi from '../../api/meta/MetaApi'; | ||
|
||
DataSelectorDialogue.propTypes = { | ||
text: PropTypes.string, | ||
state: PropTypes.object, | ||
categories: PropTypes.object, | ||
onApply: PropTypes.func, | ||
} | ||
|
||
function DataSelectorDialogue(props) { | ||
const [showProjectsList, setShowProjectsList] = useState(false); | ||
const [parameters, setParameters] = useState([]); | ||
const [selectedDataSources, setSelectedDataSources] = useState([]); | ||
const [selectedParameter, setSelectedParameter] = useState(); | ||
const [dataSources, setDataSources] = useState([]); | ||
|
||
useEffect(() => { | ||
let chemicals = [{label: __('Water Level'), value: WATER_LEVEL_KEY, group: __('Water Level')}]; | ||
for (let key in props.categories[LAYER_NAMES[0]]) { | ||
if (key == 'Vandstand') { | ||
continue; | ||
} | ||
for (let key2 in props.categories[LAYER_NAMES[0]][key]) { | ||
var label = props.categories[LAYER_NAMES[0]][key][key2]; | ||
chemicals.push({'label': label, 'value': key2, 'group': key}); | ||
} | ||
} | ||
setParameters(chemicals); | ||
}, [props.categories]); | ||
|
||
const loadDataSources = () => { | ||
const api = new MetaApi(); | ||
api.getMetaData('calypso_stationer').then((response) => { | ||
setDataSources(response); | ||
}); | ||
} | ||
|
||
useEffect(() => { | ||
loadDataSources(); | ||
}, []); | ||
|
||
const applyParameter = () => { | ||
const layers = selectedDataSources.map((source) => { | ||
return source.value; | ||
}) | ||
props.onApply({ | ||
layers: layers, | ||
chemical: (selectedParameter ? selectedParameter.value : false) | ||
}); | ||
props.onCloseButtonClick ? props.onCloseButtonClick() : null; | ||
} | ||
return ( | ||
<Root> | ||
<ModalHeader> | ||
<Grid container> | ||
<Grid container item xs={10}> | ||
<Title text={props.titleText} /> | ||
</Grid> | ||
<Grid container justify="flex-end" item xs={2}> | ||
<CloseButton onClick={props.onCloseButtonClick} /> | ||
</Grid> | ||
</Grid> | ||
</ModalHeader> | ||
<ModalBody> | ||
{showProjectsList ? <ProjectList onStateSnapshotApply={props.onCloseButtonClick} {...props} /> : | ||
<div> | ||
<PredefinedDatasourceViews /> | ||
<Grid container spacing={32}> | ||
<Grid container item md={6}> | ||
<Card> | ||
<Title text={__('Datakilder')} level={3} /> | ||
<CheckBoxList listItems={dataSources} onChange={setSelectedDataSources} /> | ||
</Card> | ||
</Grid> | ||
<Grid container item md={6}> | ||
{selectedDataSources.findIndex((item) => item.value == 'v:system.all') > -1 ? <Card> | ||
<Title text={__('Måleparameter')} level={3} /> | ||
<RadioButtonList listItems={parameters} onChange={setSelectedParameter} /> | ||
</Card> : null} | ||
</Grid> | ||
</Grid> | ||
</div>} | ||
{showProjectsList ? <ButtonGroup align={Align.Center}> | ||
<Button text={__("Choose datasource and layers")} variant={Variants.None} onClick={() => setShowProjectsList(false)} size={Size.Large} /> | ||
|
||
</ButtonGroup> : | ||
<ButtonGroup align={Align.Center} spacing={2}> | ||
<Button text={__("Abn eksisterende")} variant={Variants.None} onClick={() => setShowProjectsList(!showProjectsList)} size={Size.Large} /> | ||
<Button text={__("Start")} variant={Variants.Primary} onClick={() => applyParameter()} size={Size.Large} disabled={!selectedParameter || selectedDataSources.length == 0} /> | ||
</ButtonGroup> } | ||
</ModalBody> | ||
</Root> | ||
); | ||
} | ||
|
||
const Root = styled.div` | ||
background: ${({ theme }) => hexToRgbA(theme.colors.primary[1], 0.92)}; | ||
border-radius: ${({ theme }) => `${theme.layout.borderRadius.large}px`}; | ||
`; | ||
|
||
const ModalHeader = styled.div` | ||
padding: ${( { theme }) => `${theme.layout.gutter}px ${theme.layout.gutter}px 0 ${theme.layout.gutter}px`}; | ||
`; | ||
|
||
const ModalBody = styled.div` | ||
padding: ${( { theme }) => `${theme.layout.gutter}px`}; | ||
`; | ||
|
||
export default DataSelectorDialogue; |
14 changes: 14 additions & 0 deletions
14
browser/components/dataselector/PredefinedDatasourceViews.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import IconButton from '../shared/button/IconButton'; | ||
|
||
function PredefinedDatasourceViews(props) { | ||
|
||
return (<> | ||
<IconButton icon="cleaning-spray" label={__('Pesticider')} /> | ||
<IconButton icon="no3-solid" label={__('Nitrat')} /> | ||
<IconButton icon="water-wifi-solid" label={__('Mine stationer')} /> | ||
<IconButton icon="lab-flask-experiment" label={__('Mine favoritter')} /> | ||
</>); | ||
|
||
} | ||
|
||
export default PredefinedDatasourceViews; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
import { useState, useEffect } from 'react'; | ||
import {connect} from 'react-redux' | ||
import ProjectsApi from '../../api/projects/ProjectsApi'; | ||
import Title from '../shared/title/Title'; | ||
import styled from "styled-components"; | ||
import Grid from '@material-ui/core/Grid'; | ||
import {DarkTheme} from '../../themes/DarkTheme'; | ||
import {Align} from '../shared/constants/align'; | ||
import Button from '../shared/button/Button'; | ||
import ProjectListItem from './ProjectListItem'; | ||
|
||
|
||
function ProjectList(props) { | ||
const [projects, setProjects] = useState([]); | ||
const [isLoading, setIsLoading] = useState(false); | ||
const [hoveredItem, setHoveredItem] = useState(); | ||
|
||
const getProjectParameters = (project) => { | ||
let parameters = []; | ||
let queryParameters = props.urlparser.urlVars; | ||
parameters.push(`state=${project.id}`); | ||
let config = null; | ||
|
||
if (project.snapshot && project.snapshot.meta) { | ||
if (project.snapshot.meta.config) { | ||
config = project.snapshot.meta.config; | ||
} | ||
|
||
if (project.snapshot.meta.tmpl) { | ||
parameters.push(`tmpl=${project.snapshot.meta.tmpl}`); | ||
} | ||
} | ||
|
||
if (!config && 'config' in queryParameters && queryParameters.config) { | ||
// If config is present in project meta, use that. | ||
// Else take it from queryparams. | ||
config = queryParameters.config; | ||
} | ||
|
||
if (config) { | ||
configParameter = `config=${highPriorityConfigString}`; | ||
parameters.push(configParameter); | ||
} | ||
return parameters; | ||
|
||
} | ||
|
||
const getPermalinkForProject = (project) => { | ||
let parameters = getProjectParameters(project); | ||
let permalink = `${window.location.origin}${props.anchor.getUri()}?${parameters.join('&')}`; | ||
return permalink; | ||
} | ||
|
||
const loadProjects = () => { | ||
setIsLoading(true); | ||
const projectsApi = new ProjectsApi(); | ||
projectsApi.getProjects().then((response) => { | ||
response.json().then((results) => { | ||
console.log(results); | ||
results.map((project) => { | ||
project.permalink = getPermalinkForProject(project); | ||
}); | ||
setProjects(results); | ||
setIsLoading(false); | ||
}); | ||
}) | ||
} | ||
|
||
useEffect(() => { | ||
loadProjects(); | ||
}, []); | ||
|
||
return (<Root> | ||
{props.authenticated ? null : <Title text={__('Sign in in order to access user projects')} level={5} color={DarkTheme.colors.headings} align={Align.Center} />} | ||
{isLoading ? <Title text={__('Loading data...')} level={6} align='center' /> : | ||
<div> | ||
{projects.length > 0 ? | ||
<div> | ||
<Title text={__('My projects')} level={4} /> | ||
<Grid container> | ||
<Grid container item xs={12}> | ||
{projects.map((project, index) => { | ||
return <ProjectListItem project={project} {...props} key={index} /> | ||
} | ||
)} | ||
</Grid> | ||
</Grid> | ||
</div> : | ||
<Title text={__('No Local projects')} level={6} align={Align.Center} color={DarkTheme.colors.headings} />} | ||
</div> | ||
} | ||
</Root>) | ||
|
||
} | ||
|
||
const Root = styled.div` | ||
margin-top: ${props => props.theme.layout.gutter/2}px; | ||
margin-bottom: ${props => props.theme.layout.gutter*2}px; | ||
`; | ||
|
||
const mapStateToProps = state => ({ | ||
authenticated: state.global.authenticated | ||
}); | ||
|
||
const mapDispatchToProps = dispatch => ({ | ||
}); | ||
|
||
export default connect(mapStateToProps, mapDispatchToProps)(ProjectList); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice move :-)