Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
7bc6e462
authored
Oct 23, 2016
by
Sulyok Gabor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Machine handling fixes
parent
f7a8b0d6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
55 additions
and
17 deletions
+55
-17
circle/setty/controller.py
+22
-14
circle/setty/models.py
+3
-3
circle/setty/static/setty/setty.js
+0
-0
circle/setty/static/setty/style.css
+27
-0
circle/setty/templates/setty/index.html
+3
-0
No files found.
circle/setty/controller.py
View file @
7bc6e462
...
...
@@ -114,19 +114,27 @@ class SettyController:
@staticmethod
def
getMachineAvailableList
(
serviceId
,
used_hostnames
,
current_user
):
all_minions
=
[]
# SettyController.salthelper.getAllMinionsUngrouped()
usedMachines
=
Machine
.
objects
.
filter
(
service
=
serviceId
)
user_instances
=
Instance
.
objects
.
filter
(
owner
=
current_user
)
userMachines
=
[]
def
getMachineAvailableList
(
serviceId
,
usedHostnames
,
current_user
):
saltMinions
=
[]
#SettyController.salthelper.getAllMinionsUngrouped()
savedMachines
=
Machine
.
objects
.
filter
(
service
=
serviceId
)
savedHostNames
=
[]
for
machine
in
savedMachines
:
savedHostNames
.
append
(
machine
.
hostname
)
userInstances
=
Instance
.
objects
.
filter
(
owner
=
current_user
)
userMachines
=
[]
for
instance
in
user
_i
nstances
:
for
instance
in
user
I
nstances
:
if
instance
.
vm_name
:
print
instance
.
vm_name
userMachines
.
append
(
instance
.
vm_name
)
return
{
'machinedata'
:
userMachines
}
usedHostnamesByUser
=
set
(
savedHostNames
+
usedHostnames
)
if
not
usedHostnamesByUser
:
return
{
'machinedata'
:
userMachines
}
#{'machinedata': [machineName for machineName in userMachines if machineName in saltMinions] }
availableInstanceNames
=
list
(
set
(
userMachines
)
-
usedHostnamesByUser
)
return
{
'machinedata'
:
availableInstanceNames
}
#[ machineName for machineName in availableInstanceNames if machineName in saltMinions ]}
@staticmethod
def
addMachine
(
hostname
):
...
...
@@ -135,12 +143,12 @@ class SettyController:
return
{
'error'
:
'already added or doesnt exists'
}
except
:
pass
if
SettyController
.
salthelper
.
checkMinionExists
(
hostname
):
machine
=
Machine
.
clone
()
machine
.
hostname
=
hostname
return
machine
.
getDataDictionary
()
else
:
return
{
'error'
:
'already added or doesnt exists'
}
#
if SettyController.salthelper.checkMinionExists(hostname):
machine
=
Machine
.
clone
()
machine
.
hostname
=
hostname
return
machine
.
getDataDictionary
()
#
else:
#
return {'error': 'already added or doesnt exists'}
@staticmethod
def
addServiceNode
(
elementTemplateId
):
...
...
circle/setty/models.py
View file @
7bc6e462
...
...
@@ -152,9 +152,9 @@ class Machine(Element): # As a real machine
@staticmethod
def
getInformation
():
return
{
'hostname'
:
hostname
.
get_internal_type
(),
'alias'
:
alias
.
get_internal_type
(),
'description'
:
description
.
get_internal_type
()}
return
{
'hostname'
:
Machine
.
_meta
.
get_field
(
'hostname'
)
.
get_internal_type
(),
'alias'
:
Machine
.
_meta
.
get_field
(
'alias'
)
.
get_internal_type
(),
'description'
:
Machine
.
_meta
.
get_field
(
'description'
)
.
get_internal_type
()}
def
getDataDictionary
(
self
):
element_data
=
self
.
getDisplayData
()
...
...
circle/setty/static/setty/setty.js
View file @
7bc6e462
This diff is collapsed.
Click to expand it.
circle/setty/static/setty/style.css
View file @
7bc6e462
...
...
@@ -97,6 +97,33 @@ textarea {
z-index
:
2000
;
}
.machine
{
position
:
absolute
;
left
:
10px
;
display
:
inline
;
width
:
75px
;
height
:
75px
;
background
:
red
;
border-radius
:
8px
;
border-color
:
black
;
-webkit-border-radius
:
8px
;
border-style
:
solid
;
border-width
:
5px
;
z-index
:
40
;
cursor
:
grab
;
}
.machine
:hover
{
border
:
5px
solid
#123456
;
box-shadow
:
2px
2px
19px
#444
;
-o-box-shadow
:
2px
2px
19px
#444
;
-webkit-box-shadow
:
2px
2px
19px
#444
;
-moz-box-shadow
:
2px
2px
19px
#fff
;
opacity
:
0.9
;
filter
:
alpha
(
opacity
=
90
);
z-index
:
2000
;
}
._jsPlumb_connector
{
z-index
:
10
;
}
...
...
circle/setty/templates/setty/index.html
View file @
7bc6e462
...
...
@@ -192,8 +192,11 @@
<h4
class=
"modal-title"
><i
class=
"fa fa-outdent"
></i>
{% trans 'Machines' %}
</h4>
</div>
<div
class=
"modal-body"
id=
"addMachineDialogBody"
>
<div
class=
"list-group"
id=
"availableMachineListContainer"
>
</div>
</div>
<div
class=
"modal-footer"
>
<div
class=
"btn btn-primary"
data-dismiss=
"modal"
/>
Mégsem
</div>
</div>
</div>
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment