mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-16 07:08:55 +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 = () => {
|
getRepoTagIdList = () => {
|
||||||
let repoTagIdList = [];
|
let repoTagIdList = [];
|
||||||
let fileTagList = this.props.fileTagList;
|
let fileTagList = this.props.fileTagList || [];
|
||||||
repoTagIdList = fileTagList.map((fileTag) => fileTag.repo_tag_id);
|
repoTagIdList = fileTagList.map((fileTag) => fileTag.repo_tag_id);
|
||||||
return repoTagIdList;
|
return repoTagIdList;
|
||||||
}
|
}
|
||||||
|
@@ -94,7 +94,7 @@ class DetailListView extends React.Component {
|
|||||||
<th>{gettext('Tags')}</th>
|
<th>{gettext('Tags')}</th>
|
||||||
<td>
|
<td>
|
||||||
<ul className="file-tag-list">
|
<ul className="file-tag-list">
|
||||||
{fileTagList.map((fileTag) => {
|
{Array.isArray(fileTagList) && fileTagList.map((fileTag) => {
|
||||||
return (
|
return (
|
||||||
<li key={fileTag.id} className="file-tag-item">
|
<li key={fileTag.id} className="file-tag-item">
|
||||||
<span className="file-tag" style={{backgroundColor:fileTag.color}}></span>
|
<span className="file-tag" style={{backgroundColor:fileTag.color}}></span>
|
||||||
@@ -142,6 +142,10 @@ class DetailListView extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DetailListView.defaultProps = {
|
||||||
|
fileTagList: [],
|
||||||
|
};
|
||||||
|
|
||||||
DetailListView.propTypes = propTypes;
|
DetailListView.propTypes = propTypes;
|
||||||
|
|
||||||
export default DetailListView;
|
export default DetailListView;
|
||||||
|
@@ -85,7 +85,7 @@ class FileDetails extends React.Component {
|
|||||||
<th>{gettext('Tags')}</th>
|
<th>{gettext('Tags')}</th>
|
||||||
<td>
|
<td>
|
||||||
<ul className="file-tag-list">
|
<ul className="file-tag-list">
|
||||||
{fileTagList.map((fileTag) => {
|
{Array.isArray(fileTagList) && fileTagList.map((fileTag) => {
|
||||||
return (
|
return (
|
||||||
<li key={fileTag.id} className="file-tag-item">
|
<li key={fileTag.id} className="file-tag-item">
|
||||||
<span className="file-tag" style={{backgroundColor:fileTag.color}}></span>
|
<span className="file-tag" style={{backgroundColor:fileTag.color}}></span>
|
||||||
|
@@ -46,7 +46,7 @@ class DetailListView extends React.Component {
|
|||||||
<th>{gettext('Tags')}</th>
|
<th>{gettext('Tags')}</th>
|
||||||
<td>
|
<td>
|
||||||
<ul className="file-tag-list">
|
<ul className="file-tag-list">
|
||||||
{fileTagList.map((fileTag) => {
|
{Array.isArray(fileTagList) && fileTagList.map((fileTag) => {
|
||||||
return (
|
return (
|
||||||
<li key={fileTag.id} className="file-tag-item">
|
<li key={fileTag.id} className="file-tag-item">
|
||||||
<span className="file-tag" style={{backgroundColor: fileTag.tag_color}}></span>
|
<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;
|
DetailListView.propTypes = propTypes;
|
||||||
|
|
||||||
export default DetailListView;
|
export default DetailListView;
|
||||||
|
Reference in New Issue
Block a user