allow rebuild of single service
Change-Id: I61dd1662dfeaecfcf7c932af6cf43e6fdbb3ad55
diff --git a/xos/api/utility/onboarding.py b/xos/api/utility/onboarding.py
index 345767a..1144387 100644
--- a/xos/api/utility/onboarding.py
+++ b/xos/api/utility/onboarding.py
@@ -50,7 +50,11 @@
xos=xos[0]
- xos.rebuild()
+ service = request.data.get("service", None)
+ if service:
+ xos.rebuild([service])
+ else:
+ xos.rebuild()
return Response(True)
diff --git a/xos/core/models/xosmodel.py b/xos/core/models/xosmodel.py
index c13115e..1d0a20b 100644
--- a/xos/core/models/xosmodel.py
+++ b/xos/core/models/xosmodel.py
@@ -29,9 +29,13 @@
# def can_update(self, user):
# return user.can_update_site(self.site, allow=['tech'])
- def rebuild(self):
+ def rebuild(self, services=[]):
+ # If `services` is empty, then only rebuild the UI
+ # Otherwise, only rebuild the services listed in `services`
with transaction.atomic():
for service_controller in self.service_controllers.all():
+ if (services) and (service_controller.name not in services):
+ continue
for scr in service_controller.service_controller_resources.all():
scr.save()
service_controller.save()