U 优化发布申请Tag排序及展示

pull/103/head
vapao 2020-05-28 09:49:46 +08:00
parent b08a3e7000
commit 122188c35e
2 changed files with 10 additions and 4 deletions

View File

@ -27,8 +27,14 @@ class Git:
'author': ref.tag.tagger.name, 'author': ref.tag.tagger.name,
'date': ref.tag.tagged_date, 'date': ref.tag.tagged_date,
'message': ref.tag.message.strip() 'message': ref.tag.message.strip()
} if ref.tag else {} } if ref.tag else {
return branches, tags 'id': ref.commit.binsha.hex(),
'author': ref.commit.author.name,
'date': ref.commit.authored_date,
'message': ref.commit.message.strip()
}
tags = sorted(tags.items(), key=lambda x: x[1]['date'], reverse=True)
return branches, dict(tags)
def _get_repo(self, git_repo, repo_dir): def _get_repo(self, git_repo, repo_dir):
if os.path.exists(repo_dir): if os.path.exists(repo_dir):

View File

@ -79,7 +79,7 @@ class Ext1Form extends React.Component {
}; };
switchType = (v) => { switchType = (v) => {
this.setState({git_type: v, extra1: null}, this._initExtra1) this.setState({git_type: v, extra1: undefined}, this._initExtra1)
}; };
switchExtra1 = (v) => { switchExtra1 = (v) => {
@ -157,7 +157,7 @@ class Ext1Form extends React.Component {
Object.keys(branches || {}).map(b => <Select.Option key={b} value={b}>{b}</Select.Option>) Object.keys(branches || {}).map(b => <Select.Option key={b} value={b}>{b}</Select.Option>)
) : ( ) : (
Object.entries(tags || {}).map(([tag, info]) => ( Object.entries(tags || {}).map(([tag, info]) => (
<Select.Option key={tag} value={tag}>{tag} {info.author}</Select.Option> <Select.Option key={tag} value={tag}>{tag} {info.author} {info.message}</Select.Option>
)) ))
)} )}
</Select> </Select>