Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

CIRCLE / cloud

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 94
  • Merge Requests 10
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Merged
Merge request !161 opened Aug 14, 2014 by Kálmán Viktor@kviktor 
  • Report abuse
Report abuse

Feature Mass Ops

Closes #205 (closed)

  • Discussion 13
  • Commits 44
  • Changes
{{ resolvedDiscussionCount }}/{{ discussionCount }} {{ resolvedCountText }} resolved
  • Őry Máté
    @orymate started a discussion on an old version of the diff Aug 25, 2014
    circle/dashboard/static/dashboard/vm-list.js
    138 73 $(this).addClass('vm-list-selected');
    139 74 }
    140 75 });
    141 76 if(selected.length > 0)
    142 $('.vm-list-group-control a').attr('disabled', false);
    77 $('#vm-mass-ops .mass-operation').attr('disabled', false);
    78 return false;
    79 });
    80
    81
    82 /* mass operations */
    83 $("#vm-mass-ops").on('click', '.mass-operation', function(e) {
    84 var icon = $(this).children("i").addClass('fa-spinner fa-spin');
    85 params = "?a";
    86 for(var i=0; i<selected.length; i++) {
    87 params += "&vm=" + selected[i].vm;
    • Őry Máté @orymate commented Aug 25, 2014
      Owner

      params = selected.map(function(a){return "vm=" + a.vm}).join("&")? fixd

      Edited Aug 27, 2014
      ~~`params = selected.map(function(a){return "vm=" + a.vm}).join("&")`?~~ fixd
    Please register or sign in to reply
  • Őry Máté
    @orymate started a discussion on an old version of the diff Aug 25, 2014
    circle/dashboard/static/dashboard/vm-list.js
    118 $('#confirmation-modal').modal("hide");
    119
    120 updateStatuses(1);
    121
    122 /* if there are messages display them */
    123 if(data.messages && data.messages.length > 0) {
    124 addMessage(data.messages.join("<br />"), "danger");
    125 }
    126 },
    127 error: function(xhr, textStatus, error) {
    128 $('#confirmation-modal').modal("hide");
    129
    130 if (xhr.status == 500) {
    131 addMessage("500 Internal Server Error", "danger");
    132 } else {
    133 addMessage(xhr.status + " Unknown Error", "danger");
    • Őry Máté @orymate commented Aug 25, 2014
      Owner

      xhr.statusText?

      Edited Aug 27, 2014
      ~~`xhr.statusText`?~~
    Please register or sign in to reply
  • Őry Máté
    @orymate started a discussion on the diff Aug 25, 2014
    circle/dashboard/templates/dashboard/_vm-mass-migrate.html
    1 {% extends "dashboard/mass-operate.html" %}
    2 {% load i18n %}
    3 {% load sizefieldtags %}
    4
    5 {% block question %}
    6 <p>
    7 {% blocktrans with op=op.name %}
    8 Choose a compute node to migrate the selected VMs to.
    9 {% endblocktrans %}
    10 </p>
    11 <p class="text-info">{{op.name}}: {{op.description}}</p>
    12 {% endblock %}
    13
    14 {% block formfields %}
    15 <ul id="vm-migrate-node-list" class="list-unstyled">
    16 {% for n in nodes %}
    • Őry Máté @orymate commented Aug 25, 2014
      Owner

      we could add a None-valued option meaning smart node-choice (re-schedule)

      Edited Aug 27, 2014
      ~~we could add a None-valued option meaning smart node-choice (re-schedule)~~
    Please register or sign in to reply
  • Őry Máté
    @orymate started a discussion on an old version of the diff Aug 25, 2014
    Last updated by Őry Máté Aug 25, 2014
    circle/dashboard/templates/dashboard/mass-operate.html
    1 {% load i18n %}
    2 {% load crispy_forms_tags %}
    3
    4 {% block question %}
    5 <p>
    6 {% blocktrans with op=op.name %}
    7 Do you want to perform the following operation: <strong>{{op}}</strong>?
    • Őry Máté @orymate commented Aug 25, 2014
      Owner

      perform the {{op}} operation on the following {{count}} instances? fixed

      Edited Aug 27, 2014
      ~~perform the <strong>{{op}}</strong> operation on the following {{count}} instances?~~ fixed
    • Kálmán Viktor @kviktor commented Aug 25, 2014
      Owner

      Count in nstances with failed precond check?

      Count in nstances with failed precond check?
    • Őry Máté @orymate commented Aug 25, 2014
      Owner

      i wouldnt

      i wouldnt
    Please register or sign in to reply
  • Őry Máté
    @orymate started a discussion on an old version of the diff Aug 25, 2014
    circle/dashboard/templates/dashboard/mass-operate.html
    22 </div>
    23 </div>
    24 <input type="checkbox" name="vm" value="{{ i.pk }}" {% if not i.disabled %}checked{% endif %}
    25 style="display: none;"/>
    26 {% endfor %}
    27
    28 <div class="pull-right">
    29 <a class="btn btn-default" href="{% url "dashboard.views.vm-list" %}"
    30 data-dismiss="modal">{% trans "Cancel" %}</a>
    31 <button class="btn btn-{{ opview.effect }}" type="submit" id="op-form-send">
    32 {% if opview.icon %}<i class="fa fa-fw fa-{{opview.icon}}"></i> {% endif %}{{ opview.name|capfirst }}
    33 </button>
    34 </div>
    35 </form>
    36
    37 <style>
    • Őry Máté @orymate commented Aug 25, 2014
      Owner

      why not in the css file? fixed

      Edited Aug 27, 2014
      ~~why not in the css file?~~ fixed
    Please register or sign in to reply
  • Őry Máté
    @orymate started a discussion on an old version of the diff Aug 25, 2014
    circle/dashboard/views.py
    1092 if n.state == "ONLINE"]
    1093 return ctx
    1094
    1095 def post(self, request, extra=None, *args, **kwargs):
    1096 if extra is None:
    1097 extra = {}
    1098 node = self.request.POST.get("node")
    1099 if node:
    1100 node = get_object_or_404(Node, pk=node)
    1101 extra["to_node"] = node
    1102 return super(MassMigrationView, self).post(request, extra, *args,
    1103 **kwargs)
    1104
    1105 vm_mass_ops = OrderedDict([
    1106 ('deploy', MassOperationView.factory(
    1107 op='deploy', icon='play', effect='success')),
    • Őry Máté @orymate commented Aug 25, 2014
      Owner

      couldn't this work with multiple inheritance? from vm_ops['deploy'] and MassOperationView fixed

      Edited Aug 27, 2014
      ~~couldn't this work with multiple inheritance? from vm_ops['deploy'] and MassOperationView~~ fixed
    Please register or sign in to reply
  • Őry Máté
    @orymate started a discussion on an old version of the diff Aug 27, 2014
    Last updated by Kálmán Viktor Aug 27, 2014
    circle/dashboard/views.py
    1016 @classmethod
    1017 def get_urlname(cls):
    1018 return 'dashboard.vm.mass-op.%s' % cls.op
    1019
    1020 @classmethod
    1021 def get_url(cls):
    1022 return reverse("dashboard.vm.mass-op.%s" % cls.op)
    1023
    1024 def get_op(self, instance=None):
    1025 if instance:
    1026 return getattr(instance, self.op)
    1027 else:
    1028 return Instance._ops[self.op]
    1029
    1030 def dispatch(self, *args, **kwargs):
    1031 user = self.request.user
    • Őry Máté @orymate commented Aug 27, 2014
      Owner

      why not check every instance with has_level?

      Edited Aug 28, 2014
      ~~why not check every instance with has_level?~~
    • Kálmán Viktor @kviktor commented Aug 27, 2014
      Owner

      Checking if an element is in a list seemed more simple than has_level to every instance. Also this is only here to see if the user has any access to the selected vms to avoid listing all the vm names.

      Checking if an element is in a list seemed more simple than has_level to every instance. Also this is only here to see if the user has any access to the selected vms to avoid listing all the vm names.
    Please register or sign in to reply
  • Őry Máté
    @orymate started a discussion on an old version of the diff Aug 28, 2014
    circle/common/models.py
    484 if request.user and request.user.is_superuser:
    485 msg = self.get_admin_text()
    486 else:
    487 msg = self.get_user_text()
    495 msg = self.get_text(request.user)
    488 496 getattr(messages, level or self.level)(request, msg)
    489 497  
    490 498  
    499 def fetch_human_exception(exception, user=None):
    500 if not isinstance(exception, HumanReadableException):
    501 if isinstance(exception, PermissionDenied):
    502 exception = create_readable(ugettext_noop("Permission Denied"))
    503 else:
    504 exception = create_readable(
    505 _("Unknown error"), _("Unknown error: %(ex)s"),
    506 ex=unicode(exception)).get_text()
    • Őry Máté @orymate commented Aug 28, 2014
      Owner

      .get_text()??

      Edited Aug 29, 2014
      ~~`.get_text()`??~~
    Please register or sign in to reply
  • Őry Máté
    @orymate started a discussion on an old version of the diff Aug 28, 2014
    circle/dashboard/views.py
    1088 i.disabled = fetch_human_exception(e)
    1089 else:
    1090 i.disabled = None
    1091 return instances
    1092
    1093 def post(self, request, extra=None, *args, **kwargs):
    1094 self.check_auth()
    1095 if extra is None:
    1096 extra = {}
    1097 self._call_operations(extra)
    1098 if request.is_ajax():
    1099 store = messages.get_messages(request)
    1100 store.used = True
    1101 return HttpResponse(
    1102 json.dumps({'messages': [unicode(m) for m in store]}),
    1103 content_type="application=json"
    • Őry Máté @orymate commented Aug 28, 2014
      Owner

      /

      Edited Aug 29, 2014
      ~~`/`~~
    Please register or sign in to reply
  • Őry Máté @orymate commented Aug 29, 2014
    Owner

    +1

    +1
  • Write
  • Preview
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment
Assignee
No assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
0
Labels
None
Assign labels
  • View labels
2
2 participants
Reference: circle/cloud!161