-
Notifications
You must be signed in to change notification settings - Fork 14
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
Use GraphQL for GitHub #33
Conversation
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.
There should be an issue, and the PR should close the issue.
The frontend should be left unchanged or the change should be minimal. But, instead it's being rewritten with another css library, it's certainly not in the milestone and not related to GraphQL whatsoever. But I wanna hear what the other mentors say in this.
Are you using yarn
or npm
, please keep it consistent, we can't have 2 lockfiles, it's cumbersome to sync them both.
There's many files with missing newline on EOF.
app/controllers/application.js
Outdated
@@ -2,15 +2,10 @@ import Controller from '@ember/controller'; | |||
|
|||
export default Controller.extend({ | |||
toggleSidenav: true, | |||
|
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.
Let's keep the diff small
app/graphql/github.js
Outdated
const TEMPLATES = { | ||
tasks: | ||
` | ||
{ |
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.
I'd prefer the GraphQL to be in a separate file like in gci-leaders and gh-board.
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.
^Probably not very simple to do because of the build system design
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.
Yup, something to do with ember-cli hook. It is possible, but not worth the pain. At least for now.
Also should be noted if we want to add more queries. (There is a shift in GitLab to also use graphql)
app/graphql/github.js
Outdated
rateLimit { | ||
remaining | ||
} | ||
search(query: "{{query}}", type: ISSUE, first: 100 ) { |
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.
GraphQL has its own implementation of doing variable if you use a client for it
https://github.com/prismagraphql/graphql-request
https://github.com/alphasights/ember-graphql-adapter
If you use the Ember.js one, you'll have support for models, I think
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.
I try to keep the dependency as simple as possible.
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.
Probably will use graphql client, when there is a feature that we needed.
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 have to.
GraphQL variable is special, it's sent separately from the query and has type checking.
You could implement the GraphQL client yourself, but it's better to use battle-tested library, just find the smallest one out there.
https://medium.com/the-graphqlhub/graphql-tour-variables-58c6abd10f56
@@ -1,33 +0,0 @@ | |||
export default [ | |||
{ | |||
name: 'Discourse', |
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.
It should be possible to keep the current organization.
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.
The implementation of organization will be replaced in the task
https://gitlab.com/coala/GSoC/GSoC-2018/issues/312
using
https://gitlab.com/coala/GSoC/GSoC-2018/issues/350
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.
that is for adding more.
Add these ones as part of this PR.
Otherwise this PR is a regression.
app/routes/tasks.js
Outdated
@@ -0,0 +1,40 @@ | |||
import { computed } from '@ember/object'; | |||
import Route from '@ember/routing/route'; | |||
import {inject} from '@ember/service'; |
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.
Inconsistent bracket spacing
app/routes/tasks.js
Outdated
|
||
queryParams: { | ||
org: { | ||
refreshModel: true |
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.
Weird indent.
app/services/github.js
Outdated
@@ -0,0 +1,46 @@ | |||
import {inject} from '@ember/service'; | |||
import AjaxService from 'ember-ajax/services/ajax'; | |||
import {generate} from '../graphql/github'; |
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.
Inconsistent bracket spacing
app/templates/application.hbs
Outdated
<div id="navbarExampleTransparentExample" class="navbar-menu"> | ||
<div class="navbar-end"> | ||
<div class="navbar-item"> | ||
<a href="#" onclick={{action "showSettingsModal"}} >{{fa-icon 'cog' size="2x"}}</a> |
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.
Useless space before >
import DS from 'ember-data'; | ||
import { computed } from '@ember/object'; | ||
|
||
export default DS.Model.extend({ |
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.
Can we keep the model? Seems like this is a feature that we have to use in Ember.js.
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.
No need ATM, probably will re-add it when I add support for GitLab.
However, learning from the past, I will try to keep dependency as simple as possible. Adding ember data was adding uneeded complexity, for me.
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.
The issue model was originally used for GitHub using v3 Api.
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.
Please keep the models. We will need this level of sophistication.
Supporting multiple hosters means the app must declare its own data structure which supports a subset of each hosters features.
Can you do #32 first so it's easier for everyone to review? |
app/services/github.js
Outdated
}) | ||
} | ||
const query = generate('tasks', context); | ||
const request = this.request({query: query}) |
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.
If you don't want to use GraphQL library, atleast send the variable, there's no need to parse or do variables replacing yourself, the server will handle it.
IIRC, variables is sent as variables
key as JSON.
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.
It doesn't parse. It transform to a github compatible search query. I don't know if github search query support array :). The query
argument only support string https://developer.github.com/v4/query/#connections
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.
@blazeu We still need to transform, even though we use library.
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.
However, I do agree that I should not interpolate (Replacing) the query. and utilize variable instead.
@blazeu The previous implementation of the GUI, It was poorly designed and highly coupled with EmberData. Was make sense as previously I only design it to work on github. It was my first ember project so I added stuff that I think it is cool. Now it is not extensible, extending from there was a pain, so I decide to reuse what is usable and remove the complexity. I do not rewrite, just remove some gui element that is complex, or rename it. The idea (like issue) is still there, I rename it to task,Lbecause this project will also support pull requests. Use Bulma because the ember-paper is too complex and hard to extend. |
f7a31e0
to
95fdea6
Compare
I mean issue, there should be an issue here https://github.com/coala/git-task-list/issues for whatever is being done here, and the commit should close it. Edit: #34 was made after the PR. GitLab milestone is only for keeping track of GSoC progress. |
For the frontend change, the commit doesn't explain enough that the frontend was rewritten/changed with Bulma. Also, the commit tag |
028be11
to
da3907b
Compare
app/data/organizations.js
Outdated
trackers: [ | ||
{ | ||
type: 'github', | ||
identifier: 'coala' |
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.
Trailing , ?
@@ -1,33 +0,0 @@ | |||
export default [ | |||
{ | |||
name: 'Discourse', |
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.
that is for adding more.
Add these ones as part of this PR.
Otherwise this PR is a regression.
import DS from 'ember-data'; | ||
import { computed } from '@ember/object'; | ||
|
||
export default DS.Model.extend({ |
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.
Please keep the models. We will need this level of sophistication.
Supporting multiple hosters means the app must declare its own data structure which supports a subset of each hosters features.
It was requested at #33 (comment) that you unbreak the repo before rewriting it. Please do that. |
This is blocked. That means you stop pushing changes here for review. |
app/graphql/github.js
Outdated
|
||
export const queryBuilder = function queryBuilder({orgs}) { | ||
let queries = ["sort:updated-desc", "state:open"]; | ||
if(isIterable(orgs)) { |
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.
add a space after if
app/graphql/github.js
Outdated
}` | ||
|
||
export const queryBuilder = function queryBuilder({orgs}) { | ||
let queries = ["sort:updated-desc", "state:open"]; |
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.
Better keep the use of quotes consistent. I've seen both double quotes and single quotes at many places.
app/data/organizations.js
Outdated
identifier: '52North' | ||
} | ||
] | ||
} |
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.
Move all the organizations from app/organizations.js to here first, then you can add more in another PR
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.
It cant, the other fetches from wikidata.
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.
The model file is kept, and yet it isn't being used, that is beyond weird.
Modifying the model is ok to support the new data structure from GitHub.
In the upcoming task of supporting GitLab, it should also use the same model, so the app works seamlessly given the same model regardless of where the data comes.
app/components/settings-modal.js
Outdated
import {oneWay} from '@ember/object/computed'; | ||
import {inject} from '@ember/service'; | ||
|
||
|
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.
Should be 1 blank line
dda2e8f
to
fb5ba6c
Compare
config/coverage.js
Outdated
'use strict'; | ||
|
||
module.exports = { | ||
coverageEnvVar: 'COV', |
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.
this a separate commit, with a descriptive commit message.
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.
Removed, was going to test to disable some rule.
Note that codecov is not showing for the PR. https://codecov.io/gh/coala/git-task-list/pull/33 Please enable codecov on your fork as a temporary solution https://codecov.io/gh/bekicot/git-task-list |
OMG, https://travis-ci.org/bekicot/git-task-list is still not enabled, and https://travis-ci.org/bekicot doesnt show any related CI enabled. Yana, you must test your work on your own CI on your own fork, before pushing it to your PR. That is how you avoid build errors on your PR like https://travis-ci.org/coala/git-task-list/jobs/391590378 . |
ember-cli-build.js
Outdated
@@ -2,9 +2,6 @@ | |||
|
|||
const EmberApp = require('ember-cli/lib/broccoli/ember-app'); | |||
|
|||
const environment = process.env.EMBER_ENV; |
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.
these were added in one commit, and removed in this commit.
that isnt suitable for pushing to a PR for mentors to have to find and complain about.
app/services/organizations.js
Outdated
@@ -8,7 +8,7 @@ export default Service.extend({ | |||
this.organizations = Object.create(organizations); | |||
}, | |||
|
|||
list: computed('organizations', function () { | |||
list: computed('organizations', function listOrganization() { |
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.
this is a file you added in another commit. the lint fixup should be in the original commit where you add the file.
Run the linter on your 'real' commit and fix errors there.
The lint fixup commit should then only include additional style changes to lines of code which you did not modify in your 'real' commit.
This PR will soon be too long to be usable on GitHub. That should also fix the codecov problems. |
Ok, Will remove codecov & lint from this pull and move it to a new pull request. |
That is not what I requested. |
Ok |
Disable usupported rules for specific ember apps. Add a eslint-config-airbnb-base, eslint-plugin-ember, eslint-plugin-import to package.json. Update ember-cli-code-coverage to v1.0.0-beta.4 version to get the fix when using the `useBabelInstrumenter` config see ember-cli-code-coverage/ember-cli-code-coverage#133 . Closes coala#58
app/styles/app.scss
Outdated
.search-results { | ||
overflow-y: scroll; | ||
.tag { | ||
text-shadow: 1px 1px 1px white; |
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.
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.
Oh but it's also even harder when there's no text-shadow.
Maybe just use label color as border-color
for now? If it's too hard to implement dynamic text color.
Edit: There's simple way to calculate optimal text color if you just google it.
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.
Browser support is vary, the proper implementation is still in a draft proposal, the support is small. The other solution involves some javascript.
Maybe, i'm missing something, can you specify the link?
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.
Yes, use Javascript.
Use GraphQL for GitHub API Add support to coala & 52North Add GitHub token modal Rename implementation of Issues to Tasks Use Bulma for task list Regression: Remove Repository and User Model Remove Search Bar Closes coala#34 Bug Fix and improvement
Commit 1236cad Closes should be on the last line |
<img src="{{task.repository.owner.avatarUrl}}" alt=""> | ||
</figure> | ||
| ||
{{task.repository.nameWithOwner}} |
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.
I think he meant the coala
part shouldn't be shown because it'll always be coala
in current list.
Continued in #64 |
Use graphql for GitHub API
Add support to coala & 52North
Add GitHub token modal
Rename implementation of Issues to Tasks
Use Bulma for task list
Regression:
Remove Repository and User Model