Adding saweb-api module.
This commit is contained in:
1 parent
42857554b7
commit
263a3fceba
5 files changed
+158
-10
No files matched your search
@@ -9,6 +9,8 @@ import { client } from '../graphql/apollo'
|
||||
|
||||
import { AUTH_CONFIG } from './Auth0' // create by renaming Auth0.sample.js to Auth0.js and setting vars
|
||||
|
||||
import { setInitialEcosystem } from '../utils/ecosystem'
|
||||
|
||||
const AUTHENTICATE = gql`
|
||||
mutation authenticate($idToken: String!) {
|
||||
users_Authenticate(idToken: $idToken) {
|
||||
@@ -249,6 +251,9 @@ class Auth {
|
||||
}
|
||||
}
|
||||
setItem('user', JSON.stringify(user))
|
||||
|
||||
await setInitialEcosystem()
|
||||
|
||||
window.location.href = '/'
|
||||
return response.data
|
||||
} catch (err) {
|
||||
@@ -261,6 +266,7 @@ class Auth {
|
||||
window.localStorage.removeItem('access_token')
|
||||
window.localStorage.removeItem('user')
|
||||
window.localStorage.removeItem('name')
|
||||
window.localStorage.removeItem('ecosystem')
|
||||
deleteCookie('ajs_anonymous_id')
|
||||
deleteCookie('ajs_user_id')
|
||||
deleteCookie('current_tenant')
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
export const ECOSYSTEM_QUERY = gql`
|
||||
query {
|
||||
web_GetEcosystem {
|
||||
id
|
||||
devTeams {
|
||||
codeName
|
||||
displayName
|
||||
host {
|
||||
url
|
||||
storage
|
||||
container
|
||||
accessKey
|
||||
}
|
||||
bots {
|
||||
codeName
|
||||
displayName
|
||||
type
|
||||
repo
|
||||
configFile
|
||||
products{
|
||||
codeName
|
||||
displayName
|
||||
description
|
||||
dataSets{
|
||||
codeName
|
||||
type
|
||||
validPeriods
|
||||
filePath
|
||||
fileName
|
||||
dataRange{
|
||||
filePath
|
||||
fileName
|
||||
}
|
||||
}
|
||||
exchangeList{
|
||||
name
|
||||
}
|
||||
plotter{
|
||||
devTeam
|
||||
codeName
|
||||
moduleName
|
||||
repo
|
||||
}
|
||||
}
|
||||
}
|
||||
plotters {
|
||||
codeName
|
||||
displayName
|
||||
modules{
|
||||
codeName
|
||||
moduleName
|
||||
description
|
||||
profilePicture
|
||||
panels{
|
||||
codeName
|
||||
moduleName
|
||||
event
|
||||
}
|
||||
}
|
||||
repo
|
||||
configFile
|
||||
}
|
||||
}
|
||||
hosts {
|
||||
codeName
|
||||
displayName
|
||||
host {
|
||||
url
|
||||
storage
|
||||
container
|
||||
accessKey
|
||||
}
|
||||
competitions {
|
||||
codeName
|
||||
displayName
|
||||
description
|
||||
startDatetime
|
||||
finishDatetime
|
||||
formula
|
||||
plotter{
|
||||
devTeam
|
||||
codeName
|
||||
host{
|
||||
url
|
||||
storage
|
||||
container
|
||||
accessKey
|
||||
}
|
||||
moduleName
|
||||
repo
|
||||
}
|
||||
rules
|
||||
prizes
|
||||
participants
|
||||
repo
|
||||
configFile
|
||||
}
|
||||
plotters {
|
||||
codeName
|
||||
displayName
|
||||
modules{
|
||||
codeName
|
||||
moduleName
|
||||
description
|
||||
profilePicture
|
||||
panels{
|
||||
codeName
|
||||
moduleName
|
||||
event
|
||||
}
|
||||
}
|
||||
repo
|
||||
configFile
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
@@ -5,6 +5,7 @@ import MasterApp from './App'
|
||||
import { createStore } from 'redux'
|
||||
import { Provider } from 'react-redux'
|
||||
import rootReducer from './reducers/rootReducer'
|
||||
import { setInitialEcosystem } from './utils/ecosystem'
|
||||
|
||||
const store = createStore(rootReducer)
|
||||
|
||||
@@ -12,6 +13,8 @@ if (process.env.NODE_ENV !== 'production') {
|
||||
window.localStorage.setItem('debug', 'advanced-algos:*')
|
||||
}
|
||||
|
||||
setInitialEcosystem()
|
||||
|
||||
ReactDOM.render(
|
||||
<Provider store={store}>
|
||||
<MasterApp />
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import { client } from '../graphql/apollo'
|
||||
import { ECOSYSTEM_QUERY } from '../graphql/EcosystemQuery'
|
||||
import Log from './log'
|
||||
|
||||
export async function setInitialEcosystem() {
|
||||
try {
|
||||
const ecosystem = await client.query({ query: ECOSYSTEM_QUERY })
|
||||
window.localStorage.setItem('ecosystem', JSON.stringify(ecosystem.data.web_GetEcosystem))
|
||||
} catch (error) {
|
||||
Log.error('Error getting the ecosystem: ' + error)
|
||||
}
|
||||
}
|
||||
+17
-10
@@ -70,23 +70,27 @@ async function run () {
|
||||
'logs_',
|
||||
process.env.LOGS_API_URL,
|
||||
process.env.LOGS_API_PRESHARED)
|
||||
const transformeStrategizerSchema = await createTransformedRemoteSchema(
|
||||
const transformedStrategizerSchema = await createTransformedRemoteSchema(
|
||||
'strategizer_',
|
||||
process.env.STRATEGIZER_API_URL,
|
||||
process.env.STRATEGIZER_API_PRESHARED)
|
||||
const transformeCockpitSchema = await createTransformedRemoteSchema(
|
||||
const transformedCockpitSchema = await createTransformedRemoteSchema(
|
||||
'cockpit_',
|
||||
process.env.COCKPIT_API_URL,
|
||||
process.env.COCKPIT_API_PRESHARED)
|
||||
const transformedSAWeb = await createTransformedRemoteSchema(
|
||||
'web_',
|
||||
process.env.SAWEB_API_URL,
|
||||
process.env.SAWEB_API_PRESHARED)
|
||||
|
||||
var schemas = []
|
||||
var resolvers = {}
|
||||
|
||||
if (transformedTeamsSchema) {
|
||||
schemas.push(transformedTeamsSchema)
|
||||
if (transformedUsersSchema && transformedEventsSchema && transformeStrategizerSchema) {
|
||||
if (transformedUsersSchema && transformedEventsSchema && transformedStrategizerSchema) {
|
||||
schemas.push(teams.linkSchemaDefs)
|
||||
resolvers = Object.assign(resolvers, teams.resolver(transformedUsersSchema, transformedEventsSchema, transformeStrategizerSchema))
|
||||
resolvers = Object.assign(resolvers, teams.resolver(transformedUsersSchema, transformedEventsSchema, transformedStrategizerSchema))
|
||||
}
|
||||
}
|
||||
if (transformedUsersSchema) {
|
||||
@@ -104,9 +108,9 @@ async function run () {
|
||||
}
|
||||
if (transformedOperationsSchema) {
|
||||
schemas.push(transformedOperationsSchema)
|
||||
if (transformedTeamsSchema && transformeCockpitSchema) {
|
||||
if (transformedTeamsSchema && transformedCockpitSchema) {
|
||||
schemas.push(operations.linkSchemaDefs)
|
||||
resolvers = Object.assign(resolvers, operations.resolver(transformedTeamsSchema, transformeCockpitSchema))
|
||||
resolvers = Object.assign(resolvers, operations.resolver(transformedTeamsSchema, transformedCockpitSchema))
|
||||
}
|
||||
}
|
||||
if (transformedNotificationsSchema) {
|
||||
@@ -115,11 +119,14 @@ async function run () {
|
||||
if (transformedLogsSchema) {
|
||||
schemas.push(transformedLogsSchema)
|
||||
}
|
||||
if (transformeStrategizerSchema) {
|
||||
schemas.push(transformeStrategizerSchema)
|
||||
if (transformedStrategizerSchema) {
|
||||
schemas.push(transformedStrategizerSchema)
|
||||
}
|
||||
if (transformeCockpitSchema) {
|
||||
schemas.push(transformeCockpitSchema)
|
||||
if (transformedCockpitSchema) {
|
||||
schemas.push(transformedCockpitSchema)
|
||||
}
|
||||
if (transformedSAWeb) {
|
||||
schemas.push(transformedSAWeb)
|
||||
}
|
||||
|
||||
const schema = mergeSchemas({
|
||||
|
||||
Reference in new issue
Block a user