Merge branch 'develop' into master

This commit is contained in:
benme authored and GitHub committed 2019-03-26 19:00:26 +01:00
commit 7729df82d6
3 files changed
+23 -10

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@superalgos/operations-client",
"version": "0.0.18",
"version": "0.0.21",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
+11 -5
View File
@@ -1,4 +1,4 @@
import { GraphQLList } from 'graphql'
import { GraphQLList, GraphQLString } from 'graphql'
import { AuthentificationError, OperationsError } from '../../errors'
import { CloneType } from '../types'
import { Clone } from '../../models'
@@ -6,9 +6,11 @@ import logger from '../../config/logger'
import cloneDetails from '../cloneDetails'
import teamQuery from '../../graphQLCalls/teamQuery'
const args = {}
const args = {
botType: { type: GraphQLString }
}
const resolve = async(parent, args, context) => {
const resolve = async(parent, { botType }, context) => {
logger.debug('Retrieving History Clones.')
try {
if (!context.userId) {
@@ -25,8 +27,12 @@ const resolve = async(parent, args, context) => {
clones[i] = await cloneDetails(context.userId, team.data.data.teams_TeamById, clones[i])
clones[i].botType = clones[i].kind // Only for listing we show the teams value
}
return clones
if (botType) {
var filtered = clones.filter((value) => value.botType === botType)
return filtered
} else {
return clones
}
} catch (err) {
logger.error('Retrieving History Clones error: %s', err.stack)
throw new OperationsError('There has been an error retrieving history clones.')
+11 -4
View File
@@ -1,4 +1,4 @@
import { GraphQLList } from 'graphql'
import { GraphQLList, GraphQLString } from 'graphql'
import { AuthentificationError, OperationsError } from '../../errors'
import { CloneType } from '../types'
import { Clone } from '../../models'
@@ -8,9 +8,11 @@ import getCloneLogs from '../../kubernetes/getClonePodLogs'
import cloneDetails from '../cloneDetails'
import teamQuery from '../../graphQLCalls/teamQuery'
const args = {}
const args = {
botType: { type: GraphQLString }
}
const resolve = async(parent, args, context) => {
const resolve = async (parent, { botType }, context) => {
logger.debug('List Clones -> Entering Fuction.')
try {
if (!context.userId) {
@@ -32,7 +34,12 @@ const resolve = async(parent, args, context) => {
clones[i].botType = clones[i].kind // Only for listing we show the teams value
clones[i].botSlug = clones[i].botSlug
}
return clones
if (botType) {
var filtered = clones.filter((value) => value.botType === botType)
return filtered
} else {
return clones
}
} catch (err) {
logger.error('List Clones error: %s', err.stack)
throw new OperationsError('There has been an error listing the clones.')