Skip to content

Commit

Permalink
fix: turned columnvisibility into a static object (#126)
Browse files Browse the repository at this point in the history
### Description

This PR introduces a fix to the issue reported on #123 that prevents
users from showing/hiding columns in the service mapping table on
`PagerDutyPage`.

**Issue number:** #123 

### Type of change

- [ ] New feature (non-breaking change which adds functionality)
- [x] Fix (non-breaking change which fixes an issue)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)

### Checklist

- [x] I have performed a self-review of this change
- [x] Changes have been tested
- [ ] Changes are documented
- [x] Changes generate *no new warnings*
- [x] PR title follows [conventional commit
semantics](https://www.conventionalcommits.org/en/v1.0.0/)

If this is a breaking change 👇

- [ ] I have documented the migration process
- [ ] I have implemented necessary warnings (if it can live side by
side)

## Acknowledgement

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.

**Disclaimer:** We value your time and bandwidth. As such, any pull
requests created on non-triaged issues might not be successful.
  • Loading branch information
t1agob authored Jul 25, 2024
2 parents d814afb + 282ef57 commit 04653bb
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/components/PagerDutyPage/MappingTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export const MappingTable = ({
const columns = useMemo<MRT_ColumnDef<PagerDutyEntityMapping>[]>(
() => [
{
id: "serviceId",
accessorKey: "serviceId",
header: "Service ID",
visibleInShowHideMenu: false,
Expand All @@ -109,34 +110,40 @@ export const MappingTable = ({
),
},
{
id: "integrationKey",
accessorKey: "integrationKey",
header: "Integration Key",
visibleInShowHideMenu: false,
enableEditing: false,
Edit: () => null,
},
{
id: "serviceName",
accessorKey: "serviceName",
header: "PagerDuty Service",
enableEditing: false,
},
{
id: "account",
accessorKey: "account",
header: "Account",
enableEditing: false,
Edit: () => null,
},
{
id: "team",
accessorKey: "team",
header: "Team",
enableEditing: false,
},
{
id: "escalationPolicy",
accessorKey: "escalationPolicy",
header: "Escalation Policy",
enableEditing: false,
},
{
id: "entityRef",
accessorKey: "entityRef",
header: "Mapping",
visibleInShowHideMenu: false,
Expand All @@ -151,12 +158,14 @@ export const MappingTable = ({
},
},
{
id: "entityName",
accessorKey: "entityName",
header: "Mapped Entity Name",
enableEditing: false,
Edit: () => null,
},
{
id: "status",
accessorKey: "status",
header: "Status",
enableEditing: false,
Expand All @@ -174,6 +183,7 @@ export const MappingTable = ({
),
},
{
id: "serviceUrl",
accessorKey: "serviceUrl",
header: "Service URL",
visibleInShowHideMenu: false,
Expand Down Expand Up @@ -297,6 +307,8 @@ export const MappingTable = ({
showAlertBanner:
mappings === undefined || catalogEntities === undefined,
showProgressBars: mappings.length === 0 || catalogEntities.length === 0,
},
initialState: {
columnVisibility: {
serviceId: false,
entityRef: false,
Expand Down

0 comments on commit 04653bb

Please sign in to comment.