Skip to content

Commit

Permalink
Create Latest Release (#511)
Browse files Browse the repository at this point in the history
* First pass at new consumers table.

* Stub out filters.

* Finish base filter behavior.

* Finish basic POC of filters.

* Fix up consumers list page.

* Add proper id to search logic

* First pass at approval dialog

* First pass at laying out access request dialog.

* Add working forms.

* Fix possible empty object

* Proxy access requests.

* Add missing allowed query.

* Touch up some files.

* Wire up conditional select options.

* Wire up auth and controls.

* Bubble controls up to the top level.

* Finish forms and add data-testids

* First pass at new consumers table.

* Stub out filters.

* Finish base filter behavior.

* Finish basic POC of filters.

* Fix up consumers list page.

* Add proper id to search logic

* First pass at consumers unit tests.

* Fix type error.

* Unit tests for consumers index page functionality.

* Add mocks for access request

* Fix some tests, start grant access dialog

* Add tests for request details and controls

* Add more unit tests for access requests so consumers page tests can be lighter

* Dialog and controls tests.

* Add grant access dialog tests.

* Clean up consumers tests.

* First pass at detail page layout.

* Add restrictions.

* Handle restrictions

* UI layout tweaks and add edit form.

* First pass at editing controls.

* Finish first pass at refactor of consumers.

* Update tests.

* Finish IP restrictions test.

* Fix up tests.

* Add some coverage and fix broken tests.

* Add some edit dialog tests

* initial backend changes for getFilteredNamespaceConsumers

* add backend for getNamespaceConsumerAccess

* put back application owner in detail page

* upd backend support for getConsumerProdEnvAccess

* Update tests, organize MSW directory and add new consumers page query

* backend getConsumerProdEnvAccess query

* upd tests for backend

* upd backend ConsumerProdEnvAccess object

* Wire up auth, wire up UI for new API changes.

* upd services for consumer access detail

* Wire up edit dialog with new API.

* Fix type errors

* Fix some props access on the consumers detail page.

* Remove debugger

* upd backend updateConsumerAccess and saveConsumerLabels

* adj request details on consumer

* Update edit dialog and mock data.

* Add app owner.

* upd app owner for consumer detail and graphql whitelist

* upd whitelist for access review

* add allConsumerGroupLabels

* Add new manage labels dialog.

* tweak grant access dialog

* upd permissions and whitelist for saving labels

* Added Scenarios for Refresh Credentials, API Test and update existing client credential scenarios

* Wire up manage labels on consumers index page.

* Update grant access dialog

* add filter for consumer list

* add filter for consumer list

* add revokeAccessFromConsumer backend call

* for grant access scopes and roles are optional

* add revokeAccessFromConsumer backend call

* request details optional on edit dialog

* 1) Change config of oauth2 proxy and keycloak
2) Update cypress tests

* Refactor filters.

* filters structure for labels changed a bit

* Use names in filters instead of ids. Prevent duplicates

* wire up filtering for consumers

* wire up consumer scope and role backend for filter selection

* Wire up labels to the UI

* fix failing build

* add backend scope search logic

* Add loading state to filters.

* Add new add label group interface.

* new whitelist query for manage labels

* save labels remove blank label

* Update labels functionality, rework filters.

* add whitelist for consumer list query

* consumer read for api owner

* fix a ssr invalid query

* Cache fixes, proper naming in request dialog

* Add caching to filters, minor UI improvements.

* updates for consumer plugins

* fix edit consumer

* disable filtering

* handle services not linked to products

* inc whitelist for reject request

* fix plugin matching for consumer detail

* filter bug

* Fix the filters when no session storage.

* upd plugin service and route lisst

* add role update for consumer

* Add labels to access request

* Add test-ids

* resource tune for proto-generic-api and -mongodb

* wire up labels on access request

* remove dev,test,prod on push from ci-build-deploy

* Add revoke and hide application row if null

* fix for revoking access

* missing whitelist for revoke access

* 1)updated scenarios as per new Consumer UI
2)Added data-testid in filrwes.tsx page
3)Update keystone db schema as per new changes

* upd query types

* upd types

* remove svc accts from consumer list and fix plugin error

* stop using service access id in consumer list

* fix consumer product edit dialog

* improve plugin update comparison

* upd plugins when grant new product to consumer

* remove from whitelist the deleteGatewayConsumer

* delete consumer upds

