client: switch logging to minilog

This commit is contained in:
Barry Low committed 2018-10-30 22:10:16 -07:00
1 parent 1adc2bbd7d
commit aee1e52776
41 files changed
+151 -96

No files matched your search

+2 -2
View File
@@ -3,10 +3,10 @@ const ErrorResponse = {
}
export const checkGraphQLError = error => {
console.log('checkGraphQLError ', ErrorResponse)
log.debug('checkGraphQLError ', ErrorResponse)
if (error.search(/unique constraint/)) {
const field = error.substring(error.indexOf('=') + 1)
console.log('unique constraint', field.replace(/ +/g, ''))
log.debug('unique constraint', field.replace(/ +/g, ''))
}
}
+7
View File
@@ -0,0 +1,7 @@
import minilog from 'minilog'
if (process.env.NODE_ENV === 'development') minilog.enable()
const log = minilog('frontend')
export default log
@@ -16,6 +16,8 @@ import SettingsApplicationsIcon from '@material-ui/icons/SettingsApplications'
import { Link } from 'react-router-dom'
import log from '../../../utils/log'
const SettingsLink = props => <Link to='/teams/settings' {...props} />
const FBLink = props => <Link to='/teams/financial-beings' {...props} />
const MembersLink = props => <Link to='/teams/team-members' {...props} />
@@ -61,7 +63,7 @@ const styles = theme => ({
class TeamBar extends Component {
render () {
const { classes, user, match } = this.props
console.log('TeamBar: ', user, match)
log.debug('TeamBar: ', user, match)
return (
<div className={classes.root}>
<AppBar position='static' color='secondary'>
@@ -10,9 +10,11 @@ import { checkGraphQLError } from '../../../utils/graphql-errors'
import CREATE_TEAM from '../../../graphql/teams/CreateTeamMutation'
import GET_TEAMS_BY_OWNER from '../../../graphql/teams/GetTeamsByOwnerQuery'
import log from '../../../utils/log'
const CreateTeam = ({ authId }) => {
let input
console.log('CreateTeam', authId)
log.debug('CreateTeam', authId)
return (
<Mutation
@@ -33,7 +35,7 @@ const CreateTeam = ({ authId }) => {
if (error) {
errors = error.graphQLErrors.map(({ message }, i) => {
const displayMessage = checkGraphQLError(message)
console.log('createTeam error:', displayMessage)
log.debug('createTeam error:', displayMessage)
return (
<Typography key={i} variant='caption'>
{message}
@@ -73,7 +75,7 @@ const handleSubmit = async (e, createTeam, input) => {
const currentUser = await getItem('user')
let authId = JSON.parse(currentUser)
authId = authId.authId
console.log('createTeam submit: ', authId)
log.debug('createTeam submit: ', authId)
const name = input.value
const slug = slugify(name)
await createTeam({ variables: { name, slug, owner: authId } })
@@ -18,7 +18,7 @@ import { isEmpty } from '../../../utils/js-helpers'
import CREATE_TEAM from '../../../graphql/teams/CreateTeamMutation'
import GET_TEAMS_BY_OWNER from '../../../graphql/teams/GetTeamsByOwnerQuery'
// import { checkGraphQLError } from '../../../utils/graphql-errors'
import log from '../../../utils/log'
const styles = theme => ({
dialogContainer: {
@@ -207,7 +207,7 @@ export class CreateTeamDialog extends Component {
async handleSubmit (e, createTeam, name, botName) {
e.preventDefault()
console.log('createTeam submit: ', name, botName)
log.debug('createTeam submit: ', name, botName)
const slug = this.slugify(name)
const botSlug = this.slugify(botName)
await createTeam({ variables: { name, slug, botName, botSlug } })
@@ -11,6 +11,8 @@ import DialogContentText from '@material-ui/core/DialogContentText'
import DialogTitle from '@material-ui/core/DialogTitle'
import Typography from '@material-ui/core/Typography'
import log from '../../../utils/log'
export class CreateTeamDialog extends Component {
constructor (props) {
super(props)
@@ -50,7 +52,7 @@ export class CreateTeamDialog extends Component {
}
render () {
console.log(this.props)
log.debug(this.props)
return (
<div>
<Button
@@ -16,15 +16,17 @@ import { MessageCard } from '@advancedalgos/web-components'
import { isDefined, isString } from '../../../utils/js-helpers'
import { getItem } from '../../../utils/local-storage'
import log from '../../../utils/log'
export const DashTeam = ({ classes, user = null }) => {
let owner
let authId = null
console.log('DashTeam: ', user)
log.debug('DashTeam: ', user)
if (user !== null && isString(user)) {
owner = JSON.parse(user)
if (isDefined(owner.authId)) authId = owner.authId
}
console.log('DashTeam 2: ', owner, authId)
log.debug('DashTeam 2: ', owner, authId)
if (authId === undefined || authId === null) {
return (
@@ -46,7 +48,7 @@ export const DashTeam = ({ classes, user = null }) => {
</Typography>
<Query query={GET_TEAMS_BY_OWNER} variables={{ authId }}>
{({ loading, error, data }) => {
console.log('GET_TEAMS_BY_OWNER: ', loading, error, data)
log.debug('GET_TEAMS_BY_OWNER: ', loading, error, data)
let errors
let queryLoader
if (error) {
@@ -17,7 +17,7 @@ import { isEmpty } from '../../../utils/js-helpers'
import SEND_MEMBER_INVITE from '../../../graphql/teams/SendMemberInvite'
// import { checkGraphQLError } from '../../../utils/graphql-errors'
import log from '../../../utils/log'
const styles = theme => ({
dialogStyle: {
@@ -60,7 +60,7 @@ export class InviteMemberDialog extends Component {
return (
<Mutation mutation={SEND_MEMBER_INVITE} >
{(sendMemberInvite, { loading, error, data }) => {
console.log('sendMemberInvite: ', data)
log.debug('sendMemberInvite: ', data)
let errors
let loader = null
if (loading) {
@@ -187,7 +187,7 @@ export class InviteMemberDialog extends Component {
async handleSubmit (e, sendMemberInvite, email, teamId) {
e.preventDefault()
console.log('sendMemberInvite submit: ', email, teamId)
log.debug('sendMemberInvite submit: ', email, teamId)
await sendMemberInvite({ variables: { email, teamId } })
this.setState({ email: '' })
}
@@ -20,6 +20,8 @@ import GET_TEAMS_BY_OWNER from '../../../graphql/teams/GetTeamsByOwnerQuery'
import { checkGraphQLError } from '../../../utils/graphql-errors'
import log from '../../../utils/log'
import GET_AZURE_SAS from '../../../graphql/teams/GetAzureSASMutation'
const styles = theme => ({
@@ -52,7 +54,7 @@ export class ManageFBEdit extends Component {
}
render () {
console.log('ManageFBEdit ', this.props, this.props.slug, this.props.fb)
log.debug('ManageFBEdit ', this.props, this.props.slug, this.props.fb)
const { classes, fb, slug } = this.props
return (
<Mutation
@@ -75,7 +77,7 @@ export class ManageFBEdit extends Component {
if (error) {
errors = error.graphQLErrors.map(({ message }, i) => {
const displayMessage = checkGraphQLError(message)
console.log('updateTeamProfile error:', displayMessage)
log.debug('updateTeamProfile error:', displayMessage)
return (
<Typography key={i} variant='caption'>
{message}
@@ -105,7 +107,7 @@ export class ManageFBEdit extends Component {
<DialogContent>
<Mutation mutation={GET_AZURE_SAS} >
{(getAzureSAS, { loading, error, data }) => {
console.log('getAzureSAS: ', loading, error, data, fb)
log.debug('getAzureSAS: ', loading, error, data, fb)
const AzureStorageUrl = process.env.AZURE_STORAGE_URL
const containerName = slug
let AzureSASURL
@@ -195,12 +197,12 @@ export class ManageFBEdit extends Component {
}
handleAvatar (avatarUrl) {
console.log('handleAvatar: ', avatarUrl)
log.debug('handleAvatar: ', avatarUrl)
this.setState({ avatar: `${avatarUrl}?${Math.random()}` })
}
async handleSubmit (e, updateFB, fbId, slug) {
console.log('handleSubmit: ', this.state)
log.debug('handleSubmit: ', this.state)
e.preventDefault()
await updateFB({
@@ -10,8 +10,10 @@ import Typography from '@material-ui/core/Typography'
import ManageFBEdit from './ManageFBEdit'
import log from '../../../utils/log'
export const ManageFBItem = ({ classes, team, authId }) => {
console.log('ManageFBItem', team, team.fb[0], team.profile.avatar)
log.debug('ManageFBItem', team, team.fb[0], team.profile.avatar)
let avatar
if (team.fb[0].avatar !== undefined && team.fb[0].avatar !== 'a') {
avatar = team.fb[0].avatar
@@ -12,6 +12,8 @@ import { getItem } from '../../../utils/local-storage'
import GET_TEAMS_BY_OWNER from '../../../graphql/teams/GetTeamsByOwnerQuery'
import log from '../../../utils/log'
import ManageFBItem from './ManageFBItem'
import CreateTeamDialog from './CreateTeamDialog'
@@ -50,12 +52,12 @@ const styles = theme => ({
export const ManageFBList = ({ classes, user = null }) => {
let owner
let authId = null
console.log('ManageTeamsList: ', user)
log.debug('ManageTeamsList: ', user)
if (user !== null && isString(user)) {
owner = JSON.parse(user)
if (isDefined(owner.authId)) authId = owner.authId
}
console.log('ManageTeamsList 2: ', owner, authId)
log.debug('ManageTeamsList 2: ', owner, authId)
if (authId === undefined || authId === null) {
return (
<Grid container spacing={40}>
@@ -72,7 +74,7 @@ export const ManageFBList = ({ classes, user = null }) => {
fetchPolicy='network-only'
>
{({ loading, error, data }) => {
console.log('GET_TEAMS_BY_OWNER: ', loading, error, data)
log.debug('GET_TEAMS_BY_OWNER: ', loading, error, data)
let errors = null
if (error) {
@@ -15,6 +15,7 @@ import REMOVE_TEAM_MEMBER from '../../../graphql/teams/RemoveTeamMemberMutation'
import GET_TEAMS_BY_OWNER from '../../../graphql/teams/GetTeamsByOwnerQuery'
import { checkGraphQLError } from '../../../utils/graphql-errors'
import log from '../../../utils/log'
const styles = theme => ({
dialogContainer: {
@@ -54,7 +55,7 @@ export class ManageMemberDelete extends Component {
}
render () {
console.log(this.props, this.props.teamId)
log.debug(this.props, this.props.teamId)
const { classes, teamId, authId } = this.props
return (
<Mutation
@@ -72,7 +73,7 @@ export class ManageMemberDelete extends Component {
if (error) {
errors = error.graphQLErrors.map(({ message }, i) => {
const displayMessage = checkGraphQLError(message)
console.log('createTeam error:', displayMessage)
log.debug('createTeam error:', displayMessage)
return (
<Typography key={i} variant='caption'>
{message}
@@ -17,6 +17,7 @@ import SET_TEAM_MEMBER_ROLE from '../../../graphql/teams/SetTeamMemberRoleMutati
import GET_TEAMS_BY_OWNER from '../../../graphql/teams/GetTeamsByOwnerQuery'
import { checkGraphQLError } from '../../../utils/graphql-errors'
import log from '../../../utils/log'
const styles = theme => ({
dialogContainer: {
@@ -62,7 +63,7 @@ export class ManageMemberRole extends Component {
}
render () {
console.log(this.props, this.props.teamId)
log.debug(this.props, this.props.teamId)
const { classes, teamId, authId } = this.props
return (
<Mutation
@@ -80,7 +81,7 @@ export class ManageMemberRole extends Component {
if (error) {
errors = error.graphQLErrors.map(({ message }, i) => {
const displayMessage = checkGraphQLError(message)
console.log('createTeam error:', displayMessage)
log.debug('createTeam error:', displayMessage)
return (
<Typography key={i} variant='caption'>
{message}
@@ -10,6 +10,8 @@ import Card from '@material-ui/core/Card'
import CardContent from '@material-ui/core/CardContent'
import CardActions from '@material-ui/core/CardActions'
import log from '../../../utils/log'
const styles = theme => ({
dialogContainer: {
display: 'block',
@@ -47,7 +49,7 @@ export class ManageMemberStatus extends Component {
}
render () {
console.log(this.props, this.props.status)
log.debug(this.props, this.props.status)
const { classes, status } = this.props
return (
<div>
@@ -9,8 +9,10 @@ import ManageMemberRole from './ManageMemberRole'
import ManageMemberStatus from './ManageMemberStatus'
import { MessageCard } from '@advancedalgos/web-components'
import log from '../../../utils/log'
export const ManageMembersItem = ({ classes, member, teamId, authId }) => {
console.log('ManageMembersItem', member)
log.debug('ManageMembersItem', member)
let profile = null
let email = null
let memberStatus = null
@@ -12,6 +12,8 @@ import InviteMemberDialog from './InviteMemberDialog'
import ManageMembersItem from './ManageMembersItem'
import { MessageCard } from '@advancedalgos/web-components'
import log from '../../../utils/log'
const styles = theme => ({
heroContent: {
maxWidth: 600,
@@ -56,7 +58,7 @@ const styles = theme => ({
})
export const ManageMembersTeamItem = ({ classes, team, authId }) => {
console.log('ManageMembersItem', team, team.profile, team.profile.avatar)
log.debug('ManageMembersItem', team, team.profile, team.profile.avatar)
let avatar
if (team.profile.avatar !== undefined && team.profile.avatar !== 'a') {
avatar = team.profile.avatar
@@ -15,6 +15,7 @@ import DELETE_TEAM from '../../../graphql/teams/DeleteTeamMutation'
import GET_TEAMS_BY_OWNER from '../../../graphql/teams/GetTeamsByOwnerQuery'
import { checkGraphQLError } from '../../../utils/graphql-errors'
import log from '../../../utils/log'
const styles = theme => ({
dialogContainer: {
@@ -54,7 +55,7 @@ export class ManageTeamDelete extends Component {
}
render () {
console.log(this.props, this.props.slug)
log.debug(this.props, this.props.slug)
const { classes, authId } = this.props
return (
<Mutation
@@ -77,7 +78,7 @@ export class ManageTeamDelete extends Component {
if (error) {
errors = error.graphQLErrors.map(({ message }, i) => {
const displayMessage = checkGraphQLError(message)
console.log('createTeam error:', displayMessage)
log.debug('createTeam error:', displayMessage)
return (
<Typography key={i} variant='caption'>
{message}
@@ -11,6 +11,8 @@ import CardContent from '@material-ui/core/CardContent'
import CardActions from '@material-ui/core/CardActions'
import CardMedia from '@material-ui/core/CardMedia'
import log from '../../../utils/log'
const styles = theme => ({
dialogContainer: {
display: 'block',
@@ -62,7 +64,7 @@ export class ManageTeamDetails extends Component {
}
render () {
console.log(this.props.team)
log.debug(this.props.team)
const { classes } = this.props
const { name, members, profile, createdAt } = this.props.team
let avatar
@@ -15,6 +15,8 @@ import Typography from '@material-ui/core/Typography'
import { MessageCard, ImageUpload } from '@advancedalgos/web-components'
import log from '../../../utils/log'
import UPDATE_TEAM_PROFILE from '../../../graphql/teams/UpdateTeamProfileMutation'
import GET_TEAMS_BY_OWNER from '../../../graphql/teams/GetTeamsByOwnerQuery'
@@ -44,7 +46,7 @@ export class ManageTeamEdit extends Component {
this.handleAvatar = this.handleAvatar.bind(this)
this.handleBanner = this.handleBanner.bind(this)
console.log('ManageTeamEdit', props.team)
log.debug('ManageTeamEdit', props.team)
const motto = props.team.profile.motto || ''
const description = props.team.profile.description || ''
const avatar = props.team.profile.avatar || ''
@@ -61,7 +63,7 @@ export class ManageTeamEdit extends Component {
}
render () {
console.log('ManageTeamEdit ', this.props, this.props.slug, this.props.team)
log.debug('ManageTeamEdit ', this.props, this.props.slug, this.props.team)
const { classes, team } = this.props
return (
<Mutation
@@ -84,7 +86,7 @@ export class ManageTeamEdit extends Component {
if (error) {
errors = error.graphQLErrors.map(({ message }, i) => {
const displayMessage = checkGraphQLError(message)
console.log('updateTeamProfile error:', displayMessage)
log.debug('updateTeamProfile error:', displayMessage)
return (
<Typography key={i} variant='caption'>
{message}
@@ -114,7 +116,7 @@ export class ManageTeamEdit extends Component {
<DialogContent>
<Mutation mutation={GET_AZURE_SAS} >
{(getAzureSAS, { loading, error, data }) => {
console.log('getAzureSAS: ', loading, error, data, team.profile)
log.debug('getAzureSAS: ', loading, error, data, team.profile)
const AzureStorageUrl = process.env.AZURE_STORAGE_URL
const containerName = team.slug
let AzureSASURL
@@ -132,7 +134,7 @@ export class ManageTeamEdit extends Component {
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
if (this.state.banner === null && team.profile !== null && team.profile.banner === undefined) banner = 'https://algobotcommstorage.blob.core.windows.net/aateammodule/aa-banner-default.png'
console.log('team images: ', avatar, banner)
log.debug('team images: ', avatar, banner)
if (loading || data === undefined) {
return (<MessageCard message='Loading...' />)
@@ -262,17 +264,17 @@ export class ManageTeamEdit extends Component {
}
handleAvatar (avatarUrl) {
console.log('handleAvatar: ', avatarUrl)
log.debug('handleAvatar: ', avatarUrl)
this.setState({ avatar: `${avatarUrl}?${Math.random()}` })
}
handleBanner (bannerUrl) {
console.log('handleBanner: ', bannerUrl)
log.debug('handleBanner: ', bannerUrl)
this.setState({ banner: `${bannerUrl}?${Math.random()}` })
}
async handleSubmit (e, updateTeamProfile, slug) {
console.log('handleSubmit: ', this.state)
log.debug('handleSubmit: ', this.state)
e.preventDefault()
await updateTeamProfile({
@@ -14,6 +14,8 @@ import GET_TEAMS_BY_OWNER from '../../../graphql/teams/GetTeamsByOwnerQuery'
import ManageMembersTeamItem from './ManageMembersTeamItem'
import { MessageCard } from '@advancedalgos/web-components'
import log from '../../../utils/log'
const styles = theme => ({
heroContent: {
maxWidth: 600,
@@ -49,12 +51,12 @@ const styles = theme => ({
export const ManageTeamMembersList = ({ classes, user = null }) => {
let owner
let authId = null
console.log('ManageTeamsList: ', user)
log.debug('ManageTeamsList: ', user)
if (user !== null && isString(user)) {
owner = JSON.parse(user)
if (isDefined(owner.authId)) authId = owner.authId
}
console.log('ManageTeamsList 2: ', owner, authId)
log.debug('ManageTeamsList 2: ', owner, authId)
if (authId === undefined || authId === null) {
return (
<Grid container spacing={40}>
@@ -71,7 +73,7 @@ export const ManageTeamMembersList = ({ classes, user = null }) => {
fetchPolicy='network-only'
>
{({ loading, error, data }) => {
console.log('GET_TEAMS_BY_OWNER: ', loading, error, data)
log.debug('GET_TEAMS_BY_OWNER: ', loading, error, data)
let errors = null
if (error) {
errors = error.graphQLErrors.map(({ message }, i) => {
@@ -12,8 +12,10 @@ import ManageTeamDetails from './ManageTeamDetails'
import ManageTeamDelete from './ManageTeamDelete'
import ManageTeamEdit from './ManageTeamEdit'
import log from '../../../utils/log'
export const ManageTeamsItem = ({ classes, team, authId }) => {
console.log('ManageTeamsItem', team, team.profile, team.profile.avatar)
log.debug('ManageTeamsItem', team, team.profile, team.profile.avatar)
let avatar
if (team.profile.avatar !== undefined && team.profile.avatar !== 'a') {
avatar = team.profile.avatar
@@ -15,6 +15,8 @@ import GET_TEAMS_BY_OWNER from '../../../graphql/teams/GetTeamsByOwnerQuery'
import ManageTeamsItem from './ManageTeamsItem'
import CreateTeamDialog from './CreateTeamDialog'
import log from '../../../utils/log'
const styles = theme => ({
heroContent: {
maxWidth: 600,
@@ -50,12 +52,12 @@ const styles = theme => ({
export const ManageTeamsList = ({ classes, user = null }) => {
let owner
let authId = null
console.log('ManageTeamsList: ', user)
log.debug('ManageTeamsList: ', user)
if (user !== null && isString(user)) {
owner = JSON.parse(user)
if (isDefined(owner.authId)) authId = owner.authId
}
console.log('ManageTeamsList 2: ', owner, authId)
log.debug('ManageTeamsList 2: ', owner, authId)
if (authId === undefined || authId === null) {
return (
<Grid container spacing={40}>
@@ -72,7 +74,7 @@ export const ManageTeamsList = ({ classes, user = null }) => {
fetchPolicy='network-only'
>
{({ loading, error, data }) => {
console.log('GET_TEAMS_BY_OWNER: ', loading, error, data)
log.debug('GET_TEAMS_BY_OWNER: ', loading, error, data)
let errors = null
if (error) {
+4 -2
View File
@@ -16,6 +16,8 @@ import FinancialBeings from './FinancialBeings'
import TeamMembers from './TeamMembers'
import Settings from './settings'
import log from '../../utils/log'
const drawerWidth = 240
const styles = theme => ({
@@ -81,9 +83,9 @@ const DashboardCheckSession = lifecycle({
async componentDidMount () {
try {
const authenticated = await this.props.auth.isAuthenticated()
console.log('DashboardCheckSession res: ', authenticated)
log.debug('DashboardCheckSession res: ', authenticated)
} catch (err) {
console.log('DashboardCheckSession err: ', err)
log.debug('DashboardCheckSession err: ', err)
}
}
})(Dashboard)
@@ -20,6 +20,8 @@ import GET_TEAMS_BY_OWNER from '../../../graphql/teams/GetTeamsByOwnerQuery'
import { checkGraphQLError } from '../../../utils/graphql-errors'
import log from '../../../utils/log'
const styles = theme => ({
dialogContainer: {
display: 'block',
@@ -49,7 +51,7 @@ export class ManageFBEdit extends Component {
}
render () {
console.log('ManageFBEdit ', this.props, this.props.slug, this.props.fb)
log.debug('ManageFBEdit ', this.props, this.props.slug, this.props.fb)
const { classes, fb, slug } = this.props
return (
<Mutation
@@ -80,7 +82,7 @@ export class ManageFBEdit extends Component {
if (error) {
errors = error.graphQLErrors.map(({ message }, i) => {
const displayMessage = checkGraphQLError(message)
console.log('updateTeamProfile error:', displayMessage)
log.debug('updateTeamProfile error:', displayMessage)
return (
<Typography key={i} variant='caption'>
{message}
@@ -174,12 +176,12 @@ export class ManageFBEdit extends Component {
}
handleAvatar (avatarUrl) {
console.log('handleAvatar: ', avatarUrl)
log.debug('handleAvatar: ', avatarUrl)
this.setState({ avatar: `${avatarUrl}?${Math.random()}` })
}
async handleSubmit (e, updateFB, fbId, slug) {
console.log('handleSubmit: ', this.state)
log.debug('handleSubmit: ', this.state)
e.preventDefault()
await updateFB({
@@ -10,8 +10,10 @@ import Typography from '@material-ui/core/Typography'
import ManageFBEdit from './ManageFBEdit'
import log from '../../../utils/log'
export const ManageFBItem = ({ classes, team }) => {
console.log('ManageFBItem', team, team.fb[0], team.profile.avatar)
log.debug('ManageFBItem', team, team.fb[0], team.profile.avatar)
let avatar
if (team.fb[0].avatar !== undefined && team.fb[0].avatar !== 'a') {
avatar = team.fb[0].avatar
@@ -8,6 +8,8 @@ import { withStyles } from '@material-ui/core/styles'
import GET_TEAMS_BY_OWNER from '../../../graphql/teams/GetTeamsByOwnerQuery'
import log from '../../../utils/log'
import ManageFBItem from './ManageFBItem'
const styles = theme => ({
@@ -48,7 +50,7 @@ export const ManageFBList = ({ classes }) => (
fetchPolicy='network-only'
>
{({ loading, error, data }) => {
console.log('GET_TEAMS_BY_OWNER: ', loading, error, data)
log.debug('GET_TEAMS_BY_OWNER: ', loading, error, data)
let errors = null
if (error) {
@@ -18,7 +18,7 @@ import { isEmpty } from '../../../utils/js-helpers'
import CREATE_TEAM from '../../../graphql/teams/CreateTeamMutation'
import GET_TEAMS_BY_OWNER from '../../../graphql/teams/GetTeamsByOwnerQuery'
// import { checkGraphQLError } from '../../../utils/graphql-errors'
import log from '../../../utils/log'
const styles = theme => ({
dialogContainer: {
@@ -206,7 +206,7 @@ export class CreateTeamDialog extends Component {
async handleSubmit (e, createTeam, name, botName) {
e.preventDefault()
console.log('createTeam submit: ', name, botName)
log.debug('createTeam submit: ', name, botName)
const slug = this.slugify(name)
const botSlug = this.slugify(botName)
await createTeam({ variables: { name, slug, botName, botSlug } })
@@ -15,6 +15,7 @@ import DELETE_TEAM from '../../../graphql/teams/DeleteTeamMutation'
import GET_TEAMS_BY_OWNER from '../../../graphql/teams/GetTeamsByOwnerQuery'
import { checkGraphQLError } from '../../../utils/graphql-errors'
import log from '../../../utils/log'
const styles = theme => ({
dialogContainer: {
@@ -54,7 +55,7 @@ export class ManageTeamDelete extends Component {
}
render () {
console.log(this.props, this.props.slug)
log.debug(this.props, this.props.slug)
const { classes } = this.props
return (
<Mutation
@@ -76,7 +77,7 @@ export class ManageTeamDelete extends Component {
if (error) {
errors = error.graphQLErrors.map(({ message }, i) => {
const displayMessage = checkGraphQLError(message)
console.log('createTeam error:', displayMessage)
log.debug('createTeam error:', displayMessage)
return (
<Typography key={i} variant='caption'>
{message}
@@ -11,6 +11,8 @@ import CardContent from '@material-ui/core/CardContent'
import CardActions from '@material-ui/core/CardActions'
import CardMedia from '@material-ui/core/CardMedia'
import log from '../../../utils/log'
const styles = theme => ({
dialogContainer: {
display: 'block',
@@ -62,7 +64,7 @@ export class ManageTeamDetails extends Component {
}
render () {
console.log(this.props.team)
log.debug(this.props.team)
const { classes } = this.props
const { name, members, profile, createdAt } = this.props.team
let avatar
@@ -19,6 +19,7 @@ import UPDATE_TEAM_PROFILE from '../../../graphql/teams/UpdateTeamProfileMutatio
import GET_TEAMS_BY_OWNER from '../../../graphql/teams/GetTeamsByOwnerQuery'
import { checkGraphQLError } from '../../../utils/graphql-errors'
import log from '../../../utils/log'
const styles = theme => ({
dialogContainer: {
@@ -42,7 +43,7 @@ export class ManageTeamEdit extends Component {
this.handleAvatar = this.handleAvatar.bind(this)
this.handleBanner = this.handleBanner.bind(this)
console.log('ManageTeamEdit', props.team)
log.debug('ManageTeamEdit', props.team)
const motto = props.team.profile.motto || ''
const description = props.team.profile.description || ''
const avatar = props.team.profile.avatar || null
@@ -59,7 +60,7 @@ export class ManageTeamEdit extends Component {
render () {
const { classes, team, match } = this.props
console.log('ManageTeamEdit ', this.props, this.props.slug, this.props.team, match)
log.debug('ManageTeamEdit ', this.props, this.props.slug, this.props.team, match)
return (
<Mutation
mutation={UPDATE_TEAM_PROFILE}
@@ -82,7 +83,7 @@ export class ManageTeamEdit extends Component {
if (this.state.banner === null && team.profile !== null && (team.profile.banner === undefined || team.profile.banner === null)) banner = 'https://aadevelop.blob.core.windows.net/module-teams/module-default/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)
log.debug('team images: ', avatar, banner)
let errors
let loader
@@ -94,7 +95,7 @@ export class ManageTeamEdit extends Component {
if (error) {
errors = error.graphQLErrors.map(({ message }, i) => {
const displayMessage = checkGraphQLError(message)
console.log('updateTeamProfile error:', displayMessage)
log.debug('updateTeamProfile error:', displayMessage)
return (
<Typography key={i} variant='caption'>
{message}
@@ -242,17 +243,17 @@ export class ManageTeamEdit extends Component {
}
handleAvatar (avatarUrl) {
console.log('handleAvatar: ', avatarUrl)
log.debug('handleAvatar: ', avatarUrl)
this.setState({ avatar: `${avatarUrl}?${Math.random()}` })
}
handleBanner (bannerUrl) {
console.log('handleBanner: ', bannerUrl)
log.debug('handleBanner: ', bannerUrl)
this.setState({ banner: `${bannerUrl}?${Math.random()}` })
}
async handleSubmit (e, updateTeamProfile, slug) {
console.log('handleSubmit: ', this.state)
log.debug('handleSubmit: ', this.state)
e.preventDefault()
await updateTeamProfile({
@@ -14,6 +14,8 @@ import GET_TEAMS_BY_OWNER from '../../../graphql/teams/GetTeamsByOwnerQuery'
import ManageMembersTeamItem from './ManageMembersTeamItem'
import { MessageCard } from '@advancedalgos/web-components'
import log from '../../../utils/log'
const styles = theme => ({
heroContent: {
maxWidth: 600,
@@ -49,12 +51,12 @@ const styles = theme => ({
export const ManageTeamMembersList = ({ classes, user = null }) => {
let owner
let authId = null
console.log('ManageTeamsList: ', user)
log.debug('ManageTeamsList: ', user)
if (user !== null && isString(user)) {
owner = JSON.parse(user)
if (isDefined(owner.authId)) authId = owner.authId
}
console.log('ManageTeamsList 2: ', owner, authId)
log.debug('ManageTeamsList 2: ', owner, authId)
if (authId === undefined || authId === null) {
return (
<Grid container spacing={40}>
@@ -70,7 +72,7 @@ export const ManageTeamMembersList = ({ classes, user = null }) => {
fetchPolicy='network-only'
>
{({ loading, error, data }) => {
console.log('GET_TEAMS_BY_OWNER: ', loading, error, data)
log.debug('GET_TEAMS_BY_OWNER: ', loading, error, data)
let errors = null
if (error) {
errors = error.graphQLErrors.map(({ message }, i) => {
@@ -12,8 +12,10 @@ import ManageTeamDetails from './ManageTeamDetails'
import ManageTeamDelete from './ManageTeamDelete'
import ManageTeamEdit from './ManageTeamEdit'
import log from '../../../utils/log'
export const ManageTeamsItem = ({ classes, team, ...props }) => {
console.log('ManageTeamsItem', team, team.profile, team.profile.avatar)
log.debug('ManageTeamsItem', team, team.profile, team.profile.avatar)
let avatar
if (team.profile.avatar !== undefined && team.profile.avatar !== 'a') {
avatar = team.profile.avatar
@@ -11,6 +11,8 @@ import GET_TEAMS_BY_OWNER from '../../../graphql/teams/GetTeamsByOwnerQuery'
import ManageTeamsItem from './ManageTeamsItem'
import CreateTeamDialog from './CreateTeamDialog'
import log from '../../../utils/log'
const styles = theme => ({
heroContent: {
maxWidth: 600,
@@ -49,7 +51,7 @@ export const ManageTeamsList = ({ classes, user = null, ...props }) => (
fetchPolicy='network-only'
>
{({ loading, error, data }) => {
console.log('GET_TEAMS_BY_OWNER: ', loading, error, data)
log.debug('GET_TEAMS_BY_OWNER: ', loading, error, data)
let errors = null
if (error) {
@@ -15,6 +15,7 @@ import REMOVE_TEAM_MEMBER from '../../../graphql/teams/RemoveTeamMemberMutation'
import GET_TEAMS_BY_OWNER from '../../../graphql/teams/GetTeamsByOwnerQuery'
import { checkGraphQLError } from '../../../utils/graphql-errors'
import log from '../../../utils/log'
const styles = theme => ({
dialogContainer: {
@@ -54,7 +55,7 @@ export class ManageMemberDelete extends Component {
}
render () {
console.log(this.props, this.props.teamId)
log.debug(this.props, this.props.teamId)
const { classes, teamId, authId } = this.props
return (
<Mutation
@@ -72,7 +73,7 @@ export class ManageMemberDelete extends Component {
if (error) {
errors = error.graphQLErrors.map(({ message }, i) => {
const displayMessage = checkGraphQLError(message)
console.log('createTeam error:', displayMessage)
log.debug('createTeam error:', displayMessage)
return (
<Typography key={i} variant='caption'>
{message}
@@ -17,6 +17,7 @@ import SET_TEAM_MEMBER_ROLE from '../../../graphql/teams/SetTeamMemberRoleMutati
import GET_TEAMS_BY_OWNER from '../../../graphql/teams/GetTeamsByOwnerQuery'
import { checkGraphQLError } from '../../../utils/graphql-errors'
import log from '../../../utils/log'
const styles = theme => ({
dialogContainer: {
@@ -62,7 +63,7 @@ export class ManageMemberRole extends Component {
}
render () {
console.log(this.props, this.props.teamId)
log.debug(this.props, this.props.teamId)
const { classes, teamId, authId } = this.props
return (
<Mutation
@@ -80,7 +81,7 @@ export class ManageMemberRole extends Component {
if (error) {
errors = error.graphQLErrors.map(({ message }, i) => {
const displayMessage = checkGraphQLError(message)
console.log('createTeam error:', displayMessage)
log.debug('createTeam error:', displayMessage)
return (
<Typography key={i} variant='caption'>
{message}
@@ -10,6 +10,8 @@ import Card from '@material-ui/core/Card'
import CardContent from '@material-ui/core/CardContent'
import CardActions from '@material-ui/core/CardActions'
import log from '../../../utils/log'
const styles = theme => ({
dialogContainer: {
display: 'block',
@@ -47,7 +49,7 @@ export class ManageMemberStatus extends Component {
}
render () {
console.log(this.props, this.props.status)
log.debug(this.props, this.props.status)
const { classes, status } = this.props
return (
<div>
@@ -9,8 +9,10 @@ import ManageMemberRole from './ManageMemberRole'
import ManageMemberStatus from './ManageMemberStatus'
import { MessageCard } from '@advancedalgos/web-components'
import log from '../../../utils/log'
export const ManageMembersItem = ({ classes, member, teamId, authId }) => {
console.log('ManageMembersItem', member)
log.debug('ManageMembersItem', member)
let profile = null
let email = null
let memberStatus = null
@@ -12,6 +12,8 @@ import InviteMemberDialog from './InviteMemberDialog'
import ManageMembersItem from './ManageMembersItem'
import { MessageCard } from '@advancedalgos/web-components'
import log from '../../../utils/log'
const styles = theme => ({
heroContent: {
maxWidth: 600,
@@ -56,7 +58,7 @@ const styles = theme => ({
})
export const ManageMembersTeamItem = ({ classes, team, authId }) => {
console.log('ManageMembersItem', team, team.profile, team.profile.avatar)
log.debug('ManageMembersItem', team, team.profile, team.profile.avatar)
let avatar
if (team.profile.avatar !== undefined && team.profile.avatar !== 'a') {
avatar = team.profile.avatar
+2 -1
View File
@@ -2,6 +2,7 @@ import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { parse } from '../../utils/js-helpers'
import log from '../../utils/log'
import { MessageCard } from '@advancedalgos/web-components'
@@ -9,7 +10,7 @@ class AcceptTeamInvite extends Component {
render () {
const { location, auth } = this.props
const param = parse(location.search)
console.log(param, auth)
log.debug(param, auth)
if (auth === undefined) {
return <MessageCard message='Loading...' />
@@ -10,6 +10,7 @@ import { MessageCard } from '@advancedalgos/web-components'
import GET_ALL_TEAMS_QUERY from '../../../graphql/teams/GetAllTeamsQuery'
import { isEmpty } from '../../../utils/js-helpers'
import log from '../../../utils/log'
import TeamsItem from './TeamsItem'
import TeamsDetails from './TeamsDetails'
@@ -42,7 +43,7 @@ const styles = theme => ({
export const TeamsList = ({ classes, match }) => (
<Query query={GET_ALL_TEAMS_QUERY} fetchPolicy='cache-and-network' >
{({ loading, error, data, ...props }) => {
console.log('GET_ALL_TEAMS: ', loading, error, data, match, props)
log.debug('GET_ALL_TEAMS: ', loading, error, data, match, props)
let slug = null
if (!isEmpty(match.params) && match.params.slug) slug = match.params.slug
-13
View File
@@ -1,13 +0,0 @@
import minilog from 'minilog'
minilog.enable()
const log = minilog('frontend')
let consoleLog = global.console.log
global.console.log = function () {
consoleLog.apply(global.console, arguments)
}
export default log