Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into feature/38
Browse files Browse the repository at this point in the history
# Conflicts:
#	package-lock.json
#	package.json
#	ui/src/index.js
  • Loading branch information
m4nv3ru committed Feb 8, 2023
2 parents 0ab3123 + 80b21f1 commit 94986be
Show file tree
Hide file tree
Showing 274 changed files with 62,797 additions and 31,104 deletions.
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

2 changes: 1 addition & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ rules:
no-console: off
indent: ['error', 2, { "SwitchCase": 1 }]
max-len: ["error", { "code": 140 }]
comma-dangle: ["error", "never"]
comma-dangle: ["error", "only-multiline"]
operator-linebreak: ['error', 'after', { "overrides": { "?": "before", ":": "before"} }]
linebreak-style: ["error", "unix"]
quotes:
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/node_modules
/ui/assets
/dist
.pupil
.pupilrc
db/
Expand All @@ -12,4 +12,4 @@ coverage/
out
pkg
.grandle

/ui/db_export
5 changes: 3 additions & 2 deletions .jestrc-coverage.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"transform": {
".*": "<rootDir>/../../node_modules/babel-jest"
},
"moduleFileExtensions": ["js", "jsx"],
"moduleFileExtensions": ["js", "jsx","json"],
"collectCoverage": true,
"coverageDirectory": "<rootDir>/../../coverage/ui"
"coverageDirectory": "<rootDir>/../../coverage/ui",
"transformIgnorePatterns": ["node_modules/(?!d3|d3-array|internmap|delaunator|robust-predicates)"]
}
3 changes: 2 additions & 1 deletion .jestrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"transform": {
".*": "<rootDir>/../../node_modules/babel-jest"
},
"moduleFileExtensions": ["js", "jsx", "json"]
"moduleFileExtensions": ["js", "jsx","json"],
"transformIgnorePatterns": ["node_modules/(?!d3|d3-array|internmap|delaunator|robust-predicates)"]
}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:8
FROM node:16

RUN npm config -g set user root

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ thing - naming is hard `¯\_(ツ)_/¯`.

## Dependencies

* node.js >= 8
* node.js >= 16
* ArangoDB (tested with 3.1.28)

