mirror of
https://github.com/r4sas/recastin-panel
synced 2025-09-03 17:32:32 +00:00
Use vue shorthand for events, bind save on form instead button
This commit is contained in:
parent
b98555fcc2
commit
198dd6e4ad
@ -19,7 +19,7 @@
|
|||||||
<a href="#/ucp/settings" class="nav-link">
|
<a href="#/ucp/settings" class="nav-link">
|
||||||
Account Settings
|
Account Settings
|
||||||
</a>
|
</a>
|
||||||
<a href="#" v-on:click="logout" class="nav-link">
|
<a href="#" @click="logout" class="nav-link">
|
||||||
Log out
|
Log out
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -7,35 +7,37 @@
|
|||||||
<h4 v-if="$route.params.id != 'add'">Edit "{{ endpoint.name }}"</h4>
|
<h4 v-if="$route.params.id != 'add'">Edit "{{ endpoint.name }}"</h4>
|
||||||
|
|
||||||
<card>
|
<card>
|
||||||
<fg-input label="Name" v-model="endpoint.name"></fg-input>
|
<form @submit="save">
|
||||||
|
<fg-input label="Name" v-model="endpoint.name"></fg-input>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<p-checkbox v-model="endpoint.active">Active</p-checkbox>
|
<p-checkbox v-model="endpoint.active">Active</p-checkbox>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label">
|
<label class="control-label">
|
||||||
Type
|
Type
|
||||||
</label>
|
</label>
|
||||||
<select class="form-control" v-model="endpoint.type">
|
<select class="form-control" v-model="endpoint.type">
|
||||||
<option v-for="name in serviceNames" :value="name">{{name}}</option>
|
<option v-for="name in serviceNames" :value="name">{{name}}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group" v-if="serverData.length">
|
<div class="form-group" v-if="serverData.length">
|
||||||
<label class="control-label">
|
<label class="control-label">
|
||||||
Server
|
Server
|
||||||
</label>
|
</label>
|
||||||
<select class="form-control" v-model="endpoint.server">
|
<select class="form-control" v-model="endpoint.server">
|
||||||
<option v-for="server in serverData" :value="server.value">{{server.name}}</option>
|
<option v-for="server in serverData" :value="server.value">{{server.name}}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<fg-input label="Server" v-model="endpoint.server" v-if="!serverData.length"></fg-input>
|
<fg-input label="Server" v-model="endpoint.server" v-if="!serverData.length"></fg-input>
|
||||||
|
|
||||||
<fg-input label="Stream-Key" v-model="endpoint.streamKey"></fg-input>
|
<fg-input label="Stream-Key" v-model="endpoint.streamKey"></fg-input>
|
||||||
|
|
||||||
<button class="btn btn-primary" v-on:click="save">Save</button>
|
<button class="btn btn-primary">Save</button>
|
||||||
|
</form>
|
||||||
</card>
|
</card>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -77,7 +79,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
save: function () {
|
save: function (e) {
|
||||||
|
e.preventDefault();
|
||||||
this.axios.post('/streams/' + this.$route.params.streamId + '/endpoints/update', this.endpoint).then(() => {
|
this.axios.post('/streams/' + this.$route.params.streamId + '/endpoints/update', this.endpoint).then(() => {
|
||||||
this.$router.push('/ucp/streams/' + this.$route.params.streamId + '/');
|
this.$router.push('/ucp/streams/' + this.$route.params.streamId + '/');
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
@ -6,22 +6,25 @@
|
|||||||
|
|
||||||
<div class="alert alert-danger" v-if="authFailed">Bad credentials</div>
|
<div class="alert alert-danger" v-if="authFailed">Bad credentials</div>
|
||||||
|
|
||||||
<fg-input type="text"
|
|
||||||
label="Username"
|
|
||||||
placeholder="Username"
|
|
||||||
v-model="login._username">
|
|
||||||
</fg-input>
|
|
||||||
|
|
||||||
<div class="form-group">
|
<form @submit="onLogin">
|
||||||
<label class="control-label">Password</label>
|
<fg-input type="text"
|
||||||
<input type="password" class="form-control" placeholder="Password" v-model="login._password">
|
label="Username"
|
||||||
</div>
|
placeholder="Username"
|
||||||
|
v-model="login._username">
|
||||||
|
</fg-input>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<p-checkbox v-model="rememberMe">Remember Me</p-checkbox>
|
<label class="control-label">Password</label>
|
||||||
</div>
|
<input type="password" class="form-control" placeholder="Password" v-model="login._password">
|
||||||
|
</div>
|
||||||
|
|
||||||
<button class="btn btn-primary" v-on:click="onLogin">Login</button>
|
<div class="form-group">
|
||||||
|
<p-checkbox v-model="rememberMe">Remember Me</p-checkbox>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button class="btn btn-primary">Login</button>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -45,7 +48,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onLogin: function () {
|
onLogin: function (e) {
|
||||||
|
e.preventDefault();
|
||||||
let bodyFormData = new FormData();
|
let bodyFormData = new FormData();
|
||||||
bodyFormData.set('_username', this.login._username);
|
bodyFormData.set('_username', this.login._username);
|
||||||
bodyFormData.set('_password', this.login._password);
|
bodyFormData.set('_password', this.login._password);
|
||||||
|
@ -7,12 +7,14 @@
|
|||||||
<h4 v-if="$route.params.id != 'add'">Edit "{{ stream.name }}"</h4>
|
<h4 v-if="$route.params.id != 'add'">Edit "{{ stream.name }}"</h4>
|
||||||
|
|
||||||
<card>
|
<card>
|
||||||
<fg-input label="Name" v-model="stream.name"></fg-input>
|
<form @submit="save">
|
||||||
<div class="form-group">
|
<fg-input label="Name" v-model="stream.name"></fg-input>
|
||||||
<p-checkbox v-model="stream.active">Active</p-checkbox>
|
<div class="form-group">
|
||||||
</div>
|
<p-checkbox v-model="stream.active">Active</p-checkbox>
|
||||||
|
</div>
|
||||||
|
|
||||||
<button class="btn btn-primary" v-on:click="save">Save</button>
|
<button class="btn btn-primary">Save</button>
|
||||||
|
</form>
|
||||||
</card>
|
</card>
|
||||||
|
|
||||||
<div v-if="this.$route.params.id !== 'add'">
|
<div v-if="this.$route.params.id !== 'add'">
|
||||||
@ -39,8 +41,8 @@
|
|||||||
<td>{{ endpoint.server }}</td>
|
<td>{{ endpoint.server }}</td>
|
||||||
<td>
|
<td>
|
||||||
<a :href="'#/ucp/streams/' + $route.params.id + '/endpoints/' + endpoint.id" class="btn btn-secondary">Edit</a>
|
<a :href="'#/ucp/streams/' + $route.params.id + '/endpoints/' + endpoint.id" class="btn btn-secondary">Edit</a>
|
||||||
<a v-on:click="toggleEndpoint(endpoint)" class="btn btn-info">{{ endpoint.active ? 'Disable' : 'Enable' }}</a>
|
<a @click="toggleEndpoint(endpoint)" class="btn btn-info">{{ endpoint.active ? 'Disable' : 'Enable' }}</a>
|
||||||
<a v-on:click="deleteEndpoint(endpoint)" class="btn btn-danger">Delete</a>
|
<a @click="deleteEndpoint(endpoint)" class="btn btn-danger">Delete</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -81,7 +83,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
save: function () {
|
save: function (e) {
|
||||||
|
e.preventDefault();
|
||||||
this.axios.post('/streams/update', this.stream).then(() => {
|
this.axios.post('/streams/update', this.stream).then(() => {
|
||||||
this.$router.push('/ucp/streams/');
|
this.$router.push('/ucp/streams/');
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
<td>
|
<td>
|
||||||
<a :href="'#/ucp/streams/' + stream.id + '/setup'" class="btn btn-info">Setup</a>
|
<a :href="'#/ucp/streams/' + stream.id + '/setup'" class="btn btn-info">Setup</a>
|
||||||
<a :href="'#/ucp/streams/' + stream.id + '/'" class="btn btn-secondary">Edit</a>
|
<a :href="'#/ucp/streams/' + stream.id + '/'" class="btn btn-secondary">Edit</a>
|
||||||
<a v-on:click="regenerateKey(stream)" class="btn btn-danger">Regenerate Stream Key</a>
|
<a @click="regenerateKey(stream)" class="btn btn-danger">Regenerate Stream Key</a>
|
||||||
<a v-on:click="deleteStream(stream)" class="btn btn-danger">Delete</a>
|
<a @click="deleteStream(stream)" class="btn btn-danger">Delete</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -38,7 +38,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -75,10 +74,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
.text-right {
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user