From f7dfa161ee26647af035d2179580d0c47f49946d Mon Sep 17 00:00:00 2001 From: Samantha Date: Wed, 29 Nov 2023 16:13:08 -0500 Subject: [PATCH] Add id to filters in normal and advanced views (#143) --- .../src/parts/environments-sc/ScEnvironmentsList.js | 1 + .../src/parts/environments-sc/advanced/FilterForm.js | 1 + .../src/parts/environments-sc/advanced/ScEnvAdvancedList.js | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/addon-base-raas-ui/packages/base-raas-ui/src/parts/environments-sc/ScEnvironmentsList.js b/addons/addon-base-raas-ui/packages/base-raas-ui/src/parts/environments-sc/ScEnvironmentsList.js index 2041f15216..70921255a3 100644 --- a/addons/addon-base-raas-ui/packages/base-raas-ui/src/parts/environments-sc/ScEnvironmentsList.js +++ b/addons/addon-base-raas-ui/packages/base-raas-ui/src/parts/environments-sc/ScEnvironmentsList.js @@ -253,6 +253,7 @@ class ScEnvironmentsList extends React.Component { !_.isEmpty( _.find( [ + env.id, env.name, env.description, env.projectId, diff --git a/addons/addon-base-raas-ui/packages/base-raas-ui/src/parts/environments-sc/advanced/FilterForm.js b/addons/addon-base-raas-ui/packages/base-raas-ui/src/parts/environments-sc/advanced/FilterForm.js index e088d43027..5b98a3b506 100644 --- a/addons/addon-base-raas-ui/packages/base-raas-ui/src/parts/environments-sc/advanced/FilterForm.js +++ b/addons/addon-base-raas-ui/packages/base-raas-ui/src/parts/environments-sc/advanced/FilterForm.js @@ -47,6 +47,7 @@ function ModeToggle({ mode, onToggle }) { export default function FilterForm({ mode, filters, fields, onFilter }) { const [form, setForm] = useState( filters.reduce((acc, { key, value, match }) => ({ ...acc, [key]: { value: [...value], match } }), { + id: { value: [] }, name: { value: [] }, user: { value: [] }, project: { value: [] }, diff --git a/addons/addon-base-raas-ui/packages/base-raas-ui/src/parts/environments-sc/advanced/ScEnvAdvancedList.js b/addons/addon-base-raas-ui/packages/base-raas-ui/src/parts/environments-sc/advanced/ScEnvAdvancedList.js index 38f7f3784f..7526a1cfde 100644 --- a/addons/addon-base-raas-ui/packages/base-raas-ui/src/parts/environments-sc/advanced/ScEnvAdvancedList.js +++ b/addons/addon-base-raas-ui/packages/base-raas-ui/src/parts/environments-sc/advanced/ScEnvAdvancedList.js @@ -118,6 +118,7 @@ class ScEnvAdvancedList extends React.Component { const statusOptions = statusMap.map(({ name }) => ({ text: name, value: name })); const fields = [ + { key: 'id', label: 'ID', icon: 'hashtag', hidden: true }, { key: 'name', label: 'Name', icon: 'info' }, { key: 'user', label: 'Created By', icon: 'user', options: options.user }, { key: 'createdAt', label: 'Created At', icon: 'calendar alternate outline', type: 'date', filterable: false }, @@ -243,7 +244,8 @@ class ScEnvAdvancedList extends React.Component { ); } else if (isStoreNotEmpty(store)) { const fields = this.getEnvFields(store.list); - const tableColumns = fields.map(column => _.pick(column, ['key', 'label', 'sortable', 'type'])); + const tableColumns = fields.filter(({ hidden = false }) => !hidden) + .map(column => _.pick(column, ['key', 'label', 'sortable', 'type'])); const { paginatedEnvList, filteredEnvsCount } = this.getPaginatedEnvs(); current = filteredEnvsCount; total = store.total;