From 8d9162c6066e9f28fb9f62d439b1f2177216175d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=5B01=3B31m=1B=5BK=22name=22=1B=5Bm=1B=5BK=3A=20=22Andrew?= =?UTF-8?q?=20Donato?= <[01;31m"email": "andrew.donato91@gmail.com> Date: Tue, 20 Oct 2015 11:41:14 -0700 Subject: [PATCH 1/3] added github ajax call page --- my-notes.txt | 34 +++++++++++++++++ src/gitaccess.js | 93 +++++++++++++++++++++++++++++++++++++++++++++++ src/index.html | 17 ++++++++- src/npm-debug.log | 19 ++++++++++ src/projects.js | 10 +++++ 5 files changed, 172 insertions(+), 1 deletion(-) create mode 100644 my-notes.txt create mode 100644 src/gitaccess.js create mode 100644 src/npm-debug.log diff --git a/my-notes.txt b/my-notes.txt new file mode 100644 index 0000000..481bb8d --- /dev/null +++ b/my-notes.txt @@ -0,0 +1,34 @@ + + +## These are the user stories + + + 1. Engineer Alice makes branch "search-experiment" + 2. Alice sets up a project for "search-experiment" using this tool + 3. Engineer Bob makes further changes in master + 4. Testers start working on the "search-experiment" project + + ## why are the testers looking at the search-experiment project in the first place rather than the master branch + + +## the problem + + + + +## what I need to do: + +I need to edit the tool that I have been provided, in order to: + + [front-end] be able to specify the branch in a particular project + + [back-end] use the github api to compare a project with master + + [front-end] indicate if a project is up to date or not + + [the gist] make sure that the branch is up to date with master before testers work on it. + + + +Check the API to see if the branch is up to date with master +If not up to date, then give warning or disallow testers from working on the branch diff --git a/src/gitaccess.js b/src/gitaccess.js new file mode 100644 index 0000000..9f295d3 --- /dev/null +++ b/src/gitaccess.js @@ -0,0 +1,93 @@ +$(document).ready(function() { + // This is called after the document has loaded in its entirety + // This guarantees that any elements we bind to will exist on the page + // when we try to bind to them + + // See: http://docs.jquery.com/Tutorials:Introducing_$(document).ready() + + makeGitRequest(); + +}); + + +var makeGitRequest = function(){ + $('.githubaccess').on('submit', function(event){ + + event.preventDefault(); + + $('.githubdata').html('
loading...
'); + + var username = $('.githubusername').val(); + var requesturl = 'https://api.github.com/users/'+username; + var repourl = 'https://api.github.com/users/'+username+'/repos'; + + requestJSON(requesturl, function(json) { + + if(json.message == "Not Found" || username == '') { + $('#githubdata').html("

No User Info Found

"); + } + + else { + // else we have a user and we display their info + var fullname = json.name; + var username = json.login; + var aviurl = json.avatar_url; + var profileurl = json.html_url; + var location = json.location; + var followersnum = json.followers; + var followingnum = json.following; + var reposnum = json.public_repos; + + if(fullname == undefined) { fullname = username; } + var outhtml = '

'+fullname+' (@'+username+')

'; + outhtml = outhtml + '
'+username+'
'; + outhtml = outhtml + '

Followers: '+followersnum+' - Following: '+followingnum+'
Repos: '+reposnum+'

'; + outhtml = outhtml + '
'; + + var repositories; + $.getJSON(repouri, function(json){ + repositories = json; + outputPageContent(); + }); + + function outputPageContent() { + if(repositories.length == 0) { outhtml = outhtml + '

No repos!

'; } + else { + outhtml = outhtml + '

Repos List:

'; + } + $('#githubdata').html(outhtml); + } + } + }); + }); +} + +// var form = $(this); +// var data = form.serialize(); +// var path = $('.create_project_form').attr('action') +// var method = $('.create_project_form').attr('method') + +// var request = $.ajax({ +// url: path, +// type: method, +// data: data, +// dataType: "json" +// }) +// request.done(function(serverData){ +// console.log('success'); +// console.log(serverData, "hello"); +// $('div.project_index').children().last().append('
'+ serverData.name+ '
') +// $('.hidden_project_form').toggle(); +// $('.create_project_form')[0].reset(); +// }) +// request.fail(function(serverData){ +// console.log(serverData); +// console.log('server request failed'); +// }) +// }); +// }; + diff --git a/src/index.html b/src/index.html index 4f13778..e526785 100644 --- a/src/index.html +++ b/src/index.html @@ -30,11 +30,24 @@

All active projects

+

Add new project

+ +
+ + +
+ +
+ + +
+ +
@@ -49,12 +62,14 @@

Add new project

- +
+ + diff --git a/src/npm-debug.log b/src/npm-debug.log new file mode 100644 index 0000000..c99a30b --- /dev/null +++ b/src/npm-debug.log @@ -0,0 +1,19 @@ +0 info it worked if it ends with ok +1 verbose cli [ 'node', '/usr/local/bin/npm', 'start' ] +2 info using npm@2.7.5 +3 info using node@v0.12.2 +4 verbose node symlink /usr/local/bin/node +5 verbose stack Error: ENOENT, open '/Users/apprentice/Documents/tech-professional/job-challenges/quixey/webdev-exercise/src/package.json' +5 verbose stack at Error (native) +6 verbose cwd /Users/apprentice/Documents/tech-professional/job-challenges/quixey/webdev-exercise/src +7 error Darwin 14.5.0 +8 error argv "node" "/usr/local/bin/npm" "start" +9 error node v0.12.2 +10 error npm v2.7.5 +11 error path /Users/apprentice/Documents/tech-professional/job-challenges/quixey/webdev-exercise/src/package.json +12 error code ENOENT +13 error errno -2 +14 error enoent ENOENT, open '/Users/apprentice/Documents/tech-professional/job-challenges/quixey/webdev-exercise/src/package.json' +14 error enoent This is most likely not a problem with npm itself +14 error enoent and is related to npm not being able to find a file. +15 verbose exit [ -2, true ] diff --git a/src/projects.js b/src/projects.js index 6c11b49..7e93dec 100644 --- a/src/projects.js +++ b/src/projects.js @@ -1,3 +1,6 @@ + + + function Project(id, type, name, lastActivity) { this.id = id; this.type = type; @@ -58,3 +61,10 @@ $(function(){ e.preventDefault(); }); }); + + + +///////////////////////////////////////////////////////////////// + +//remember to npm install + From 1549fc67575ab728016463e7d37e192ea108b796 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=5B01=3B31m=1B=5BK=22name=22=1B=5Bm=1B=5BK=3A=20=22Andrew?= =?UTF-8?q?=20Donato?= <[01;31m"email": "andrew.donato91@gmail.com> Date: Tue, 20 Oct 2015 12:51:09 -0700 Subject: [PATCH 2/3] made the http request work --- src/gitaccess.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gitaccess.js b/src/gitaccess.js index 9f295d3..c0ed6c7 100644 --- a/src/gitaccess.js +++ b/src/gitaccess.js @@ -1,3 +1,8 @@ +var request = new XMLHttpRequest(); +request.open('get', 'https://api.github.com/users/andrewdonato') +request.send() + + $(document).ready(function() { // This is called after the document has loaded in its entirety // This guarantees that any elements we bind to will exist on the page From 20ce54d6a38e6884335f59be3951a2ca89668e05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=5B01=3B31m=1B=5BK=22name=22=1B=5Bm=1B=5BK=3A=20=22Andrew?= =?UTF-8?q?=20Donato?= <[01;31m"email": "andrew.donato91@gmail.com> Date: Tue, 20 Oct 2015 16:01:18 -0700 Subject: [PATCH 3/3] removed previously made changes --- src/gitaccess.js | 7 +++++++ src/index.html | 6 +++--- src/npm-debug.log | 19 ------------------- src/projects.js | 5 ----- 4 files changed, 10 insertions(+), 27 deletions(-) delete mode 100644 src/npm-debug.log diff --git a/src/gitaccess.js b/src/gitaccess.js index c0ed6c7..b8d4afb 100644 --- a/src/gitaccess.js +++ b/src/gitaccess.js @@ -96,3 +96,10 @@ var makeGitRequest = function(){ // }); // }; + + +create a column for branch name and another column for status (is ahead or up to date) + +add project field +add another dropdown for project branch +make a request from local to github client side diff --git a/src/index.html b/src/index.html index e526785..05a6d7e 100644 --- a/src/index.html +++ b/src/index.html @@ -37,7 +37,7 @@

