Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(adminPanel): RN-1301: Enable column resizing #5663

Merged
merged 10 commits into from
May 27, 2024
1 change: 0 additions & 1 deletion packages/admin-panel/src/common.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ export const DATA_ELEMENT_FIELDS = [
{
Header: 'Permission Groups',
source: 'permission_groups',
type: 'tooltip',
editConfig: {
optionsEndpoint: 'permissionGroups',
optionLabelKey: 'name',
Expand Down
1 change: 0 additions & 1 deletion packages/admin-panel/src/routes/entities/entities.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export const FIELDS = {
name: {
Header: 'Name',
source: 'name',
type: 'tooltip',
},
type: {
Header: 'Type',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const FIELDS = [
{
Header: 'Code',
source: 'code',
type: 'tooltip',
},
{
Header: 'Name',
Expand Down Expand Up @@ -54,7 +53,8 @@ const COLUMNS = [
{
Header: 'Test',
type: 'testDatabaseConnection',
colWidth: '6.5rem',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this not working previously? Or preferring to switch to static width because it's related to expected character lengths of this field?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the columns are resizable, we rely now on react-table to give use the width, and they only support px values, not strings (e.g rems) so have changed to a width and a pixel value instead

width: 90,
disableResizing: true,
},
{
Header: 'Delete',
Expand Down
2 changes: 0 additions & 2 deletions packages/admin-panel/src/routes/projects/projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ const DEFAULT_FIELDS = [
{
Header: 'Description',
source: 'description',
type: 'tooltip',
},
{
Header: 'Dashboard',
source: 'dashboard_group_name',
type: 'tooltip',
editConfig: {
optionsEndpoint: 'dashboards',
optionLabelKey: 'name',
Expand Down
5 changes: 0 additions & 5 deletions packages/admin-panel/src/routes/surveys/questions.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,25 @@ const QUESTION_FIELDS = [
{
Header: 'Name',
source: 'name',
type: 'tooltip',
},
{
Header: 'Question',
source: 'text',
type: 'tooltip',
},
{
Header: 'Legacy options',
source: 'options',
type: 'tooltip',
editConfig: {
type: 'jsonArray',
},
},
{
Header: 'Detail',
source: 'detail',
type: 'tooltip',
},
{
Header: 'Hook',
source: 'hook',
type: 'tooltip',
},
{
Header: 'Option set ID',
Expand Down
7 changes: 0 additions & 7 deletions packages/admin-panel/src/routes/surveys/surveyResponses.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@ const surveyName = {
Header: 'Survey',
source: 'survey.name',
editable: false,
type: 'tooltip',
};

const surveyId = {
Header: 'Survey ID',
source: 'survey.id',
editable: false,
type: 'tooltip',
show: false,
};

Expand All @@ -42,7 +40,6 @@ const assessorName = {
const date = {
Header: 'Date of survey',
source: 'end_time',
type: 'tooltip',
accessor: row => moment(row.end_time).local().format('ddd, MMM Do YYYY, HH:mm:ss ZZ'),
filterable: false,
editable: false,
Expand All @@ -51,7 +48,6 @@ const date = {
const dateOfData = {
Header: 'Date of data',
source: 'data_time',
type: 'tooltip',
accessor: row => moment.parseZone(row.data_time).format('ddd, MMM Do YYYY, HH:mm:ss'),
filterable: false,
editConfig: {
Expand All @@ -63,7 +59,6 @@ const dateOfData = {
const approvalStatus = {
Header: 'Approval status',
source: 'approval_status',
type: 'tooltip',
};

const entityName = {
Expand Down Expand Up @@ -121,12 +116,10 @@ export const ANSWER_COLUMNS = [
Header: 'Question',
source: 'question.text',
editable: false,
type: 'tooltip',
},
{
Header: 'Answer',
source: 'text',
type: 'tooltip',
},
];

Expand Down
7 changes: 0 additions & 7 deletions packages/admin-panel/src/routes/surveys/surveys.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ const SURVEY_FIELDS = {
name: {
Header: 'Name',
source: 'name',
type: 'tooltip',
editConfig: {
maxLength: 50,
secondaryLabel: 'Max length: 50 characters',
Expand Down Expand Up @@ -267,7 +266,6 @@ const QUESTION_FIELDS = [
{
Header: 'Code',
source: 'question.code',
type: 'tooltip',
editable: false,
},
{
Expand All @@ -277,27 +275,22 @@ const QUESTION_FIELDS = [
{
Header: 'Name',
source: 'question.name',
type: 'tooltip',
},
{
Header: 'Question',
source: 'question.text',
type: 'tooltip',
},
{
Header: 'Detail',
source: 'question.detail',
type: 'tooltip',
},
{
Header: 'Question label',
source: 'question_label',
type: 'tooltip',
},
{
Header: 'Detail label',
source: 'detail_label',
type: 'tooltip',
},
];

Expand Down
2 changes: 1 addition & 1 deletion packages/admin-panel/src/routes/surveys/syncGroups.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const COLUMNS = [
source: 'sync_status',
filterable: false,
disableSortBy: true,
colWidth: '12rem',
width: 200,
actionConfig: {
syncStatusEndpoint: 'dataServiceSyncGroups/{id}',
latestSyncLogEndpoint: 'dataServiceSyncGroups/{id}/logs?limit=1',
Expand Down
3 changes: 0 additions & 3 deletions packages/admin-panel/src/routes/users/accessRequests.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const USER_FIELDS = [
{
Header: 'Email address',
source: 'user_account.email',
type: 'tooltip',
},
{
Header: 'First name',
Expand Down Expand Up @@ -50,7 +49,6 @@ const ACCESS_REQUEST_FIELDS = [
{
Header: 'Message',
source: 'message',
type: 'tooltip',
editable: false,
},
{
Expand Down Expand Up @@ -98,7 +96,6 @@ const USER_COLUMNS = [
Header: 'Message',
source: 'message',
bulkAccessor: rows => rows.map(row => (row.message ? row.message : 'blank')).join(', '),
type: 'tooltip',
editable: false,
},
{
Expand Down
5 changes: 0 additions & 5 deletions packages/admin-panel/src/routes/users/users.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ const EDIT_FIELDS = [
{
Header: 'Email address',
source: 'email',
type: 'tooltip',
},
{
Header: 'Phone number',
Expand All @@ -51,12 +50,10 @@ const EDIT_FIELDS = [
{
Header: 'Employer',
source: 'employer',
type: 'tooltip',
},
{
Header: 'Verified',
source: 'verified_email',
type: 'tooltip',
editConfig: {
options: [
{
Expand Down Expand Up @@ -94,12 +91,10 @@ const COLUMNS = [
{
Header: 'Email Address',
source: 'email',
type: 'tooltip',
},
{
Header: 'Employer',
source: 'employer',
type: 'tooltip',
},
{
Header: 'Verified',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ const FIELDS = [
{
Header: 'Code',
source: 'code',
type: 'tooltip',
},
{
Header: 'Report code',
source: 'report_code',
type: 'tooltip',
},
{
Header: 'Config',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ const ENTRY_FIELDS = [
{
Header: 'Email',
source: 'dashboard_mailing_list_entry.email',
type: 'tooltip',
},
{
Header: 'Subscribed',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const FIELDS = [
{
Header: 'Code',
source: 'code',
type: 'tooltip',
},
{
Header: 'Name',
Expand Down
2 changes: 0 additions & 2 deletions packages/admin-panel/src/routes/visualisations/dataTables.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const FIELDS = [
{
Header: 'Code',
source: 'code',
type: 'tooltip',
},
{
Header: 'Description',
Expand All @@ -35,7 +34,6 @@ const FIELDS = [
{
Header: 'Permission groups',
source: 'permission_groups',
type: 'tooltip',
Filter: ArrayFilter,
Cell: ({ value }) => prettyArray(value),
editConfig: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ const FIELDS = [
{
Header: 'Code',
source: 'code',
type: 'tooltip',
},
{
Header: 'Data builder',
source: 'data_builder',
type: 'tooltip',
},
{
Header: 'Data builder config',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const FIELDS = [
{
Header: 'Map overlay group code',
source: 'map_overlay_group.code',
type: 'tooltip',

editConfig: {
optionsEndpoint: 'mapOverlayGroups',
optionLabelKey: 'map_overlay_group.code',
Expand All @@ -22,7 +22,7 @@ const FIELDS = [
{
Header: 'Child ID',
source: 'child_id',
type: 'tooltip',

editConfig: {
optionsEndpoint: 'mapOverlays',
optionLabelKey: 'mapOverlay.id',
Expand All @@ -35,7 +35,7 @@ const FIELDS = [
Header: 'Child type',
width: 160,
source: 'child_type',
type: 'tooltip',

editConfig: {
options: [
{
Expand All @@ -52,7 +52,6 @@ const FIELDS = [
{
Header: 'Sort order',
source: 'sort_order',
type: 'tooltip',
},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ const FIELDS = [
{
Header: 'Code',
source: 'code',
type: 'tooltip',
},
{
Header: 'Name',
source: 'name',
type: 'tooltip',
},
];

Expand All @@ -42,7 +40,7 @@ export const RELATION_FIELDS = [
{
Header: 'Child ID',
source: 'child_id',
type: 'tooltip',

editConfig: {
optionsEndpoint: 'mapOverlays',
optionLabelKey: 'mapOverlay.id',
Expand All @@ -53,7 +51,7 @@ export const RELATION_FIELDS = [
{
Header: 'Child type',
source: 'child_type',
type: 'tooltip',

editConfig: {
options: [
{
Expand All @@ -70,7 +68,6 @@ export const RELATION_FIELDS = [
{
Header: 'Sort order',
source: 'sort_order',
type: 'tooltip',
},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ const FIELDS = [
{
Header: 'Code',
source: 'code',
type: 'tooltip',
},
{
Header: 'Name',
source: 'name',
width: 140,
type: 'tooltip',
},
{
Header: 'Permission group',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const FIELDS = [
{
Header: 'Creation date',
source: 'creation_date',
type: 'tooltip',

accessor: row => moment(row.creation_date).local().toString(),
editConfig: {
type: 'datetime-local',
Expand Down
Loading