Skip to content
This repository has been archived by the owner on Aug 21, 2023. It is now read-only.

Feature/select model #21

Merged
merged 11 commits into from
Aug 31, 2016

Conversation

flibbertigibbet
Copy link
Contributor

Implements two selectors in the navbar, one for changing the scenario, and the other for selecting models. There's not an obvious/easy way to switch back to selecting all models yet. If we move towards using ng2-angular components, I think it might be good to use their multi-select instead of the existing modal of checkboxes from the prototype that I wired up for the model selector here.

This moves the remaining default API query options into the constants.ts file, so there are three new constants that will need to be added to run this.

After rebasing off of develop, a number of new typechecker warnings appeared, mostly suggesting using string instead of String, so I have made those changes (there are no linter warnings now.)

@CloudNiner
Copy link

@fungjj92 just merged her chart controls PR, which adds the ng2 bootstrap lib and removes the bootstrap lib. It looks like this PR makes use of the modal and dropdown bootstrap js, and needs a rebase to switch to the ng2 bootstrap versions of those components.

Otherwise looks great!

@flibbertigibbet
Copy link
Contributor Author

There's no bootstrap JS in here, just styling classes and a TODO about maybe switching in future to an ng2-bootstrap component once it's stable.

Also wire up to one of the prototype select fields, but styling is broken.
Hacky workaround to reading changed model value for multiselect.
Listen to `ngModelChange` instead of `change` to get set value from select field. On `change` event, model holds previous value and event target for multiselect is not readily accessible.
Change button to open modal directly, since other options do not apply.
Close modal with update button and add listener.
Used for checkbox filtering.
Request list of scenarios from server; use default constant scenario for selection.
Mostly changing references to `String` wrapper to `string`.
@CloudNiner
Copy link

There's JS somewhere that's making the modal/dropdowns work right now, I assumed it was the import 'bootstrap' in vendor.browser.ts, which jenny removed in her latest PR.

@flibbertigibbet
Copy link
Contributor Author

Okay, a rebase off of develop has broken the dropdowns (which were already present an functioning, in mock form). I'll look into it.

@CloudNiner
Copy link

Yup, thats it. If i remove the import bootstrap line then the modals/dropdowns no longer work. So these controls should be updated to use the ng2-bootstrap versions

@CloudNiner
Copy link

CloudNiner commented Aug 31, 2016

I updated my constants.ts file to include the new constants, does your webpack linter throw these errors:

[default] /home/andrew/src/climate-change-lab/src/app/lab/lab.component.ts:14:32 
    Module '"/home/andrew/src/climate-change-lab/src/app/constants"' has no exported member 'defaultScenario'.
[default] /home/andrew/src/climate-change-lab/src/app/services/chart.service.ts:7:42 
    Module '"/home/andrew/src/climate-change-lab/src/app/constants"' has no exported member 'defaultScenario'.
[default] /home/andrew/src/climate-change-lab/src/app/services/chart.service.ts:7:59 
    Module '"/home/andrew/src/climate-change-lab/src/app/constants"' has no exported member 'defaultVariable'.
[default] /home/andrew/src/climate-change-lab/src/app/services/chart.service.ts:7:76 
    Module '"/home/andrew/src/climate-change-lab/src/app/constants"' has no exported member 'defaultYears'.

Here's what my constants file looks like now:

/*
 * Climate Change Lab
 * Constant Values
 */


export const defaultCity = {"id":7, "properties":{"name":"Philadelphia","admin":"PA"}};
export const apiHost = "https://staging.api.futurefeelslike.com/api/";
export const apiToken = "redacted";
export const defaultScenario = 'RCP85';
export const defaultVariable = 'pr';
export const defaultYears = '2070';

@flibbertigibbet
Copy link
Contributor Author

No, I don't see those errors. It seems the linter requires a server restart to silence warnings related to changes, though it doesn't interfere with functionality.

@flibbertigibbet
Copy link
Contributor Author

The bootstrap library switch radically changes how components are used, as it requires loading directives now. The dropdown is a relatively straightforward fix, but the modal update is causing issues.

Fix broken bootstrap components by switching to ng2-bootstrap directive syntax.
Backdrop on modal is disabled as workaround for ng2-bootstrap/#854.
@flibbertigibbet
Copy link
Contributor Author

Ok, rebased off develop and fixed the dropdown and modal broken by the bootstrap library switch.

The backdrop on the modal has been disabled temporarily as a workaround for valor-software/ngx-bootstrap#854.

@CloudNiner
Copy link

👍

@flibbertigibbet flibbertigibbet merged commit 64ea1bf into azavea:develop Aug 31, 2016
@flibbertigibbet flibbertigibbet deleted the feature/select-model branch August 31, 2016 21:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants