Skip to content

Commit

Permalink
fix(client)!: update KG status indexing percentage.
Browse files Browse the repository at this point in the history
BREAKING CHANGE: require a new version of renku-graph

re SwissDataScienceCenter/renku-graph#1253
  • Loading branch information
lorenzo-cavazzi committed Jan 4, 2023
1 parent 83e7c76 commit 9985fc1
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 19 deletions.
9 changes: 5 additions & 4 deletions client/src/file/KnowledgeGraphStatus.present.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,16 @@ function KnowledgeGraphStatus(props) {
const { error, progress, webhookJustCreated } = props;
if (error != null) {
return <MigrationWarnAlert>
Knowledge Graph integration must be activated to view the lineage, but&nbsp;
Knowledge Graph integration must be activated to view the lineage, but
there is a problem with the knowledge graph integration for this project. To resolve this problem,
you should contact the development team on&nbsp;
you should contact the development team on {" "}
<a href={Links.GITTER}
target="_blank" rel="noreferrer noopener">Gitter</a> or&nbsp;
target="_blank" rel="noreferrer noopener">Gitter</a> or{" "}
<a href={Links.GITHUB}
target="_blank" rel="noreferrer noopener">GitHub</a>.
</MigrationWarnAlert>;
}

if (progress == null) {
return (
<Loader />
Expand Down Expand Up @@ -111,7 +112,7 @@ function KnowledgeGraphStatus(props) {
return (
<div>
<Alert color="primary">
<p>Knowledge Graph is building... {parseInt(progress)}%</p>
<p>Knowledge Graph is building... {progress}%</p>
<Progress value={progress} />
</Alert>
</div>
Expand Down
41 changes: 27 additions & 14 deletions client/src/project/Project.state.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,26 +529,39 @@ class ProjectCoordinator {
}

fetchGraphStatus(client) {
return client.checkGraphStatus(this.get("metadata.id"))
const projectId = this.get("metadata.id");
if (!projectId)
return null;
return client.checkGraphStatus(projectId)
.then((resp) => {
let progress;
if (resp.progress == null)
progress = GraphIndexingStatus.NO_PROGRESS;

if (resp.progress === 0 || resp.progress)
progress = resp.progress;
this.set("webhook.progress", progress);
return progress;
// extract the percentage
const progress = resp?.progress ?? null;
let percentage;
if (progress.percentage == null)
percentage = GraphIndexingStatus.NO_PROGRESS;

if (progress.percentage === 0 || progress.percentage)
percentage = progress.percentage;
this.setObject({
webhook: {
progress: percentage,
data: resp ? resp : {}
}
});
return percentage;
})
.catch((err) => {
if (err.case === API_ERRORS.notFoundError) {
const progress = GraphIndexingStatus.NO_WEBHOOK;
this.set("webhook.progress", progress);
return progress;
const percentage = GraphIndexingStatus.NO_WEBHOOK;
this.setObject({
webhook: {
progress: percentage,
error: err ? err : {}
}
});
return percentage;
}

throw err;

});
}

Expand Down
1 change: 0 additions & 1 deletion client/src/utils/components/progress/Progress.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

.progress-bar {
height: var(--progress_height);
background-color: #E6E9ED;
width: 100%;
overflow: hidden;
position: relative;
Expand Down

0 comments on commit 9985fc1

Please sign in to comment.