Skip to content

Allow hiding the HTTPS and hotkey messages in FunctionTop.vue #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
22 changes: 18 additions & 4 deletions src/components/FunctionTop.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<template>
<div class="row functionTop">
<div class="col-sm-12">
<div class="alert alert-warning" v-if="!isHTTPS">
<div class="alert alert-warning" v-if="showHTTPSWarning">
Your connection is not secure.
Please go to <a :href="url">{{url}}</a>
<button type="button" class="close pull-right" @click="hideHTTPSWarning">&times;</button>
</div>
<div class="alert alert-default">
<div class="alert alert-default" v-if="showHotkeyTips">
Preview is <kbd>{{winKey}}</kbd> or <kbd>{{macKey}}</kbd> . Snippets are <kbd>{{snippetWinKey}}</kbd> or <kbd>{{snippetMacKey}}</kbd> .
<button type="button" class="close pull-right" @click="hideHotkeyTips">&times;</button>
</div>
<div class="row form-group">
<div class="col-sm-12">
Expand All @@ -28,8 +31,11 @@ export default {
Parameters
},
computed: {
isHTTPS (): boolean {
return this.$store.state.plantumlEditor.isHTTPS
showHTTPSWarning (): boolean {
return (!this.$store.state.plantumlEditor.isHTTPS && this.$store.state.plantumlEditor.showHTTPSWarning)
},
showHotkeyTips (): boolean {
return this.$store.state.plantumlEditor.showHotkeyTips
},
url (): string {
return this.$store.state.plantumlEditor.url
Expand All @@ -42,6 +48,14 @@ export default {
snippetWinKey: this.$store.state.plantumlEditor.snippetKey.win,
snippetMacKey: this.$store.state.plantumlEditor.snippetKey.mac
}
},
methods: {
hideHTTPSWarning () {
this.$store.commit('plantumlEditor/setShowHTTPSWarning', false)
},
hideHotkeyTips () {
this.$store.commit('plantumlEditor/setShowHotkeyTips', false)
}
}
}
</script>
Expand Down
10 changes: 9 additions & 1 deletion src/store/modules/PlantumlEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ const state: any = {
snippetKey: {
'win': 'Ctrl-E',
'mac': 'Cmd-E'
}
},
showHTTPSWarning: true,
showHotkeyTips: true
}

const getters: any = {
Expand Down Expand Up @@ -166,6 +168,12 @@ const mutations: any = {
},
setIsLoading (state: any, isLoading: boolean) {
state.isLoading = isLoading
},
setShowHTTPSWarning (state: any, show: boolean) {
state.showHTTPSWarning = show
},
setShowHotkeyTips (state: any, show: boolean) {
state.showHotkeyTips = show
}
}

Expand Down