* fix my access and access lists

* dedup list of scopes

* Add some custom error messages

* Remove bcsc user menu option

* Use unified error in toasts

* Access request button tweaks.

* fix 427 api key not getting deleted

* resolve 443 creds for jwt key pair

* fix org dataset operations

* Standardize toasts to all be closable with only a startcase capitalized

* add test branch back in to ci-build-deploy

* fix revoke access whitelist

* Comment out flaky verification step

* fix ci-build-deploy indent

* Fix yaml formatting

* add in resources

* run as production when starting keystone

* fix allProductsByNamespace showing too much

* fix unable to load form for access request

* fix gateway services showing too many services

* Added Test to verify directory details for the namespace that has no directory

* Added test to verify namespace having no directory

* improve log security

* fix wrong role for identity provider

* fix ds api error response dataset

* fix business profile not displaying

* remove old pages for requests

* Update expected status code when call the API with non exist directory ID

* Revisions for UX

* Switch to providerUsername

* upd provider username in queries

Co-authored-by: Joshua Jones <[email protected]>
Co-authored-by: ikethecoder <[email protected]>
Co-authored-by: Niraj Patel <[email protected]>
Co-authored-by: nirajCITZ <[email protected]>
Co-authored-by: Justin Tendeck <[email protected]>
Co-authored-by: ikethecoder <[email protected]>
Co-authored-by: jTendeck <[email protected]>
  • Loading branch information
