Skip to content

Commit

Permalink
Stop displaying production users links on pkg view (#1959)
Browse files Browse the repository at this point in the history
Signed-off-by: Sergio Castaño Arteaga <[email protected]>
Signed-off-by: Cintia Sanchez Garcia <[email protected]>
Co-authored-by: Sergio Castaño Arteaga <[email protected]>
Co-authored-by: Cintia Sanchez Garcia <[email protected]>
  • Loading branch information
cynthia-sg and tegioz authored May 10, 2022
1 parent 50e20f9 commit 9bbc7b8
Show file tree
Hide file tree
Showing 20 changed files with 118 additions and 813 deletions.
17 changes: 3 additions & 14 deletions database/migrations/functions/packages/get_package.sql
Original file line number Diff line number Diff line change
Expand Up @@ -97,20 +97,9 @@ begin
'subscriptions', (select count(*) from subscription where package_id = v_package_id),
'webhooks', (select count(*) from webhook__package where package_id = v_package_id)
),
'production_organizations', (
select json_agg(json_build_object(
'name', o.name,
'display_name', o.display_name,
'home_url', o.home_url,
'logo_image_id', o.logo_image_id
))
from (
select o.name, o.display_name, o.home_url, o.logo_image_id
from production_usage pu
join organization o using (organization_id)
where pu.package_id = v_package_id
order by o.name asc
) o
'production_organizations_count', (
select count(*) from production_usage
where package_id = v_package_id
)
))
from package p
Expand Down
30 changes: 5 additions & 25 deletions database/tests/functions/packages/get_package.sql
Original file line number Diff line number Diff line change
Expand Up @@ -377,14 +377,7 @@ select is(
"subscriptions": 1,
"webhooks": 0
},
"production_organizations": [
{
"name": "org2",
"display_name": "Organization 2",
"home_url": "https://org2.com",
"logo_image_id": "00000000-0000-0000-0000-000000000003"
}
]
"production_organizations_count": 1
}'::jsonb,
'Last package1 version is returned as a json object'
);
Expand Down Expand Up @@ -530,14 +523,7 @@ select is(
"subscriptions": 1,
"webhooks": 0
},
"production_organizations": [
{
"name": "org2",
"display_name": "Organization 2",
"home_url": "https://org2.com",
"logo_image_id": "00000000-0000-0000-0000-000000000003"
}
]
"production_organizations_count": 1
}'::jsonb,
'Last package1 version is returned as a json object'
);
Expand Down Expand Up @@ -633,14 +619,7 @@ select is(
"subscriptions": 1,
"webhooks": 0
},
"production_organizations": [
{
"name": "org2",
"display_name": "Organization 2",
"home_url": "https://org2.com",
"logo_image_id": "00000000-0000-0000-0000-000000000003"
}
]
"production_organizations_count": 1
}'::jsonb,
'Requested package version is returned as a json object'
);
Expand Down Expand Up @@ -688,7 +667,8 @@ select is(
"stats": {
"subscriptions": 0,
"webhooks": 1
}
},
"production_organizations_count": 0
}'::jsonb,
'Last package2 version is returned as a json object'
);
Expand Down
4 changes: 2 additions & 2 deletions web/src/layout/common/ProductionBadge.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('VerifiedPublisherBadge', () => {

it('renders label', async () => {
render(<ProductionBadge productionOrganizationsCount={7} />);
expect(screen.getByText('In Production')).toBeInTheDocument();
expect(screen.getByText('Production users')).toBeInTheDocument();

const badge = screen.getByTestId('elementWithTooltip');
expect(badge).toBeInTheDocument();
Expand All @@ -28,7 +28,7 @@ describe('VerifiedPublisherBadge', () => {

it('renders label with tooltip msg in singular', async () => {
render(<ProductionBadge productionOrganizationsCount={1} />);
expect(screen.getByText('In Production')).toBeInTheDocument();
expect(screen.getByText('Production users')).toBeInTheDocument();

const badge = screen.getByTestId('elementWithTooltip');
expect(badge).toBeInTheDocument();
Expand Down
2 changes: 1 addition & 1 deletion web/src/layout/common/ProductionBadge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const ProductionBadge = (props: Props) => {
return (
<ElementWithTooltip
className={props.className}
element={<Label text="In Production" icon={<MdBusiness />} iconLegend={props.productionOrganizationsCount} />}
element={<Label text="Production users" icon={<MdBusiness />} iconLegend={props.productionOrganizationsCount} />}
tooltipMessage={`${props.productionOrganizationsCount} ${
props.productionOrganizationsCount === 1 ? 'organization is' : 'organizations are'
} using this package in production`}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 0 additions & 22 deletions web/src/layout/package/OrgsUsingPackage/Card.module.css

This file was deleted.

56 changes: 0 additions & 56 deletions web/src/layout/package/OrgsUsingPackage/Card.test.tsx

This file was deleted.

56 changes: 0 additions & 56 deletions web/src/layout/package/OrgsUsingPackage/Card.tsx

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 9bbc7b8

Please sign in to comment.