-
Notifications
You must be signed in to change notification settings - Fork 3
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
store configs to firebase + allow sharing #35
store configs to firebase + allow sharing #35
Conversation
54ffbe4
to
2a4794f
Compare
Overall, I think the db layout looks good. Couple of questions
|
Have we looked at using angularfire? |
|
||
angular | ||
.module('gcloudConsole') | ||
.service('configuration', Configuration); |
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.
Generally I use .factory
+ revealing module pattern for services
I figured I wouldn't get too attached to the structure of the json for now. Firebase will store any object you give it, so as we finalize that we can make changes. In particular with
What is the default for a projects section? Did I forget about something we talked about?
That's a good idea! Maybe we can change the wording of "Share your configuration" to "Save this configuration" and then have a section of saved configurations appear:
I plan to elaborate on my vision of the somewhat abstract "cards" concept tomorrow (re: #29) with a quick mockup.
Yep, I actually had it included at first, then realized I was only using the raw library. It's nice that it promisifys stuff, so I'll give it another try. |
What if instead of having a share configuration button in the left nav, we had a project configuration button instead. It would take us to a view where we could:
|
var deferred = this.$q.defer(); | ||
|
||
if (ref.getAuth()) { | ||
deferred.resolve(ref); |
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.
You could wait to create the deferred object and do something like..
if (ref.getAuth()) {
return $q.resolve(ref);
}
@stephenplusplus per our discussions last Thursday, I've made a fairly hefty refactor to our state hierarchy. Let me know if you have questions/comments/concerns |
Fixes #33
Fixes #34
To Dos
This implements some firebase persistence, changing the default storage driver to the new "FirebaseDriver".
There are also two services created:
firebase
- Has one method,getRef
, that returns a promise that returns an authenticated ref. Auth is done with the same token we already have from the user being logged into the console with their Google account.configuration
- Easily access a global configuration.What's a global configuration? For a better understanding of that, let's look at the schema stored in Firebase.

- `configurations` - stores a list of plug-ins and their configuration using a unique name. - `projects` - stores a list of projects.Let's open up

configurations
:creator
- Used for firebase security rules. Anyone can create a configuration, but only the original creator can make modifications to it.lastModified
- In case we ever find that useful.plugins
- This is a clone of the plugin configuration that is currently persisted in localStorage. It's likely going to change as we go, so we don't need to dig into the specifics of that object here. Whatever changes we make will automatically go here.Now,

projects
:lastModified
- Again, in case we need this some day.plugins
- Exactly as described above.How this all comes together
Anytime a user makes changes to their settings, it is persisted to Firebase, keyed by the project they're making changes for.
There is a new "Share your configuration" button. This brings up a dialog that lets the user give it a name. After doing so, it returns a URL that will load the config, something like: http://stephenplusplus.github.io/phoenix/#/projects/import/the-name-you-chose
When another user goes to that URL, they get a prompt to select the project they want to apply those settings to. After they click "Ok", it redirects them to their project, where any settings they previously had have now been replaced.
This is a work in progress, so that last part about replacing everything won't be permanent. Instead, I think we want to go the "cards" route brought up in #29. That way, when a user hits an import URL and selects a project, it doesn't affect their old settings at all, or worry about trying to merge them. It will just create a new "card" by the same name of the configuration (e.g. "easy-storage-ui") under their project, and when they visit it, they'll be able to tweak the plug-ins to their needs without affecting anything else.
This would require some changes in Firebase and the site, so @callmehiphop, we should sync up sometime soon to decide how to proceed.
For now, HERE'S A PREVIEW: http://stephenplusplus.github.io/phoenix