Skip to content

Commit 9475577

Browse files
committed
added proper error message with back button to the failed expert instaltion
1 parent 1dfdf02 commit 9475577

File tree

1 file changed

+40
-7
lines changed

1 file changed

+40
-7
lines changed

src/components/wizard_steps/InstalationProgress.vue

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
<h1 class="title" data-id="installation-title">Installation Progress</h1>
44

55
<n-card class="progress-card" data-id="progress-card">
6-
<div class="summary-section" data-id="installation-summary" v-if="!instalation_running && !instalation_finished">
6+
<div class="summary-section" data-id="installation-summary"
7+
v-if="!instalation_running && !instalation_finished && !instalation_failed">
78
<div class="versions-info" v-if="all_settings" data-id="versions-info">
89
<h3 data-id="versions-title">Installing ESP-IDF Versions:</h3>
910
<div class="version-chips" data-id="version-chips">
@@ -15,7 +16,7 @@
1516
</div>
1617
<div data-id="start-button-container">
1718
<n-button @click="startInstalation()" type="error" size="large" :loading="instalation_running"
18-
:disabled="instalation_running" data-id="start-installation-button">
19+
:disabled="instalation_running" data-id="start-installation-button" v-if="!instalation_failed">
1920
{{ instalation_running ? 'Installing...' : 'Start Installation' }}
2021
</n-button>
2122
</div>
@@ -55,10 +56,15 @@
5556
</n-table>
5657
</n-tab-pane>
5758
</n-tabs>
58-
<GlobalProgress messagePosition="right" v-if="!instalation_finished" />
59+
<GlobalProgress messagePosition="right" v-if="!instalation_finished && !instalation_failed" />
60+
<div v-if="instalation_failed" class="error-message" data-id="error-message">
61+
<h3 data-id="error-title">Error during installation:</h3>
62+
<p data-id="error-message-text">{{ error_message }} <br> For more information consult the log file.</p>
63+
<n-button @click="goHome()" type="error" size="large" data-id="home-installation-button">Go Back</n-button>
64+
</div>
5965
</div>
6066

61-
<div class="action-footer" v-if="instalation_finished" data-id="action-footer">
67+
<div class="action-footer" v-if="instalation_finished && !instalation_failed" data-id="action-footer">
6268
<n-button @click="nextstep" type="error" size="large" data-id="complete-installation-button-footer">
6369
Complete Installation
6470
</n-button>
@@ -73,7 +79,7 @@ import { invoke } from "@tauri-apps/api/core";
7379
import { NButton, NSpin, NCard, NTag, NTabs, NTabPane, NTable } from 'naive-ui'
7480
import { listen } from '@tauri-apps/api/event'
7581
import GlobalProgress from "./../GlobalProgress.vue";
76-
82+
import { useWizardStore } from '../../store'
7783
7884
export default {
7985
name: 'InstalationProgress',
@@ -96,14 +102,25 @@ export default {
96102
progressDisplay_progress: true,
97103
instalation_running: false,
98104
instalation_finished: false,
105+
instalation_failed: false,
106+
error_message: "",
99107
curently_installing_version: undefined,
100108
versions_finished: [],
101109
versions_failed: [],
102110
}),
103111
methods: {
112+
goHome: function () {
113+
this.store.setStep(1);
114+
this.$router.push('/');
115+
},
104116
startInstalation: async function () {
105117
this.instalation_running = true;
106-
const _ = await invoke("start_installation", {});
118+
try {
119+
const _ = await invoke("start_installation", {});
120+
} catch (e) {
121+
console.error('Error during installation:', e);
122+
this.error_message = e;
123+
}
107124
this.instalation_running = false;
108125
this.instalation_finished = true;
109126
},
@@ -136,13 +153,16 @@ export default {
136153
break;
137154
case 'error':
138155
this.tools[this.curently_installing_version][event.payload.tool].error = true;
139-
156+
this.instalation_running = false;
157+
this.instalation_failed = true;
140158
break;
141159
case 'download_verified':
142160
this.tools[this.curently_installing_version][event.payload.tool].verified = true;
143161
break;
144162
case 'download_verification_failed':
145163
this.tools[this.curently_installing_version][event.payload.tool].verified = false;
164+
this.instalation_running = false;
165+
this.instalation_failed = true;
146166
break;
147167
default:
148168
console.warn('Unknown action:', event.payload.action);
@@ -186,8 +206,14 @@ export default {
186206
this.os = await invoke("get_operating_system", {});;
187207
return false;
188208
},
209+
get_logs_path: async function () {
210+
this.LogPath = await invoke("get_logs_folder", {});;
211+
}
189212
},
190213
computed: {
214+
store() {
215+
return useWizardStore()
216+
},
191217
idf_versions() {
192218
return this.all_settings ? this.all_settings.idf_versions : [];
193219
},
@@ -200,6 +226,7 @@ export default {
200226
this.get_settings();
201227
this.startListening();
202228
this.startListeningToInstalationProgress();
229+
this.get_logs_path();
203230
},
204231
beforeDestroy() {
205232
if (this.unlisten) this.unlisten();
@@ -340,4 +367,10 @@ tr>td:first-child {
340367
margin-top: 6px;
341368
margin-right: 6px;
342369
}
370+
371+
.error-message {
372+
margin-top: 1rem;
373+
border: 1px dotted #E8362D;
374+
padding: 1rem;
375+
}
343376
</style>

0 commit comments

Comments
 (0)