mirror of
https://github.com/harness/drone.git
synced 2025-05-05 06:21:50 +08:00
Fix branch sorting (#80)
* Implement Branch item actions * Implement Branch item actions * Fix sorting
This commit is contained in:
parent
6d8c979e7c
commit
21eb0f61b6
@ -4,7 +4,6 @@ import type { CellProps, Column } from 'react-table'
|
|||||||
import { Link, useHistory } from 'react-router-dom'
|
import { Link, useHistory } from 'react-router-dom'
|
||||||
import cx from 'classnames'
|
import cx from 'classnames'
|
||||||
import Keywords from 'react-keywords'
|
import Keywords from 'react-keywords'
|
||||||
import { orderBy } from 'lodash-es'
|
|
||||||
import { useMutate } from 'restful-react'
|
import { useMutate } from 'restful-react'
|
||||||
import { String, useStrings } from 'framework/strings'
|
import { String, useStrings } from 'framework/strings'
|
||||||
import { useAppContext } from 'AppContext'
|
import { useAppContext } from 'AppContext'
|
||||||
@ -136,7 +135,7 @@ export function BranchesContent({ repoMetadata, searchTerm = '', branches, onDel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[getString, repoMetadata.defaultBranch, repoMetadata.path, routes, searchTerm, history]
|
[getString, repoMetadata.defaultBranch, repoMetadata.path, routes, searchTerm, history, onDeleteSuccess]
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -144,7 +143,7 @@ export function BranchesContent({ repoMetadata, searchTerm = '', branches, onDel
|
|||||||
<Table<RepoBranch>
|
<Table<RepoBranch>
|
||||||
className={css.table}
|
className={css.table}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
data={orderBy(branches || [], [searchTerm ? '' : 'commit.author.when'], ['desc'])}
|
data={branches || []}
|
||||||
getRowClassName={row => cx(css.row, (row.index + 1) % 2 ? css.odd : '')}
|
getRowClassName={row => cx(css.row, (row.index + 1) % 2 ? css.odd : '')}
|
||||||
/>
|
/>
|
||||||
</Container>
|
</Container>
|
||||||
|
@ -26,6 +26,7 @@ export function RepositoryBranchesContent({ repoMetadata }: Pick<GitInfoProps, '
|
|||||||
queryParams: {
|
queryParams: {
|
||||||
per_page: LIST_FETCHING_PER_PAGE,
|
per_page: LIST_FETCHING_PER_PAGE,
|
||||||
page: pageIndex + 1,
|
page: pageIndex + 1,
|
||||||
|
sort: 'date',
|
||||||
direction: 'desc',
|
direction: 'desc',
|
||||||
include_commit: true,
|
include_commit: true,
|
||||||
query: searchTerm
|
query: searchTerm
|
||||||
|
Loading…
Reference in New Issue
Block a user