-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Main benefit is that emitted errors no longer need to bubble all the way to the App.vue to get shown. This should prevent situations where refactoring components distrupts the emit chain and leaves the error unshown - Refactors the modal to a single standalone component - Fixes the odd naming where R2Error's "name" was stored in variable called "message", and "message" was stored in "stack" variable - Unifies some logged messages from "name\n-> message" format to "[name]: message" format
- Loading branch information
Showing
16 changed files
with
181 additions
and
175 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
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
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,55 @@ | ||
<script lang="ts"> | ||
import { Component, Vue } from "vue-property-decorator"; | ||
import R2Error from "../../model/errors/R2Error"; | ||
@Component | ||
export default class ErrorModal extends Vue { | ||
get error(): R2Error | null { | ||
return this.$store.state.modals.errorModalError; | ||
} | ||
get isOpen(): boolean { | ||
return this.$store.state.modals.isErrorModalOpen && this.error !== null; | ||
} | ||
get name() { | ||
return this.error ? this.error.name : ''; | ||
} | ||
get message() { | ||
return this.error ? this.error.message : ''; | ||
} | ||
get solution() { | ||
return this.error ? this.error.solution : ''; | ||
} | ||
close() { | ||
this.$store.commit('closeErrorModal'); | ||
} | ||
} | ||
</script> | ||
|
||
<template> | ||
<div v-if="isOpen" id="errorModal" class="modal z-top is-active"> | ||
<div class="modal-background" @click="close"></div> | ||
<div class="modal-content"> | ||
<div class="notification is-danger"> | ||
<h3 class="title">Error</h3> | ||
<h5 class="title is-5">{{name}}</h5> | ||
<p>{{message}}</p> | ||
<div v-if="solution"> | ||
<h5 class="title is-5">Suggestion</h5> | ||
<p>{{solution}}</p> | ||
</div> | ||
</div> | ||
</div> | ||
<button class="modal-close is-large" aria-label="close" @click="close"></button> | ||
</div> | ||
</template> | ||
|
||
<style scoped lang="scss"> | ||
p + div { | ||
margin-top: 1.5rem; | ||
} | ||
</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
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
Oops, something went wrong.