-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(gui): add download tracking interface on bot launch
fix(astor): bad struct field access on msg listening
- Loading branch information
Showing
5 changed files
with
224 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
resources/static/vue-igopher/src/components/DownloadTracking.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<template> | ||
<div | ||
class="modal fade" | ||
id="dlModal" | ||
tabindex="-1" | ||
aria-labelledby="dlModalLabel" | ||
aria-hidden="true" | ||
> | ||
<div class="modal-dialog modal-dialog-centered" style="width: 40vw; height: 50vw;"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<h5 class="modal-title" id="dlModalLabel">Dependencies Manager</h5> | ||
</div> | ||
<div class="modal-body text-center align-middle"> | ||
Downloading required dependencies, please wait... | ||
<hr> | ||
<div | ||
class="row my-2 px-1" | ||
v-for="(dl, filename) in downloadTracking" | ||
:key="filename" | ||
> | ||
<div class="col-3" style="font-size: 12px"> | ||
{{ filename }} | ||
</div> | ||
<div class="col-9 ps-2"> | ||
<div class="progress" style="height: 20px;"> | ||
<div | ||
:id="'bar-' + filename" | ||
class="progress-bar progress-bar-striped progress-bar-animated" | ||
role="progressbar" | ||
style="width: 0%;" | ||
:aria-valuenow="dl.progress" | ||
aria-valuemin="0" | ||
aria-valuemax="100" | ||
> | ||
{{ dl.progress }}% | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { Vue, Options } from "vue-class-component"; | ||
import { inject } from "vue"; | ||
import { Astor } from "../plugins/astilectron"; | ||
import { bootstrap } from "@/config"; | ||
@Options({ | ||
data() { | ||
return { | ||
astor: Astor, | ||
dlmodal: {}, | ||
downloadTracking: {}, | ||
}; | ||
}, | ||
methods: { | ||
updateProgress(payload: any) { | ||
this.downloadTracking = payload.payload; | ||
for (const key in this.downloadTracking) { | ||
const progress = Math.floor(this.downloadTracking[key].Progress); | ||
const bar = document.getElementById("bar-" + key); | ||
bar.setAttribute("aria-valuenow", "" + progress); | ||
bar.style.width = progress + "%"; | ||
bar.innerHTML = progress + "%"; | ||
} | ||
}, | ||
closeModal() { | ||
this.dlModal.toggle(); | ||
this.dlModal.dispose(); | ||
this.astor.remove("downloads tracking", this.updateProgress); | ||
this.$emit("done"); | ||
}, | ||
}, | ||
mounted() { | ||
this.astor = inject("astor"); | ||
this.astor.listen( | ||
"downloads tracking", | ||
this.updateProgress.bind(this), | ||
false | ||
); | ||
this.astor.listen("downloads done", this.closeModal.bind(this), true); | ||
this.dlModal = new bootstrap.Modal(document.getElementById("dlModal"), { | ||
backdrop: "static", | ||
keyboard: false, | ||
}); | ||
this.dlModal.toggle(); | ||
}, | ||
}) | ||
export default class DownloadTracking extends Vue {} | ||
</script> | ||
|
||
<style></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters