Skip to content
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

Closed
wants to merge 4 commits into from
Closed

Use GraphQL for GitHub #33

wants to merge 4 commits into from

Conversation

bekicot
Copy link
Contributor

@bekicot bekicot commented May 30, 2018

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

Copy link
Member

@blazeu blazeu left a 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.

@@ -2,15 +2,10 @@ import Controller from '@ember/controller';

export default Controller.extend({
toggleSidenav: true,

Copy link
Member

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

const TEMPLATES = {
tasks:
`
{
Copy link
Member

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.

Copy link
Member

@blazeu blazeu May 30, 2018

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

Copy link
Contributor Author

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)

rateLimit {
remaining
}
search(query: "{{query}}", type: ISSUE, first: 100 ) {
Copy link
Member

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

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Member

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',
Copy link
Member

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.

Copy link
Contributor Author

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

Copy link
Member

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.

@@ -0,0 +1,40 @@
import { computed } from '@ember/object';
import Route from '@ember/routing/route';
import {inject} from '@ember/service';
Copy link
Member

Choose a reason for hiding this comment

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

Inconsistent bracket spacing


queryParams: {
org: {
refreshModel: true
Copy link
Member

Choose a reason for hiding this comment

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

Weird indent.

@@ -0,0 +1,46 @@
import {inject} from '@ember/service';
import AjaxService from 'ember-ajax/services/ajax';
import {generate} from '../graphql/github';
Copy link
Member

Choose a reason for hiding this comment

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

Inconsistent bracket spacing

<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>
Copy link
Member

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({
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Member

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.

@blazeu
Copy link
Member

blazeu commented May 30, 2018

Can you do #32 first so it's easier for everyone to review?

})
}
const query = generate('tasks', context);
const request = this.request({query: query})
Copy link
Member

@blazeu blazeu May 30, 2018

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.

Copy link
Contributor Author

@bekicot bekicot May 31, 2018

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

Copy link
Contributor Author

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.

Copy link
Contributor Author

@bekicot bekicot May 31, 2018

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.

@bekicot
Copy link
Contributor Author

bekicot commented May 30, 2018

@blazeu
Will fix graphQl.
And remove package-lock

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.

@bekicot bekicot force-pushed the use-graphql branch 3 times, most recently from f7a31e0 to 95fdea6 Compare May 31, 2018 04:35
@blazeu
Copy link
Member

blazeu commented May 31, 2018

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.

@blazeu
Copy link
Member

blazeu commented May 31, 2018

For the frontend change, the commit doesn't explain enough that the frontend was rewritten/changed with Bulma.

Also, the commit tag graphql: is redundant, Use GraphQL for GitHub + Closes link is enough, note the capitalization though.

@bekicot bekicot force-pushed the use-graphql branch 2 times, most recently from 028be11 to da3907b Compare May 31, 2018 22:55
trackers: [
{
type: 'github',
identifier: 'coala'
Copy link
Member

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',
Copy link
Member

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({
Copy link
Member

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.

@jayvdb jayvdb added the blocked label Jun 1, 2018
@jayvdb
Copy link
Member

jayvdb commented Jun 1, 2018

It was requested at #33 (comment) that you unbreak the repo before rewriting it. Please do that.

@jayvdb
Copy link
Member

jayvdb commented Jun 1, 2018

This is blocked. That means you stop pushing changes here for review.
Re-read my comment above.

@bekicot bekicot mentioned this pull request Jun 1, 2018

export const queryBuilder = function queryBuilder({orgs}) {
let queries = ["sort:updated-desc", "state:open"];
if(isIterable(orgs)) {
Copy link
Member

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

}`

export const queryBuilder = function queryBuilder({orgs}) {
let queries = ["sort:updated-desc", "state:open"];
Copy link
Member

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.

identifier: '52North'
}
]
}
Copy link
Member

@blazeu blazeu Jun 1, 2018

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

Copy link
Contributor Author

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.

Copy link
Member

@blazeu blazeu left a 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.

import {oneWay} from '@ember/object/computed';
import {inject} from '@ember/service';


Copy link
Member

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

@blazeu blazeu removed the blocked label Jun 1, 2018
@bekicot bekicot force-pushed the use-graphql branch 2 times, most recently from dda2e8f to fb5ba6c Compare June 13, 2018 01:38
'use strict';

module.exports = {
coverageEnvVar: 'COV',
Copy link
Member

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.

Copy link
Contributor Author

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.

@jayvdb
Copy link
Member

jayvdb commented Jun 13, 2018

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

@jayvdb jayvdb removed the request for review from guyzmo June 13, 2018 08:30
@jayvdb jayvdb changed the title [WIP] graphql: Use graphql for GitHub [WIP] Use GraphQL for GitHub Jun 13, 2018
@jayvdb
Copy link
Member

jayvdb commented Jun 13, 2018

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 .

@@ -2,9 +2,6 @@

const EmberApp = require('ember-cli/lib/broccoli/ember-app');

const environment = process.env.EMBER_ENV;
Copy link
Member

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.

@@ -8,7 +8,7 @@ export default Service.extend({
this.organizations = Object.create(organizations);
},

list: computed('organizations', function () {
list: computed('organizations', function listOrganization() {
Copy link
Member

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.

@jayvdb
Copy link
Member

jayvdb commented Jun 13, 2018

This PR will soon be too long to be usable on GitHub.
When that happens, please create a new branch, and a new PR, and then we close this one.

That should also fix the codecov problems.

@bekicot
Copy link
Contributor Author

bekicot commented Jun 13, 2018

Ok, Will remove codecov & lint from this pull and move it to a new pull request.

@jayvdb
Copy link
Member

jayvdb commented Jun 13, 2018

Ok, Will remove codecov & lint from this pull and move it to a new pull request.

That is not what I requested.
Please activate https://travis-ci.org/bekicot/git-task-list and https://codecov.io/gh/bekicot/git-task-list

@bekicot
Copy link
Contributor Author

bekicot commented Jun 13, 2018

Ok

@bekicot
Copy link
Contributor Author

bekicot commented Jun 15, 2018

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
.search-results {
overflow-y: scroll;
.tag {
text-shadow: 1px 1px 1px white;
Copy link
Member

Choose a reason for hiding this comment

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

The text shadow makes it harder to read.
image

Copy link
Member

@blazeu blazeu Jun 27, 2018

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.

Copy link
Contributor Author

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?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, use Javascript.

bekicot added 3 commits June 28, 2018 18:09
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
@blazeu
Copy link
Member

blazeu commented Jun 29, 2018

Commit 1236cad

Closes should be on the last line

<img src="{{task.repository.owner.avatarUrl}}" alt="">
</figure>
&nbsp;
{{task.repository.nameWithOwner}}
Copy link
Member

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.

@bekicot bekicot changed the title [WIP] Use GraphQL for GitHub Use GraphQL for GitHub Jun 30, 2018
@bekicot bekicot closed this Jun 30, 2018
@bekicot
Copy link
Contributor Author

bekicot commented Jun 30, 2018

Continued in #64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

5 participants