-
Key {{ selectedKeyIndex + 1 }}
+
+
+
+ {{ selectedKeySetName }} > Key {{ selectedKeyNumber }}
-
-
+
+
-
-
+
+
-
@@ -58,9 +122,7 @@
imageWidth: 0,
boundingBox: null,
scaledBoundingBox: null,
- modalOpened: false,
selectedKey: null,
- selectedKeyIndex: null,
selectedLine: null,
keyOverlayActive: false,
selectedKeyTypeData: null,
@@ -115,27 +177,45 @@
if(this.selectedLine !== null) {
return this.selectedLine.type;
}
- return 'private';
+ return _.get(this.typeOptions, '0.value', '');
},
set(type) {
this.selectedKeyTypeData = type;
}
},
+ selectedKeySetName() {
+ if(this.selectedKey !== null) {
+ return this.selectedKey.keySet.name;
+ }
+ return '';
+ },
+ selectedKeyNumber() {
+ if(this.selectedKey !== null) {
+ return (this.selectedKey.index + 1);
+ }
+ return '';
+ },
typeOptions() {
- return [
- {
- label: this.$t('pbxConfig.keyTypeShared'),
- value: 'shared'
- },
- {
+ let options = [];
+ if(this.selectedKey !== null && this.selectedKey.keySet.can_blf) {
+ options.push({
label: this.$t('pbxConfig.keyTypeBLF'),
value: 'blf'
- },
- {
+ });
+ }
+ if (this.selectedKey !== null && this.selectedKey.keySet.can_private) {
+ options.push({
label: this.$t('pbxConfig.keyTypePrivate'),
value: 'private'
- }
- ];
+ });
+ }
+ if (this.selectedKey !== null && this.selectedKey.keySet.can_shared) {
+ options.push({
+ label: this.$t('pbxConfig.keyTypeShared'),
+ value: 'shared'
+ });
+ }
+ return options;
},
isMobile() {
return Platform.is.mobile;
@@ -143,8 +223,24 @@
imageUrl() {
return _.get(this.device, 'profile.modelFrontImageUrl');
},
+ keySets() {
+ return _.get(this.device, 'profile.model.linerange', []);
+ },
keys() {
- return _.get(this.device, 'profile.model.linerange[0].keys', []);
+ let keys = [];
+ this.keySets.forEach(($keySet)=>{
+ let $keys = _.get($keySet, 'keys', []);
+ $keys.forEach(($key, $index)=>{
+ let key = _.clone($key);
+ key.keySet = $keySet;
+ key.index = $index;
+ keys.push(key);
+ });
+ });
+ return keys;
+ },
+ lines() {
+ return _.get(this.device, 'lines', []);
},
canvasStyles() {
return {
@@ -169,24 +265,12 @@
this.loadGroupsAndSeats();
},
methods: {
- getLineIndexByKey(keyIndex) {
- let lineIndex = null;
- let lines = _.get(this.device, 'lines', []);
- if(lines.length > 0) {
- lines.forEach(($line, index)=>{
- if($line.key_num === keyIndex) {
- lineIndex = index;
- }
- });
- }
- return lineIndex;
- },
getLineByKey(key) {
let line = null;
- this.device.lines.forEach(($line)=>{
- if($line.key_num === key) {
- line = $line;
-
+ this.lines.forEach(($line, $lineIndex)=>{
+ if($line.key_num === key.index && $line.linerange === key.keySet.name) {
+ line = _.clone($line);
+ line.index = $lineIndex;
}
});
return line;
@@ -282,19 +366,11 @@
}
return classes;
},
- subscriberChanged(subscriberId) {
- let clonedKey = _.clone(this.selectedKey);
- clonedKey.subscriber_id = subscriberId;
- this.$emit('keyChanged', {
- key: clonedKey,
- keyIndex: this.selectedKeyIndex
- });
- },
- openKeyOverlay(key, index) {
+ openKeyOverlay(key) {
this.selectedKey = key;
- this.selectedKeyIndex = index;
- this.selectedLine = this.getLineByKey(index);
+ this.selectedLine = this.getLineByKey(key);
this.keyOverlayActive = true;
+ this.$scrollTo(this.$parent.$el);
},
closeKeyOverlay() {
this.keyOverlayActive = false;
@@ -304,23 +380,24 @@
},
keySubscriberChanged(subscriberId) {
let newLines = [];
- let lines = _.clone(_.get(this.device, 'lines', []));
- let lineIndex = this.getLineIndexByKey(this.selectedKeyIndex);
+ let lines = _.clone(this.lines);
+ let line = this.getLineByKey(this.selectedKey);
+
let changed = false;
- if(_.isNumber(lineIndex) && lineIndex < lines.length && subscriberId === null) {
- delete lines[lineIndex];
+ if(line !== null && subscriberId === null) {
+ delete lines[line.index];
changed = true;
}
- else if(_.isNumber(lineIndex) && lineIndex < lines.length) {
- _.set(lines, lineIndex + '.subscriber_id', subscriberId);
+ else if(line !== null) {
+ _.set(lines, line.index + '.subscriber_id', subscriberId);
changed = true;
}
else if(subscriberId !== null) {
newLines.push({
extension_unit: 0,
- key_num: this.selectedKeyIndex,
+ key_num: this.selectedKey.index,
subscriber_id: subscriberId,
- linerange: _.get(this.device, 'profile.model.linerange.0.name'),
+ linerange: this.selectedKey.keySet.name,
type: this.$refs.selectType.value
});
changed = true;
@@ -340,14 +417,10 @@
},
keyTypeChanged(type) {
let newLines = [];
- let lines = _.clone(_.get(this.device, 'lines', []));
- let lineIndex = this.getLineIndexByKey(this.selectedKeyIndex);
- let changed = false;
- if(_.isNumber(lineIndex) && _.isObject(lines[lineIndex])) {
- _.set(lines, lineIndex + '.type', type);
- changed = true;
- }
- if(changed === true) {
+ let lines = _.clone(this.lines);
+ let line = this.getLineByKey(this.selectedKey);
+ if(line != null) {
+ _.set(lines, line.index + '.type', type);
lines.forEach((line)=>{
newLines.push({
extension_unit: line.extension_unit,
@@ -364,7 +437,7 @@
watch: {
device() {
if(this.keyOverlayActive) {
- this.selectedLine = this.getLineByKey(this.selectedKeyIndex);
+ this.selectedLine = this.getLineByKey(this.selectedKey);
}
}
}
diff --git a/src/components/pages/PbxConfiguration/CscPbxDevices.vue b/src/components/pages/PbxConfiguration/CscPbxDevices.vue
index b2532583..52ce900f 100644
--- a/src/components/pages/PbxConfiguration/CscPbxDevices.vue
+++ b/src/components/pages/PbxConfiguration/CscPbxDevices.vue
@@ -30,7 +30,7 @@
:label="$t('pbxConfig.filterPhoneModel')"
@opened="modelSelectOpened()"
@select="filterByProfile"
- @reseted="resetFilter"
+ @reseted="resetProfileFilter"
/>
{
let silent = _.get(options, 'silent', false);
- let page = _.get(options, 'page', 1);
- let profile_id = _.get(options, 'profile_id', null);
- context.commit('deviceListRequesting', {
- silent: silent,
- page: page
- });
+ context.commit('deviceListRequesting', silent);
getDeviceList({
- page: page,
- profile_id: profile_id
+ page: _.get(context, 'getters.listCurrentPage', 1),
+ profile_id: _.get(context, 'getters.listProfileFilter', null)
}).then((devices)=>{
context.commit('deviceListSucceeded', devices);
devices.items.forEach((device)=>{
@@ -265,7 +260,10 @@ export default {
context.commit('createDeviceRequesting', device);
createDevice(device).then(()=>{
context.commit('createDeviceSucceeded');
- context.dispatch('listDevices');
+ context.dispatch('listDevices', {
+ page: context.getters.listCurrentPage,
+ silent: true
+ });
}).catch((err)=>{
context.commit('createDeviceFailed', err.message);
});
@@ -274,7 +272,10 @@ export default {
context.commit('deviceRequesting', device.id);
removeDevice(device.id).then(()=>{
context.commit('deviceRemoved', device);
- context.dispatch('listDevices');
+ context.dispatch('listDevices', {
+ page: context.getters.listCurrentPage,
+ silent: true
+ });
}).catch((err)=>{
context.commit('deviceFailed', device.id, err.message);
});
@@ -330,5 +331,17 @@ export default {
}).catch((err) => {
context.commit('updateProfileFailed', err.message);
});
+ },
+ filterByProfile(context, profileId) {
+ context.commit('filterByProfile', profileId);
+ context.dispatch('listDevices');
+ },
+ resetProfileFilter(context) {
+ context.commit('resetProfileFilter');
+ context.dispatch('listDevices');
+ },
+ goToPage(context, page) {
+ context.commit('goToPage', page);
+ context.dispatch('listDevices');
}
}
diff --git a/src/store/pbx-config/getters.js b/src/store/pbx-config/getters.js
index 3f7e06e5..22f9619e 100644
--- a/src/store/pbx-config/getters.js
+++ b/src/store/pbx-config/getters.js
@@ -267,5 +267,8 @@ export default {
},
updatedDeviceProperty(state) {
return state.updatedDeviceProperty;
+ },
+ listProfileFilter(state) {
+ return state.listProfileFilter;
}
}
diff --git a/src/store/pbx-config/mutations.js b/src/store/pbx-config/mutations.js
index ad977425..1ea51d0e 100644
--- a/src/store/pbx-config/mutations.js
+++ b/src/store/pbx-config/mutations.js
@@ -161,7 +161,7 @@ export default {
},
deviceListRequesting(state, options) {
options = options || {};
- state.listCurrentPage = _.get(options, 'page', 1);
+ // state.listCurrentPage = _.get(options, 'page', 1);
state.listLastPage = null;
state.listLoadingSilently = _.get(options, 'silent', false);
state.listState = RequestState.requesting;
@@ -329,5 +329,15 @@ export default {
},
updateProfileFailed(state, error) {
updateDevicePropertyFailed(state, error);
+ },
+ filterByProfile(state, profile) {
+ state.listProfileFilter = profile.id;
+ state.listCurrentPage = 1;
+ },
+ resetProfileFilter(state) {
+ state.listProfileFilter = null;
+ },
+ goToPage(state, page) {
+ state.listCurrentPage = page;
}
}
diff --git a/src/store/pbx-config/state.js b/src/store/pbx-config/state.js
index 76bdb798..b47faed3 100644
--- a/src/store/pbx-config/state.js
+++ b/src/store/pbx-config/state.js
@@ -21,6 +21,7 @@ export default {
listLoadingSilently: false,
listCurrentPage: 1,
listLastPage: null,
+ listProfileFilter: null,
addState: RequestState.initiated,
addError: null,
addItem: null,
diff --git a/t/Dockerfile b/t/Dockerfile
index b7f8ff75..5ca00599 100644
--- a/t/Dockerfile
+++ b/t/Dockerfile
@@ -5,7 +5,7 @@ FROM docker.mgm.sipwise.com/sipwise-stretch:latest
# is updated with the current date. It will force refresh of all
# of the base images and things like `apt-get update` won't be using
# old cached versions when the Dockerfile is built.
-ENV REFRESHED_AT 2018-06-14
+ENV REFRESHED_AT 2018-06-27
ENV DEBIAN_FRONTEND noninteractive
ENV DISPLAY=:0