Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 25 additions & 13 deletions web/src/components/AppsMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,21 @@
},

async created() {
const apps = await this.loadAppsDataFromBackend();

this.appsMixin.activeAppIds = apps.filter((app) => app.active).map((app) => app.id);

this.appsMixin.apps = apps.reduce((prev, app) => ({
...prev,
[app.id]: app,
}), {});
try {
const apps = await this.loadAppsDataFromBackend();

this.appsMixin.activeAppIds = apps.filter((app) => app.active).map((app) => app.id);

this.appsMixin.apps = apps.reduce((prev, app) => ({
...prev,
[app.id]: app,
}), {});
} catch (err) {
console.error('Failed to load apps data:', err);

Check warning on line 25 in web/src/components/AppsMixin.js

View workflow job for this annotation

GitHub Actions / build-local

Unexpected console statement
// Set defaults to ensure the page can still render
this.appsMixin.activeAppIds = [];
this.appsMixin.apps = {};
}
},

computed: {
Expand All @@ -30,11 +37,16 @@

methods: {
async loadAppsDataFromBackend() {
return (await axios({
method: 'get',
url: '/api/apps',
responseType: 'json',
})).data;
try {
return (await axios({
method: 'get',
url: '/api/apps',
responseType: 'json',
})).data;
} catch (err) {
console.error('Failed to load apps from backend:', err);

Check warning on line 47 in web/src/components/AppsMixin.js

View workflow job for this annotation

GitHub Actions / build-local

Unexpected console statement
return [];
}
},

getAppColor(id) {
Expand Down
16 changes: 11 additions & 5 deletions web/src/components/ItemListPageBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,17 @@
},

async loadItems() {
this.items = (await axios({
method: 'get',
url: this.getItemsUrl(),
responseType: 'json',
})).data;
try {
this.items = (await axios({
method: 'get',
url: this.getItemsUrl(),
responseType: 'json',
})).data;
} catch (err) {
console.error('Failed to load items:', err);

Check warning on line 146 in web/src/components/ItemListPageBase.js

View workflow job for this annotation

GitHub Actions / build-local

Unexpected console statement
// Set default empty array to ensure the page can still render
this.items = [];
}
},
},
};
59 changes: 41 additions & 18 deletions web/src/views/project/Templates.vue
Original file line number Diff line number Diff line change
Expand Up @@ -369,15 +369,21 @@
},

async loadViews() {
this.views = (await axios({
method: 'get',
url: `/api/project/${this.projectId}/views`,
responseType: 'json',
})).data;
this.views.sort((v1, v2) => v1.position - v2.position);

if (this.viewId != null && !this.views.some((v) => v.id === this.viewId)) {
await this.$router.push({ path: `/project/${this.projectId}/templates` });
try {
this.views = (await axios({
method: 'get',
url: `/api/project/${this.projectId}/views`,
responseType: 'json',
})).data;
this.views.sort((v1, v2) => v1.position - v2.position);

if (this.viewId != null && !this.views.some((v) => v.id === this.viewId)) {
await this.$router.push({ path: `/project/${this.projectId}/templates` });
}
} catch (err) {
console.error('Failed to load views:', err);

Check warning on line 384 in web/src/views/project/Templates.vue

View workflow job for this annotation

GitHub Actions / build-local

Unexpected console statement
// Set default empty array to ensure the page can still render
this.views = [];
}
},

Expand Down Expand Up @@ -486,15 +492,32 @@
},

async loadData() {
[
this.inventory,
this.environment,
this.repositories,
] = await Promise.all([
this.loadProjectResources('inventory'),
this.loadProjectResources('environment'),
this.loadProjectResources('repositories'),
]);
try {
[
this.inventory,
this.environment,
this.repositories,
] = await Promise.all([
this.loadProjectResources('inventory').catch((err) => {
console.error('Failed to load inventory:', err);

Check warning on line 502 in web/src/views/project/Templates.vue

View workflow job for this annotation

GitHub Actions / build-local

Unexpected console statement
return [];
}),
this.loadProjectResources('environment').catch((err) => {
console.error('Failed to load environment:', err);

Check warning on line 506 in web/src/views/project/Templates.vue

View workflow job for this annotation

GitHub Actions / build-local

Unexpected console statement
return [];
}),
this.loadProjectResources('repositories').catch((err) => {
console.error('Failed to load repositories:', err);

Check warning on line 510 in web/src/views/project/Templates.vue

View workflow job for this annotation

GitHub Actions / build-local

Unexpected console statement
return [];
}),
]);
} catch (err) {
console.error('Failed to load project data:', err);

Check warning on line 515 in web/src/views/project/Templates.vue

View workflow job for this annotation

GitHub Actions / build-local

Unexpected console statement
// Set defaults to ensure the page can still render
this.inventory = this.inventory || [];
this.environment = this.environment || [];
this.repositories = this.repositories || [];
}
},

onTableSettingsChange({ headers }) {
Expand Down
Loading