[Code] adjust clone progress and not found rendering in source view page (#38213)
This commit is contained in:
parent
358343b1e1
commit
fee3a82bb5
|
@ -24,11 +24,11 @@ export const CloneStatus = (props: Props) => {
|
|||
const { receivedObjects, totalObjects, indexedObjects } = cloneProgress;
|
||||
|
||||
if (receivedObjects === totalObjects) {
|
||||
progress = `Indexing objects: ${(indexedObjects / totalObjects).toFixed(
|
||||
progress = `Indexing objects: ${((indexedObjects * 100) / totalObjects).toFixed(
|
||||
2
|
||||
)}% (${indexedObjects}/${totalObjects})`;
|
||||
} else {
|
||||
progress = `Receiving objects: ${(receivedObjects / totalObjects).toFixed(
|
||||
progress = `Receiving objects: ${((receivedObjects * 100) / totalObjects).toFixed(
|
||||
2
|
||||
)}% (${receivedObjects}/${totalObjects})`;
|
||||
}
|
||||
|
|
|
@ -237,7 +237,7 @@ class CodeContent extends React.PureComponent<Props> {
|
|||
);
|
||||
}
|
||||
|
||||
public shouldRenderProgress() {
|
||||
public shouldRenderCloneProgress() {
|
||||
if (!this.props.repoStatus) {
|
||||
return false;
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ class CodeContent extends React.PureComponent<Props> {
|
|||
);
|
||||
}
|
||||
|
||||
public renderProgress() {
|
||||
public renderCloneProgress() {
|
||||
if (!this.props.repoStatus) {
|
||||
return null;
|
||||
}
|
||||
|
@ -268,12 +268,15 @@ class CodeContent extends React.PureComponent<Props> {
|
|||
public renderContent() {
|
||||
const { file, match, tree, fileTreeLoadingPaths, isNotFound, notFoundDirs } = this.props;
|
||||
const { path, pathType, resource, org, repo, revision } = match.params;
|
||||
|
||||
// The clone progress rendering should come before the NotFound rendering.
|
||||
if (this.shouldRenderCloneProgress()) {
|
||||
return this.renderCloneProgress();
|
||||
}
|
||||
|
||||
if (isNotFound || notFoundDirs.includes(path || '')) {
|
||||
return <NotFound />;
|
||||
}
|
||||
if (this.shouldRenderProgress()) {
|
||||
return this.renderProgress();
|
||||
}
|
||||
|
||||
const repoUri = `${resource}/${org}/${repo}`;
|
||||
switch (pathType) {
|
||||
|
|
Loading…
Reference in a new issue