|
|
|
@ -38,6 +38,7 @@ class TPMRepositoryComponent extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
componentDidMount = () => {
|
|
|
|
|
this.nameTypeMap = {}
|
|
|
|
|
this.fetchRepo()
|
|
|
|
|
}
|
|
|
|
|
setContentWidth100 = (flag) => {
|
|
|
|
@ -108,7 +109,7 @@ class TPMRepositoryComponent extends Component {
|
|
|
|
|
if (!array || array.length === 0) {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
return this._isFileName( array[array.length - 1] )
|
|
|
|
|
return this.nameTypeMap[array[array.length - 1]] !== 'tree' && this._isFileName( array[array.length - 1] )
|
|
|
|
|
}
|
|
|
|
|
// listItem 如果是num,则是通过面包屑点击过来的,取pathArray的子集
|
|
|
|
|
fetchRepo = (listItem) => {
|
|
|
|
@ -117,7 +118,7 @@ class TPMRepositoryComponent extends Component {
|
|
|
|
|
|
|
|
|
|
if (listItem === 0 || listItem) {
|
|
|
|
|
this.setContentWidth100(false)
|
|
|
|
|
|
|
|
|
|
this.nameTypeMap[listItem.name] = listItem.type
|
|
|
|
|
if (typeof listItem == 'number') { // 参数是数字的话,做截取
|
|
|
|
|
// if (this._isFileName(newPathArray[listItem])) { // 面包屑中的文件不让点击了
|
|
|
|
|
// listItem--;
|
|
|
|
@ -137,7 +138,8 @@ class TPMRepositoryComponent extends Component {
|
|
|
|
|
let urlNewPathArray = newPathArray;
|
|
|
|
|
let fileInPathArray = false;
|
|
|
|
|
if (newPathArray.length) {
|
|
|
|
|
fileInPathArray = this._isFileName( newPathArray[newPathArray.length - 1] )
|
|
|
|
|
fileInPathArray = this.nameTypeMap[newPathArray[newPathArray.length - 1]] ? this.nameTypeMap[newPathArray[newPathArray.length - 1]] !== 'tree'
|
|
|
|
|
: (listItem.type !== 'tree' && this._isFileName( newPathArray[newPathArray.length - 1] ))
|
|
|
|
|
if ( fileInPathArray ) {
|
|
|
|
|
urlNewPathArray = newPathArray.slice(0, newPathArray.length - 1)
|
|
|
|
|
}
|
|
|
|
@ -195,6 +197,7 @@ class TPMRepositoryComponent extends Component {
|
|
|
|
|
{ !isContentWidth100 ? <TPMRepository
|
|
|
|
|
{...this.props}
|
|
|
|
|
{...this.state}
|
|
|
|
|
nameTypeMap={this.nameTypeMap}
|
|
|
|
|
fetchRepo={this.fetchRepo}
|
|
|
|
|
>
|
|
|
|
|
</TPMRepository>
|
|
|
|
@ -208,7 +211,7 @@ class TPMRepositoryComponent extends Component {
|
|
|
|
|
{...this.props}
|
|
|
|
|
fetchRepo={this.fetchRepo}
|
|
|
|
|
saveCode={this.saveCode}
|
|
|
|
|
|
|
|
|
|
nameTypeMap={this.nameTypeMap}
|
|
|
|
|
|
|
|
|
|
></RepositoryCodeEditor>
|
|
|
|
|
</div>
|
|
|
|
|