@@ -178,12 +179,39 @@
deviceModel() {
return {
id: this.changes.id,
- station_name: this.changes.stationName
+ station_name: this.changes.stationName,
+ identifier: this.device.identifier
}
},
stationNameHasChanges() {
return this.stationName !== this.changes.stationName;
- }
+ },
+ identifierHasChanges() {
+ return this.device.identifier !== this.changes.identifier;
+ },
+ identifierButtons() {
+ let buttons = [];
+ let self = this;
+ if(this.identifierHasChanges) {
+ buttons.push({
+ icon: 'check',
+ error: false,
+ handler (event) {
+ event.stopPropagation();
+ self.saveIdentifier();
+ }
+ }, {
+ icon: 'clear',
+ error: false,
+ handler (event) {
+ event.stopPropagation();
+ self.resetIdentifier();
+ }
+ }
+ );
+ }
+ return buttons;
+ },
},
mounted() {
this.$emit('loaded');
@@ -207,7 +235,8 @@
getDevice() {
return {
id: this.device.id,
- stationName: this.device.station_name
+ stationName: this.device.station_name,
+ identifier: this.device.identifier
}
},
resetStationName() {
@@ -215,6 +244,12 @@
},
saveStationName() {
this.$emit('save-station-name', this.deviceModel);
+ },
+ resetIdentifier() {
+ this.changes.identifier = this.device.identifier;
+ },
+ saveIdentifier() {
+ this.$emit('save-identifier', this.deviceModel);
}
},
watch: {
diff --git a/src/components/pages/PbxConfiguration/CscPbxDevices.vue b/src/components/pages/PbxConfiguration/CscPbxDevices.vue
index 0cccab26..12900fe4 100644
--- a/src/components/pages/PbxConfiguration/CscPbxDevices.vue
+++ b/src/components/pages/PbxConfiguration/CscPbxDevices.vue
@@ -26,7 +26,8 @@
:label="$t('pbxConfig.filterPhoneModel')"
@opened="modelSelectOpened()"
@select="filterByProfile"
- @reseted="resetFilter" />
+ @reseted="resetFilter"
+ />
{
context.commit('updateStationNameFailed', err.message);
});
+ },
+ setIdentifier(context, device) {
+ context.commit('updateIdentifierRequesting', device);
+ setIdentifier(device.id, device.identifier).then(() => {
+ context.commit('updateIdentifierSucceeded');
+ context.dispatch('loadDevice', device.id);
+ }).catch((err) => {
+ context.commit('updateIdentifierFailed', err.message);
+ });
}
}
diff --git a/src/store/pbx-config/getters.js b/src/store/pbx-config/getters.js
index 3fb1c6ce..3f7e06e5 100644
--- a/src/store/pbx-config/getters.js
+++ b/src/store/pbx-config/getters.js
@@ -264,5 +264,8 @@ export default {
},
updatedDeviceError(state) {
return state.updatedDeviceError;
+ },
+ updatedDeviceProperty(state) {
+ return state.updatedDeviceProperty;
}
}
diff --git a/src/store/pbx-config/mutations.js b/src/store/pbx-config/mutations.js
index f9a74d1e..6c9f9eaa 100644
--- a/src/store/pbx-config/mutations.js
+++ b/src/store/pbx-config/mutations.js
@@ -5,6 +5,23 @@ import _ from 'lodash'
import { RequestState } from '../common'
import { reactiveSet } from '../../helpers/store-helper'
+function updateDevicePropertyRequesting(state, deviceId, property) {
+ state.updatedDevice = deviceId;
+ state.updatedDeviceState = RequestState.requesting;
+ state.updatedDeviceError = null;
+ state.updatedDeviceProperty = property;
+}
+
+function updateDevicePropertySucceeded(state) {
+ state.updatedDeviceState = RequestState.succeeded;
+ state.updatedDeviceError = null;
+}
+
+function updateDevicePropertyFailed(state, error) {
+ state.updatedDeviceState = RequestState.failed;
+ state.updatedDeviceError = error;
+}
+
export default {
listRequesting(state, options) {
options = options || {};
@@ -287,16 +304,21 @@ export default {
state.listProfilesError = error;
},
updateStationNameRequesting(state, deviceId) {
- state.updatedDevice = deviceId;
- state.updatedDeviceState = RequestState.requesting;
- state.updatedDeviceError = null;
+ updateDevicePropertyRequesting(state, deviceId, 'station_name');
},
updateStationNameSucceeded(state) {
- state.updatedDeviceState = RequestState.succeeded;
- state.updatedDeviceError = null;
+ updateDevicePropertySucceeded(state);
},
updateStationNameFailed(state, error) {
- state.updatedDeviceState = RequestState.failed;
- state.updatedDeviceError = error;
+ updateDevicePropertyFailed(state, error);
+ },
+ updateIdentifierRequesting(state, deviceId) {
+ updateDevicePropertyRequesting(state, deviceId, 'identifier');
+ },
+ updateIdentifierSucceeded(state) {
+ updateDevicePropertySucceeded(state);
+ },
+ updateIdentifierFailed(state, error) {
+ updateDevicePropertyFailed(state, error);
}
}
diff --git a/src/store/pbx-config/state.js b/src/store/pbx-config/state.js
index e5418685..76bdb798 100644
--- a/src/store/pbx-config/state.js
+++ b/src/store/pbx-config/state.js
@@ -52,6 +52,7 @@ export default {
listProfilesState: RequestState.initiated,
listProfilesError: null,
updatedDevice: null,
+ updatedDeviceProperty: null,
updatedDeviceState: RequestState.initiated,
updatedDeviceError: null,
modelImageStates: {},