Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
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
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
7bc6e462
authored
8 years ago
by
Sulyok Gabor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Machine handling fixes
parent
f7a8b0d6
Pipeline
#257
failed with stage
in 0 seconds
Changes
5
Pipelines
1
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:
...
@@ -114,19 +114,27 @@ class SettyController:
@staticmethod
@staticmethod
def
getMachineAvailableList
(
serviceId
,
used_hostnames
,
current_user
):
def
getMachineAvailableList
(
serviceId
,
usedHostnames
,
current_user
):
all_minions
=
[]
# SettyController.salthelper.getAllMinionsUngrouped()
saltMinions
=
[]
#SettyController.salthelper.getAllMinionsUngrouped()
usedMachines
=
Machine
.
objects
.
filter
(
service
=
serviceId
)
savedMachines
=
Machine
.
objects
.
filter
(
service
=
serviceId
)
user_instances
=
Instance
.
objects
.
filter
(
owner
=
current_user
)
userMachines
=
[]
savedHostNames
=
[]
for
machine
in
savedMachines
:
savedHostNames
.
append
(
machine
.
hostname
)
userInstances
=
Instance
.
objects
.
filter
(
owner
=
current_user
)
userMachines
=
[]
userMachines
=
[]
for
instance
in
user
_i
nstances
:
for
instance
in
user
I
nstances
:
if
instance
.
vm_name
:
if
instance
.
vm_name
:
print
instance
.
vm_name
userMachines
.
append
(
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
@staticmethod
def
addMachine
(
hostname
):
def
addMachine
(
hostname
):
...
@@ -135,12 +143,12 @@ class SettyController:
...
@@ -135,12 +143,12 @@ class SettyController:
return
{
'error'
:
'already added or doesnt exists'
}
return
{
'error'
:
'already added or doesnt exists'
}
except
:
except
:
pass
pass
if
SettyController
.
salthelper
.
checkMinionExists
(
hostname
):
#
if SettyController.salthelper.checkMinionExists(hostname):
machine
=
Machine
.
clone
()
machine
=
Machine
.
clone
()
machine
.
hostname
=
hostname
machine
.
hostname
=
hostname
return
machine
.
getDataDictionary
()
return
machine
.
getDataDictionary
()
else
:
#
else:
return
{
'error'
:
'already added or doesnt exists'
}
#
return {'error': 'already added or doesnt exists'}
@staticmethod
@staticmethod
def
addServiceNode
(
elementTemplateId
):
def
addServiceNode
(
elementTemplateId
):
...
...
This diff is collapsed.
Click to expand it.
circle/setty/models.py
View file @
7bc6e462
...
@@ -152,9 +152,9 @@ class Machine(Element): # As a real machine
...
@@ -152,9 +152,9 @@ class Machine(Element): # As a real machine
@staticmethod
@staticmethod
def
getInformation
():
def
getInformation
():
return
{
'hostname'
:
hostname
.
get_internal_type
(),
return
{
'hostname'
:
Machine
.
_meta
.
get_field
(
'hostname'
)
.
get_internal_type
(),
'alias'
:
alias
.
get_internal_type
(),
'alias'
:
Machine
.
_meta
.
get_field
(
'alias'
)
.
get_internal_type
(),
'description'
:
description
.
get_internal_type
()}
'description'
:
Machine
.
_meta
.
get_field
(
'description'
)
.
get_internal_type
()}
def
getDataDictionary
(
self
):
def
getDataDictionary
(
self
):
element_data
=
self
.
getDisplayData
()
element_data
=
self
.
getDisplayData
()
...
...
This diff is collapsed.
Click to expand it.
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 {
...
@@ -97,6 +97,33 @@ textarea {
z-index
:
2000
;
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
{
._jsPlumb_connector
{
z-index
:
10
;
z-index
:
10
;
}
}
...
...
This diff is collapsed.
Click to expand it.
circle/setty/templates/setty/index.html
View file @
7bc6e462
...
@@ -192,8 +192,11 @@
...
@@ -192,8 +192,11 @@
<h4
class=
"modal-title"
><i
class=
"fa fa-outdent"
></i>
{% trans 'Machines' %}
</h4>
<h4
class=
"modal-title"
><i
class=
"fa fa-outdent"
></i>
{% trans 'Machines' %}
</h4>
</div>
</div>
<div
class=
"modal-body"
id=
"addMachineDialogBody"
>
<div
class=
"modal-body"
id=
"addMachineDialogBody"
>
<div
class=
"list-group"
id=
"availableMachineListContainer"
>
</div>
</div>
</div>
<div
class=
"modal-footer"
>
<div
class=
"modal-footer"
>
<div
class=
"btn btn-primary"
data-dismiss=
"modal"
/>
Mégsem
</div>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
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