This repository has been archived by the owner on Aug 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 89
Add frontend settings page for configuration file extension #55
Closed
ritesh-pandey
wants to merge
6
commits into
ezaquarii:master
from
ritesh-pandey:add-config-file-extension-setting
Closed
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c6855e9
Add frontend settings page for configuration file extension
ritesh-pandey 82d4e18
Add config extension in download URL
ritesh-pandey 8fabc87
:art: Populate config file extension choices from API
ritesh-pandey 4bb2092
:fire: Removed commented lines
ritesh-pandey 797b476
:art: Improved config file extension choices API
ritesh-pandey 4bd6f51
:sparkles: Separate setting for client and server config file extension
ritesh-pandey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
backend/vpnathome/apps/management/migrations/0006_settings_config_file_extension.py
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,18 @@ | ||
# Generated by Django 2.2.4 on 2019-10-14 13:33 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('management', '0005_blocklisturl_last_updated'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='settings', | ||
name='config_file_extension', | ||
field=models.CharField(choices=[('ovpn', 'OVPN'), ('conf', 'CONF')], default='ovpn', max_length=10), | ||
), | ||
] |
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
55 changes: 55 additions & 0 deletions
55
frontend/src/components/settings/ConfigFileExtensionSettings.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,55 @@ | ||
<template> | ||
<form class="ui form" @submit.prevent="handleSubmit"> | ||
<div class="content"> | ||
<!-- TODO Remove hardcoding of available extensions --> | ||
<div class="field"> | ||
<div class="ui radio checkbox"> | ||
<input id="ovpn" v-model="settings.config_file_extension" type="radio" value="ovpn"> | ||
<label for="ovpn">OVPN</label> | ||
</div> | ||
</div> | ||
<div class="field"> | ||
<div class="ui radio checkbox"> | ||
<input id="conf" v-model="settings.config_file_extension" type="radio" value="conf"> | ||
<label for="conf">CONF</label> | ||
</div> | ||
</div> | ||
<div class="field"> | ||
<button type="submit" class="ui button settings-button" role="button" @submit="{}">Save</button> | ||
</div> | ||
</div> | ||
</form> | ||
</template> | ||
|
||
<script> | ||
import { Component, Vue } from 'vue-property-decorator'; | ||
import NavigationBar from '@/components/NavigationBar.vue'; | ||
import _ from 'lodash'; | ||
|
||
@Component({ | ||
name: 'ConfigFileExtensionSettings', | ||
components: { | ||
NavigationBar | ||
} | ||
}) | ||
export default class ConfigFileExtensionSettings extends Vue { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd prefer to have a General settings page, where more misc options can be added in the future. Having a page |
||
|
||
settings = { | ||
config_file_extension: 'conf' | ||
}; | ||
|
||
handleSubmit () { | ||
this.$store.dispatch('setSettings', this.settings); | ||
} | ||
|
||
mounted () { | ||
this.settings.config_file_extension = _.cloneDeep(this.$store.state.settings.config_file_extension); | ||
} | ||
|
||
} | ||
|
||
</script> | ||
|
||
<style scoped lang="scss"> | ||
|
||
</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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we'd need 2 options: one for the client (which mostly expects ovpn), one for server (which mostly requires
conf
file, as this is whatsystemd
on Linux expects).I'd then default to
ovpn
on the client andconf
for the server.