All active projects

Add new project

-
+
@@ -70,6 +70,6 @@

Add new project

- + diff --git a/src/npm-debug.log b/src/npm-debug.log deleted file mode 100644 index c99a30b..0000000 --- a/src/npm-debug.log +++ /dev/null @@ -1,19 +0,0 @@ -0 info it worked if it ends with ok -1 verbose cli [ 'node', '/usr/local/bin/npm', 'start' ] -2 info using npm@2.7.5 -3 info using node@v0.12.2 -4 verbose node symlink /usr/local/bin/node -5 verbose stack Error: ENOENT, open '/Users/apprentice/Documents/tech-professional/job-challenges/quixey/webdev-exercise/src/package.json' -5 verbose stack at Error (native) -6 verbose cwd /Users/apprentice/Documents/tech-professional/job-challenges/quixey/webdev-exercise/src -7 error Darwin 14.5.0 -8 error argv "node" "/usr/local/bin/npm" "start" -9 error node v0.12.2 -10 error npm v2.7.5 -11 error path /Users/apprentice/Documents/tech-professional/job-challenges/quixey/webdev-exercise/src/package.json -12 error code ENOENT -13 error errno -2 -14 error enoent ENOENT, open '/Users/apprentice/Documents/tech-professional/job-challenges/quixey/webdev-exercise/src/package.json' -14 error enoent This is most likely not a problem with npm itself -14 error enoent and is related to npm not being able to find a file. -15 verbose exit [ -2, true ] diff --git a/src/projects.js b/src/projects.js index 7e93dec..20e76c8 100644 --- a/src/projects.js +++ b/src/projects.js @@ -63,8 +63,3 @@ $(function(){ }); - -///////////////////////////////////////////////////////////////// - -//remember to npm install -