Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE3
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
5
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
1b01e6b7
authored
Jul 27, 2022
by
Karsa Zoltán István
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
prism init
parent
d1030b90
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
3 deletions
+30
-3
circle/circle/settings/base.py
+2
-0
circle/dashboard/static/dashboard/js/prism.js
+0
-0
circle/dashboard/static/dashboard/vm-details.js
+12
-0
circle/dashboard/templates/dashboard/_ci-data-help.html
+3
-0
circle/vm/models/instance.py
+13
-3
No files found.
circle/circle/settings/base.py
View file @
1b01e6b7
...
...
@@ -198,6 +198,7 @@ PIPELINE = {
"network/network.less"
,
"autocomplete_light/vendor/select2/dist/css/select2.css"
,
"autocomplete_light/select2.css"
,
"dashboard/prism.css"
),
"output_filename"
:
"all.css"
,
}
...
...
@@ -239,6 +240,7 @@ PIPELINE = {
"output_filename"
:
"all.js"
,
},
"vm-detail"
:
{
"source_filenames"
:
(
"dashboard/js/prism.js"
,
"clipboard/dist/clipboard.min.js"
,
"dashboard/vm-details.js"
,
"no-vnc/include/util.js"
,
...
...
circle/dashboard/static/dashboard/js/prism.js
0 → 100644
View file @
1b01e6b7
This diff is collapsed.
Click to expand it.
circle/dashboard/static/dashboard/vm-details.js
View file @
1b01e6b7
var
Websock_native
;
// not sure
function
data
()
{
Prism
.
hooks
.
add
(
"before-highlight"
,
function
(
env
)
{
env
.
code
=
env
.
element
.
innerText
;
});
$
(
'#meta_data_code'
).
text
(
$
(
'#id_ci_meta_data'
).
val
())
$
(
'#id_ci_meta_data'
).
on
(
'input'
,
function
()
{
let
result_element
=
document
.
querySelector
(
"#meta_data_code"
);
res
=
Prism
.
highlight
(
document
.
getElementById
(
"id_ci_meta_data"
).
value
,
Prism
.
languages
.
yaml
,
'yaml'
)
result_element
.
innerHTML
=
Prism
.
highlight
(
res
,
Prism
.
languages
.
jinja2
,
'jinja2'
)
})
}
$
(
function
()
{
/* */
$
(
'#vm-details-cidata-save'
).
click
(
function
(
e
)
{
...
...
circle/dashboard/templates/dashboard/_ci-data-help.html
View file @
1b01e6b7
...
...
@@ -19,6 +19,7 @@
<li>
{% trans "
<code>
net.ipv4
</code>
- default host ip address" %}
</li>
<li>
{% trans "
<code>
net.ipv6
</code>
- default host ipv6 address" %}
</li>
<li>
{% trans "
<code>
net.vlans
</code>
- associated vlans: list of objects (name: vlan name, ipv4/ipv6: host ip in vlan)" %}
</li>
<li>
{% trans "
<code>
ssh.keys
</code>
- owner's ssh-keys dictionary: the key is the ssh-key's name" %}
</li>
<li>
{% trans "
<code>
ci.rndstr(len: int)
</code>
- function: make random string with 'len' charachters lenght" %}
</li>
</ul>
<b>
Example:
</b>
...
...
@@ -34,6 +35,8 @@ users:
chpasswd: { expire: False }
lock-passwd: false
passwd: "{{password}}"
ssh_authorized_keys:
- {{ ssh.keys['my-key'] }}
{% for u in acl.operators %}
- name: {{i}}
- shell: /bin/bash
...
...
circle/vm/models/instance.py
View file @
1b01e6b7
...
...
@@ -49,9 +49,9 @@ from model_utils import Choices
from
model_utils.managers
import
QueryManager
from
model_utils.models
import
TimeStampedModel
,
StatusModel
from
taggit.managers
import
TaggableManager
from
simplesshkey.models
import
UserKey
from
django.db
import
models
import
json
from
acl.models
import
AclBase
from
django
import
forms
from
common.models
import
(
...
...
@@ -64,6 +64,7 @@ from .common import BaseResourceConfigModel, Lease
from
.network
import
Interface
from
.node
import
Node
,
Trait
logger
=
getLogger
(
__name__
)
pre_state_changed
=
Signal
(
providing_args
=
[
"new_state"
])
post_state_changed
=
Signal
(
providing_args
=
[
"new_state"
])
...
...
@@ -265,6 +266,12 @@ class AclTemplate:
self
.
operators
=
list
(
k
[
'username'
]
for
k
in
self
.
user_levels
if
k
[
'level'
]
==
'operator'
)
self
.
users
=
list
(
k
[
'username'
]
for
k
in
self
.
user_levels
if
k
[
'level'
]
==
'user'
)
class
SSHKeyTemplate
:
def
__init__
(
self
,
instance
):
owner
=
instance
.
owner
self
.
keys
=
{}
for
k
in
UserKey
.
objects
.
filter
(
user
=
owner
):
self
.
keys
[
k
.
name
]
=
k
.
key
class
NetTemplate
:
class
Host
:
...
...
@@ -279,6 +286,8 @@ class NetTemplate:
self
.
ipv6
=
str
(
instance
.
ipv6
)
class
Instance
(
AclBase
,
VirtualMachineDescModel
,
StatusModel
,
OperatedMixin
,
TimeStampedModel
):
...
...
@@ -402,7 +411,8 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
"password"
:
sha512_crypt
.
hash
(
self
.
pw
),
"owner"
:
str
(
self
.
owner
.
username
),
"net"
:
NetTemplate
(
self
),
"acl"
:
AclTemplate
(
self
)
"acl"
:
AclTemplate
(
self
),
"ssh"
:
SSHKeyTemplate
(
self
),
}
return
datas
...
...
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