Skip to content

Commit

Permalink
refactor(xlds.modem.service): add constant for service status (#4372)
Browse files Browse the repository at this point in the history
ref: UXCT-371

Signed-off-by: Stephanie Moallic <[email protected]>
  • Loading branch information
Steffy29 authored Feb 2, 2021
1 parent 2f438ac commit acba35a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export const SERVICE_STATUS = {
enabled: 'enabled',
disabled: 'disabled',
};

export default { SERVICE_STATUS };
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { SERVICE_STATUS } from './service.constants';

export default class XdslModemServiceCtrl {
/* @ngInject */
constructor(
Expand Down Expand Up @@ -33,7 +35,7 @@ export default class XdslModemServiceCtrl {
})
.$promise.then(({ data }) => {
blocIP.isDefined = true;
blocIP.value = data === 'enabled';
blocIP.value = data === SERVICE_STATUS.enabled;
return data;
})
.finally(() => {
Expand Down Expand Up @@ -86,7 +88,7 @@ export default class XdslModemServiceCtrl {
})
.$promise.then(({ data }) => {
callWaiting.isDefined = true;
callWaiting.value = data === 'enabled';
callWaiting.value = data === SERVICE_STATUS.enabled;
return data;
})
.finally(() => {
Expand Down Expand Up @@ -138,7 +140,7 @@ export default class XdslModemServiceCtrl {
xdslId: this.$stateParams.serviceName,
})
.$promise.then(({ data }) => {
contentSharing.value = data === 'enabled';
contentSharing.value = data === SERVICE_STATUS.enabled;
contentSharing.isDefined = true;
return data;
})
Expand Down Expand Up @@ -205,7 +207,7 @@ export default class XdslModemServiceCtrl {
xdslId: this.$stateParams.serviceName,
})
.$promise.then(({ data }) => {
ftp.value = data === 'enabled';
ftp.value = data === SERVICE_STATUS.enabled;
ftp.isDefined = true;
return data;
})
Expand Down Expand Up @@ -256,7 +258,7 @@ export default class XdslModemServiceCtrl {
xdslId: this.$stateParams.serviceName,
})
.$promise.then(({ data }) => {
ipsecAlg.value = data === 'enabled';
ipsecAlg.value = data === SERVICE_STATUS.enabled;
ipsecAlg.isDefined = true;
return data;
})
Expand Down Expand Up @@ -309,7 +311,7 @@ export default class XdslModemServiceCtrl {
xdslId: this.$stateParams.serviceName,
})
.$promise.then(({ data }) => {
sipAlg.value = data === 'enabled';
sipAlg.value = data === SERVICE_STATUS.enabled;
sipAlg.isDefined = true;
return data;
})
Expand Down Expand Up @@ -362,7 +364,7 @@ export default class XdslModemServiceCtrl {
xdslId: this.$stateParams.serviceName,
})
.$promise.then(({ data }) => {
upnp.value = data === 'enabled';
upnp.value = data === SERVICE_STATUS.enabled;
upnp.isDefined = true;
return data;
})
Expand Down Expand Up @@ -407,10 +409,14 @@ export default class XdslModemServiceCtrl {
changeValue(name, value) {
switch (name) {
case 'blocIP':
this.updateBlocIp(value ? 'enabled' : 'disabled');
this.updateBlocIp(
value ? SERVICE_STATUS.enabled : SERVICE_STATUS.disabled,
);
break;
case 'callWaiting':
this.updateCallWaiting(value ? 'enabled' : 'disabled');
this.updateCallWaiting(
value ? SERVICE_STATUS.enabled : SERVICE_STATUS.disabled,
);
break;
case 'contentSharing':
this.$uibModal
Expand All @@ -429,22 +435,32 @@ export default class XdslModemServiceCtrl {
break;
}
default:
this.updateContentSharing(value ? 'enabled' : 'disabled');
this.updateContentSharing(
value ? SERVICE_STATUS.enabled : SERVICE_STATUS.disabled,
);
break;
}
});
break;
case 'ftp':
this.updateFTP(value ? 'enabled' : 'disabled');
this.updateFTP(
value ? SERVICE_STATUS.enabled : SERVICE_STATUS.disabled,
);
break;
case 'ipsecAlg':
this.updateIpsecAlg(value ? 'enabled' : 'disabled');
this.updateIpsecAlg(
value ? SERVICE_STATUS.enabled : SERVICE_STATUS.disabled,
);
break;
case 'sipAlg':
this.updateSipAlg(value ? 'enabled' : 'disabled');
this.updateSipAlg(
value ? SERVICE_STATUS.enabled : SERVICE_STATUS.disabled,
);
break;
case 'upnp':
this.updateUPnP(value ? 'enabled' : 'disabled');
this.updateUPnP(
value ? SERVICE_STATUS.enabled : SERVICE_STATUS.disabled,
);
break;
default:
break;
Expand Down

0 comments on commit acba35a

Please sign in to comment.