Skip to content

Commit

Permalink
Update GoToOpenPullReqesut button to be button Group to include the M…
Browse files Browse the repository at this point in the history
…ulti Repos (#2566)

* init groupbutton

* add gitrepos btn group

* remove unused code

* remove uneeded import

* enhance btn text

* omit protocol so that all links can be open

* refactor typo

* add open pull request btn to add app view

* make sure btn are disabled while there is no options

* update  gitrepos to be sent to the component

* wip

* add a little hook

* fix issue were URIJS getting wrong domain value

* update bitbucket provider condition

* add handle for case azure ssh devops

* strip out port from url

* Rollback changes to getInitialGitRepo, don't consider managementClusterName

* update test and add icon to pull request btn

* remove unused improts

* update failing test case

* update failing test case

---------

Co-authored-by: Simon Howe <[email protected]>
  • Loading branch information
ahussein3 and foot authored Apr 6, 2023
1 parent dc71746 commit f84d5b2
Show file tree
Hide file tree
Showing 10 changed files with 274 additions and 131 deletions.
2 changes: 2 additions & 0 deletions ui-cra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@types/react-router-dom": "^5.1.7",
"@types/react-syntax-highlighter": "^13.5.2",
"@types/styled-components": "^5.1.9",
"@types/urijs": "^1.19.19",
"@weaveworks/progressive-delivery": "0.0.0-rc13",
"@weaveworks/weave-gitops": "npm:@weaveworks/[email protected]",
"@weaveworks/weave-gitops-main": "0.20.0-12-gccf5178b",
Expand Down Expand Up @@ -53,6 +54,7 @@
"remark-gfm": "^3.0.1",
"styled-components": "^5.3.0",
"typescript": "^4.1.2",
"urijs": "^1.19.11",
"web-vitals": "^1.0.1",
"yaml": "^2.2.1"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,31 +374,9 @@ exports[`Applications index test snapshots loading 1`] = `
ADD AN APPLICATION
</span>
</button>
<button
class="MuiButtonBase-root MuiButton-root MuiButton-outlined c12 MuiButton-outlinedPrimary MuiButton-disableElevation"
tabindex="0"
type="button"
>
<span
class="MuiButton-label"
>
<div
class="c8 c13 makeStyles-externalIcon-17"
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"
/>
</svg>
</div>
GO TO OPEN PULL REQUESTS
</span>
</button>
<div>
Loading...
</div>
</div>
</div>
<div
Expand Down Expand Up @@ -1160,11 +1138,11 @@ exports[`Applications index test snapshots success 1`] = `
class="c3 c4 test-id-breadcrumbs"
>
<div
class="makeStyles-path-34"
class="makeStyles-path-35"
style="align-items: center;"
>
<span
class="c5 makeStyles-labelLink-38"
class="c5 makeStyles-labelLink-39"
title="Applications"
>
Applications
Expand Down Expand Up @@ -1251,34 +1229,9 @@ exports[`Applications index test snapshots success 1`] = `
class="MuiTouchRipple-root"
/>
</button>
<button
class="MuiButtonBase-root MuiButton-root MuiButton-outlined c12 MuiButton-outlinedPrimary MuiButton-disableElevation"
tabindex="0"
type="button"
>
<span
class="MuiButton-label"
>
<div
class="c8 c13 makeStyles-externalIcon-33"
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"
/>
</svg>
</div>
GO TO OPEN PULL REQUESTS
</span>
<span
class="MuiTouchRipple-root"
/>
</button>
<div>
Git Repos not found
</div>
</div>
</div>
<div
Expand Down Expand Up @@ -1536,14 +1489,14 @@ exports[`Applications index test snapshots success 1`] = `
>
<span
aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-45 MuiCheckbox-root MuiCheckbox-colorPrimary PrivateSwitchBase-checked-46 Mui-checked MuiIconButton-colorPrimary"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-48 MuiCheckbox-root MuiCheckbox-colorPrimary PrivateSwitchBase-checked-49 Mui-checked MuiIconButton-colorPrimary"
>
<span
class="MuiIconButton-label"
>
<input
checked=""
class="PrivateSwitchBase-input-48"
class="PrivateSwitchBase-input-51"
data-indeterminate="false"
type="checkbox"
value=""
Expand Down Expand Up @@ -1990,14 +1943,14 @@ exports[`Applications index test snapshots success 1`] = `
>
<span
aria-disabled="true"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-45 MuiCheckbox-root MuiCheckbox-colorSecondary PrivateSwitchBase-disabled-47 Mui-disabled MuiIconButton-colorSecondary Mui-disabled Mui-disabled"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-48 MuiCheckbox-root MuiCheckbox-colorSecondary PrivateSwitchBase-disabled-50 Mui-disabled MuiIconButton-colorSecondary Mui-disabled Mui-disabled"
tabindex="-1"
>
<span
class="MuiIconButton-label"
>
<input
class="PrivateSwitchBase-input-48"
class="PrivateSwitchBase-input-51"
data-indeterminate="false"
disabled=""
id="clusterName"
Expand Down Expand Up @@ -2040,14 +1993,14 @@ exports[`Applications index test snapshots success 1`] = `
>
<span
aria-disabled="true"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-45 MuiCheckbox-root MuiCheckbox-colorSecondary PrivateSwitchBase-disabled-47 Mui-disabled MuiIconButton-colorSecondary Mui-disabled Mui-disabled"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-48 MuiCheckbox-root MuiCheckbox-colorSecondary PrivateSwitchBase-disabled-50 Mui-disabled MuiIconButton-colorSecondary Mui-disabled Mui-disabled"
tabindex="-1"
>
<span
class="MuiIconButton-label"
>
<input
class="PrivateSwitchBase-input-48"
class="PrivateSwitchBase-input-51"
data-indeterminate="false"
disabled=""
id="namespace"
Expand Down Expand Up @@ -2090,14 +2043,14 @@ exports[`Applications index test snapshots success 1`] = `
>
<span
aria-disabled="true"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-45 MuiCheckbox-root MuiCheckbox-colorSecondary PrivateSwitchBase-disabled-47 Mui-disabled MuiIconButton-colorSecondary Mui-disabled Mui-disabled"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-48 MuiCheckbox-root MuiCheckbox-colorSecondary PrivateSwitchBase-disabled-50 Mui-disabled MuiIconButton-colorSecondary Mui-disabled Mui-disabled"
tabindex="-1"
>
<span
class="MuiIconButton-label"
>
<input
class="PrivateSwitchBase-input-48"
class="PrivateSwitchBase-input-51"
data-indeterminate="false"
disabled=""
id="status"
Expand Down Expand Up @@ -2140,14 +2093,14 @@ exports[`Applications index test snapshots success 1`] = `
>
<span
aria-disabled="true"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-45 MuiCheckbox-root MuiCheckbox-colorSecondary PrivateSwitchBase-disabled-47 Mui-disabled MuiIconButton-colorSecondary Mui-disabled Mui-disabled"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-48 MuiCheckbox-root MuiCheckbox-colorSecondary PrivateSwitchBase-disabled-50 Mui-disabled MuiIconButton-colorSecondary Mui-disabled Mui-disabled"
tabindex="-1"
>
<span
class="MuiIconButton-label"
>
<input
class="PrivateSwitchBase-input-48"
class="PrivateSwitchBase-input-51"
data-indeterminate="false"
disabled=""
id="tenant"
Expand Down Expand Up @@ -2190,14 +2143,14 @@ exports[`Applications index test snapshots success 1`] = `
>
<span
aria-disabled="true"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-45 MuiCheckbox-root MuiCheckbox-colorSecondary PrivateSwitchBase-disabled-47 Mui-disabled MuiIconButton-colorSecondary Mui-disabled Mui-disabled"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-48 MuiCheckbox-root MuiCheckbox-colorSecondary PrivateSwitchBase-disabled-50 Mui-disabled MuiIconButton-colorSecondary Mui-disabled Mui-disabled"
tabindex="-1"
>
<span
class="MuiIconButton-label"
>
<input
class="PrivateSwitchBase-input-48"
class="PrivateSwitchBase-input-51"
data-indeterminate="false"
disabled=""
id="type"
Expand Down
25 changes: 2 additions & 23 deletions ui-cra/src/components/Applications/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@ import {
IconType,
LoadingPage,
useListAutomations,
theme,
Flex,
} from '@weaveworks/weave-gitops';
import styled from 'styled-components';
import { useHistory } from 'react-router-dom';
import { makeStyles, createStyles } from '@material-ui/core';
import { openLinkHandler } from '../../utils/link-checker';
import { Routes } from '../../utils/nav';
import { useListConfigContext } from '../../contexts/ListConfig';
import OpenedPullRequest from '../Clusters/OpenedPullRequest';

interface Size {
size?: 'small';
Expand All @@ -27,20 +24,9 @@ const ActionsWrapper = styled(Flex)<Size>`
}
`;

const useStyles = makeStyles(() =>
createStyles({
externalIcon: {
marginRight: theme.spacing.small,
},
}),
);

const WGApplicationsDashboard: FC = () => {
const { data: automations, isLoading } = useListAutomations();
const history = useHistory();
const listConfigContext = useListConfigContext();
const repoLink = listConfigContext?.repoLink || '';
const classes = useStyles();

const handleAddApplication = () => history.push(Routes.AddApplication);

Expand Down Expand Up @@ -70,14 +56,7 @@ const WGApplicationsDashboard: FC = () => {
>
ADD AN APPLICATION
</Button>
<Button onClick={openLinkHandler(repoLink)}>
<Icon
className={classes.externalIcon}
type={IconType.ExternalTab}
size="base"
/>
GO TO OPEN PULL REQUESTS
</Button>
<OpenedPullRequest />
</ActionsWrapper>
</div>
{isLoading ? (
Expand Down
Loading

0 comments on commit f84d5b2

Please sign in to comment.