-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Arc 2777 reactify GHE backfill pg (#2620)
* chore: make spa wrapper width variable * chore: rectify colum names * chore: work to delete ghe server * chore: update test cases * chore: add test cases * fix: build error * chore: add test cases * chore: add test cases * chore: add config option for GHR server app * chore: refactor code * chore: pr review comments * chore: update code as per PR comments * chore: update code as per PR comments * Enforce security check on GHES app (#2624) --------- Co-authored-by: Gary Xue <[email protected]>
- Loading branch information
1 parent
26ebf9c
commit 3bb9839
Showing
24 changed files
with
1,262 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
spa/src/pages/Connections/GHEnterpriseConnections/GHEnterpriseAppHeader.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/** @jsxImportSource @emotion/react */ | ||
import DropdownMenu, { | ||
DropdownItem, | ||
DropdownItemGroup, | ||
} from "@atlaskit/dropdown-menu"; | ||
import Button from "@atlaskit/button"; | ||
import { Flex, xcss } from "@atlaskit/primitives"; | ||
import MoreIcon from "@atlaskit/icon/glyph/more"; | ||
import Heading from "@atlaskit/heading"; | ||
import ChevronRightIcon from "@atlaskit/icon/glyph/chevron-right"; | ||
import ChevronDownIcon from "@atlaskit/icon/glyph/chevron-down"; | ||
import { | ||
BackfillPageModalTypes, | ||
GitHubEnterpriseApplication, | ||
SuccessfulConnection, | ||
} from "../../../rest-interfaces"; | ||
import { css } from "@emotion/react"; | ||
|
||
const applicationHeaderStyle = css` | ||
cursor: pointer; | ||
display: flex; | ||
align-items: center; | ||
justify-content: flex-start; | ||
width: 100%; | ||
`; | ||
|
||
const appHeaderContainerStyle = xcss({ | ||
width: "100%", | ||
justifyContent: "space-between", | ||
marginBottom: "20px", | ||
}); | ||
|
||
type GitHubEnterpriseApplicationProps = { | ||
application: GitHubEnterpriseApplication; | ||
setDataForModal: (dataForModal: SuccessfulConnection | GitHubEnterpriseApplication) => void; | ||
setSelectedModal: (selectedModal: BackfillPageModalTypes) => void; | ||
setIsModalOpened: (isModalOpen: boolean) => void; | ||
showAppContent: boolean; | ||
toggleShowAppContent: () => void; | ||
}; | ||
|
||
const GHEnterpriseAppHeader = ({ | ||
application, | ||
setIsModalOpened, | ||
setDataForModal, | ||
setSelectedModal, | ||
showAppContent, | ||
toggleShowAppContent | ||
}: GitHubEnterpriseApplicationProps) => { | ||
|
||
const onEditGitHubApp = () =>{ | ||
const uuid = application.uuid; | ||
AP.navigator.go( | ||
"addonmodule", | ||
{ | ||
moduleKey: "github-edit-app-page", | ||
customData: { uuid } | ||
} | ||
); | ||
}; | ||
return ( | ||
<Flex xcss={appHeaderContainerStyle}> | ||
<div | ||
css={applicationHeaderStyle} | ||
onClick={() => { | ||
toggleShowAppContent(); | ||
}} | ||
> | ||
{showAppContent ? ( | ||
<ChevronDownIcon label="" /> | ||
) : ( | ||
<ChevronRightIcon label="" /> | ||
)} | ||
<Heading level="h400">{application.gitHubAppName}</Heading> | ||
</div> | ||
<div> | ||
<DropdownMenu | ||
trigger={({ triggerRef, ...props }) => ( | ||
<Button | ||
{...props} | ||
appearance="subtle" | ||
iconBefore={<MoreIcon label="more" size="small" />} | ||
ref={triggerRef} | ||
/> | ||
)} | ||
> | ||
<DropdownItemGroup> | ||
<DropdownItem onClick={onEditGitHubApp}>Edit</DropdownItem> | ||
<DropdownItem onClick={()=>{ | ||
setIsModalOpened(true); | ||
setDataForModal(application); | ||
setSelectedModal("DISCONNECT_SERVER_APP"); | ||
}}>Disconnect</DropdownItem> | ||
</DropdownItemGroup> | ||
</DropdownMenu> | ||
</div> | ||
</Flex> | ||
); | ||
}; | ||
|
||
export default GHEnterpriseAppHeader; |
Oops, something went wrong.