## Installation
Expand Down
8 changes: 8 additions & 0 deletions babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"presets": ["@babel/react",
["@babel/preset-env", {
"useBuiltIns": "usage",
"corejs": 3
}]
]
}
111 changes: 60 additions & 51 deletions foxx/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const queryType = new gql.GraphQLObjectType({
args: {
since: { type: Timestamp },
until: { type: Timestamp },
sort: { type: Sort }
sort: { type: Sort },
},
query: (root, args, limit) => {
let q = qb.for('commit').in('commits').sort('commit.date', args.sort);
Expand All @@ -45,29 +45,29 @@ const queryType = new gql.GraphQLObjectType({
q = q.limit(limit.offset, limit.count).return('commit');

return q;
}
},
}),
commit: {
type: require('./types/commit.js'),
args: {
sha: {
description: 'sha of the commit',
type: new gql.GraphQLNonNull(gql.GraphQLString)
}
type: new gql.GraphQLNonNull(gql.GraphQLString),
},
},
resolve(root, args) {
return commits.document(args.sha);
}
},
},
latestCommit: {
type: require('./types/commit.js'),
args: {
since: { type: Timestamp },
until: { type: Timestamp }
until: { type: Timestamp },
},
resolve(root, args) {
return commits.document(args.sha);
}
},
},
commitDateHistogram: makeDateHistogramEndpoint(commits, 'date', {
args: {
Expand All @@ -76,27 +76,27 @@ const queryType = new gql.GraphQLObjectType({
name: 'BuildFilter',
values: {
successful: {
value: 'successful'
value: 'successful',
},
failed: {
value: 'failed'
value: 'failed',
},
all: {
value: 'all'
}
}
value: 'all',
},
},
}),
description: 'Include/exclude commits that have successful builds'
}
description: 'Include/exclude commits that have successful builds',
},
},
makeFilter: args => {
makeFilter: (args) => {
if (!args.buildFilter || args.buildFilter === 'all') {
return true;
}

const comparatorMap = {
successful: 'gt',
failed: 'eq'
failed: 'eq',
};

return qb[comparatorMap[args.buildFilter]](
Expand All @@ -109,32 +109,32 @@ const queryType = new gql.GraphQLObjectType({
),
0
);
}
},
}),
files: paginated({
type: require('./types/file.js'),
args: {
sort: { type: Sort }
sort: { type: Sort },
},
query: (root, args, limit) => {
let q = qb.for('file').in('files').sort('file.path', args.sort);

q = q.limit(limit.offset, limit.count).return('file');

return q;
}
},
}),
file: {
type: require('./types/file.js'),
args: {
path: {
description: 'Path of the file',
type: new gql.GraphQLNonNull(gql.GraphQLString)
}
type: new gql.GraphQLNonNull(gql.GraphQLString),
},
},
resolve(root, args) {
return files.firstExample({ path: args.path });
}
},
},
languages: paginated({
type: require('./types/language'),
Expand All @@ -143,19 +143,19 @@ const queryType = new gql.GraphQLObjectType({
IN
${languages}
${limit}
RETURN language`
RETURN language`,
}),
language: {
type: require('./types/language'),
args: {
name: {
description: 'name of language',
type: new gql.GraphQLNonNull(gql.GraphQLString)
}
type: new gql.GraphQLNonNull(gql.GraphQLString),
},
},
resolve(root, args) {
return languages.firstExample({ name: args.name });
}
},
},
modules: paginated({
type: require('./types/module'),
Expand All @@ -164,19 +164,19 @@ const queryType = new gql.GraphQLObjectType({
IN
${modules}
${limit}
RETURN module`
RETURN module`,
}),
module: {
type: require('./types/module'),
args: {
path: {
description: 'path of module',
type: new gql.GraphQLNonNull(gql.GraphQLString)
}
type: new gql.GraphQLNonNull(gql.GraphQLString),
},
},
resolve(root, args) {
return modules.firstExample({ path: args.path });
}
},
},
stakeholders: paginated({
type: require('./types/stakeholder.js'),
Expand All @@ -185,7 +185,7 @@ const queryType = new gql.GraphQLObjectType({
IN
${stakeholders}
${limit}
RETURN stakeholder`
RETURN stakeholder`,
}),
committers: {
type: new gql.GraphQLList(gql.GraphQLString),
Expand All @@ -198,7 +198,7 @@ const queryType = new gql.GraphQLObjectType({
RETURN DISTINCT commit.signature`
)
.toArray();
}
},
},
baseBuilds: paginated({
type: require('./types/build.js'),
Expand All @@ -207,30 +207,34 @@ const queryType = new gql.GraphQLObjectType({
FOR build IN ${builds}
SORT build.createdAt ASC
${limit}
RETURN build`
RETURN build`,
}),
builds: paginated({
type: require('./types/build.js'),
args: {},
query: (root, args, limit) => aql`
args: { since: { type: Timestamp }, until: { type: Timestamp } },
query: (root, args, limit) => {
return aql`
FOR build IN ${builds}
SORT build.createdAt ASC
${limit}
FILTER DATE_TIMESTAMP(build.createdAt) >= DATE_TIMESTAMP(${args.since})
FILTER DATE_TIMESTAMP(build.createdAt) <= DATE_TIMESTAMP(${args.until})
LET countsByStatus = (
FOR other IN ${builds}
FILTER other.finishedAt <= build.createdAt
COLLECT status = other.status WITH COUNT INTO statusCount
RETURN { [status]: statusCount }
)
RETURN MERGE(build, { stats: MERGE(countsByStatus) })`
RETURN MERGE(build, { stats: MERGE(countsByStatus) })`;
},
}),
issues: paginated({
type: require('./types/issue.js'),
args: {
q: { type: gql.GraphQLString },
since: { type: Timestamp },
until: { type: Timestamp },
sort: { type: Sort }
sort: { type: Sort },
},
query: (root, args, limit) => {
let exactQuery = [];
Expand Down Expand Up @@ -258,15 +262,15 @@ const queryType = new gql.GraphQLObjectType({
q = q.limit(limit.offset, limit.count).return('issue');

return q;
}
},
}),
issue: {
type: require('./types/issue.js'),
args: {
iid: {
description: 'Project-Internal issue number',
type: new gql.GraphQLNonNull(gql.GraphQLInt)
}
type: new gql.GraphQLNonNull(gql.GraphQLInt),
},
},
resolve(root, args) {
return db
Expand All @@ -278,43 +282,45 @@ const queryType = new gql.GraphQLObjectType({
RETURN issue`
)
.toArray()[0];
}
},
},
branches: paginated({
type: require('./types/branch.js'),
args: {
sort: { type: Sort }
sort: { type: Sort },
},
query: (root, args, limit) => {
let q = qb.for('branch').in('branches').sort('branch.id', args.sort);

q = q.limit(limit.offset, limit.count).return('branch');

return q;
}
},
}),
issueDateHistogram: makeDateHistogramEndpoint(issues)
issueDateHistogram: makeDateHistogramEndpoint(issues),
};
}
},
});

module.exports = new gql.GraphQLSchema({
query: queryType
query: queryType,
});

function makeDateHistogramEndpoint(collection, dateFieldName, { makeFilter, args } = {}) {
const extendedArgs = Object.assign(
{
granularity: {
type: new gql.GraphQLNonNull(DateHistogramGranularity)
}
type: new gql.GraphQLNonNull(DateHistogramGranularity),
},
since: { type: Timestamp },
until: { type: Timestamp },
},
args
);

if (!dateFieldName) {
extendedArgs.dateField = {
type: new gql.GraphQLNonNull(gql.GraphQLString)
type: new gql.GraphQLNonNull(gql.GraphQLString),
};
}

Expand All @@ -324,6 +330,9 @@ function makeDateHistogramEndpoint(collection, dateFieldName, { makeFilter, args
resolve(root, args) {
let q = qb.for('item').in(collection);

q = queryHelpers.addDateFilter('item.' + (dateFieldName || args.dateField), 'gte', args.since, q);
q = queryHelpers.addDateFilter('item.' + (dateFieldName || args.dateField), 'lte', args.until, q);

if (makeFilter) {
q = q.filter(makeFilter(args));
}
Expand All @@ -333,11 +342,11 @@ function makeDateHistogramEndpoint(collection, dateFieldName, { makeFilter, args
.withCountInto('length')
.return({
category: 'category',
count: 'length'
count: 'length',
})
.toAQL();

return db._query(q).toArray();
}
},
};
}
Loading

0 comments on commit 94986be

Please sign in to comment.