Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added IntegrationProvider, IntegrationToken tables, GitLab auth, migrated Mattermost to the new data format #5805

Closed
wants to merge 44 commits into from
Closed
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
0dc385e
initial commit, framing in mattermost
jordanh Oct 16, 2021
99e4b43
feature complete
jordanh Oct 16, 2021
f91cffb
self-review fixups
jordanh Oct 20, 2021
e8ba78c
review changes
jordanh Oct 26, 2021
fb0bfd5
remove autofocus
jordanh Oct 26, 2021
e575a8b
Majority of Maintainer review fixups
jordanh Nov 2, 2021
40f8fec
refactor: add userId to MattermostAuth
jordanh Nov 2, 2021
49b363c
better scheduled jobs types
mattkrick Nov 5, 2021
1577aa6
address @mattkrick 2nd review comments
jordanh Nov 9, 2021
298dc22
Refactor Mattermost, add GitLab w/new auth scheme
jordanh Oct 16, 2021
9352749
remove notifyMattermost okResponse
jordanh Nov 12, 2021
b9a6fe5
refactor/rename field names
jordanh Nov 12, 2021
450baf3
self-review fixups
jordanh Nov 12, 2021
64c5db9
Merge branch master into add-mattermost
mattkrick Nov 16, 2021
a75833f
Merge branch 'master' into add-mattermost
jordanh Dec 3, 2021
adc7cef
maintainer review round 3 fixups
jordanh Dec 3, 2021
89f97d6
Webpack updates for server image assets
jordanh Dec 6, 2021
841afb8
fixed small nits
jordanh Dec 6, 2021
cedec5f
Merge branch 'add-mattermost' into add-gitlab-auth
jordanh Dec 6, 2021
e47d6ba
Merge branch 'master' into add-gitlab-auth
BartoszJarocki Dec 13, 2021
55a8ba1
fix: removed not needed mattermost queries
BartoszJarocki Dec 13, 2021
5fbfeae
fix: removed not needed mattermost queries
BartoszJarocki Dec 13, 2021
627a11c
fix: added integration auth loaders to CustomLoaderMakers
BartoszJarocki Dec 13, 2021
74bad44
fix: mattermost provider row missing variables
BartoszJarocki Dec 13, 2021
94ff90a
fix: various merge fixes, type improvements
BartoszJarocki Dec 13, 2021
59eaa56
fix: mattermost panel component types
BartoszJarocki Dec 13, 2021
4e05e68
refactor: lowercase integration provider enums, various fixes
BartoszJarocki Dec 14, 2021
94479be
Re-added mattermost webhook validation
jordanh Dec 15, 2021
130c02c
Merge branch 'master' into add-gitlab-auth
BartoszJarocki Dec 20, 2021
b889222
feat: changed integration providers schema
BartoszJarocki Dec 17, 2021
bf4784a
feat: extracted oauth2 helper method
BartoszJarocki Dec 19, 2021
dba28c7
feat: aligned makeGlobalIntegrationProvidersFromEnv to use new data s…
BartoszJarocki Dec 20, 2021
52f7b08
feat: added new gql types, adjusted mattermost and gitlab client inte…
BartoszJarocki Dec 20, 2021
652eedb
fix: is provider active check, code cleanup
BartoszJarocki Dec 20, 2021
aabad17
feat: aligned integration provider input types
BartoszJarocki Dec 20, 2021
d0bfea6
fix: gitlab auth
BartoszJarocki Dec 20, 2021
427290e
feat: better checks if integration provider can have tokens
BartoszJarocki Dec 20, 2021
6cd9eb6
code cleanup
BartoszJarocki Dec 20, 2021
18f2714
refactor: code cleanup, more comments
BartoszJarocki Dec 21, 2021
e26e7bd
code cleanup
BartoszJarocki Dec 21, 2021
7f99e88
fix: mattermost to integration token migration
BartoszJarocki Dec 21, 2021
c0813b7
fix: mattermost to integration providers table migration
BartoszJarocki Dec 22, 2021
d27b81c
refactor: integration providers columns rename: 'type' is now 'provid…
BartoszJarocki Dec 22, 2021
ce69790
fix: removed not needed noFallthroughCasesInSwitch from tsconfig
BartoszJarocki Dec 22, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions codegen.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
{
"schema": "packages/server/utils/githubSchema.graphql",
"documents": "packages/server/utils/githubQueries/*.graphql",
"config": {
"content": "// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck"
},
"generates": {
"packages/server/types/githubTypes.ts": {
"plugins": [
"typescript",
"typescript-operations",
"add"
],
"config": {
"content": "// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck"
}
"schema": "packages/server/utils/githubSchema.graphql",
"documents": "packages/server/utils/githubQueries/*.graphql",
"plugins": ["typescript", "typescript-operations", "add"]
},
"packages/server/types/gitlabTypes.ts": {
"schema": "packages/server/graphql/nestedSchema/GitLab/gitlabSchema.graphql",
"documents": "packages/server/graphql/nestedSchema/GitLab/queries/*.graphql",
"plugins": ["typescript", "typescript-operations", "add"]
}
}
}
10 changes: 10 additions & 0 deletions packages/client/components/GitLabProviderLogo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import styled from '@emotion/styled'
import logo from '../styles/theme/images/graphics/gitlab-icon-rgb.svg'

const GitLabProviderLogo = styled('div')({
background: `url("${logo}")`,
height: 48,
width: 48
})

export default GitLabProviderLogo
39 changes: 39 additions & 0 deletions packages/client/components/GitLabSVG.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React from 'react'

