Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
config/local.json
public/dist/
node_modules/
data/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
keys/
data/
config/local.js
config/local.json
Expand Down
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM glavin001/alpine-python2-numpy-scipy
MAINTAINER Glavin Wiechert <glavin.wiechert@gmail.com>

RUN apk update

# Install Node.js
RUN apk add nodejs

# Defines our working directory in container
WORKDIR /usr/src/app

# Copy the application project
COPY package.json .
RUN npm install

# Build
COPY webpack.config.babel.js \
.babelrc \
./
COPY config/ config/
COPY src/ src/
COPY public/src/ public/src/
RUN npm run build

# Enable systemd init system in container
# ENV INITSYSTEM on

# Run on device
CMD npm run start:server
14 changes: 14 additions & 0 deletions config/custom-environment-variables.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"github": {
"token": "GITHUB_TOKEN",
"client_id": "GITHUB_CLIENT_ID",
"client_secret": "GITHUB_CLIENT_SECRET"
},
"db": {
"database": "DB_DATABASE",
"username": "DB_USERNAME",
"password": "DB_PASSWORD",
"host": "DB_HOST",
"dialect": "DB_DIALECT"
}
}
16 changes: 16 additions & 0 deletions config/resin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"server": {
"base_url": "http://localhost:8080",
"port": 80
},
"app": {
"base_url": "http://localhost:8080"
},
"db": {
"database": "issuemanager",
"username": "resin",
"password": "resin",
"host": "localhost",
"dialect": "postgres"
}
}
33 changes: 33 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: '2'

services:

issue-bot:
container_name: issue-bot
build: .
ports:
- "8080:80"
volumes:
- /data
environment:
- NODE_ENV=docker
- GITHUB_TOKEN
- GITHUB_CLIENT_ID
- GITHUB_CLIENT_SECRET
- DB_DATABASE=issuebot
- DB_USERNAME=issuebot
- DB_PASSWORD=issuebot
- DB_HOST=database
- DB_DIALECT=postgres

database:
container_name: issue-bot-database
image: postgres:alpine
ports:
- "5432:5432"
volumes:
- /var/lib/postgresql/data
environment:
- POSTGRES_DB=issuebot
- POSTGRES_USER=issuebot
- POSTGRES_PASSWORD=issuebot
43 changes: 22 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
"scripts:get-issues": "node scripts/get-issues.js",
"scripts": "npm-run-all run:get-issues run:classify",
"build": "webpack",
"build:watch": "webpack --watch",
"start:webpack-watch": "webpack --watch",
"start:webpack": "webpack-dev-server --hot --inline",
"start:server": "node src",
"start": "npm-run-all --parallel start:webpack start:server"
"start": "npm-run-all --parallel build:watch start:server"
},
"repository": {
"type": "git",
Expand All @@ -38,47 +39,47 @@
"bootstrap": "^3.3.6",
"bootstrap-sass": "^3.3.6",
"config": "^1.21.0",
"d3": "^3.5.17",
"d3": "3.5.17",
"express": "^4.13.4",
"font-awesome": "^4.6.3",
"font-awesome-webpack": "0.0.4",
"github": "^1.1.1",
"font-awesome-webpack": "0.0.5-beta.2",
"github": "^9.2.0",
"github-oauth": "^0.2.2",
"github-webhook-handler": "^0.5.0",
"jquery": "^2.0.0",
"github-webhook-handler": "^0.6.0",
"jquery": "^3.2.1",
"lodash": "^4.13.1",
"mkdirp": "^0.5.1",
"parse-github-url": "^0.3.1",
"pg": "^5.1.0",
"parse-github-url": "^1.0.0",
"pg": "^6.1.5",
"pg-hstore": "^2.3.2",
"python-shell": "^0.4.0",
"react": "^15.1.0",
"react-dom": "^15.1.0",
"react-if": "^2.0.5",
"react-router": "^2.4.1",
"react-router": "^3.0.5",
"sequelize": "^3.23.3",
"socket.io": "^1.4.6"
"socket.io": "^2.0.1"
},
"devDependencies": {
"babel-core": "^6.9.1",
"babel-loader": "^6.2.4",
"babel-loader": "^7.0.0",
"babel-plugin-transform-class-properties": "^6.9.1",
"babel-preset-es2015": "^6.9.0",
"babel-preset-react": "^6.5.0",
"babel-preset-react-hmre": "^1.1.1",
"chai": "^3.5.0",
"css-loader": "^0.23.1",
"file-loader": "^0.8.5",
"css-loader": "^0.28.1",
"file-loader": "^0.11.1",
"less": "^2.7.1",
"less-loader": "^2.2.3",
"mocha": "^2.5.3",
"node-sass": "^3.7.0",
"npm-run-all": "^2.1.1",
"less-loader": "^4.0.3",
"mocha": "^3.3.0",
"node-sass": "^4.5.2",
"npm-run-all": "^4.0.2",
"react-hot-loader": "^1.3.0",
"sass-loader": "^3.2.0",
"style-loader": "^0.13.1",
"sass-loader": "^6.0.5",
"style-loader": "^0.17.0",
"url-loader": "^0.5.7",
"webpack": "^1.13.1",
"webpack-dev-server": "^1.14.1"
"webpack": "^2.5.1",
"webpack-dev-server": "^2.4.5"
}
}
4 changes: 2 additions & 2 deletions public/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<body>

