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
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,10 @@ jspm_packages

# Built css files
*.css

# Lock file
yarn.lock

# Builds
/lib
/src/index.js
5 changes: 3 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Setup development environment

.. code-block:: bash

npm i
yarn

#. Build styles

Expand All @@ -32,7 +32,8 @@ Setup development environment

GITLAB_URL="http://gitlab.localhost" \
GITLAB_TOKEN="personal_access_token" \
npm start
GITLAB_GROUP_ID=1234567 \
yarn start


- ``GITLAB_URL`` is the home page for your GitLab instance
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
]
},
"engines": {
"node": ">=5.0 <6",
"npm": ">=3.3 <4"
"node": ">=5.0",
"npm": ">=3.3"
},
"dependencies": {
"react": "15.6.1",
Expand All @@ -43,8 +43,8 @@
"scripts": {
"clean": "rm -rf ./lib",
"build": "webpack && gulp sass && cp -R ./src/resources ./lib",
"lib": "npm run clean && babel src -d lib",
"prepublish": "npm run lib",
"lib": "yarn clean && babel src -d lib",
"prepublish": "yarn lib",
"start": "webpack-dev-server"
}
}
3 changes: 2 additions & 1 deletion src/actions/member.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { gitlabRequest } from './gitlabApi';
import {GITLAB_GROUP_ID} from "../config";


export const MEMBERS_SET = 'MEMBERS_SET';

export function fetchMembers() {
return gitlabRequest('/users', {active: true, blocked: false});
return gitlabRequest('/groups/'+GITLAB_GROUP_ID+'/members/all', {active: true, blocked: false});
}

export function membersSet(data) {
Expand Down
3 changes: 2 additions & 1 deletion src/actions/project.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { gitlabRequest } from './gitlabApi';
import {GITLAB_GROUP_ID} from "../config";


export const PROJECTS_SET = 'PROJECTS_SET';

export function fetchProjects() {
return gitlabRequest('/projects');
return gitlabRequest('/groups/'+GITLAB_GROUP_ID+'/projects');
}

export function projectsSet(data) {
Expand Down
1 change: 1 addition & 0 deletions src/config.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Environment variables (see README and webpack.config.js)
export const GITLAB_URL = __GITLAB_URL;
export const GITLAB_TOKEN = __GITLAB_TOKEN;
export const GITLAB_GROUP_ID = __GITLAB_GROUP_ID;
6 changes: 3 additions & 3 deletions src/middlewares/gitlabApi.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ACTIONS } from '../actions/gitlabApi';
const MAX_PER_PAGE = 100;

function Deferred() {
var self = this;
let self = this;
this.promise = new Promise((resolve, reject) => {
self.resolve = resolve;
self.reject = reject;
Expand Down Expand Up @@ -37,7 +37,7 @@ export const isApiAction = (action) => {
};

export const createGitlabApiMiddleware = (instanceUrl, accessToken) => {
return (store) => {
return (/*store*/) => {
return (next) => {
return (action) => {
if (!isApiAction(action)) {
Expand All @@ -47,7 +47,7 @@ export const createGitlabApiMiddleware = (instanceUrl, accessToken) => {
let result;
const { type: actionType, payload: actionPayload } = action;

if (actionType == ACTIONS.GITLAB_REQUEST) {
if (actionType === ACTIONS.GITLAB_REQUEST) {
const { url, args, paginated } = actionPayload;
result = fetchPart(`${instanceUrl}/api/v4/${url.replace(/^\/?/, '')}`, {
...args,
Expand Down
3 changes: 2 additions & 1 deletion src/reducers/members.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import { MEMBERS_SET } from '../actions/member';
let initialState = [];

export default function (state=initialState, action) {
if (action.type == MEMBERS_SET) {
if (action.type === MEMBERS_SET) {
return [{
id: null,
name: 'No assignee',
avatar_url: '/resources/image/no-assignee.png',
capacity: 0,
}].concat(action.payload.data.map(member => {
// TODO: find a way to store capacity in some kind of gitlab custom fields
// now bio isn't exists in member object
let match = /\/capacity\s+(\d+)/.exec(member.bio);
return {...member, capacity: match ? parseInt(match[1]): 30}
}));
Expand Down
2 changes: 2 additions & 0 deletions src/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
User-agent: *
Disallow: /
6 changes: 4 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const
LISTEN_HOST = env.LISTEN_HOST || 'localhost',
LISTEN_PORT = env.LISTEN_PORT || 3030,
GITLAB_URL = env.GITLAB_URL || 'localhost',
GITLAB_TOKEN = env.GITLAB_TOKEN || '';
GITLAB_TOKEN = env.GITLAB_TOKEN || '',
GITLAB_GROUP_ID = env.GITLAB_GROUP_ID || '';

module.exports = {
entry: './src',
Expand Down Expand Up @@ -47,7 +48,8 @@ module.exports = {
plugins: [
new webpack.DefinePlugin({
__GITLAB_URL: JSON.stringify(GITLAB_URL),
__GITLAB_TOKEN: JSON.stringify(GITLAB_TOKEN)
__GITLAB_TOKEN: JSON.stringify(GITLAB_TOKEN),
__GITLAB_GROUP_ID: JSON.stringify(GITLAB_GROUP_ID)
})
]
};