-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
159f374
commit 0bf0934
Showing
12 changed files
with
207 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 68 additions & 16 deletions
84
manager/components/JobsExplorerTableHeader/JobsExplorerTableHeader.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,94 @@ | ||
/* * */ | ||
|
||
import styles from './JobsExplorerTableHeader.module.css'; | ||
import { useJobsExplorerContext } from 'contexts/JobsExplorerContext'; | ||
import JobsExplorerTableRowContainer from '@/components/JobsExplorerTableRowContainer/JobsExplorerTableRowContainer'; | ||
|
||
/* * */ | ||
|
||
export default function JobsExplorerTableHeader() { | ||
// | ||
|
||
// | ||
// A. Setup variables | ||
|
||
const jobsExplorerContext = useJobsExplorerContext(); | ||
|
||
// | ||
// B. Handle actions | ||
|
||
const handleClickColumnHeader = async (columnKey) => { | ||
jobsExplorerContext.setSortKey(columnKey); | ||
}; | ||
|
||
// | ||
// B. Render components | ||
|
||
return ( | ||
<div className={styles.container}> | ||
<JobsExplorerTableRowContainer className={styles.container}> | ||
<div className={styles.column} /> | ||
|
||
<div className={styles.column}>job_id</div> | ||
|
||
<div className={styles.column}>status</div> | ||
<div className={`${styles.column} ${styles.sortable}`} onClick={() => handleClickColumnHeader('status')}> | ||
status | ||
</div> | ||
|
||
<div className={styles.column}>notification_count</div> | ||
<div className={styles.column}>download_count</div> | ||
<div className={`${styles.column} ${styles.sortable}`} onClick={() => handleClickColumnHeader('notification_count')}> | ||
notification_count | ||
</div> | ||
<div className={`${styles.column} ${styles.sortable}`} onClick={() => handleClickColumnHeader('download_count')}> | ||
download_count | ||
</div> | ||
|
||
<div className={styles.column}>date_registered</div> | ||
<div className={styles.column}>date_updated</div> | ||
<div className={styles.column}>date_processing</div> | ||
<div className={styles.column}>date_ready</div> | ||
<div className={`${styles.column} ${styles.sortable}`} onClick={() => handleClickColumnHeader('date_registered')}> | ||
date_registered | ||
</div> | ||
<div className={`${styles.column} ${styles.sortable}`} onClick={() => handleClickColumnHeader('date_updated')}> | ||
date_updated | ||
</div> | ||
<div className={`${styles.column} ${styles.sortable}`} onClick={() => handleClickColumnHeader('date_processing')}> | ||
date_processing | ||
</div> | ||
<div className={`${styles.column} ${styles.sortable}`} onClick={() => handleClickColumnHeader('date_ready')}> | ||
date_ready | ||
</div> | ||
<div className={styles.column}>date_notified</div> | ||
<div className={styles.column}>date_downloaded</div> | ||
<div className={styles.column}>date_expired</div> | ||
<div className={`${styles.column} ${styles.sortable}`} onClick={() => handleClickColumnHeader('date_expired')}> | ||
date_expired | ||
</div> | ||
|
||
<div className={styles.column}>owner_name</div> | ||
<div className={styles.column}>owner_email</div> | ||
<div className={styles.column}>owner_lang</div> | ||
<div className={styles.column}>gdpr_consent</div> | ||
<div className={`${styles.column} ${styles.sortable}`} onClick={() => handleClickColumnHeader('owner_name')}> | ||
owner_name | ||
</div> | ||
<div className={`${styles.column} ${styles.sortable}`} onClick={() => handleClickColumnHeader('owner_email')}> | ||
owner_email | ||
</div> | ||
<div className={`${styles.column} ${styles.sortable}`} onClick={() => handleClickColumnHeader('owner_lang')}> | ||
owner_lang | ||
</div> | ||
<div className={`${styles.column} ${styles.sortable}`} onClick={() => handleClickColumnHeader('gdpr_consent')}> | ||
gdpr_consent | ||
</div> | ||
|
||
<div className={styles.column}>render_host</div> | ||
<div className={styles.column}>render_path</div> | ||
<div className={styles.column}>render_format</div> | ||
<div className={`${styles.column} ${styles.sortable}`} onClick={() => handleClickColumnHeader('render_host')}> | ||
render_host | ||
</div> | ||
<div className={`${styles.column} ${styles.sortable}`} onClick={() => handleClickColumnHeader('render_path')}> | ||
render_path | ||
</div> | ||
<div className={`${styles.column} ${styles.sortable}`} onClick={() => handleClickColumnHeader('render_format')}> | ||
render_format | ||
</div> | ||
|
||
<div className={styles.column}>filename</div> | ||
<div className={`${styles.column} ${styles.sortable}`} onClick={() => handleClickColumnHeader('filename')}> | ||
filename | ||
</div> | ||
</JobsExplorerTableRowContainer> | ||
</div> | ||
); | ||
|
||
// | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
manager/components/JobsExplorerToolbar/JobsExplorerToolbar.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { transliterate } from 'inflected'; | ||
|
||
export default function useSearch(query, data, options) { | ||
// | ||
|
||
// Return all data if query is empty | ||
if (!query) return data; | ||
|
||
// Normalize the query to remove non-English characters | ||
const normalizedQuery = transliterate(query.toLowerCase()); | ||
|
||
// Check if 'keys' option is present | ||
if (options && options.keys) { | ||
return data.filter((item) => { | ||
let hasMatch = false; | ||
for (let key of options.keys) { | ||
if (item.hasOwnProperty(key)) { | ||
const value = item[key]; | ||
const stringifiedValue = value ? String(value).toLowerCase() : ''; | ||
const normalizedValue = transliterate(stringifiedValue); | ||
if (normalizedValue.includes(normalizedQuery)) { | ||
hasMatch = true; | ||
break; | ||
} | ||
} | ||
} | ||
return hasMatch; | ||
}); | ||
} | ||
|
||
// The case where options is not defined | ||
return data.filter((item) => { | ||
const stringifiedData = Object.values(item).join('').toLowerCase(); | ||
const normalizedItemValue = transliterate(stringifiedData); | ||
return normalizedItemValue.includes(normalizedQuery); | ||
}); | ||
|
||
// | ||
} |
Oops, something went wrong.