<div id="root"></div>
<script src="http://issue-manager.ngrok.io/socket.io/socket.io.js"></script>
<script src="app.bundle.js"></script>
<script src="/socket.io/socket.io.js"></script>
<script src="bundle.js"></script>

</body>

Expand Down
2 changes: 1 addition & 1 deletion public/src/js/components/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class App extends Component {
super(props);

this.state = {
socket: io('http://issue-manager.ngrok.io')
socket: io()
};
}

Expand Down
11 changes: 8 additions & 3 deletions public/src/js/components/graph.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Component } from 'react';
import _ from 'lodash';
import d3 from 'd3';
import * as d3 from 'd3';
import ReactDOM from 'react-dom'

// *****************************************************
Expand Down Expand Up @@ -99,7 +99,11 @@ export default class Graph extends Component {
// }

var updateNode = (selection) => {
selection.attr("transform", (d) => "translate(" + d.x + "," + d.y + ")");
console.log('selection', selection);
selection.attr("transform", (d) => {
console.log('d', d);
return "translate(" + d.x + "," + d.y + ")"
});
};

var enterLink = (selection) => {
Expand Down Expand Up @@ -142,7 +146,8 @@ export default class Graph extends Component {
console.log('svg', svg, g);
// .scaleExtent([1, 100])
svg.call(d3.behavior.zoom().on("zoom", () => {
g.attr("transform", "translate(" + d3.event.translate + ")" + " scale(" + d3.event.scale + ")")
// console.log('d3.event', d3.event);
d3.event && g.attr("transform", "translate(" + d3.event.translate + ")" + " scale(" + d3.event.scale + ")")
}))
.on("dblclick.zoom", null);

Expand Down
14 changes: 7 additions & 7 deletions public/src/js/components/setup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ export default class Setup extends Component {
componentDidMount() {
console.log('Loading!');

this.context.socket.emit(EVENTS.AUTHENTICATE, this.state.token, (err, user) => {
console.log(err, user);
this.context.socket.emit(EVENTS.AUTHENTICATE, this.state.token, (err, result) => {
console.log(err, result);
const user = result.data;
this.setState({
user
});
Expand All @@ -52,15 +53,14 @@ export default class Setup extends Component {
isValidRepository: null, // Pending
});
this.context.socket.emit(EVENTS.PARSE_REPOSITORY_URL, value, (repo) => {
// console.log('repo', repo);
if (repo && repo.name) {
this.context.socket.emit(EVENTS.GITHUB_REPO, {
user: repo.owner,
owner: repo.owner,
repo: repo.name
}, (err, repo) => {
}, (err, result) => {
this.setState({
repo,
isValidRepository: !!repo
repo: result.data,
isValidRepository: Boolean(result && result.data)
});
});
} else {
Expand Down
2 changes: 1 addition & 1 deletion public/src/js/components/welcome.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default class Welcome extends Component {
<div className="jumbotron">
<h1>Issue Manager!</h1>
<p>Your automated Issue organizer and assistant.</p>
<p><a className="btn btn-primary btn-lg" href="http://issue-manager.ngrok.io/github/login" role="button">Login with GitHub <i className="fa fa-github" aria-hidden="true"></i></a></p>
<p><a className="btn btn-primary btn-lg" href="/github/login" role="button">Login with GitHub <i className="fa fa-github" aria-hidden="true"></i></a></p>
</div>
</div>);
}
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
scikit-learn==0.17.1
numpy==1.9.2
numpy==1.13.0rc1
18 changes: 18 additions & 0 deletions scripts/create-database.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env sh
set -e

# Start PostgreSQL
echo "Start PostgreSQL"
/etc/init.d/postgresql start

# Create database
echo "Create PostgreSQL database"
echo "createdb issuemanager" | sudo -i -u postgres

# Create User role
echo "Create PostgreSQL User"
echo "psql issuemanager --command=\"create user resin password 'resin';\"" | sudo -i -u postgres

# Stop PostgreSQL
echo "Stop PostgreSQL"
/etc/init.d/postgresql stop
2 changes: 1 addition & 1 deletion scripts/get-issues.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async.parallel([
], (err, results) => {

// Get contents for each Issue
// console.log(err, issues);
console.log(err, results);
let issues = results[1];
issues = _.map(issues, (issue) => {
issue.labels = _.map(issue.labels, 'name');
Expand Down
4 changes: 2 additions & 2 deletions scripts/multi-label_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

# Get JSON data
user = "Glavin001"
repo = "test-issues"
# repo = "atom-beautify"
# repo = "test-issues"
repo = "atom-beautify"
# repo = "atom-preview"
# user = "reactjs"
# repo = "redux"
Expand Down
8 changes: 4 additions & 4 deletions scripts/train.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ const { train } = require('../src/classifier');
const fs = require('fs');

// Get list of Issues for repository
let user = 'Glavin001';
let owner = 'Glavin001';
let repo = 'atom-beautify';
// let user = 'reactjs';
// let repo = 'redux';
// let user = 'nodejs';
// let repo = 'node';
let dataPath = path.resolve(__dirname, '../data/',user,repo);
let dataPath = path.resolve(__dirname, '../data/', owner, repo);

const issues = require(path.resolve(dataPath, 'issues.json'));
console.log('Issues: '+issues.length);

train(issues)
const ignoreLabels = ['published', 'cannot-reproduce', 'high priority', 'in-progress', 'invalid', 'quick-todo', 'update-dependency', 'waiting-for-user-information', 'linux', 'mac'];
train('labels', [owner, repo, issues, ignoreLabels])
.then((results) => {
console.log('finished!');
fs.writeFileSync(path.resolve(dataPath,'results.json'), JSON.stringify(results, undefined, 2));
Expand Down
2 changes: 1 addition & 1 deletion src/api/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = function(socket) {
*/
socket.on(EVENTS.GITHUB_REPO, (options, cb) => {
if (!socket.github) return cb(ERRORS.MISSING_GITHUB);

console.log(options);
socket.github.repos.get(options, function(err, res) {
return cb(err && err.message, res);
});
Expand Down
7 changes: 6 additions & 1 deletion src/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,13 @@ module.exports = function(socket, io) {
const github = new GitHubApi({
debug: false,
});

// Create an authenticated GitHub client
github.authenticate({type: "oauth", token: token});
github.authenticate({
type: "oauth",
token: token
});

// Test the client by attempting to get the user's information
github.users.get({}, function(err, res) {
if (err) {
Expand Down
Loading