const GitLabSVG = React.memo(() => {
return (
<svg
version='1.1'
width='24'
height='24'
viewBox='0 0 24 24'
xmlns='http://www.w3.org/2000/svg'
>
<g transform='matrix(1.3333 0 0 -1.3333 0 745.33)'>
<g transform='matrix(.0053314 0 0 .0053314 -6.6229 535.81)'>
<path d='m2930.3 1240.2 621.99 1913.2h-1243.1l621.08-1913.2' fill='#e33426' />
<path
d='m1438 3153.4-189.42-581.26c-17.13-52.78 1.37-111.04 46.61-143.94l1635.1-1188-1492.3 1913.2'
fill='#f79818'
/>
<path
d='m1438 3153.4h871.2l-374.94 1152.2c-19.19 58.95-102.82 58.95-122.7 0l-373.56-1152.2'
fill='#e33426'
/>
<path
d='m4423.5 3153.4 188.72-581.26c17.14-52.78-1.37-111.04-46.61-143.94l-1635.3-1188 1493.2 1913.2'
fill='#f79818'
/>
<path
d='m4423.5 3153.4h-871.21l374.25 1152.2c19.2 58.95 102.82 58.95 122.7 0l374.26-1152.2'
fill='#e33426'
/>
<path d='m2930.3 1240.2 621.99 1913.2h871.21z' fill='#f25923' />
<path d='m2930.3 1240.2-1492.3 1913.2h871.2z' fill='#f25923' />
</g>
</g>
</svg>
)
})

export default GitLabSVG
21 changes: 15 additions & 6 deletions packages/client/hooks/useMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,15 @@ const useMenu = <T extends HTMLElement = HTMLButtonElement>(
if (originCoords) {
;(originRef as any).current = {getBoundingClientRect: () => originCoords} as RectElement
}
const {portal, closePortal, togglePortal, portalStatus, setPortalStatus, openPortal} = usePortal({
const {
portal,
closePortal,
openPortal,
portalStatus,
terminatePortal,
togglePortal,
setPortalStatus
} = usePortal({
id,
onOpen,
onClose,
Expand All @@ -60,14 +68,15 @@ const useMenu = <T extends HTMLElement = HTMLButtonElement>(
)
const menuProps = {portalStatus, closePortal, isDropdown}
return {
togglePortal,
originRef,
menuPortal,
menuProps,
loadingDelay,
loadingWidth,
menuPortal,
menuProps,
openPortal,
originRef,
portalStatus,
openPortal
terminatePortal,
togglePortal
}
}

Expand Down
3 changes: 2 additions & 1 deletion packages/client/modules/demo/DemoUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ export default class DemoUser {
createdAt = new Date().toJSON()
email: string
featureFlags = {
jira: false
gitlab: false,
video: false
mattkrick marked this conversation as resolved.
Show resolved Hide resolved
}
facilitatorUserId: string
facilitatorName: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import graphql from 'babel-plugin-relay/macro'
import SettingsWrapper from '../../../../components/Settings/SettingsWrapper'
import AtlassianProviderRow from '../ProviderRow/AtlassianProviderRow'
import GitHubProviderRow from '../ProviderRow/GitHubProviderRow'
import GitLabProviderRow from '../ProviderRow/GitLabProviderRow'
import MattermostProviderRow from '../ProviderRow/MattermostProviderRow'
import SlackProviderRow from '../ProviderRow/SlackProviderRow'

Expand All @@ -21,10 +22,14 @@ const StyledWrapper = styled(SettingsWrapper)({

const ProviderList = (props: Props) => {
const {viewer, retry, teamId} = props
const {
featureFlags: {gitlab: allowGitlab}
} = viewer
return (
<StyledWrapper>
<AtlassianProviderRow teamId={teamId} retry={retry} viewer={viewer} />
<GitHubProviderRow teamId={teamId} viewer={viewer} />
{allowGitlab && <GitLabProviderRow teamId={teamId} viewerRef={viewer} />}
<MattermostProviderRow teamId={teamId} viewerRef={viewer} />
<SlackProviderRow teamId={teamId} viewer={viewer} />
</StyledWrapper>
Expand All @@ -36,8 +41,13 @@ export default createFragmentContainer(ProviderList, {
fragment ProviderList_viewer on User {
...AtlassianProviderRow_viewer
...GitHubProviderRow_viewer
...GitLabProviderRow_viewer
...MattermostProviderRow_viewer
...SlackProviderRow_viewer

featureFlags {
gitlab
}
}
`
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React from 'react'
import useAtmosphere from '../../../../hooks/useAtmosphere'
import {MenuProps} from '../../../../hooks/useMenu'
import {MenuMutationProps} from '../../../../hooks/useMutationProps'
import RemoveIntegrationTokenMutation from '../../../../mutations/RemoveIntegrationTokenMutation'
import Menu from '../../../../components/Menu'
import MenuItem from '../../../../components/MenuItem'

interface Props {
menuProps: MenuProps
mutationProps: MenuMutationProps
providerId: string
teamId: string
terminatePortal: () => void
}

const GitLabConfigMenu = (props: Props) => {
const {menuProps, mutationProps, providerId, teamId, terminatePortal} = props
const {onError, onCompleted, submitMutation, submitting} = mutationProps
const atmosphere = useAtmosphere()

const removeGitLabAuth = () => {
if (submitting) return
submitMutation()
RemoveIntegrationTokenMutation(atmosphere, {providerId, teamId}, {onCompleted, onError})
// Our parent component does not unmount, and it often re-renders before the CSS menu transition
// can complete. We nuke the portal here to ensure the menu is closed.
terminatePortal()
mattkrick marked this conversation as resolved.
Show resolved Hide resolved
}
return (
<Menu ariaLabel={'Configure your GitLab integration'} {...menuProps}>
<MenuItem label='Remove GitLab' onClick={removeGitLabAuth} />
</Menu>
)
}

export default GitLabConfigMenu
Loading