From fca6ce0fc592de369c74273f17e9b4de162d2385 Mon Sep 17 00:00:00 2001 From: Stephanie Moallic Date: Tue, 26 May 2020 18:17:12 +0200 Subject: [PATCH 1/5] feat(otb.services): retrieve list of actions and their detail Ref: UXCT-269 Signed-off-by: Stephanie Moallic --- src/api/overTheBox/overTheBox.v6.service.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/api/overTheBox/overTheBox.v6.service.js b/src/api/overTheBox/overTheBox.v6.service.js index 43d4fdd2..0de969f0 100644 --- a/src/api/overTheBox/overTheBox.v6.service.js +++ b/src/api/overTheBox/overTheBox.v6.service.js @@ -109,6 +109,17 @@ angular.module('ovh-api-services').service('OvhApiOverTheBoxV6', ($resource, Ovh url: '/overTheBox/:serviceName/device/logs ', isArray: false, }, + getActions: { + method: 'GET', + url: '/overTheBox/:serviceName/device/actions', + isArray: true, + cache: OvhApiOverTheBox.cache, + }, + getAction: { + method: 'GET', + url: '/overTheBox/:serviceName/device/actions/:actionId', + cache: OvhApiOverTheBox.cache, + }, }); return overTheBox; From 5c557acd0fa9b257bb06dc456c8979896a5cd664 Mon Sep 17 00:00:00 2001 From: Stephanie Moallic Date: Tue, 26 May 2020 19:09:33 +0200 Subject: [PATCH 2/5] feat(otb.services): add endpoint to unlink device Ref: UXCT-268 Signed-off-by: Stephanie Moallic --- src/api/overTheBox/overTheBox.v6.service.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/api/overTheBox/overTheBox.v6.service.js b/src/api/overTheBox/overTheBox.v6.service.js index 0de969f0..6f1df47f 100644 --- a/src/api/overTheBox/overTheBox.v6.service.js +++ b/src/api/overTheBox/overTheBox.v6.service.js @@ -120,6 +120,11 @@ angular.module('ovh-api-services').service('OvhApiOverTheBoxV6', ($resource, Ovh url: '/overTheBox/:serviceName/device/actions/:actionId', cache: OvhApiOverTheBox.cache, }, + unlinkDevice: { + method: 'DELETE', + url: '/overTheBox/:serviceName/device', + interceptor, + }, }); return overTheBox; From c47367a9a4cec44f57bfa714f023dda098c65a08 Mon Sep 17 00:00:00 2001 From: Stephanie Moallic Date: Tue, 26 May 2020 22:01:37 +0200 Subject: [PATCH 3/5] feat(otb.service): remove cache for actions Signed-off-by: Stephanie Moallic --- src/api/overTheBox/overTheBox.v6.service.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/api/overTheBox/overTheBox.v6.service.js b/src/api/overTheBox/overTheBox.v6.service.js index 6f1df47f..588c7d8d 100644 --- a/src/api/overTheBox/overTheBox.v6.service.js +++ b/src/api/overTheBox/overTheBox.v6.service.js @@ -113,12 +113,10 @@ angular.module('ovh-api-services').service('OvhApiOverTheBoxV6', ($resource, Ovh method: 'GET', url: '/overTheBox/:serviceName/device/actions', isArray: true, - cache: OvhApiOverTheBox.cache, }, getAction: { method: 'GET', url: '/overTheBox/:serviceName/device/actions/:actionId', - cache: OvhApiOverTheBox.cache, }, unlinkDevice: { method: 'DELETE', From a69374f298cb5a6ecc9ecf2ddc2a6dc7a383ffd9 Mon Sep 17 00:00:00 2001 From: Stephanie Moallic Date: Fri, 29 May 2020 16:28:42 +0200 Subject: [PATCH 4/5] feat(otb.service): add device submodule Signed-off-by: Stephanie Moallic --- .../device/overTheBox-device.service.js | 11 +++++++ .../device/overTheBox-device.v6.service.js | 29 +++++++++++++++++++ src/api/overTheBox/overTheBox.service.js | 3 ++ 3 files changed, 43 insertions(+) create mode 100644 src/api/overTheBox/device/overTheBox-device.service.js create mode 100644 src/api/overTheBox/device/overTheBox-device.v6.service.js diff --git a/src/api/overTheBox/device/overTheBox-device.service.js b/src/api/overTheBox/device/overTheBox-device.service.js new file mode 100644 index 00000000..3d3fcb5b --- /dev/null +++ b/src/api/overTheBox/device/overTheBox-device.service.js @@ -0,0 +1,11 @@ +angular.module('ovh-api-services').service('OvhApiOverTheBoxDevice', ($injector, $cacheFactory) => { + const cache = $cacheFactory('OvhApiOverTheBoxDevice'); + + return { + v6() { + return $injector.get('OvhApiOverTheBoxDeviceV6'); + }, + resetCache: cache.removeAll, + cache, + }; +}); diff --git a/src/api/overTheBox/device/overTheBox-device.v6.service.js b/src/api/overTheBox/device/overTheBox-device.v6.service.js new file mode 100644 index 00000000..7c31ff23 --- /dev/null +++ b/src/api/overTheBox/device/overTheBox-device.v6.service.js @@ -0,0 +1,29 @@ +angular.module('ovh-api-services').service('OvhApiOverTheBoxDeviceV6', ($resource, OvhApiOverTheBoxDevice) => { + const interceptor = { + response(response) { + OvhApiOverTheBoxDevice.resetCache(); + return response.resource; + }, + }; + + const overTheBoxDevice = $resource('/overTheBox/:serviceName/device', { + serviceName: '@serviceName', + }, { + getActions: { + method: 'GET', + url: '/overTheBox/:serviceName/device/actions', + isArray: true, + }, + getAction: { + method: 'GET', + url: '/overTheBox/:serviceName/device/actions/:actionId', + }, + unlinkDevice: { + method: 'DELETE', + url: '/overTheBox/:serviceName/device', + interceptor, + }, + }); + + return overTheBoxDevice; +}); diff --git a/src/api/overTheBox/overTheBox.service.js b/src/api/overTheBox/overTheBox.service.js index 56626433..52aeffd6 100644 --- a/src/api/overTheBox/overTheBox.service.js +++ b/src/api/overTheBox/overTheBox.service.js @@ -11,6 +11,9 @@ angular.module('ovh-api-services').service('OvhApiOverTheBox', ($injector, $cach v7() { return $injector.get('OvhApiOverTheBoxV7'); }, + Device() { + return $injector.get('OvhApiOverTheBoxDevice'); + }, resetCache: cache.removeAll, cache, }; From bca5a3fa3c5439eb4d61b313dbc346f8f8c17052 Mon Sep 17 00:00:00 2001 From: Stephanie Moallic Date: Mon, 1 Jun 2020 09:57:56 +0200 Subject: [PATCH 5/5] fix(otb.service): remove duplicate endpoints Signed-off-by: Stephanie Moallic --- src/api/overTheBox/overTheBox.v6.service.js | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/api/overTheBox/overTheBox.v6.service.js b/src/api/overTheBox/overTheBox.v6.service.js index 588c7d8d..43d4fdd2 100644 --- a/src/api/overTheBox/overTheBox.v6.service.js +++ b/src/api/overTheBox/overTheBox.v6.service.js @@ -109,20 +109,6 @@ angular.module('ovh-api-services').service('OvhApiOverTheBoxV6', ($resource, Ovh url: '/overTheBox/:serviceName/device/logs ', isArray: false, }, - getActions: { - method: 'GET', - url: '/overTheBox/:serviceName/device/actions', - isArray: true, - }, - getAction: { - method: 'GET', - url: '/overTheBox/:serviceName/device/actions/:actionId', - }, - unlinkDevice: { - method: 'DELETE', - url: '/overTheBox/:serviceName/device', - interceptor, - }, }); return overTheBox;