Skip to content

Commit

Permalink
task: filter overview table (#1604)
Browse files Browse the repository at this point in the history
Co-authored-by: Cole Blanchard <cblanchard@Coles-MacBook-Pro.local>
Co-authored-by: Thanh Pham <98172806+tangopapatime@users.noreply.github.com>
  • Loading branch information
3 people authored Jul 28, 2023
1 parent 502bc9e commit 3cafcf5
Showing 1 changed file with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
<h4>Resource Manager</h4>
<span class="p-input-icon-left">
<i class="pi pi-search" />
<InputText placeholder="Keyword search" class="keyword-search" />
<InputText v-model="searchTable" placeholder="Keyword search" class="keyword-search" />
</span>
</div>
<!-- resource list data table -->
Expand Down Expand Up @@ -309,6 +309,7 @@ const multiSelectButtons = [
}
];
const searchTable = ref('');
const showMultiSelect = ref<boolean>(false);
const assets = computed(() => {
Expand All @@ -322,12 +323,20 @@ const assets = computed(() => {
Object.keys(projectAssets).forEach((type) => {
if (isProjectAssetTypes(type) && !isEmpty(projectAssets[type])) {
const projectAssetType: ProjectAssetTypes = type as ProjectAssetTypes;
const typeAssets = projectAssets[projectAssetType].map((asset) => {
const assetName = (asset?.name || asset?.title || asset?.id)?.toString();
const pageType = asset?.type ?? projectAssetType;
const assetId = asset?.id ?? '';
return { assetName, pageType, assetId };
});
const typeAssets = projectAssets[projectAssetType]
.map((asset) => {
const assetName = (asset?.name || asset?.title || asset?.id)?.toString();
const pageType = asset?.type ?? projectAssetType;
const assetId = asset?.id ?? '';
return { assetName, pageType, assetId };
})
.filter((asset) => {
if (!searchTable.value?.trim()) {
return true;
}
const searchTermLower = searchTable.value?.trim().toLowerCase();
return asset.assetName.toLowerCase().includes(searchTermLower);
});
result.push(...typeAssets);
}
});
Expand Down

0 comments on commit 3cafcf5

Please sign in to comment.