Skip to content

Save block diagrams#57

Merged
hbradio merged 7 commits intodevelopmentfrom
feature/Save_bds
Apr 12, 2017
Merged

Save block diagrams#57
hbradio merged 7 commits intodevelopmentfrom
feature/Save_bds

Conversation

@hbradio
Copy link
Copy Markdown
Collaborator

@hbradio hbradio commented Apr 8, 2017

This makes mission control save the block diagrams to rovercode.com instead of to the rover.

Can't really check that the CSRF tokens are working in the development environment. Just have to see if they work on beta.rovercode.com?

Reorganized the js files a bit.

@hbradio hbradio added this to the Release 0.4 milestone Apr 8, 2017
@hbradio hbradio requested a review from cabarnes April 8, 2017 12:05
@hbradio
Copy link
Copy Markdown
Collaborator Author

hbradio commented Apr 8, 2017

Whoops. Forgot to run linter. Fixing.

@hbradio
Copy link
Copy Markdown
Collaborator Author

hbradio commented Apr 8, 2017

@ryanknutson feel free to review if you're interested in the python/js stuff!

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling 2cc9f82 on feature/Save_bds into 03f14ff on development.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling 2cc9f82 on feature/Save_bds into 03f14ff on development.

function saveFirst() {
$.post('/mission-control/block-diagrams/', data, function(response){
bdId = response.id;
console.log('Created bd ' + bdId + ' on the server server');
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two server

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops. Fixing.

console.log('Created bd ' + bdId + ' on the server server');
})
.fail(function(){
console.log("Failure when creating saved bd on server.");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest console.error. There are some other cases in this file as well. Also, if you put a parameter for the function, you can get the error message that might be helpful.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea.

We get lots of info back on an error. I went with printing xhr.responseText to the console?

var allBlocksHidden = true;
for (hiddenBlock of blocksToHide) {
if (!hideBlock(hiddenBlock))
allBlocksHidden = false;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent

});
}

function saveAgain() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer create and update for the function names, but it's up to you.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha, yes. Real CRUD works are better. Changing.


function saveFirst() {
$.post('/mission-control/block-diagrams/', data, function(response){
bdId = response.id;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you'd want to set this id from loadDesign as well. Otherwise, you won't have it unless the user saved a new block diagram.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. But I think I'd like to do that in my next PR when I fix up the loadDesign function for #56.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling 45591dc on feature/Save_bds into 03f14ff on development.

@hbradio hbradio merged commit 99aa45b into development Apr 12, 2017
@hbradio hbradio deleted the feature/Save_bds branch April 12, 2017 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants