diff --git a/client/package.json b/client/package.json index c0a9f35e9..c0907e711 100644 --- a/client/package.json +++ b/client/package.json @@ -1,6 +1,6 @@ { "name": "@superalgos/operations-client", - "version": "0.0.7", + "version": "0.0.8", "description": "Superalgos Operations client-side web app", "main": "src/index.js", "dependencies": { diff --git a/client/src/views/Clone/Add/index.js b/client/src/views/Clone/Add/index.js index 06781d9ad..54d42e0a8 100644 --- a/client/src/views/Clone/Add/index.js +++ b/client/src/views/Clone/Add/index.js @@ -43,7 +43,8 @@ class AddClone extends Component { stateDatetime: 0, createDatetime: 0, runAsTeam: false, - financialBeings:[], + teams: [], + teamId: '', // Indicator Bot startYear: 2019, @@ -131,7 +132,7 @@ class AddClone extends Component { ) } else{ - this.financialBeings = data.teams_FbByTeamMember.fb + this.teams = data.teams_FbByTeamMember } return ( @@ -408,10 +409,11 @@ class AddClone extends Component { } setSelectedBot(botId){ - if(isDefined(this.financialBeings)){ - for (var i = 0; i < this.financialBeings.length; i++) { - if(this.financialBeings[i].id === botId){ - this.setState({selectedBot:this.financialBeings[i]}) + if(isDefined(this.teams)){ + for (var i = 0; i < this.teams.fb.length; i++) { + if(this.teams.fb[i].id === botId){ + this.setState({selectedBot:this.teams.fb[i]}) + this.setState({teamId:this.teams.id}) return } } @@ -439,6 +441,7 @@ class AddClone extends Component { async createCloneOnServer(){ let variables = { clone:{ + teamId: this.state.teamId, botId: this.state.selectedBot.id, mode: this.state.mode, resumeExecution: this.state.resumeExecution, @@ -496,6 +499,8 @@ class AddClone extends Component { createDatetime: 0, runAsTeam: false, processName: '', + teams: [], + teamId: '', //Error handlers nameError: false, diff --git a/server/src/schema/mutations/AddCloneMutation.js b/server/src/schema/mutations/AddCloneMutation.js index dd14e931e..c9ca557a1 100644 --- a/server/src/schema/mutations/AddCloneMutation.js +++ b/server/src/schema/mutations/AddCloneMutation.js @@ -50,7 +50,7 @@ const resolve = async(parent, { clone }, context) => { } try{ - let team = await teamQuery(context.authorization) + let team = await teamQuery(context.authorization, clone.teamId) clone = await cloneDetails(context.userId, team.data.data.teams_TeamById, clone) clone.createDatetime = new Date().valueOf() / 1000|0 clone.active = true diff --git a/server/src/schema/types/input/Clone.js b/server/src/schema/types/input/Clone.js index 9d20ec6ac..0db3cdf0d 100644 --- a/server/src/schema/types/input/Clone.js +++ b/server/src/schema/types/input/Clone.js @@ -10,6 +10,7 @@ const Type = new GraphQLInputObjectType({ name: 'CloneInput', description: 'Payload for clone input', fields: () => ({ + teamId: { type: new GraphQLNonNull(GraphQLString) }, botId: { type: new GraphQLNonNull(GraphQLString) }, mode: { type: GraphQLString }, resumeExecution: { type: GraphQLBoolean },