Parcourir la source

add stop/delete network support in ui

tags/v0.1.6
Jonathan Cobb il y a 4 ans
Parent
révision
259929bbe9
5 fichiers modifiés avec 25 ajouts et 7 suppressions
  1. +11
    -4
      bubble-server/src/main/java/bubble/resources/account/AccountOwnedResource.java
  2. +7
    -0
      bubble-server/src/main/java/bubble/resources/bill/AccountPlansResource.java
  3. +5
    -0
      bubble-server/src/main/java/bubble/resources/cloud/NetworksResource.java
  4. +1
    -2
      bubble-server/src/main/resources/message_templates/en_US/server/post_auth/ResourceMessages.properties
  5. +1
    -1
      bubble-web

+ 11
- 4
bubble-server/src/main/java/bubble/resources/account/AccountOwnedResource.java Voir le fichier

@@ -131,6 +131,7 @@ public class AccountOwnedResource<E extends HasAccount, DAO extends AccountOwned
}

protected E findAlternate(ContainerRequest ctx, E request) { return null; }
protected E findAlternate(ContainerRequest ctx, String id) { return null; }

protected Object daoCreate(E toCreate) { return getDao().create(toCreate); }

@@ -141,8 +142,11 @@ public class AccountOwnedResource<E extends HasAccount, DAO extends AccountOwned
@PathParam("id") String id,
E request) {
final Account caller = checkEditable(ctx);
final E found = find(ctx, id);
if (found == null) return notFound(id);
E found = find(ctx, id);
if (found == null) {
found = findAlternate(ctx, id);
if (found == null) return notFound(id);
}
if (!(found instanceof HasAccountNoName) && !canChangeName() && request.hasName() && !found.getName().equals(request.getName())) {
return notFound(id+"/"+request.getName());
}
@@ -158,8 +162,11 @@ public class AccountOwnedResource<E extends HasAccount, DAO extends AccountOwned
public Response delete(@Context ContainerRequest ctx,
@PathParam("id") String id) {
final Account caller = checkEditable(ctx);
final E found = find(ctx, id);
if (found == null) return notFound(id);
E found = find(ctx, id);
if (found == null) {
found = findAlternate(ctx, id);
if (found == null) return notFound(id);
}

if (!canDelete(ctx, caller, found)) return forbidden();



+ 7
- 0
bubble-server/src/main/java/bubble/resources/bill/AccountPlansResource.java Voir le fichier

@@ -56,6 +56,13 @@ public class AccountPlansResource extends AccountOwnedResource<AccountPlan, Acco
return getDao().findByAccountAndNotDeleted(account.getUuid());
}

@Override protected AccountPlan findAlternate(ContainerRequest ctx, String id) {
// id might be a network uuid
final String accountUuid = getAccountUuid(ctx);
final BubbleNetwork network = networkDAO.findByAccountAndId(accountUuid, id);
return network == null ? null : getDao().findByAccountAndNetwork(accountUuid, network.getUuid());
}

@Override protected boolean canCreate(Request req, ContainerRequest ctx, Account caller, AccountPlan request) {
// ensure caller is not from a disallowed country
if (configuration.hasDisallowedCountries()) {


+ 5
- 0
bubble-server/src/main/java/bubble/resources/cloud/NetworksResource.java Voir le fichier

@@ -99,6 +99,11 @@ public class NetworksResource extends AccountOwnedResource<BubbleNetwork, Bubble
return false;
}

@Override protected boolean canDelete(ContainerRequest ctx, Account caller, BubbleNetwork found) {
// delete networks through plans
return false;
}

@GET @Path("/{id}"+EP_CLOSEST)
public Response findClosest(@Context Request req,
@Context ContainerRequest ctx,


+ 1
- 2
bubble-server/src/main/resources/message_templates/en_US/server/post_auth/ResourceMessages.properties Voir le fichier

@@ -167,10 +167,9 @@ label_field_networks_locale=Locale
label_field_networks_timezone=Time Zone
label_field_networks_object_state=State
label_field_networks_action_view=View
label_field_networks_action_start_stop=Start/Stop
label_field_networks_action_stop=Stop
label_field_networks_action_delete=Delete
table_row_networks_action_view=View
table_row_networks_action_start=Start
table_row_networks_action_stop=Stop
table_row_networks_action_delete=Delete
button_label_new_network=Create Bubble


+ 1
- 1
bubble-web

@@ -1 +1 @@
Subproject commit 0f3b38169089cad36ce86a0b468293d1ca6c2169
Subproject commit e8c5f6c80992169184d4a17c1c65bfc5424a0686

Chargement…
Annuler
Enregistrer