@apollo-annotation/jbrowse-plugin-apollo 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -0
- package/dist/index.esm.js +10248 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +7 -0
- package/dist/jbrowse-plugin-apollo.cjs.development.js +10298 -0
- package/dist/jbrowse-plugin-apollo.cjs.development.js.map +1 -0
- package/dist/jbrowse-plugin-apollo.cjs.production.min.js +2 -0
- package/dist/jbrowse-plugin-apollo.cjs.production.min.js.map +1 -0
- package/dist/jbrowse-plugin-apollo.umd.development.js +46957 -0
- package/dist/jbrowse-plugin-apollo.umd.development.js.map +1 -0
- package/dist/jbrowse-plugin-apollo.umd.production.min.js +2 -0
- package/dist/jbrowse-plugin-apollo.umd.production.min.js.map +1 -0
- package/package.json +130 -0
- package/src/ApolloInternetAccount/addMenuItems.ts +94 -0
- package/src/ApolloInternetAccount/components/AuthTypeSelector.tsx +121 -0
- package/src/ApolloInternetAccount/components/LoginButtons.tsx +62 -0
- package/src/ApolloInternetAccount/components/LoginIcons.tsx +74 -0
- package/src/ApolloInternetAccount/configSchema.ts +26 -0
- package/src/ApolloInternetAccount/index.ts +2 -0
- package/src/ApolloInternetAccount/model.ts +448 -0
- package/src/ApolloJobModel.ts +117 -0
- package/src/ApolloSequenceAdapter/ApolloSequenceAdapter.ts +186 -0
- package/src/ApolloSequenceAdapter/configSchema.ts +12 -0
- package/src/ApolloSequenceAdapter/index.ts +21 -0
- package/src/ApolloSixFrameRenderer/ApolloSixFrameRenderer.tsx +12 -0
- package/src/ApolloSixFrameRenderer/components/ApolloRendering.tsx +692 -0
- package/src/ApolloSixFrameRenderer/configSchema.ts +7 -0
- package/src/ApolloSixFrameRenderer/index.ts +3 -0
- package/src/ApolloTextSearchAdapter/ApolloTextSearchAdapter.ts +64 -0
- package/src/ApolloTextSearchAdapter/configSchema.ts +24 -0
- package/src/ApolloTextSearchAdapter/index.ts +18 -0
- package/src/BackendDrivers/BackendDriver.ts +31 -0
- package/src/BackendDrivers/CollaborationServerDriver.ts +318 -0
- package/src/BackendDrivers/DesktopFileDriver.ts +170 -0
- package/src/BackendDrivers/InMemoryFileDriver.ts +76 -0
- package/src/BackendDrivers/index.ts +4 -0
- package/src/ChangeManager.ts +148 -0
- package/src/LinearApolloDisplay/components/LinearApolloDisplay.tsx +248 -0
- package/src/LinearApolloDisplay/components/index.ts +1 -0
- package/src/LinearApolloDisplay/configSchema.ts +16 -0
- package/src/LinearApolloDisplay/glyphs/BoxGlyph.ts +422 -0
- package/src/LinearApolloDisplay/glyphs/CanonicalGeneGlyph.ts +1191 -0
- package/src/LinearApolloDisplay/glyphs/GenericChildGlyph.ts +151 -0
- package/src/LinearApolloDisplay/glyphs/Glyph.ts +382 -0
- package/src/LinearApolloDisplay/glyphs/ImplicitExonGeneGlyph.ts +697 -0
- package/src/LinearApolloDisplay/glyphs/index.ts +4 -0
- package/src/LinearApolloDisplay/index.ts +2 -0
- package/src/LinearApolloDisplay/stateModel/base.ts +146 -0
- package/src/LinearApolloDisplay/stateModel/getGlyph.ts +39 -0
- package/src/LinearApolloDisplay/stateModel/glyphs.ts +45 -0
- package/src/LinearApolloDisplay/stateModel/index.ts +20 -0
- package/src/LinearApolloDisplay/stateModel/layouts.ts +230 -0
- package/src/LinearApolloDisplay/stateModel/mouseEvents.ts +513 -0
- package/src/LinearApolloDisplay/stateModel/rendering.ts +441 -0
- package/src/LinearApolloDisplay/stateModel/trackHeightMixin.ts +43 -0
- package/src/LinearApolloDisplay/types.ts +1 -0
- package/src/OntologyManager/OntologyStore/__snapshots__/fulltext.test.ts.snap +208 -0
- package/src/OntologyManager/OntologyStore/__snapshots__/index.test.ts.snap +18846 -0
- package/src/OntologyManager/OntologyStore/fulltext-stopwords.ts +137 -0
- package/src/OntologyManager/OntologyStore/fulltext.test.ts +94 -0
- package/src/OntologyManager/OntologyStore/fulltext.ts +264 -0
- package/src/OntologyManager/OntologyStore/index.test.ts +130 -0
- package/src/OntologyManager/OntologyStore/index.ts +526 -0
- package/src/OntologyManager/OntologyStore/indexeddb-schema.ts +89 -0
- package/src/OntologyManager/OntologyStore/indexeddb-storage.ts +180 -0
- package/src/OntologyManager/OntologyStore/obo-graph-json-schema.ts +110 -0
- package/src/OntologyManager/OntologyStore/prefixes.ts +35 -0
- package/src/OntologyManager/index.ts +173 -0
- package/src/SixFrameFeatureDisplay/components/TrackLines.tsx +19 -0
- package/src/SixFrameFeatureDisplay/components/index.ts +1 -0
- package/src/SixFrameFeatureDisplay/configSchema.ts +21 -0
- package/src/SixFrameFeatureDisplay/index.ts +2 -0
- package/src/SixFrameFeatureDisplay/stateModel.ts +413 -0
- package/src/TabularEditor/HybridGrid/ChangeHandling.ts +88 -0
- package/src/TabularEditor/HybridGrid/Feature.tsx +346 -0
- package/src/TabularEditor/HybridGrid/FeatureAttributes.tsx +34 -0
- package/src/TabularEditor/HybridGrid/Highlight.tsx +40 -0
- package/src/TabularEditor/HybridGrid/HybridGrid.tsx +138 -0
- package/src/TabularEditor/HybridGrid/NumberCell.tsx +77 -0
- package/src/TabularEditor/HybridGrid/ToolBar.tsx +59 -0
- package/src/TabularEditor/HybridGrid/featureContextMenuItems.ts +119 -0
- package/src/TabularEditor/HybridGrid/index.ts +1 -0
- package/src/TabularEditor/TabularEditorPane.tsx +34 -0
- package/src/TabularEditor/index.ts +3 -0
- package/src/TabularEditor/model.ts +44 -0
- package/src/TabularEditor/types.ts +3 -0
- package/src/components/AddAssembly.tsx +464 -0
- package/src/components/AddChildFeature.tsx +247 -0
- package/src/components/AddFeature.tsx +252 -0
- package/src/components/CopyFeature.tsx +328 -0
- package/src/components/DeleteAssembly.tsx +185 -0
- package/src/components/DeleteFeature.tsx +90 -0
- package/src/components/Dialog.tsx +47 -0
- package/src/components/DownloadGFF3.tsx +213 -0
- package/src/components/ImportFeatures.tsx +295 -0
- package/src/components/ManageChecks.tsx +280 -0
- package/src/components/ManageUsers.tsx +218 -0
- package/src/components/ModifyFeatureAttribute.tsx +457 -0
- package/src/components/OntologyTermAutocomplete.tsx +240 -0
- package/src/components/OntologyTermMultiSelect.tsx +349 -0
- package/src/components/OpenLocalFile.tsx +178 -0
- package/src/components/ViewChangeLog.tsx +208 -0
- package/src/components/ViewCheckResults.tsx +151 -0
- package/src/components/index.ts +12 -0
- package/src/config.ts +10 -0
- package/src/declare.d.ts +3 -0
- package/src/extensions/annotationFromPileup.ts +208 -0
- package/src/extensions/index.ts +1 -0
- package/src/index.ts +394 -0
- package/src/makeDisplayComponent.tsx +244 -0
- package/src/session/ClientDataStore.ts +282 -0
- package/src/session/index.ts +1 -0
- package/src/session/session.ts +373 -0
- package/src/types.ts +10 -0
- package/src/util/index.ts +31 -0
- package/src/util/loadAssemblyIntoClient.ts +291 -0
package/package.json
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.1.0",
|
|
3
|
+
"name": "@apollo-annotation/jbrowse-plugin-apollo",
|
|
4
|
+
"description": "Apollo plugin for JBrowse 2",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/GMOD/Apollo3.git",
|
|
8
|
+
"directory": "packages/jbrowse-plugin-apollo"
|
|
9
|
+
},
|
|
10
|
+
"author": "JBrowse Team",
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"jbrowse",
|
|
14
|
+
"jbrowse2"
|
|
15
|
+
],
|
|
16
|
+
"main": "dist/index.js",
|
|
17
|
+
"module": "dist/index.esm.js",
|
|
18
|
+
"typings": "dist/index.d.ts",
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"src"
|
|
22
|
+
],
|
|
23
|
+
"config": {
|
|
24
|
+
"jbrowse": {
|
|
25
|
+
"plugin": {
|
|
26
|
+
"name": "Apollo"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"setup": "rimraf .jbrowse && jbrowse create .jbrowse",
|
|
32
|
+
"clean": "rimraf dist",
|
|
33
|
+
"start": "yarn clean && npm-run-all --parallel start:watch start:server",
|
|
34
|
+
"start:watch": "JB_NPM=false NODE_ENV=development rollup --config --watch",
|
|
35
|
+
"start:server": "serve --no-request-logging --cors --listen 9000 .",
|
|
36
|
+
"build": "yarn build:shared && yarn clean && rollup --config",
|
|
37
|
+
"browse": "serve --no-request-logging --listen 8999 .jbrowse",
|
|
38
|
+
"test": "jest",
|
|
39
|
+
"test:ci": "jest --coverage",
|
|
40
|
+
"start:collab-cypress": "yarn workspace apollo-collaboration-server run cypress:start",
|
|
41
|
+
"test:e2e": "yarn build && start-test \"npm-run-all --parallel start:server browse start:collab-cypress\" \"9000|8999|http://localhost:3999/health\" \"npm-run-all cypress:run\"",
|
|
42
|
+
"test:e2e:debug": "yarn build && start-test \"npm-run-all --parallel start:server browse start:collab-cypress\" \"9000|8999|http://localhost:3999/health\" \"npm-run-all cypress:debug\"",
|
|
43
|
+
"cypress:run": "cypress run --browser chrome",
|
|
44
|
+
"cypress:debug": "cypress run --browser chrome --config screenshotOnRunFailure=true,video=true",
|
|
45
|
+
"cypress:open": "cypress open --config baseUrl=http://localhost:3000",
|
|
46
|
+
"prepublish": "yarn test",
|
|
47
|
+
"prepack": "yarn build",
|
|
48
|
+
"postversion": "git push --follow-tags"
|
|
49
|
+
},
|
|
50
|
+
"jbrowse-plugin": {
|
|
51
|
+
"name": "Apollo"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"@emotion/react": "^11.10.6",
|
|
55
|
+
"@emotion/styled": "^11.10.6",
|
|
56
|
+
"@gmod/gff": "1.2.0",
|
|
57
|
+
"@jbrowse/plugin-authentication": "^2.0.1",
|
|
58
|
+
"@jbrowse/plugin-linear-genome-view": "^2.0.1",
|
|
59
|
+
"@mui/icons-material": "^5.8.4",
|
|
60
|
+
"@types/jsonpath": "^0.2.0",
|
|
61
|
+
"apollo-common": "^1.0.0-alpha.0",
|
|
62
|
+
"apollo-mst": "^1.0.0-alpha.0",
|
|
63
|
+
"apollo-shared": "^1.0.0-alpha.0",
|
|
64
|
+
"autosuggest-highlight": "^3.3.4",
|
|
65
|
+
"bson-objectid": "^2.0.4",
|
|
66
|
+
"clsx": "^1.1.1",
|
|
67
|
+
"fast-deep-equal": "^3.1.3",
|
|
68
|
+
"file-saver": "^2.0.5",
|
|
69
|
+
"http-proxy-middleware": "^2.0.6",
|
|
70
|
+
"idb": "^7.1.1",
|
|
71
|
+
"jsonpath": "^1.1.1",
|
|
72
|
+
"nanoid": "^4.0.2",
|
|
73
|
+
"regenerator-runtime": "^0.13.9",
|
|
74
|
+
"socket.io-client": "^4.5.4",
|
|
75
|
+
"tslib": "^2.3.1"
|
|
76
|
+
},
|
|
77
|
+
"peerDependencies": {
|
|
78
|
+
"@jbrowse/core": "^2.7.0",
|
|
79
|
+
"@mui/material": "^5.11.10",
|
|
80
|
+
"mobx": "^6.6.1",
|
|
81
|
+
"mobx-react": "^7.2.1",
|
|
82
|
+
"mobx-state-tree": "^5.1.7",
|
|
83
|
+
"prop-types": "^15.8.1",
|
|
84
|
+
"react": "^18.2.0",
|
|
85
|
+
"react-dom": "^18.2.0",
|
|
86
|
+
"rxjs": "^7.4.0",
|
|
87
|
+
"tss-react": "^4.6.1"
|
|
88
|
+
},
|
|
89
|
+
"devDependencies": {
|
|
90
|
+
"@jbrowse/cli": "^2.6.2",
|
|
91
|
+
"@jbrowse/core": "^2.7.0",
|
|
92
|
+
"@jbrowse/development-tools": "^2.1.1",
|
|
93
|
+
"@jest/globals": "^29.0.3",
|
|
94
|
+
"@mui/material": "^5.11.10",
|
|
95
|
+
"@mui/x-data-grid": "^6.0.1",
|
|
96
|
+
"@types/autosuggest-highlight": "^3",
|
|
97
|
+
"@types/file-saver": "^2",
|
|
98
|
+
"@types/node": "^18.14.2",
|
|
99
|
+
"@types/prop-types": "^15",
|
|
100
|
+
"@types/react": "^17.0.34",
|
|
101
|
+
"@types/react-dom": "^18",
|
|
102
|
+
"cypress": "12.17.3",
|
|
103
|
+
"cypress-mongodb": "^6.2.0",
|
|
104
|
+
"fake-indexeddb": "^4.0.2",
|
|
105
|
+
"jest": "^29.6.2",
|
|
106
|
+
"jest-fetch-mock": "^3.0.3",
|
|
107
|
+
"librpc-web-mod": "^1.1.9",
|
|
108
|
+
"mobx": "^6.6.1",
|
|
109
|
+
"mobx-react": "^7.2.1",
|
|
110
|
+
"mobx-state-tree": "^5.1.7",
|
|
111
|
+
"npm-run-all": "^4.1.5",
|
|
112
|
+
"prop-types": "^15.8.1",
|
|
113
|
+
"react": "^18.2.0",
|
|
114
|
+
"react-dom": "^18.2.0",
|
|
115
|
+
"rimraf": "^3.0.2",
|
|
116
|
+
"rollup": "^2.59.0",
|
|
117
|
+
"rxjs": "^7.4.0",
|
|
118
|
+
"serve": "^14.0.1",
|
|
119
|
+
"shx": "^0.3.3",
|
|
120
|
+
"start-server-and-test": "^1.11.7",
|
|
121
|
+
"ts-jest": "^29.1.1",
|
|
122
|
+
"ts-node": "^10.3.0",
|
|
123
|
+
"tss-react": "^4.6.1",
|
|
124
|
+
"typescript": "^5.1.6"
|
|
125
|
+
},
|
|
126
|
+
"publishConfig": {
|
|
127
|
+
"access": "public"
|
|
128
|
+
},
|
|
129
|
+
"stableVersion": "0.0.0"
|
|
130
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { AbstractMenuManager, AbstractSessionModel } from '@jbrowse/core/util'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
AddAssembly,
|
|
5
|
+
DeleteAssembly,
|
|
6
|
+
ImportFeatures,
|
|
7
|
+
ManageUsers,
|
|
8
|
+
} from '../components'
|
|
9
|
+
import { ApolloSessionModel } from '../session'
|
|
10
|
+
|
|
11
|
+
export function addMenuItems(rootModel: AbstractMenuManager) {
|
|
12
|
+
rootModel.appendToMenu('Apollo', {
|
|
13
|
+
label: 'Add Assembly',
|
|
14
|
+
onClick: (session: ApolloSessionModel) => {
|
|
15
|
+
;(session as unknown as AbstractSessionModel).queueDialog(
|
|
16
|
+
(doneCallback) => [
|
|
17
|
+
AddAssembly,
|
|
18
|
+
{
|
|
19
|
+
session,
|
|
20
|
+
handleClose: () => {
|
|
21
|
+
doneCallback()
|
|
22
|
+
},
|
|
23
|
+
changeManager: session.apolloDataStore.changeManager,
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
)
|
|
27
|
+
},
|
|
28
|
+
})
|
|
29
|
+
rootModel.appendToMenu('Apollo', {
|
|
30
|
+
label: 'Delete Assembly',
|
|
31
|
+
onClick: (session: ApolloSessionModel) => {
|
|
32
|
+
;(session as unknown as AbstractSessionModel).queueDialog(
|
|
33
|
+
(doneCallback) => [
|
|
34
|
+
DeleteAssembly,
|
|
35
|
+
{
|
|
36
|
+
session,
|
|
37
|
+
handleClose: () => {
|
|
38
|
+
doneCallback()
|
|
39
|
+
},
|
|
40
|
+
changeManager: session.apolloDataStore.changeManager,
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
)
|
|
44
|
+
},
|
|
45
|
+
})
|
|
46
|
+
rootModel.appendToMenu('Apollo', {
|
|
47
|
+
label: 'Import Features',
|
|
48
|
+
onClick: (session: ApolloSessionModel) => {
|
|
49
|
+
;(session as unknown as AbstractSessionModel).queueDialog(
|
|
50
|
+
(doneCallback) => [
|
|
51
|
+
ImportFeatures,
|
|
52
|
+
{
|
|
53
|
+
session,
|
|
54
|
+
handleClose: () => {
|
|
55
|
+
doneCallback()
|
|
56
|
+
},
|
|
57
|
+
changeManager: (session as ApolloSessionModel).apolloDataStore
|
|
58
|
+
.changeManager,
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
)
|
|
62
|
+
},
|
|
63
|
+
})
|
|
64
|
+
rootModel.appendToMenu('Apollo', {
|
|
65
|
+
label: 'Manage Users',
|
|
66
|
+
onClick: (session: ApolloSessionModel) => {
|
|
67
|
+
;(session as unknown as AbstractSessionModel).queueDialog(
|
|
68
|
+
(doneCallback) => [
|
|
69
|
+
ManageUsers,
|
|
70
|
+
{
|
|
71
|
+
session,
|
|
72
|
+
handleClose: () => {
|
|
73
|
+
doneCallback()
|
|
74
|
+
},
|
|
75
|
+
changeManager: (session as ApolloSessionModel).apolloDataStore
|
|
76
|
+
.changeManager,
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
)
|
|
80
|
+
},
|
|
81
|
+
})
|
|
82
|
+
rootModel.appendToMenu('Apollo', {
|
|
83
|
+
label: 'Undo',
|
|
84
|
+
onClick: (session: ApolloSessionModel) => {
|
|
85
|
+
const { apolloDataStore } = session
|
|
86
|
+
const { notify } = session as unknown as AbstractSessionModel
|
|
87
|
+
if (apolloDataStore.changeManager.recentChanges.length > 0) {
|
|
88
|
+
void apolloDataStore.changeManager.revertLastChange()
|
|
89
|
+
} else {
|
|
90
|
+
notify('No changes to undo', 'info')
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
})
|
|
94
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { isAbortException } from '@jbrowse/core/util'
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
DialogActions,
|
|
5
|
+
DialogContent,
|
|
6
|
+
DialogContentText,
|
|
7
|
+
Divider,
|
|
8
|
+
} from '@mui/material'
|
|
9
|
+
import React, { useEffect, useState } from 'react'
|
|
10
|
+
import { makeStyles } from 'tss-react/mui'
|
|
11
|
+
|
|
12
|
+
import { Dialog } from '../../components/Dialog'
|
|
13
|
+
import { createFetchErrorMessage } from '../../util'
|
|
14
|
+
import { GoogleButton, GuestButton, MicrosoftButton } from './LoginButtons'
|
|
15
|
+
|
|
16
|
+
const useStyles = makeStyles()((theme) => ({
|
|
17
|
+
divider: {
|
|
18
|
+
marginTop: theme.spacing(4),
|
|
19
|
+
marginBottom: theme.spacing(5),
|
|
20
|
+
},
|
|
21
|
+
}))
|
|
22
|
+
|
|
23
|
+
export const AuthTypeSelector = ({
|
|
24
|
+
baseURL,
|
|
25
|
+
handleClose,
|
|
26
|
+
name,
|
|
27
|
+
}: {
|
|
28
|
+
baseURL: string
|
|
29
|
+
name: string
|
|
30
|
+
handleClose: (type?: 'google' | 'microsoft' | 'guest' | Error) => void
|
|
31
|
+
}) => {
|
|
32
|
+
const { classes } = useStyles()
|
|
33
|
+
const [errorMessage, setErrorMessage] = useState('')
|
|
34
|
+
const [loginTypes, setLoginTypes] = useState<string[]>([])
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
const controller = new AbortController()
|
|
37
|
+
const { signal } = controller
|
|
38
|
+
async function getAuthTypes() {
|
|
39
|
+
const uri = new URL('/auth/types', baseURL).href
|
|
40
|
+
const response = await fetch(uri, { method: 'GET', signal })
|
|
41
|
+
if (!response.ok) {
|
|
42
|
+
const newErrorMessage = await createFetchErrorMessage(
|
|
43
|
+
response,
|
|
44
|
+
'Error when retrieving auth types from server',
|
|
45
|
+
)
|
|
46
|
+
setErrorMessage(newErrorMessage)
|
|
47
|
+
return
|
|
48
|
+
}
|
|
49
|
+
const data = (await response.json()) as string[]
|
|
50
|
+
setLoginTypes(data)
|
|
51
|
+
}
|
|
52
|
+
getAuthTypes().catch((error) =>
|
|
53
|
+
isAbortException(error) ? '' : setErrorMessage(String(error)),
|
|
54
|
+
)
|
|
55
|
+
return () => {
|
|
56
|
+
controller.abort()
|
|
57
|
+
}
|
|
58
|
+
}, [baseURL])
|
|
59
|
+
|
|
60
|
+
function handleClick(authType: 'google' | 'microsoft' | 'guest') {
|
|
61
|
+
if (authType === 'google') {
|
|
62
|
+
handleClose('google')
|
|
63
|
+
} else if (authType === 'microsoft') {
|
|
64
|
+
handleClose('microsoft')
|
|
65
|
+
} else {
|
|
66
|
+
handleClose('guest')
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const allowGoogle = loginTypes.includes('google')
|
|
71
|
+
const allowMicrosoft = loginTypes.includes('microsoft')
|
|
72
|
+
const allowGuest = loginTypes.includes('guest')
|
|
73
|
+
return (
|
|
74
|
+
<Dialog
|
|
75
|
+
open
|
|
76
|
+
title={`Log in to ${name}`}
|
|
77
|
+
handleClose={handleClose}
|
|
78
|
+
maxWidth={false}
|
|
79
|
+
data-testid="login-apollo"
|
|
80
|
+
>
|
|
81
|
+
<DialogContent
|
|
82
|
+
style={{ display: 'flex', flexDirection: 'column', paddingTop: 8 }}
|
|
83
|
+
>
|
|
84
|
+
{allowGoogle ? (
|
|
85
|
+
<GoogleButton
|
|
86
|
+
disabled={!allowGoogle}
|
|
87
|
+
onClick={() => handleClick('google')}
|
|
88
|
+
/>
|
|
89
|
+
) : null}
|
|
90
|
+
{allowMicrosoft ? (
|
|
91
|
+
<MicrosoftButton
|
|
92
|
+
disabled={!allowMicrosoft}
|
|
93
|
+
onClick={() => handleClick('microsoft')}
|
|
94
|
+
/>
|
|
95
|
+
) : null}
|
|
96
|
+
{allowGuest ? (
|
|
97
|
+
<>
|
|
98
|
+
<Divider className={classes.divider} />
|
|
99
|
+
<GuestButton onClick={() => handleClick('guest')} />
|
|
100
|
+
</>
|
|
101
|
+
) : null}
|
|
102
|
+
</DialogContent>
|
|
103
|
+
<DialogActions>
|
|
104
|
+
<Button
|
|
105
|
+
variant="outlined"
|
|
106
|
+
type="submit"
|
|
107
|
+
onClick={() => {
|
|
108
|
+
handleClose()
|
|
109
|
+
}}
|
|
110
|
+
>
|
|
111
|
+
Cancel
|
|
112
|
+
</Button>
|
|
113
|
+
</DialogActions>
|
|
114
|
+
{errorMessage ? (
|
|
115
|
+
<DialogContent>
|
|
116
|
+
<DialogContentText color="error">{errorMessage}</DialogContentText>
|
|
117
|
+
</DialogContent>
|
|
118
|
+
) : null}
|
|
119
|
+
</Dialog>
|
|
120
|
+
)
|
|
121
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import AccountCircleIcon from '@mui/icons-material/AccountCircle'
|
|
2
|
+
import { Button, ButtonProps } from '@mui/material'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
import { makeStyles } from 'tss-react/mui'
|
|
5
|
+
|
|
6
|
+
import { Google, Microsoft } from './LoginIcons'
|
|
7
|
+
|
|
8
|
+
const useStyles = makeStyles()((theme) => ({
|
|
9
|
+
loginButton: {
|
|
10
|
+
marginBottom: theme.spacing(1),
|
|
11
|
+
width: '220px',
|
|
12
|
+
height: '40px',
|
|
13
|
+
fontSize: '16px',
|
|
14
|
+
textTransform: 'none',
|
|
15
|
+
justifyContent: 'left',
|
|
16
|
+
padding: '3px 12px',
|
|
17
|
+
},
|
|
18
|
+
}))
|
|
19
|
+
|
|
20
|
+
export function GoogleButton(props: ButtonProps) {
|
|
21
|
+
const { classes } = useStyles()
|
|
22
|
+
const { disabled } = props
|
|
23
|
+
return (
|
|
24
|
+
<Button
|
|
25
|
+
className={classes.loginButton}
|
|
26
|
+
variant="outlined"
|
|
27
|
+
startIcon={<Google color={disabled ? 'disabled' : undefined} />}
|
|
28
|
+
{...props}
|
|
29
|
+
>
|
|
30
|
+
Sign in with Google
|
|
31
|
+
</Button>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function MicrosoftButton(props: ButtonProps) {
|
|
36
|
+
const { classes } = useStyles()
|
|
37
|
+
const { disabled } = props
|
|
38
|
+
return (
|
|
39
|
+
<Button
|
|
40
|
+
className={classes.loginButton}
|
|
41
|
+
variant="outlined"
|
|
42
|
+
startIcon={<Microsoft color={disabled ? 'disabled' : undefined} />}
|
|
43
|
+
{...props}
|
|
44
|
+
>
|
|
45
|
+
Sign in with Microsoft
|
|
46
|
+
</Button>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function GuestButton(props: ButtonProps) {
|
|
51
|
+
const { classes } = useStyles()
|
|
52
|
+
return (
|
|
53
|
+
<Button
|
|
54
|
+
className={classes.loginButton}
|
|
55
|
+
variant="outlined"
|
|
56
|
+
startIcon={<AccountCircleIcon fontSize="small" />}
|
|
57
|
+
{...props}
|
|
58
|
+
>
|
|
59
|
+
Continue as Guest
|
|
60
|
+
</Button>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { SvgIcon, SvgIconProps } from '@mui/material'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
// Icon source: https://developers.google.com/identity/branding-guidelines
|
|
5
|
+
export function Google(props: SvgIconProps) {
|
|
6
|
+
const { color } = props
|
|
7
|
+
return (
|
|
8
|
+
<SvgIcon
|
|
9
|
+
viewBox="0 0 18 18"
|
|
10
|
+
style={{ fontSize: 18, marginRight: 4 }}
|
|
11
|
+
{...props}
|
|
12
|
+
>
|
|
13
|
+
{color === 'disabled' ? (
|
|
14
|
+
<path d="M9.001,10.71 l0,-3.348 l8.424,0 c0.126,0.567,0.225,1.098,0.225,1.845 c0,5.139,-3.447,8.793,-8.64,8.793 c-4.968,0,-9,-4.032,-9,-9 c0,-4.968,4.032,-9,9,-9 c2.43,0,4.464,0.891,6.021,2.349 l-2.556,2.484 c-0.648,-0.612,-1.782,-1.332,-3.465,-1.332 c-2.979,0,-5.409,2.475,-5.409,5.508 c0,3.033,2.43,5.508,5.409,5.508 c3.447,0,4.716,-2.385,4.95,-3.798 l-4.959,0 l0,-0.009 z"></path>
|
|
15
|
+
) : (
|
|
16
|
+
<>
|
|
17
|
+
<path
|
|
18
|
+
d="M17.64,9.20454545 c0,-0.638,-0.057,-1.252,-0.164,-1.841 l-8.476,0 l0,3.481 l4.844,0 c-0.209,1.125,-0.843,2.079,-1.796,2.717 l0,2.258 l2.908,0 c1.702,-1.567,2.684,-3.874,2.684,-6.615 l0,0 z"
|
|
19
|
+
fill="#4285F4"
|
|
20
|
+
></path>
|
|
21
|
+
<path
|
|
22
|
+
d="M9,18 c2.43,0,4.467,-0.806,5.956,-2.18 l-2.908,-2.259 c-0.806,0.54,-1.837,0.859,-3.048,0.859 c-2.344,0,-4.328,-1.583,-5.036,-3.71 l-3.007,0 l0,2.332 c1.481,2.941,4.525,4.958,8.043,4.958 l0,0 z"
|
|
23
|
+
fill="#34A853"
|
|
24
|
+
></path>
|
|
25
|
+
<path
|
|
26
|
+
d="M3.96409091,10.71 c-0.18,-0.54,-0.282,-1.117,-0.282,-1.71 c0,-0.593,0.102,-1.17,0.282,-1.71 l0,-2.332 l-3.007,0 c-0.609,1.215,-0.957,2.59,-0.957,4.042 c0,1.452,0.348,2.827,0.957,4.042 l3.007,-2.332 l0,0 z"
|
|
27
|
+
fill="#FBBC05"
|
|
28
|
+
></path>
|
|
29
|
+
<path
|
|
30
|
+
d="M9,3.57954545 c1.321,0,2.508,0.454,3.44,1.346 l2.582,-2.581 c-1.559,-1.453,-3.596,-2.345,-6.022,-2.345 c-3.518,0,-6.562,2.017,-8.043,4.959 l3.007,2.331 c0.708,-2.127,2.692,-3.71,5.036,-3.71 l0,0 z"
|
|
31
|
+
fill="#EA4335"
|
|
32
|
+
></path>
|
|
33
|
+
</>
|
|
34
|
+
)}
|
|
35
|
+
</SvgIcon>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Icon source: https://learn.microsoft.com/en-us/azure/active-directory/develop/howto-add-branding-in-azure-ad-apps
|
|
40
|
+
export function Microsoft(props: SvgIconProps) {
|
|
41
|
+
const { color } = props
|
|
42
|
+
return (
|
|
43
|
+
<SvgIcon viewBox="0 0 21 21" style={{ fontSize: 21 }} {...props}>
|
|
44
|
+
<rect
|
|
45
|
+
x="1"
|
|
46
|
+
y="1"
|
|
47
|
+
width="9"
|
|
48
|
+
height="9"
|
|
49
|
+
fill={color === 'disabled' ? '#7B7B7B' : '#F25022'}
|
|
50
|
+
/>
|
|
51
|
+
<rect
|
|
52
|
+
x="1"
|
|
53
|
+
y="11"
|
|
54
|
+
width="9"
|
|
55
|
+
height="9"
|
|
56
|
+
fill={color === 'disabled' ? '#7B7B7B' : '#00A4EF'}
|
|
57
|
+
/>
|
|
58
|
+
<rect
|
|
59
|
+
x="11"
|
|
60
|
+
y="1"
|
|
61
|
+
width="9"
|
|
62
|
+
height="9"
|
|
63
|
+
fill={color === 'disabled' ? '#939393' : '#7FBA00'}
|
|
64
|
+
/>
|
|
65
|
+
<rect
|
|
66
|
+
x="11"
|
|
67
|
+
y="11"
|
|
68
|
+
width="9"
|
|
69
|
+
height="9"
|
|
70
|
+
fill={color === 'disabled' ? '#B9B9B9' : '#FFB900'}
|
|
71
|
+
/>
|
|
72
|
+
</SvgIcon>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ConfigurationSchema } from '@jbrowse/core/configuration'
|
|
2
|
+
import { BaseInternetAccountConfig } from '@jbrowse/core/pluggableElementTypes'
|
|
3
|
+
import { Instance } from 'mobx-state-tree'
|
|
4
|
+
|
|
5
|
+
const ApolloConfigSchema = ConfigurationSchema(
|
|
6
|
+
'ApolloInternetAccount',
|
|
7
|
+
{
|
|
8
|
+
baseURL: {
|
|
9
|
+
description: 'Location of Apollo server',
|
|
10
|
+
type: 'string',
|
|
11
|
+
defaultValue: '',
|
|
12
|
+
},
|
|
13
|
+
tokenType: {
|
|
14
|
+
description: 'A custom name for a token to include in the header',
|
|
15
|
+
type: 'string',
|
|
16
|
+
defaultValue: 'Bearer',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
{ baseConfiguration: BaseInternetAccountConfig, explicitlyTyped: true },
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
export type ApolloInternetAccountConfigModel = typeof ApolloConfigSchema
|
|
23
|
+
|
|
24
|
+
export type ApolloInternetAccountConfig =
|
|
25
|
+
Instance<ApolloInternetAccountConfigModel>
|
|
26
|
+
export default ApolloConfigSchema
|