-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Started working on remote poll toggling. * Daughter woke up. * Returning error in case API calls need correct values. * Setting poller to false. * Using a non-blocking send. * Skeleton for using toggle switch. * Skeleton for separate settings view. * Working poller button... though ugly as hell. * settings set on mount. * Fixed settings mount. * Polling enalbing / disabling is working now correctly. And mounted button shows correct status. * Using a different style toggle button. * Removed bulma-switch * A vague table. * Working vue good table!!!! * First bunch of tests. * Increased coverage and added ticket tests as well. * Uh... * This is not pretty. * Looking a bit better. * Using proper db and added a test. * Error handling and added tests. * Creating bucket and naming the object properly.
- Loading branch information
1 parent
519a2be
commit 56d9c03
Showing
12 changed files
with
781 additions
and
28 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
153 changes: 153 additions & 0 deletions
153
frontend/client/views/settings/settings/manage-settings.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,153 @@ | ||
<template> | ||
<div class="tile is-vertical"> | ||
<div class="tile is-parent"> | ||
<article class="tile is-child notification content-article box"> | ||
<div class="tile is-parent"> | ||
<article class="tile is-child notification content-article box"> | ||
<vue-good-table | ||
:columns="settingColumns" | ||
:rows="settingRows" | ||
:paginate="true" | ||
:global-search="true" | ||
:defaultSortBy="{field: 'name', type: 'desc'}" | ||
globalSearchPlaceholder="Search ..." | ||
styleClass="table table-grid table-own-bordered"> | ||
<template slot="table-row" slot-scope="props"> | ||
<td> | ||
<span>{{ props.row.display_name }}</span> | ||
</td> | ||
<td v-tippy="{ arrow : true, animation : 'shift-away'}"> | ||
<toggle-button | ||
v-model="props.row.display_value" | ||
id="pollertoggle" | ||
:color="{checked: '#7DCE94', unchecked: '#82C7EB'}" | ||
:labels="{checked: 'On', unchecked: 'Off'}" | ||
@change="settingsTogglePollerSwitch" | ||
:sync="true"/> | ||
</td> | ||
</template> | ||
<div slot="emptystate" class="empty-table-text"> | ||
No settings found. | ||
</div> | ||
</vue-good-table> | ||
</article> | ||
</div> | ||
</article> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import Vue from 'vue' | ||
import { ToggleButton } from 'vue-js-toggle-button' | ||
import {TabPane, Tabs} from 'vue-bulma-tabs' | ||
import VueGoodTable from 'vue-good-table' | ||
import VueTippy from 'vue-tippy' | ||
import Notification from 'vue-bulma-notification-fixed' | ||
const NotificationComponent = Vue.extend(Notification) | ||
const openNotification = (propsData = { | ||
title: '', | ||
message: '', | ||
type: '', | ||
direction: '', | ||
duration: 4500, | ||
container: '.notifications' | ||
}) => { | ||
return new NotificationComponent({ | ||
el: document.createElement('div'), | ||
propsData | ||
}) | ||
} | ||
Vue.use(VueGoodTable) | ||
Vue.use(VueTippy) | ||
export default { | ||
name: 'manage-settings', | ||
components: {Tabs, TabPane, ToggleButton}, | ||
data () { | ||
return { | ||
settingsTogglePollerValue: false, | ||
settingColumns: [ | ||
{ | ||
label: 'Name', | ||
field: 'display_name' | ||
}, | ||
{ | ||
label: 'Value', | ||
field: 'display_value' | ||
} | ||
], | ||
settingRows: [] | ||
} | ||
}, | ||
mounted () { | ||
this.setSettings() | ||
}, | ||
methods: { | ||
settingsTogglePollerSwitch (val) { | ||
if (val.value) { | ||
this.$http | ||
.post('/api/v1/settings/poll/on') | ||
.then(response => { | ||
openNotification({ | ||
title: 'Poll turned on!', | ||
message: 'Polling has been enabled.', | ||
type: 'success' | ||
}) | ||
}) | ||
.catch((error) => { | ||
this.$onError(error) | ||
}) | ||
} else { | ||
this.$http | ||
.post('/api/v1/settings/poll/off') | ||
.then(response => { | ||
openNotification({ | ||
title: 'Poll turned off!', | ||
message: 'Polling has been disabled.', | ||
type: 'success' | ||
}) | ||
}) | ||
.catch((error) => { | ||
this.$onError(error) | ||
}) | ||
} | ||
}, | ||
setSettings () { | ||
this.$http | ||
.get('/api/v1/settings/poll', {showProgressBar: false}) | ||
.then(response => { | ||
this.settingRows = [{ | ||
display_name: 'Polling', | ||
display_value: response.data.Status | ||
}] | ||
}) | ||
.catch((error) => { | ||
this.$onError(error) | ||
}) | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
.settings-row { | ||
cursor: pointer; | ||
} | ||
.table-general { | ||
background: #413F4A; | ||
border: 2px solid #000; | ||
} | ||
.table-general th { | ||
color: #4da2fc; | ||
} | ||
.table-general td { | ||
border: 2px solid #000; | ||
color: #8c91a0; | ||
} | ||
.table-settings td:hover { | ||
background: #575463; | ||
cursor: pointer; | ||
} | ||
</style> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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.