Skip to content

Commit

Permalink
bug-display-the-project-name-instead-of-the-project-id-in-the-project…
Browse files Browse the repository at this point in the history
…-page

155 bug display the project name instead of the project id in the project page
  • Loading branch information
Tomansion authored Feb 19, 2024
2 parents e4e8907 + 3dc0d16 commit 6a95b61
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ def get_project_selections(url, project_id):
selections = api.get_selections(url, project_id)

if selections is None:
print(
"Error: No selections found for project {} on {}".format(
project_id, url
)
)
print(f"Error: No selections found for project {project_id} on {url}")
raise DataProviderException("No selections found", 404)

debiai_selections = []
for selection in selections:
if "id" not in selection or selection["id"] is None:
print(f"Error: No id for selection: {selection}")
raise DataProviderException(
"An id is missing in the given selection", 400
)

selection_to_add = {
"name": selection["name"] if "name" in selection else selection["id"],
"id": selection["id"],
Expand All @@ -30,7 +32,8 @@ def get_project_selections(url, project_id):

debiai_selections.append(selection_to_add)
return debiai_selections
except DataProviderException as e:

except DataProviderException:
# The route may not be implemented in the data provider
return []

Expand Down
2 changes: 1 addition & 1 deletion backend/swagger.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
swagger: "2.0"
info:
version: 0.26.0-beta5
version: 0.26.0-beta6
title: DebiAI_BACKEND_API
description: DebiAI backend api
contact:
Expand Down
4 changes: 2 additions & 2 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "debiai_frontend",
"version": "0.26.0-beta5",
"version": "0.26.0-beta6",
"description": "Frontend for Debiai, made with Vuejs",
"license": "Apache-2.0",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion frontend/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
<title>DebiAI</title>

<!-- Imports -->
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
Expand Down
13 changes: 6 additions & 7 deletions frontend/src/components/debiai/dataAnalysis/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,7 @@
<!-- DebiAI Logo -->
<router-link
id="debiaiLogo"
:to="
'/dataprovider/' +
$store.state.ProjectPage.dataProviderId +
'/project/' +
$store.state.ProjectPage.projectId
"
to="/"
>
<img
src="@/assets/images/DebiAI_black.png"
Expand All @@ -55,7 +50,11 @@
'/project/' +
$store.state.ProjectPage.projectId
"
>{{ $store.state.ProjectPage.projectId }}</router-link
>{{
$store.state.ProjectPage.projectName
? $store.state.ProjectPage.projectName
: $store.state.ProjectPage.projectId
}}</router-link
>
/ Analysis
</div>
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/components/debiai/frontpage/FrontPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@ export default {
created() {
// Load the projects
this.loadProjects();
// Change the browser title
document.title = "DebiAI";
},
methods: {
loadProjects() {
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/components/debiai/project/Project.vue
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ export default {
// Store some info
this.$store.commit("setProjectColumns", this.project.columns);
this.$store.commit("setProjectResultsColumns", this.project.resultStructure);
this.$store.commit("setProjectName", this.project.name);
// Change the browser title
if (this.project.name) document.title = this.project.name;
else document.title = this.project.id;
})
.catch((e) => {
if (e.response && e.response.status === 500) {
Expand Down
5 changes: 0 additions & 5 deletions frontend/src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,5 @@ let router = new Router({
},
],
});
const DEFAULT_TITLE = "DebiAI";
router.beforeEach((to, from, next) => {
document.title = to.query.projectId || to.params.projectId || DEFAULT_TITLE;
next();
});

export default router;
4 changes: 4 additions & 0 deletions frontend/src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const Dashboard = {
const ProjectPage = {
state: {
projectId: null,
projectName: null,
dataProviderId: null,
selectionsIds: [],
projectColumns: [],
Expand All @@ -74,6 +75,9 @@ const ProjectPage = {
setProjectId(state, projectId) {
state.projectId = projectId;
},
setProjectName(state, projectName) {
state.projectName = projectName;
},
setDataProviderId(state, dataProviderId) {
state.dataProviderId = dataProviderId;
},
Expand Down

0 comments on commit 6a95b61

Please sign in to comment.