From 4d87e353e8223fff823ea381bbb5aa84a4050ee5 Mon Sep 17 00:00:00 2001 From: Barry Low Date: Wed, 17 Oct 2018 11:47:29 -0700 Subject: [PATCH] Fix team images for Master App --- api/src/graphql/TeamsFragment.js | 1 + api/src/index.js | 12 ++++---- client/package-lock.json | 2 +- client/package.json | 2 +- client/src/graphql/fbs/AddAlgobotMutation.js | 17 ----------- .../src/graphql/fbs/DeleteAlgobotMutation.js | 10 ------- client/src/graphql/fbs/GetAlgobotQuery.js | 19 ------------ client/src/graphql/fbs/GetAllAlgobotsQuery.js | 29 ------------------- .../src/graphql/fbs/UniqueAlgobotnameQuery.js | 10 ------- .../graphql/members/GetUserByAuthIDQuery.js | 25 ---------------- client/src/graphql/members/index.js | 3 +- .../manage-teams/components/ManageTeamEdit.js | 11 +++---- .../components/ManageTeamsItem.js | 4 +-- .../components/ManageTeamsList.js | 3 +- client/src/views/manage-teams/index.js | 4 +-- .../views/teams/components/TeamsDetails.js | 4 +-- .../src/views/teams/components/TeamsList.js | 6 ++++ 17 files changed, 30 insertions(+), 132 deletions(-) delete mode 100644 client/src/graphql/fbs/AddAlgobotMutation.js delete mode 100644 client/src/graphql/fbs/DeleteAlgobotMutation.js delete mode 100644 client/src/graphql/fbs/GetAlgobotQuery.js delete mode 100644 client/src/graphql/fbs/GetAllAlgobotsQuery.js delete mode 100644 client/src/graphql/fbs/UniqueAlgobotnameQuery.js delete mode 100644 client/src/graphql/members/GetUserByAuthIDQuery.js diff --git a/api/src/graphql/TeamsFragment.js b/api/src/graphql/TeamsFragment.js index c440139bd..442829e3c 100644 --- a/api/src/graphql/TeamsFragment.js +++ b/api/src/graphql/TeamsFragment.js @@ -13,6 +13,7 @@ const TEAMS_FRAGMENT = gql`{ createdAt profile { avatar + banner description motto updatedAt diff --git a/api/src/index.js b/api/src/index.js index aecdb8fb5..db637cf06 100644 --- a/api/src/index.js +++ b/api/src/index.js @@ -162,13 +162,13 @@ const resolvers = { async createTeam(parent, { name, slug, botName, botSlug }, ctx, info) { console.log('createTeam ctx:', ctx.request.user) const authId = ctx.request.user.sub - const encodedAuthId = encodeURI(`:"${authId}"`) - const encodedURL = `https://users-api.advancedalgos.net/graphql?query=%7B%0A%20%20userByAuthId(authId${encodedAuthId})%7B%0A%20%20%20%20id%0A%09%09email%0A%20%20%20%20alias%0A%20%20%7D%0A%7D` + const encodedAuthId = encodeURI(authId) + const encodedURL = `https://users-api.advancedalgos.net/graphql?query=%7B%0A%20%20userByAuthId(authId%3A%20"${encodedAuthId}")%7B%0A%20%20%20%20id%0A%09%09email%0A%20%20%20%20alias%0A%20%20%7D%0A%7D` const decodedURL = decodeURI(encodedURL) - console.log('decoded URL: ', decodedURL) + console.log('createTeam URLs: ', encodedURL, decodedURL) const getUserModuleUser = await axios.get(encodedURL) .then((result) => { - console.log('getUserModuleUser:', result) + console.log('getUserModuleUser axios:', result) return result }) .catch(err =>{ @@ -182,8 +182,8 @@ const resolvers = { const banner = 'https://algobotcommstorage.blob.core.windows.net/aateammodule/aa-banner-default.png' const createTeamUrl = encodeURI(`${slug}/${name}/${alias}/${botSlug}/${authId}`) - // const platformUrl = 'https://develop.advancedalgos.net/AABrowserAPI/teamSetup/' - const platformUrl = 'http://localhost:1337/AABrowserAPI/teamSetup/' + const platformUrl = 'https://develop.advancedalgos.net/AABrowserAPI/teamSetup/' + // const platformUrl = 'http://localhost:3100/AABrowserAPI/teamSetup/' const createPlatformTeam = await axios.get(`${platformUrl}${createTeamUrl}`) .then((result) => { console.log('createPlatformTeam:', result) diff --git a/client/package-lock.json b/client/package-lock.json index ce7aff7cf..eb2f30df0 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -1,6 +1,6 @@ { "name": "@advancedalgos/teams-client", - "version": "0.0.20", + "version": "0.0.21", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/client/package.json b/client/package.json index 5e17d159e..8b41213b7 100644 --- a/client/package.json +++ b/client/package.json @@ -1,6 +1,6 @@ { "name": "@advancedalgos/teams-client", - "version": "0.0.20", + "version": "0.0.21", "description": "Advanced Algos Team client-side web app", "main": "src/index.js", "scripts": { diff --git a/client/src/graphql/fbs/AddAlgobotMutation.js b/client/src/graphql/fbs/AddAlgobotMutation.js deleted file mode 100644 index f9470e458..000000000 --- a/client/src/graphql/fbs/AddAlgobotMutation.js +++ /dev/null @@ -1,17 +0,0 @@ -/* eslint-disable no-unused-vars */ -import gql from 'graphql-tag' - -export const AddAlgobotMutation = gql` - mutation addAlgobot($input: AddAlgobotInput!) { - addAlgobot(input: $input) { - id - name - slug - owner - avatar - repo - team_id - type - } - } -` diff --git a/client/src/graphql/fbs/DeleteAlgobotMutation.js b/client/src/graphql/fbs/DeleteAlgobotMutation.js deleted file mode 100644 index 50e7e294a..000000000 --- a/client/src/graphql/fbs/DeleteAlgobotMutation.js +++ /dev/null @@ -1,10 +0,0 @@ -/* eslint-disable no-unused-vars */ -import gql from 'graphql-tag' - -export const DeleteAlgobotMutation = gql` - mutation deleteAlgobot($id: Int!) { - deleteAlgobot(id: $id) { - id - } - } -` diff --git a/client/src/graphql/fbs/GetAlgobotQuery.js b/client/src/graphql/fbs/GetAlgobotQuery.js deleted file mode 100644 index 9ea18b346..000000000 --- a/client/src/graphql/fbs/GetAlgobotQuery.js +++ /dev/null @@ -1,19 +0,0 @@ -/* eslint-disable no-unused-vars */ -import gql from 'graphql-tag' - -export const GetAlgobotQuery = gql` - query getAlgobotByOwner($owner: Int!) { - getAlgobotByOwner(owner: $owner) { - id - name - slug - owner - avatar - repo - team_id - type - } - } -` - -export default GetAlgobotQuery diff --git a/client/src/graphql/fbs/GetAllAlgobotsQuery.js b/client/src/graphql/fbs/GetAllAlgobotsQuery.js deleted file mode 100644 index bc723a0d5..000000000 --- a/client/src/graphql/fbs/GetAllAlgobotsQuery.js +++ /dev/null @@ -1,29 +0,0 @@ -/* eslint-disable no-unused-vars */ -import gql from 'graphql-tag' - -export const GetAllAlgobotsQuery = gql` - query algobots($limit: Int!, $after: Int) { - algobots(limit: $limit, after: $after) { - totalCount - edges { - cursor - node { - id - name - slug - owner - avatar - repo - team_id - type - } - } - pageInfo { - endCursor - hasNextPage - } - } - } -` - -export default GetAllAlgobotsQuery diff --git a/client/src/graphql/fbs/UniqueAlgobotnameQuery.js b/client/src/graphql/fbs/UniqueAlgobotnameQuery.js deleted file mode 100644 index 587e9bece..000000000 --- a/client/src/graphql/fbs/UniqueAlgobotnameQuery.js +++ /dev/null @@ -1,10 +0,0 @@ -/* eslint-disable no-unused-vars */ -import gql from 'graphql-tag' - -export const UniqueAlgobotnameQuery = gql` - query uniqueAlgobotname($algobotname: String!) { - uniqueAlgobotname(algobotname: $algobotname) - } -` - -export default UniqueAlgobotnameQuery diff --git a/client/src/graphql/members/GetUserByAuthIDQuery.js b/client/src/graphql/members/GetUserByAuthIDQuery.js deleted file mode 100644 index 14375c2f1..000000000 --- a/client/src/graphql/members/GetUserByAuthIDQuery.js +++ /dev/null @@ -1,25 +0,0 @@ -/* eslint-disable no-unused-vars */ -import gql from 'graphql-tag' - -export const USER_BY_AUTHID = gql` -query($authId: String){ - userByAuthId (authId: $authId){ - id - alias - firstName - middleName - lastName - bio - email - emailVerified - isDeveloper - isDataAnalyst - isTrader - role { - id - } - } -} -` - -export default USER_BY_AUTHID diff --git a/client/src/graphql/members/index.js b/client/src/graphql/members/index.js index 7ff5637c7..a53b48a41 100644 --- a/client/src/graphql/members/index.js +++ b/client/src/graphql/members/index.js @@ -1,4 +1,3 @@ import { GetCurrentMember } from './GetCurrentMemberQuery' -import { USER_BY_AUTHID } from './GetUserByAuthIDQuery' -export { GetCurrentMember, USER_BY_AUTHID } +export { GetCurrentMember } diff --git a/client/src/views/manage-teams/components/ManageTeamEdit.js b/client/src/views/manage-teams/components/ManageTeamEdit.js index c49131db5..caeef3975 100644 --- a/client/src/views/manage-teams/components/ManageTeamEdit.js +++ b/client/src/views/manage-teams/components/ManageTeamEdit.js @@ -61,8 +61,8 @@ export class ManageTeamEdit extends Component { } render () { - console.log('ManageTeamEdit ', this.props, this.props.slug, this.props.team) - const { classes, team } = this.props + const { classes, team, match } = this.props + console.log('ManageTeamEdit ', this.props, this.props.slug, this.props.team, match) return ( {(getAzureSAS, { loading, error, data }) => { - console.log('getAzureSAS: ', loading, error, data, team.profile) const AzureStorageUrl = process.env.AZURE_STORAGE_URL const containerName = team.slug + console.log('getAzureSAS: ', loading, error, data, containerName, AzureStorageUrl, this.props) let AzureSASURL if (!loading && data !== undefined) { AzureSASURL = data.teams_GetAzureSAS @@ -162,7 +162,7 @@ export class ManageTeamEdit extends Component { debug /> { +export const ManageTeamsItem = ({ classes, team, authId, ...props }) => { console.log('ManageTeamsItem', team, team.profile, team.profile.avatar) let avatar if (team.profile.avatar !== undefined && team.profile.avatar !== 'a') { @@ -39,7 +39,7 @@ export const ManageTeamsItem = ({ classes, team, authId }) => { - + diff --git a/client/src/views/manage-teams/components/ManageTeamsList.js b/client/src/views/manage-teams/components/ManageTeamsList.js index 2f217fb0c..0fdf78fae 100644 --- a/client/src/views/manage-teams/components/ManageTeamsList.js +++ b/client/src/views/manage-teams/components/ManageTeamsList.js @@ -47,7 +47,7 @@ const styles = theme => ({ } }) -export const ManageTeamsList = ({ classes, user = null }) => { +export const ManageTeamsList = ({ classes, user = null, ...props }) => { let owner let authId = null console.log('ManageTeamsList: ', user) @@ -92,6 +92,7 @@ export const ManageTeamsList = ({ classes, user = null }) => { team={team} classes={classes} authId={authId} + {...props} /> ))} {errors} diff --git a/client/src/views/manage-teams/index.js b/client/src/views/manage-teams/index.js index e6582254f..763154429 100644 --- a/client/src/views/manage-teams/index.js +++ b/client/src/views/manage-teams/index.js @@ -12,12 +12,12 @@ const styles = theme => ({ } }) -const ManageTeams = ({ classes }) => ( +const ManageTeams = ({ classes, ...props }) => (
Manage Your Teams - +
) diff --git a/client/src/views/teams/components/TeamsDetails.js b/client/src/views/teams/components/TeamsDetails.js index 7f91302dd..d7cd1e0cf 100644 --- a/client/src/views/teams/components/TeamsDetails.js +++ b/client/src/views/teams/components/TeamsDetails.js @@ -58,13 +58,13 @@ const styles = theme => ({ const TeamsDetails = ({ classes, team }) => { let avatar - if (team.profile.avatar !== undefined && team.profile.avatar !== 'a') { + if (team.profile.avatar !== undefined && team.profile.avatar !== null) { avatar = team.profile.avatar } else { avatar = 'data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%22288%22%20height%3D%22225%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20288%20225%22%20preserveAspectRatio%3D%22none%22%3E%3Cdefs%3E%3Cstyle%20type%3D%22text%2Fcss%22%3E%23holder_164edaf95ee%20text%20%7B%20fill%3A%23eceeef%3Bfont-weight%3Abold%3Bfont-family%3AArial%2C%20Helvetica%2C%20Open%20Sans%2C%20sans-serif%2C%20monospace%3Bfont-size%3A14pt%20%7D%20%3C%2Fstyle%3E%3C%2Fdefs%3E%3Cg%20id%3D%22holder_164edaf95ee%22%3E%3Crect%20width%3D%22288%22%20height%3D%22225%22%20fill%3D%22%2355595c%22%3E%3C%2Frect%3E%3Cg%3E%3Ctext%20x%3D%2296.32500076293945%22%20y%3D%22118.8%22%3EThumbnail%3C%2Ftext%3E%3C%2Fg%3E%3C%2Fg%3E%3C%2Fsvg%3E' } let banner - if (team.profile.banner !== undefined && team.profile.banner !== 'a') { + if (team.profile.banner !== undefined && team.profile.banner !== null) { banner = team.profile.banner } else { banner = 'data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%22288%22%20height%3D%22225%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20288%20225%22%20preserveAspectRatio%3D%22none%22%3E%3Cdefs%3E%3Cstyle%20type%3D%22text%2Fcss%22%3E%23holder_164edaf95ee%20text%20%7B%20fill%3A%23eceeef%3Bfont-weight%3Abold%3Bfont-family%3AArial%2C%20Helvetica%2C%20Open%20Sans%2C%20sans-serif%2C%20monospace%3Bfont-size%3A14pt%20%7D%20%3C%2Fstyle%3E%3C%2Fdefs%3E%3Cg%20id%3D%22holder_164edaf95ee%22%3E%3Crect%20width%3D%22288%22%20height%3D%22225%22%20fill%3D%22%2355595c%22%3E%3C%2Frect%3E%3Cg%3E%3Ctext%20x%3D%2296.32500076293945%22%20y%3D%22118.8%22%3EThumbnail%3C%2Ftext%3E%3C%2Fg%3E%3C%2Fg%3E%3C%2Fsvg%3E' diff --git a/client/src/views/teams/components/TeamsList.js b/client/src/views/teams/components/TeamsList.js index 00785eeea..a8bd4cf84 100644 --- a/client/src/views/teams/components/TeamsList.js +++ b/client/src/views/teams/components/TeamsList.js @@ -102,6 +102,12 @@ export const TeamsList = ({ classes, match }) => ( ) } + } else { + return ( + + + + ) } } else { return (