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
406efb10
authored
Apr 06, 2016
by
Estók Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Separate machine and element panel. Modified client-server communication
due to backend modifications.
parent
e7c08ebc
Pipeline
#54
failed with stage
in 0 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
27 deletions
+78
-27
circle/setty/static/setty/setty.js
+41
-8
circle/setty/templates/setty/index.html
+36
-15
circle/setty/views.py
+1
-4
No files found.
circle/setty/static/setty/setty.js
View file @
406efb10
...
@@ -71,7 +71,6 @@ jsPlumb.ready(function() {
...
@@ -71,7 +71,6 @@ jsPlumb.ready(function() {
var
elementConnections
=
[];
var
elementConnections
=
[];
var
elementIndex
=
0
;
var
elementIndex
=
0
;
var
dragContainerScroll
=
0
;
var
dragContainerScroll
=
0
;
var
clickEvent
=
0
;
var
workspaceWidth
=
$
(
"#dropContainer"
).
width
();
var
workspaceWidth
=
$
(
"#dropContainer"
).
width
();
var
workspaceHeight
=
$
(
"#dropContainer"
).
height
();
var
workspaceHeight
=
$
(
"#dropContainer"
).
height
();
...
@@ -80,6 +79,8 @@ jsPlumb.ready(function() {
...
@@ -80,6 +79,8 @@ jsPlumb.ready(function() {
var
objectStack
=
[];
var
objectStack
=
[];
var
undoStack
=
[];
var
undoStack
=
[];
var
redoStack
=
[];
var
redoStack
=
[];
var
clickEvent
=
0
;
var
nextStepConstraint
=
0
;
/* Functions. */
/* Functions. */
...
@@ -94,6 +95,7 @@ jsPlumb.ready(function() {
...
@@ -94,6 +95,7 @@ jsPlumb.ready(function() {
};
};
addInfo
=
function
(
title
,
info
,
type
,
object
)
{
addInfo
=
function
(
title
,
info
,
type
,
object
)
{
/*
$("#informationContainer").empty();
$("#informationContainer").empty();
switch(type){
switch(type){
...
@@ -140,7 +142,7 @@ jsPlumb.ready(function() {
...
@@ -140,7 +142,7 @@ jsPlumb.ready(function() {
'</div> ' +
'</div> ' +
'<div class="row">' +
'<div class="row">' +
'<div class="col-xs-12 text-center">' +
'<div class="col-xs-12 text-center">' +
'<button id="removeFromWorkspace" class="btn btn-info">Remove from workspace</button>'
+
'<button id="remove
Element
FromWorkspace" class="btn btn-info">Remove from workspace</button>' +
'</div>' +
'</div>' +
'</div>';
'</div>';
break;
break;
...
@@ -162,7 +164,13 @@ jsPlumb.ready(function() {
...
@@ -162,7 +164,13 @@ jsPlumb.ready(function() {
'</div>' +
'</div>' +
'</div>';
'</div>';
break;
break;
}
}*/
// Here comes the ajax getInformation post.
// elementtemplateid vagy hostname
div
=
0
;
$
(
"#informationContainer"
).
append
(
div
);
$
(
"#informationContainer"
).
append
(
div
);
...
@@ -272,6 +280,21 @@ jsPlumb.ready(function() {
...
@@ -272,6 +280,21 @@ jsPlumb.ready(function() {
return
returnValue
;
return
returnValue
;
};
};
elementIsConnected
=
function
(
element
)
{
anchors
=
element
.
attr
(
"anchors"
);
id
=
element
.
attr
(
"id"
);
for
(
i
=
0
;
i
<
anchors
;
i
++
)
{
if
(
isConnected
(
i
+
"_"
+
id
))
{
return
true
;
}
}
return
false
;
};
getConnectionparamAndAnchor
=
function
(
anchorId
)
{
getConnectionparamAndAnchor
=
function
(
anchorId
)
{
parameters
=
""
;
parameters
=
""
;
otherAnchor
=
""
;
otherAnchor
=
""
;
...
@@ -501,12 +524,13 @@ jsPlumb.ready(function() {
...
@@ -501,12 +524,13 @@ jsPlumb.ready(function() {
$
(
'body'
).
on
(
'contextmenu'
,
'.element'
,
function
(
event
)
{
$
(
'body'
).
on
(
'contextmenu'
,
'.element'
,
function
(
event
)
{
setServiceStatus
(
"unsaved"
);
setServiceStatus
(
"unsaved"
);
removeElement
(
$
(
this
));
removeElement
(
$
(
this
));
undoStack
.
splice
(
stackIndexer
,
0
,
addElement
);
undoStack
.
splice
(
stackIndexer
,
0
,
addElement
);
redoStack
.
splice
(
stackIndexer
,
0
,
removeElement
);
redoStack
.
splice
(
stackIndexer
,
0
,
removeElement
);
objectStack
.
splice
(
stackIndexer
,
0
,
$
(
this
));
objectStack
.
splice
(
stackIndexer
,
0
,
$
(
this
));
nextStepConstraint
=
0
;
stackSize
++
;
stackSize
++
;
stackIndexer
++
;
stackIndexer
++
;
});
});
...
@@ -542,7 +566,8 @@ jsPlumb.ready(function() {
...
@@ -542,7 +566,8 @@ jsPlumb.ready(function() {
stackSize
++
;
stackSize
++
;
});
});
$
(
'body'
).
on
(
'click'
,
'#removeFromWorkspace'
,
function
()
{
$
(
'body'
).
on
(
'click'
,
'#removeElementFromWorkspace'
,
function
()
{
setServiceStatus
(
"unsaved"
);
removeElement
(
sharedObject
);
removeElement
(
sharedObject
);
undoStack
.
splice
(
stackIndexer
,
0
,
addElement
);
undoStack
.
splice
(
stackIndexer
,
0
,
addElement
);
...
@@ -570,8 +595,7 @@ jsPlumb.ready(function() {
...
@@ -570,8 +595,7 @@ jsPlumb.ready(function() {
});
});
$
(
'body'
).
on
(
'click'
,
'#clearService'
,
function
()
{
$
(
'body'
).
on
(
'click'
,
'#clearService'
,
function
()
{
jsPlumbInstance
.
reset
();
jsPlumbInstance
.
remove
(
"element"
);
$
(
".element"
).
remove
();
setServiceStatus
(
"unsaved"
);
setServiceStatus
(
"unsaved"
);
elementIndex
=
0
;
elementIndex
=
0
;
...
@@ -590,10 +614,19 @@ jsPlumb.ready(function() {
...
@@ -590,10 +614,19 @@ jsPlumb.ready(function() {
if
(
stackIndexer
>=
stackSize
)
return
;
if
(
stackIndexer
>=
stackSize
)
return
;
clickEvent
=
1
;
clickEvent
=
1
;
object
=
objectStack
[
stackIndexer
];
object
=
objectStack
[
stackIndexer
];
redoStack
[
stackIndexer
++
](
object
);
redoStack
[
stackIndexer
](
object
);
stackIndexer
++
;
clickEvent
=
0
;
clickEvent
=
0
;
});
});
$
(
'body'
).
on
(
'click'
,
'#addMachineDialog'
,
function
()
{
// Here comes the ajax post of getMachineAvailableList
// posting usedhostnames
//
//
// after it, appending obtained content to addmachinedialogbody
});
$
(
'body'
).
on
(
'click'
,
'.elementTemplateInfo'
,
function
()
{
$
(
'body'
).
on
(
'click'
,
'.elementTemplateInfo'
,
function
()
{
id
=
$
(
this
).
attr
(
"element"
);
id
=
$
(
this
).
attr
(
"element"
);
addInfo
(
$
(
"#"
+
id
).
attr
(
"alt"
),
$
(
"#"
+
id
).
attr
(
"desc"
),
"elementTemplate"
,
$
(
"#"
+
id
));
addInfo
(
$
(
"#"
+
id
).
attr
(
"alt"
),
$
(
"#"
+
id
).
attr
(
"desc"
),
"elementTemplate"
,
$
(
"#"
+
id
));
...
...
circle/setty/templates/setty/index.html
View file @
406efb10
...
@@ -17,33 +17,37 @@
...
@@ -17,33 +17,37 @@
<div
class=
"panel-heading"
>
<div
class=
"panel-heading"
>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-xs-1 text-left"
>
<div
class=
"col-xs-1 text-left"
>
<button
class=
"btn btn-info btn-xs
hidden-xs hidden-sm
"
id=
"undoMovement"
>
{% trans 'Undo' %}
</button>
<button
class=
"btn btn-info btn-xs
btn-block hidden-xs hidden-sm hidden-md
"
id=
"undoMovement"
>
{% trans 'Undo' %}
</button>
<button
class=
"btn btn-info btn-xs hidden-
md hidden-
lg"
id=
"undoMovement"
><i
class=
"fa fa-undo"
></i></button>
<button
class=
"btn btn-info btn-xs hidden-lg"
id=
"undoMovement"
><i
class=
"fa fa-undo"
></i></button>
</div>
</div>
<div
class=
"col-xs-1 text-left"
>
<div
class=
"col-xs-1 text-left"
>
<button
class=
"btn btn-info btn-xs
hidden-xs hidden-sm
"
id=
"redoMovement"
>
{% trans 'Redo' %}
</button>
<button
class=
"btn btn-info btn-xs
btn-block hidden-xs hidden-sm hidden-md
"
id=
"redoMovement"
>
{% trans 'Redo' %}
</button>
<button
class=
"btn btn-info btn-xs hidden-
md hidden-
lg"
id=
"redoMovement"
><i
class=
"fa fa-repeat"
></i></button>
<button
class=
"btn btn-info btn-xs hidden-lg"
id=
"redoMovement"
><i
class=
"fa fa-repeat"
></i></button>
</div>
</div>
<div
class=
"col-xs-1 text-left"
>
<div
class=
"col-xs-1 text-left"
>
<button
class=
"btn btn-success btn-xs
hidden-xs hidden-sm"
id=
"showAddElementDialog"
data-toggle=
"modal"
data-target=
"#addElementDialog"
>
{% trans 'Add element
' %}
</button>
<button
class=
"btn btn-success btn-xs
btn-block hidden-xs hidden-sm hidden-md"
id=
"showAddElementDialog"
data-toggle=
"modal"
data-target=
"#addElementDialog"
>
{% trans 'Elements
' %}
</button>
<button
class=
"btn btn-success btn-xs hidden-
md hidden-
lg"
id=
"showAddElementDialog"
data-toggle=
"modal"
data-target=
"#addElementDialog"
><i
class=
"fa fa-plus"
></i></button>
<button
class=
"btn btn-success btn-xs hidden-lg"
id=
"showAddElementDialog"
data-toggle=
"modal"
data-target=
"#addElementDialog"
><i
class=
"fa fa-plus"
></i></button>
</div>
</div>
<div
class=
"col-xs-6 text-center"
>
<div
class=
"col-xs-1 text-left"
>
<button
class=
"btn btn-success btn-xs btn-block hidden-xs hidden-sm hidden-md"
id=
"showAddMachineDialog"
>
{% trans 'Machines' %}
</button>
<button
class=
"btn btn-success btn-xs hidden-lg"
id=
"showAddMachineDialog"
><i
class=
"fa fa-plus-circle"
></i></button>
</div>
<div
class=
"col-xs-4 text-center"
>
<h3
class=
"no-margin"
id=
"serviceName"
></h3>
<h3
class=
"no-margin"
id=
"serviceName"
></h3>
<input
class=
"form-control form-control-sm initHidden"
id=
"serviceNameEdit"
type=
"text"
style=
"margin-top: -4px !important; margin-bottom: -4px !important;
width:
80%;"
/>
<input
class=
"form-control form-control-sm initHidden"
id=
"serviceNameEdit"
type=
"text"
style=
"margin-top: -4px !important; margin-bottom: -4px !important;
width:
80%;"
/>
<button
class=
"btn btn-success btn-xs initHidden"
id=
"serviceNameSave"
>
{% trans 'OK' %}
</button>
<button
class=
"btn btn-success btn-xs initHidden"
id=
"serviceNameSave"
>
{% trans 'OK' %}
</button>
</div>
</div>
<div
class=
"col-xs-1 text-right"
>
<div
class=
"col-xs-1 text-right"
>
<button
class=
"btn btn-info btn-xs
hidden-xs hidden-sm
"
id=
"clearService"
>
{% trans 'Clean' %}
</button>
<button
class=
"btn btn-info btn-xs
btn-block hidden-xs hidden-sm hidden-md
"
id=
"clearService"
>
{% trans 'Clean' %}
</button>
<button
class=
"btn btn-info btn-xs hidden-
md hidden-
lg"
id=
"clearService"
><i
class=
"fa fa-eraser"
></i></button>
<button
class=
"btn btn-info btn-xs hidden-lg"
id=
"clearService"
><i
class=
"fa fa-eraser"
></i></button>
</div>
</div>
<div
class=
"col-xs-1 text-right"
>
<div
class=
"col-xs-1 text-right"
>
<button
class=
"btn btn-success btn-xs
hidden-xs hidden-sm
"
id=
"saveService"
>
{% trans 'Save' %}
</button>
<button
class=
"btn btn-success btn-xs
btn-block hidden-xs hidden-sm hidden-md
"
id=
"saveService"
>
{% trans 'Save' %}
</button>
<button
class=
"btn btn-success btn-xs hidden-
md hidden-
lg"
id=
"saveService"
><i
class=
"fa fa-floppy-o"
></i></button>
<button
class=
"btn btn-success btn-xs hidden-lg"
id=
"saveService"
><i
class=
"fa fa-floppy-o"
></i></button>
</div>
</div>
<div
class=
"col-xs-1 text-right"
>
<div
class=
"col-xs-1 text-right"
>
<button
class=
"btn btn-danger btn-xs
hidden-xs hidden-sm
"
id=
"deleteService"
data-toggle=
"modal"
data-target=
"#deleteServiceDialog"
>
{% trans 'Delete' %}
</button>
<button
class=
"btn btn-danger btn-xs
btn-block hidden-xs hidden-sm hidden-md
"
id=
"deleteService"
data-toggle=
"modal"
data-target=
"#deleteServiceDialog"
>
{% trans 'Delete' %}
</button>
<button
class=
"btn btn-danger btn-xs hidden-
md hidden-
lg"
id=
"deleteService"
data-toggle=
"modal"
data-target=
"#deleteServiceDialog"
><i
class=
"fa fa-trash-o"
></i></button>
<button
class=
"btn btn-danger btn-xs hidden-lg"
id=
"deleteService"
data-toggle=
"modal"
data-target=
"#deleteServiceDialog"
><i
class=
"fa fa-trash-o"
></i></button>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -152,7 +156,7 @@
...
@@ -152,7 +156,7 @@
</div>
</div>
</div>
</div>
<!--
c
hanging information dialog -->
<!--
C
hanging information dialog -->
<div
class=
"modal fade"
id=
"changeInformationDialog"
role=
"dialog"
>
<div
class=
"modal fade"
id=
"changeInformationDialog"
role=
"dialog"
>
<div
class=
"modal-dialog"
>
<div
class=
"modal-dialog"
>
...
@@ -169,5 +173,22 @@
...
@@ -169,5 +173,22 @@
</div>
</div>
</div>
</div>
<!-- Adding machine dialog -->
<div
class=
"modal fade"
id=
"addMachineDialog"
role=
"dialog"
>
<div
class=
"modal-dialog"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<button
class=
"close"
type=
"button"
data-dismiss=
"modal"
>
×
</button>
<h4
class=
"modal-title"
><i
class=
"fa fa-outdent"
></i>
{% trans 'Machines' %}
</h4>
</div>
<div
class=
"modal-body"
id=
"addMachineDialogBody"
>
</div>
<div
class=
"modal-footer"
>
</div>
</div>
</div>
</div>
{% endblock %}
{% endblock %}
circle/setty/views.py
View file @
406efb10
...
@@ -34,13 +34,11 @@ class DetailView(LoginRequiredMixin, TemplateView):
...
@@ -34,13 +34,11 @@ class DetailView(LoginRequiredMixin, TemplateView):
context
=
super
(
DetailView
,
self
)
.
get_context_data
(
**
kwargs
)
context
=
super
(
DetailView
,
self
)
.
get_context_data
(
**
kwargs
)
context
[
'elementTemplateList'
]
=
ElementTemplate
.
objects
.
all
()
context
[
'elementTemplateList'
]
=
ElementTemplate
.
objects
.
all
()
context
[
'actualId'
]
=
kwargs
[
'pk'
]
context
[
'actualId'
]
=
kwargs
[
'pk'
]
# context['elementCategoryList'] = ...
return
context
return
context
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
if
self
.
request
.
POST
.
get
(
'event'
)
==
"saveService"
:
if
self
.
request
.
POST
.
get
(
'event'
)
==
"saveService"
:
data
=
json
.
loads
(
self
.
request
.
POST
.
get
(
'data'
))
data
=
json
.
loads
(
self
.
request
.
POST
.
get
(
'data'
))
service
=
Service
.
objects
.
get
(
id
=
kwargs
[
'pk'
])
service
=
Service
.
objects
.
get
(
id
=
kwargs
[
'pk'
])
service
.
name
=
data
[
'serviceName'
]
service
.
name
=
data
[
'serviceName'
]
service
.
save
()
service
.
save
()
...
@@ -129,7 +127,6 @@ class CreateView(LoginRequiredMixin, TemplateView):
...
@@ -129,7 +127,6 @@ class CreateView(LoginRequiredMixin, TemplateView):
else
:
else
:
return
[
'dashboard/nojs-wrapper.html'
]
return
[
'dashboard/nojs-wrapper.html'
]
def
get_context_data
(
self
,
*
args
,
**
kwargs
):
def
get_context_data
(
self
,
*
args
,
**
kwargs
):
context
=
super
(
CreateView
,
self
)
.
get_context_data
(
*
args
,
**
kwargs
)
context
=
super
(
CreateView
,
self
)
.
get_context_data
(
*
args
,
**
kwargs
)
...
@@ -144,7 +141,7 @@ class CreateView(LoginRequiredMixin, TemplateView):
...
@@ -144,7 +141,7 @@ class CreateView(LoginRequiredMixin, TemplateView):
service_name
=
self
.
request
.
POST
.
get
(
'serviceName'
)
service_name
=
self
.
request
.
POST
.
get
(
'serviceName'
)
if
not
service_name
:
if
not
service_name
:
service_name
=
"Noname"
service_name
=
"Noname"
service
=
Service
(
service
=
Service
(
name
=
service_name
,
name
=
service_name
,
...
...
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