+
Save
-
+
Delete
@@ -252,7 +259,7 @@ export default {
},
computed: {
- ...mapState('config', ['configID', 'netChoices', 'multiChannel']),
+ ...mapState('config', ['configID', 'netChoices']),
configGui: {
get () {
return this.$store.state.config.configGui
@@ -281,27 +288,24 @@ export default {
methods: {
addChannel () {
- const config = this.$_.cloneDeep(this.configGui)
- const newConf = this.$_.cloneDeep(this.configGui[this.configGui.length - 1])
+ const channels = this.$_.cloneDeep(this.configGui)
+ const newChannel = this.$_.cloneDeep(this.configGui[this.configGui.length - 1])
- const playoutConfigPath = newConf.playout_config.match(/.*\//)
- const playoutConfigFile = newConf.playout_config.replace(/(.*\/|\.yml)/g, '').split('-')
+ const playoutConfigPath = newChannel.config_path.match(/.*\//)
+ const confName = `channel${String(channels.length + 1).padStart(3, '0')}`
- const engineService = newConf.engine_service.split('-')
+ newChannel.id = channels.length + 1
+ newChannel.name = `Channel ${Math.random().toString(36).substring(7)}`
+ newChannel.config_path = `${playoutConfigPath}${confName}.yml`
+ newChannel.service = `ffplayout@${confName}.service`
- newConf.id = config.length + 1
- newConf.channel = `Channel ${Math.random().toString(36).substring(7)}`
- newConf.playout_config = `${playoutConfigPath}${playoutConfigFile[0]}-${String(parseInt(playoutConfigFile[1]) + 1).padStart(3, '0')}.yml`
- newConf.engine_service = `${engineService[0]}-${String(parseInt(engineService[1]) + 1).padStart(3, '0')}`
+ channels.push(newChannel)
- config.push(newConf)
-
- this.$store.commit('config/UPDATE_GUI_CONFIG', config)
+ this.$store.commit('config/UPDATE_GUI_CONFIG', channels)
this.$store.commit('config/UPDATE_CONFIG_ID', this.configGui.length - 1)
},
async onSubmitGui (evt) {
evt.preventDefault()
- await this.$store.dispatch('auth/inspectToken')
const update = await this.$store.dispatch('config/setGuiConfig', this.configGui[this.configID])
if (update.status === 200 || update.status === 201) {
@@ -324,7 +328,7 @@ export default {
this.showAlert = true
return
}
- const response = await this.$axios.delete(`api/player/guisettings/${id}/`)
+ const response = await this.$axios.delete(`api/channel/${id}`)
config.splice(this.configID, 1)
@@ -332,7 +336,7 @@ export default {
this.$store.commit('config/UPDATE_CONFIG_ID', this.configGui.length - 1)
await this.$store.dispatch('config/getPlayoutConfig')
- if (response.status === 204) {
+ if (response.status === 200) {
this.alertVariant = 'success'
this.alertMsg = 'Delete GUI config success!'
} else {
@@ -367,10 +371,10 @@ export default {
if (update.status === 200) {
this.alertVariant = 'success'
- this.alertMsg = 'Update user profil success!'
+ this.alertMsg = 'Update user profile success!'
} else {
this.alertVariant = 'danger'
- this.alertMsg = 'Update user profil failed!'
+ this.alertMsg = 'Update user profile failed!'
}
this.showAlert = true
diff --git a/store/config.js b/store/config.js
index f8d22845..06482e17 100644
--- a/store/config.js
+++ b/store/config.js
@@ -10,8 +10,7 @@ export const state = () => ({
configPlayout: {},
currentUser: null,
configUser: null,
- timezone: 'UTC',
- multiChannel: false
+ timezone: 'UTC'
})
export const mutations = {
@@ -58,7 +57,7 @@ export const actions = {
},
async getGuiConfig ({ commit, state }) {
- const response = await this.$axios.get('api/settings')
+ const response = await this.$axios.get('api/channels')
if (response.data) {
for (const data of response.data) {
@@ -90,13 +89,13 @@ export const actions = {
let response
if (state.configGuiRaw.some(e => e.id === stringObj.id)) {
- response = await this.$axios.patch(`api/settings/${obj.id}`, stringObj)
+ response = await this.$axios.patch(`api/channel/${obj.id}`, stringObj)
} else {
- response = await this.$axios.post('api/settings/', stringObj)
+ response = await this.$axios.post('api/channel/', stringObj)
const guiConfigs = []
for (const obj of state.configGui) {
- if (obj.channel === stringObj.channel) {
+ if (obj.name === stringObj.name) {
response.data.extra_extensions = response.data.extra_extensions.split(',')
guiConfigs.push(response.data)
} else {