8 people authored Aug 18, 2022
1 parent 3ae1d2b commit ed0b532
Show file tree
Hide file tree
Showing 27 changed files with 278 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
mode
owner {
name
username
providerUsername
email
}
environmentDetails
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
id
userId
name
username
providerUsername
email
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
id
userId
name
username
providerUsername
email
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
owner {
id
name
username
providerUsername
email
}
environments {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
owner {
id
name
username
providerUsername
email
}
environments {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@

query GetConsumer($consumerId: ID!) {
allConsumerGroupLabels

getNamespaceConsumerAccess(consumerId: $consumerId) {
consumer {
id
username
}
application {
name
}
owner {
name
providerUsername
email
}
labels {
labelGroup
values
}
prodEnvAccess {
productName
environment {
flow
name
id
additionalDetailsToRequest
}
plugins {
name
}
revocable
serviceAccessId
authorization {
defaultClientScopes
}
request {
name
isIssued
isApproved
isComplete
additionalDetails
}
requestApprover {
name
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

query GetAccessRequests {
allAccessRequestsByNamespace(where: { isComplete_not: true }) {
id
name
additionalDetails
communication
createdAt
requestor {
name
providerUsername
email
}
application {
name
}
productEnvironment {
id
name
additionalDetailsToRequest
product {
name
}
}
serviceAccess {
consumer {
id
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

query GetCredentialIssuers {
allCredentialIssuersByNamespace {
id
name
flow
mode
owner {
name
username
email
}
environmentDetails
availableScopes
clientAuthenticator
clientRoles
clientMappers
apiKeyName
resourceType
resourceScopes
resourceAccessScope
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
mode
owner {
name
username
providerUsername
}
environments {
name
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

query GetConsumers($filter: ConsumerQueryFilterInput) {
allConsumerGroupLabels
getFilteredNamespaceConsumers(filter: $filter) {
id
consumerType
username
labels {
labelGroup
values
}
lastUpdated
}

allAccessRequestsByNamespace(where: { isComplete_not: true }) {
id
name
additionalDetails
communication
createdAt
requestor {
name
providerUsername
email
}
application {
name
}
productEnvironment {
name
additionalDetailsToRequest
}
}
}
10 changes: 5 additions & 5 deletions src/mocks/resolvers/consumers.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const harleyAccessRequest = {
requestor: {
id: 'u1',
name: 'Harley Jones',
username: 'harley123',
providerUsername: 'harley123',
email: '[email protected]',
},
application: {
Expand Down Expand Up @@ -219,20 +219,20 @@ export const getConsumersHandler = (req, res, ctx) => {
};

export const getConsumerHandler = (req, res, ctx) => {
const { serviceAccessId } = req.variables;
const { consumerId } = req.variables;
const consumer = store.data.getFilteredNamespaceConsumers.find(
(d) => d.id === serviceAccessId
(d) => d.id === consumerId
);
const owner = {
name: harleyAccessRequest.requestor.name,
username: 'harley123',
providerUsername: 'harley123',
email: '[email protected]',
};
return res(
ctx.data({
getNamespaceConsumerAccess: {
application:
serviceAccessId === 'd1'
consumerId === 'd1'
? null
: {
id: 'a1',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ interface AccessRequestDialogProps {
name: string;
preview: boolean;
open?: boolean;
variant?: 'inline' | 'button';
}

const AccessRequestDialog: React.FC<AccessRequestDialogProps> = ({
Expand All @@ -46,6 +47,7 @@ const AccessRequestDialog: React.FC<AccessRequestDialogProps> = ({
name,
preview,
open,
variant = 'button',
}) => {
const client = useQueryClient();
const auth = useAuth();
Expand All @@ -65,6 +67,15 @@ const AccessRequestDialog: React.FC<AccessRequestDialogProps> = ({
? 'Request Access & Continue'
: 'Request Access';
const [accessRequestId, setAccessRequestId] = React.useState<string>('');
const isInline = variant === 'inline';
const buttonProps = !isInline
? {}
: {
fontWeight: 'normal',
fontSize: 'inherit',
color: 'bc-link',
textDecor: 'underline',
};

// Events
const handleAccessSubmit = React.useCallback(
Expand Down Expand Up @@ -148,11 +159,13 @@ const AccessRequestDialog: React.FC<AccessRequestDialogProps> = ({
<>
{auth.user && (
<Button
colorScheme="green"
disabled={disabled}
variant="solid"
onClick={onOpen}
data-testid="request-access-button"
variant={isInline ? 'link' : 'primary'}
fontWeight="600"
color="white"
{...buttonProps}
>
Request Access
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ const AccessRequestForm: React.FC<AccessRequestFormProps> = ({
<input
type="hidden"
name="name"
value={`${dataset.name} FOR ${requestor.name ?? requestor.username}`}
value={`${dataset.name} FOR ${
requestor.name ?? requestor.providerUsername
}`}
/>
<input
type="hidden"
Expand Down Expand Up @@ -246,7 +248,7 @@ const query = gql`
id
userId
name
username
providerUsername
email
}
}
Expand Down
11 changes: 4 additions & 7 deletions src/nextapp/components/access-request/access-request-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
TabList,
Tab,
useToast,
Flex,
} from '@chakra-ui/react';
import { AccessRequest, Query } from '@/shared/types/query.types';

Expand Down Expand Up @@ -68,7 +67,7 @@ const AccessRequestDialog: React.FC<AccessRequestDialogProps> = ({
}));
return { prevAccessRequests };
},
onError: (err: Error, context) => {
onError: (_: Error, context: { prevAccessRequests: unknown }) => {
client.setQueryData(accessRequestsQueryKey, context.prevAccessRequests);
},
onSettled: () => {
Expand Down Expand Up @@ -211,16 +210,14 @@ const AccessRequestDialog: React.FC<AccessRequestDialogProps> = ({
<ModalFooter>
<ButtonGroup>
<Button
variant="solid"
colorScheme="green"
variant="success"
onClick={handleAccept}
data-testid="ar-approve-btn"
>
Accept
Approve
</Button>
<Button
variant="solid"
colorScheme="red"
variant="danger"
onClick={handleReject}
data-testid="ar-reject-btn"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ const query = gql`
createdAt
requestor {
name
providerUsername
email
}
application {
name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ const ApiProductItem: React.FC<ApiProductItemProps> = ({
id={id}
name={data.name}
preview={preview}
variant="inline"
/>
</Text>
</GridItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ const BusinessProfileContent: React.FC<BusinessProfileContentProps> = ({
Business Profile:
</Heading>
{!data.institution && (
<Text color="bc-component">A business profile has not been added</Text>
<Text color="bc-component" fontStyle="italic" opacity={0.6}>
A business profile has not been added
</Text>
)}
{data.institution && (
<Flex>
Expand Down Expand Up @@ -82,7 +84,7 @@ const BusinessProfileContent: React.FC<BusinessProfileContentProps> = ({
)}
{!isLoading && (
<>
<Text lineHeight="1" data-testid={`${testId}-name`}>
<Text lineHeight="5" data-testid={`${testId}-name`}>
{legalName}
{data.institution?.isSuspended && (
<Text as="em" ml={2} color="bc-divider">
Expand Down
Loading

0 comments on commit ed0b532

Please sign in to comment.