-
-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use AppDialog in UpdatingDialog
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
- Loading branch information
1 parent
cbe4307
commit 4d76edb
Showing
4 changed files
with
54 additions
and
66 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,88 +1,73 @@ | ||
<template> | ||
<v-dialog | ||
:value="showDialog" | ||
<app-dialog | ||
v-model="open" | ||
:title="updating ? $t('app.version.status.updating') : $t('app.version.status.finished')" | ||
:loading="updating" | ||
:close-button-disabled="updating" | ||
max-width="650" | ||
persistent | ||
> | ||
<v-card :loading="(updating) ? 'primary' : false"> | ||
<v-card-title> | ||
<span class="headline">{{ title }}</span> | ||
</v-card-title> | ||
<v-card-text> | ||
<console | ||
:items="responses" | ||
key-field="id" | ||
:height="250" | ||
readonly | ||
/> | ||
</v-card-text> | ||
<v-card-actions> | ||
<v-spacer /> | ||
<slot name="actions"> | ||
<app-btn | ||
color="primary" | ||
text | ||
:disabled="updating" | ||
@click="close" | ||
> | ||
{{ buttonTitle }} | ||
</app-btn> | ||
</slot> | ||
</v-card-actions> | ||
</v-card> | ||
</v-dialog> | ||
<v-card-text> | ||
<console | ||
:items="responses" | ||
:fullscreen="isMobileViewport" | ||
:height="250" | ||
readonly | ||
/> | ||
</v-card-text> | ||
|
||
<template #actions> | ||
<v-spacer /> | ||
|
||
<app-btn | ||
color="primary" | ||
text | ||
:disabled="updating" | ||
@click="open = false" | ||
> | ||
{{ updating ? $t('app.version.status.updating') : $t('app.version.btn.finish') }} | ||
</app-btn> | ||
</template> | ||
</app-dialog> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { Component, Mixins } from 'vue-property-decorator' | ||
import StateMixin from '@/mixins/state' | ||
import Console from '@/components/widgets/console/Console.vue' | ||
import BrowserMixin from '@/mixins/browser' | ||
@Component({ | ||
components: { | ||
Console | ||
} | ||
}) | ||
export default class UpdatingDialog extends Mixins(StateMixin) { | ||
export default class UpdatingDialog extends Mixins(StateMixin, BrowserMixin) { | ||
invokedDialog = false | ||
get showDialog () { | ||
if ( | ||
this.invokedDialog === true || | ||
this.$store.state.version.busy | ||
) { | ||
get open (): boolean { | ||
if (this.invokedDialog || this.updating) { | ||
this.invokedDialog = true | ||
return true | ||
} | ||
return false | ||
} | ||
get updating () { | ||
return this.$store.state.version.busy | ||
return false | ||
} | ||
get title () { | ||
if (this.updating) { | ||
return this.$t('app.version.status.updating') | ||
} else { | ||
return this.$t('app.version.status.finished') | ||
set open (value: boolean) { | ||
if (!value) { | ||
this.invokedDialog = false | ||
this.$store.commit('version/setClearUpdateResponse') | ||
} | ||
} | ||
get buttonTitle () { | ||
if (this.updating) { | ||
return this.$t('app.version.status.updating') | ||
} else { | ||
return this.$t('app.version.btn.finish') | ||
} | ||
get updating () { | ||
return this.$store.state.version.busy | ||
} | ||
get responses () { | ||
return this.$store.getters['version/getResponses'] | ||
} | ||
close () { | ||
this.invokedDialog = false | ||
this.$store.commit('version/setClearUpdateResponse') | ||
} | ||
} | ||
</script> |
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