From 1d711e4ae0767c0811d6b7ac4d7443286d3a04a5 Mon Sep 17 00:00:00 2001 From: Barry Low Date: Wed, 17 Oct 2018 14:41:30 -0700 Subject: [PATCH] Switch images to dev storage --- api/src/index.js | 5 - api/src/schema.graphql | 1 - client/package.json | 6 +- .../src/graphql/teams/GetAzureSASMutation.js | 10 -- .../components/ManageFBEdit.js | 81 ++++------- .../manage-teams/components/ManageTeamEdit.js | 133 ++++++++---------- 6 files changed, 91 insertions(+), 145 deletions(-) delete mode 100644 client/src/graphql/teams/GetAzureSASMutation.js diff --git a/api/src/index.js b/api/src/index.js index db637cf06..b063b8ae8 100644 --- a/api/src/index.js +++ b/api/src/index.js @@ -232,11 +232,6 @@ const resolvers = { return error.message }) }) - }, - async getAzureSAS(parent, { teamSlug }, ctx, info) { - const SASUrl = createSASQueryURL(teamSlug) - console.log('createSASQueryURL: ', SASUrl) - return SASUrl } } } diff --git a/api/src/schema.graphql b/api/src/schema.graphql index 650345ee3..2be3053e3 100644 --- a/api/src/schema.graphql +++ b/api/src/schema.graphql @@ -26,7 +26,6 @@ type Mutation { updateTeamProfile(slug: String!, description: String, motto: String, avatar: String, banner: String): Team @isAuthenticated updateFB(fbId: String!, avatar: String): FinancialBeings @isAuthenticated deleteTeam(slug: String!): Team @isAuthenticated @isOwner(type: "Team") - getAzureSAS(teamSlug: String!):String sendMemberInviteSG(email: String!, teamId: String!): String confirmMember(token: String!): String removeTeamMember(teamId: String!, memberId: String!): String diff --git a/client/package.json b/client/package.json index 8b41213b7..86234aefd 100644 --- a/client/package.json +++ b/client/package.json @@ -71,8 +71,6 @@ "dependencies": { "@advancedalgos/web-components": "0.0.12", "@azure/storage-blob": "^10.0.0-preview", - "@material-ui/core": "^3.2.0", - "@material-ui/icons": "^3.0.1", "apollo-cache-inmemory": "^1.3.5", "apollo-client": "^2.4.2", "apollo-link": "^1.2.3", @@ -99,6 +97,10 @@ "recompose": "^0.30.0", "subscriptions-transport-ws": "^0.9.15" }, + "peerDependencies": { + "@material-ui/core": "^3.2.0", + "@material-ui/icons": "^3.0.1" + }, "standard": { "parser": "babel-eslint", "ignore": [ diff --git a/client/src/graphql/teams/GetAzureSASMutation.js b/client/src/graphql/teams/GetAzureSASMutation.js deleted file mode 100644 index 506a53143..000000000 --- a/client/src/graphql/teams/GetAzureSASMutation.js +++ /dev/null @@ -1,10 +0,0 @@ -/* eslint-disable no-unused-vars */ -import gql from 'graphql-tag' - -export const GET_AZURE_SAS = gql` - mutation getAzureSAS($teamSlug: String!) { - teams_GetAzureSAS(teamSlug: $teamSlug) - } -` - -export default GET_AZURE_SAS diff --git a/client/src/views/financial-beings/components/ManageFBEdit.js b/client/src/views/financial-beings/components/ManageFBEdit.js index ba150bc83..323aec53d 100644 --- a/client/src/views/financial-beings/components/ManageFBEdit.js +++ b/client/src/views/financial-beings/components/ManageFBEdit.js @@ -13,15 +13,13 @@ import DialogContentText from '@material-ui/core/DialogContentText' import DialogTitle from '@material-ui/core/DialogTitle' import Typography from '@material-ui/core/Typography' -import { MessageCard, ImageUpload } from '@advancedalgos/web-components' +import { ImageUpload } from '@advancedalgos/web-components' import UPDATE_FB from '../../../graphql/teams/UpdateFBMutation' import GET_TEAMS_BY_OWNER from '../../../graphql/teams/GetTeamsByOwnerQuery' import { checkGraphQLError } from '../../../utils/graphql-errors' -import GET_AZURE_SAS from '../../../graphql/teams/GetAzureSASMutation' - const styles = theme => ({ dialogContainer: { display: 'block', @@ -65,6 +63,15 @@ export class ManageFBEdit extends Component { ]} > {(updateFB, { loading, error, data }) => { + const AzureStorageUrl = process.env.AZURE_STORAGE_URL_TEAMS + const AzureStorageSAS = process.env.AZURE_STORAGE_SAS_TEAMS + const containerName = slug + + let avatar = null + if (this.state.avatar === null && fb.avatar === undefined) avatar = 'https://algobotcommstorage.blob.core.windows.net/aateammodule/aa-avatar-default.png' + if (fb.avatar !== undefined && fb.avatar !== null) avatar = fb.avatar + if (this.state.avatar !== null) avatar = this.state.avatar + let errors let loader if (loading) { @@ -103,54 +110,28 @@ export class ManageFBEdit extends Component { Edit Financial Being - - {(getAzureSAS, { loading, error, data }) => { - console.log('getAzureSAS: ', loading, error, data, fb) - const AzureStorageUrl = process.env.AZURE_STORAGE_URL - const containerName = slug - let AzureSASURL - if (!loading && data !== undefined) { - AzureSASURL = data.getAzureSAS - } else { - getAzureSAS({ variables: { teamSlug: containerName } }) - } - - let avatar = null - if (fb.avatar !== undefined && fb.avatar !== null) avatar = fb.avatar - if (this.state.avatar !== null) avatar = this.state.avatar - if (this.state.avatar === null && fb.avatar === undefined) avatar = 'https://algobotcommstorage.blob.core.windows.net/aateammodule/aa-avatar-default.png' - - if (loading || data === undefined) { - return () - } else { - return ( - - Update Financial Beings's Avatar - - - ) - } + Update Financial Beings's Avatar + + AzureStorageUrl={AzureStorageUrl} + AzureSASURL={AzureStorageSAS} + cropRatio={1} + debug + /> ({ dialogContainer: { display: 'block', @@ -74,6 +72,20 @@ export class ManageTeamEdit extends Component { ]} > {(updateTeamProfile, { loading, error, data }) => { + const AzureStorageUrl = process.env.AZURE_STORAGE_URL_TEAMS + const AzureStorageSAS = process.env.AZURE_STORAGE_SAS_TEAMS + const containerName = team.slug + let avatar = null + if (this.state.avatar === null && team.profile !== null && (team.profile.avatar === undefined || team.profile.avatar === null)) avatar = 'https://algobotcommstorage.blob.core.windows.net/aateammodule/aa-avatar-default.png' + if (team.profile !== null && team.profile.avatar !== undefined && team.profile.avatar !== null) avatar = team.profile.avatar + if (this.state.avatar !== null) avatar = this.state.avatar + + let banner = null + if (this.state.banner === null && team.profile !== null && (team.profile.banner === undefined || team.profile.banner === null)) banner = 'https://algobotcommstorage.blob.core.windows.net/aateammodule/aa-banner-default.png' + if (team.profile !== null && team.profile.banner !== undefined && team.profile.banner !== null) banner = team.profile.banner + if (this.state.banner !== null) banner = this.state.banner + console.log('team images: ', avatar, banner) + let errors let loader if (loading) { @@ -112,81 +124,48 @@ export class ManageTeamEdit extends Component { Edit Team Details - - {(getAzureSAS, { loading, error, data }) => { - 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 - } else { - getAzureSAS({ variables: { teamSlug: containerName } }) - } - - let avatar = null - if (this.state.avatar === null && team.profile !== null && (team.profile.avatar === undefined || team.profile.avatar === null)) avatar = 'https://algobotcommstorage.blob.core.windows.net/aateammodule/aa-avatar-default.png' - if (team.profile !== null && team.profile.avatar !== undefined && team.profile.avatar !== null) avatar = team.profile.avatar - if (this.state.avatar !== null) avatar = this.state.avatar - - let banner = null - if (this.state.banner === null && team.profile !== null && (team.profile.banner === undefined || team.profile.banner === null)) banner = 'https://algobotcommstorage.blob.core.windows.net/aateammodule/aa-banner-default.png' - if (team.profile !== null && team.profile.banner !== undefined && team.profile.banner !== null) banner = team.profile.banner - if (this.state.banner !== null) banner = this.state.banner - console.log('team images: ', avatar, banner) - - if (loading || data === undefined) { - return () - } else { - return ( - - - - - ) - } + + AzureStorageUrl={AzureStorageUrl} + AzureSASURL={AzureStorageSAS} + cropRatio={4} + debug + /> +