Commit 251e4039 by Őry Máté

dashboard: add effect to operation buttons

parent 03ae1309
...@@ -526,6 +526,7 @@ class OperationView(DetailView): ...@@ -526,6 +526,7 @@ class OperationView(DetailView):
template_name = 'dashboard/operate.html' template_name = 'dashboard/operate.html'
show_in_toolbar = True show_in_toolbar = True
effect = None
@property @property
def name(self): def name(self):
...@@ -587,9 +588,9 @@ class OperationView(DetailView): ...@@ -587,9 +588,9 @@ class OperationView(DetailView):
return redirect("%s#activity" % self.object.get_absolute_url()) return redirect("%s#activity" % self.object.get_absolute_url())
@classmethod @classmethod
def factory(cls, op, icon='cog'): def factory(cls, op, icon='cog', effect='info'):
return type(str(cls.__name__ + op), return type(str(cls.__name__ + op),
(cls, ), {'op': op, 'icon': icon}) (cls, ), {'op': op, 'icon': icon, 'effect': effect})
@classmethod @classmethod
def bind_to_object(cls, instance): def bind_to_object(cls, instance):
...@@ -670,6 +671,7 @@ class VmMigrateView(VmOperationView): ...@@ -670,6 +671,7 @@ class VmMigrateView(VmOperationView):
op = 'migrate' op = 'migrate'
icon = 'truck' icon = 'truck'
effect = 'info'
template_name = 'dashboard/_vm-migrate.html' template_name = 'dashboard/_vm-migrate.html'
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
...@@ -697,23 +699,23 @@ class VmSaveView(FormOperationMixin, VmOperationView): ...@@ -697,23 +699,23 @@ class VmSaveView(FormOperationMixin, VmOperationView):
vm_ops = OrderedDict([ vm_ops = OrderedDict([
('deploy', VmOperationView.factory( ('deploy', VmOperationView.factory(
op='deploy', icon='play')), op='deploy', icon='play', effect='success')),
('wake_up', VmOperationView.factory( ('wake_up', VmOperationView.factory(
op='wake_up', icon='sun')), op='wake_up', icon='sun', effect='success')),
('sleep', VmOperationView.factory( ('sleep', VmOperationView.factory(
op='sleep', icon='moon')), op='sleep', icon='moon', effect='info')),
('migrate', VmMigrateView), ('migrate', VmMigrateView),
('save_as_template', VmSaveView), ('save_as_template', VmSaveView),
('reboot', VmOperationView.factory( ('reboot', VmOperationView.factory(
op='reboot', icon='refresh')), op='reboot', icon='refresh', effect='warning')),
('reset', VmOperationView.factory( ('reset', VmOperationView.factory(
op='reset', icon='bolt')), op='reset', icon='bolt', effect='warning')),
('shutdown', VmOperationView.factory( ('shutdown', VmOperationView.factory(
op='shutdown', icon='off')), op='shutdown', icon='off', effect='warning')),
('shut_off', VmOperationView.factory( ('shut_off', VmOperationView.factory(
op='shut_off', icon='ban-circle')), op='shut_off', icon='ban-circle', effect='warning')),
('destroy', VmOperationView.factory( ('destroy', VmOperationView.factory(
op='destroy', icon='remove')), op='destroy', icon='remove', effect='danger')),
('create_disk', VmCreateDiskView), ('create_disk', VmCreateDiskView),
('download_disk', VmDownloadDiskView), ('download_disk', VmDownloadDiskView),
]) ])
......
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