mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-14 22:33:17 +00:00
fix: file tag list bug (#5616)
* fix: file tag list bug * Feat: add default value
This commit is contained in:
@@ -40,7 +40,7 @@ class TagItem extends React.Component {
|
||||
|
||||
getRepoTagIdList = () => {
|
||||
let repoTagIdList = [];
|
||||
let fileTagList = this.props.fileTagList;
|
||||
let fileTagList = this.props.fileTagList || [];
|
||||
repoTagIdList = fileTagList.map((fileTag) => fileTag.repo_tag_id);
|
||||
return repoTagIdList;
|
||||
}
|
||||
|
@@ -94,7 +94,7 @@ class DetailListView extends React.Component {
|
||||
<th>{gettext('Tags')}</th>
|
||||
<td>
|
||||
<ul className="file-tag-list">
|
||||
{fileTagList.map((fileTag) => {
|
||||
{Array.isArray(fileTagList) && fileTagList.map((fileTag) => {
|
||||
return (
|
||||
<li key={fileTag.id} className="file-tag-item">
|
||||
<span className="file-tag" style={{backgroundColor:fileTag.color}}></span>
|
||||
@@ -142,6 +142,10 @@ class DetailListView extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
DetailListView.defaultProps = {
|
||||
fileTagList: [],
|
||||
};
|
||||
|
||||
DetailListView.propTypes = propTypes;
|
||||
|
||||
export default DetailListView;
|
||||
|
@@ -85,7 +85,7 @@ class FileDetails extends React.Component {
|
||||
<th>{gettext('Tags')}</th>
|
||||
<td>
|
||||
<ul className="file-tag-list">
|
||||
{fileTagList.map((fileTag) => {
|
||||
{Array.isArray(fileTagList) && fileTagList.map((fileTag) => {
|
||||
return (
|
||||
<li key={fileTag.id} className="file-tag-item">
|
||||
<span className="file-tag" style={{backgroundColor:fileTag.color}}></span>
|
||||
|
@@ -46,7 +46,7 @@ class DetailListView extends React.Component {
|
||||
<th>{gettext('Tags')}</th>
|
||||
<td>
|
||||
<ul className="file-tag-list">
|
||||
{fileTagList.map((fileTag) => {
|
||||
{Array.isArray(fileTagList) && fileTagList.map((fileTag) => {
|
||||
return (
|
||||
<li key={fileTag.id} className="file-tag-item">
|
||||
<span className="file-tag" style={{backgroundColor: fileTag.tag_color}}></span>
|
||||
@@ -75,6 +75,10 @@ class DetailListView extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
DetailListView.defaultProps = {
|
||||
fileTagList: [],
|
||||
};
|
||||
|
||||
DetailListView.propTypes = propTypes;
|
||||
|
||||
export default DetailListView;
|
||||
|
Reference in New Issue
Block a user