Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
19
Merge Requests
19
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
1aabfe3f
Commit
1aabfe3f
authored
Apr 03, 2019
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_jio: Improve/speed up display of monitoring for services and instances
parent
a506499c
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
117 additions
and
79 deletions
+117
-79
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_hosting_subscription_view_js.js
...rjs_gadget_erp5_page_slap_hosting_subscription_view_js.js
+1
-1
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_hosting_subscription_view_js.xml
...js_gadget_erp5_page_slap_hosting_subscription_view_js.xml
+2
-2
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_service_list_js.js
..._page_module/rjs_gadget_erp5_page_slap_service_list_js.js
+17
-18
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_service_list_js.xml
...page_module/rjs_gadget_erp5_page_slap_service_list_js.xml
+2
-2
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_slapos_hosting_subscription_status_html.html
...e/rjs_gadget_slapos_hosting_subscription_status_html.html
+4
-0
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_slapos_hosting_subscription_status_html.xml
...le/rjs_gadget_slapos_hosting_subscription_status_html.xml
+2
-2
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_slapos_hosting_subscription_status_js.js
...odule/rjs_gadget_slapos_hosting_subscription_status_js.js
+75
-51
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_slapos_hosting_subscription_status_js.xml
...dule/rjs_gadget_slapos_hosting_subscription_status_js.xml
+2
-2
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/HostingSubscription_getNewsDict.py
.../slapos_hal_json_style/HostingSubscription_getNewsDict.py
+12
-1
No files found.
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_hosting_subscription_view_js.js
View file @
1aabfe3f
...
...
@@ -276,7 +276,7 @@
"
url
"
:
"
gadget_slapos_hosting_subscription_status.html
"
,
"
sandbox
"
:
""
,
"
key
"
:
"
monitoring_status
"
,
"
hidden
"
:
gadget
.
state
.
doc
.
root_slave
===
1
,
"
hidden
"
:
0
,
"
type
"
:
"
GadgetField
"
},
"
my_monitor_scope
"
:
{
...
...
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_hosting_subscription_view_js.xml
View file @
1aabfe3f
...
...
@@ -230,7 +230,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
974.
49068.53964.3174
</string>
</value>
<value>
<string>
974.
50466.65103.30515
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>
1554
168123.0
9
</float>
<float>
1554
257716.7
9
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_service_list_js.js
View file @
1aabfe3f
...
...
@@ -18,24 +18,23 @@
"
root_slave
"
];
return
gadget
.
jio_allDocs
(
param_list
[
0
])
.
push
(
function
(
result
)
{
var
i
,
value
,
len
=
result
.
data
.
total_rows
;
var
i
,
value
,
news
,
len
=
result
.
data
.
total_rows
;
for
(
i
=
0
;
i
<
len
;
i
+=
1
)
{
if
(
1
||
(
result
.
data
.
rows
[
i
].
value
.
hasOwnProperty
(
"
root_slave
"
)))
{
if
(
result
.
data
.
rows
[
i
].
value
.
root_slave
!==
1
)
{
value
=
result
.
data
.
rows
[
i
].
id
;
result
.
data
.
rows
[
i
].
value
.
monitoring_status
=
{
field_gadget_param
:
{
css_class
:
""
,
description
:
"
The Status
"
,
hidden
:
0
,
"
default
"
:
{
jio_key
:
value
},
key
:
"
status
"
,
url
:
"
gadget_slapos_hosting_subscription_status.html
"
,
title
:
"
Status
"
,
type
:
"
GadgetField
"
}
};
}
if
(
1
||
(
result
.
data
.
rows
[
i
].
value
.
hasOwnProperty
(
"
HostingSubscription_getNewsDict
"
)))
{
value
=
result
.
data
.
rows
[
i
].
id
;
news
=
result
.
data
.
rows
[
i
].
value
.
HostingSubscription_getNewsDict
;
result
.
data
.
rows
[
i
].
value
.
HostingSubscription_getNewsDict
=
{
field_gadget_param
:
{
css_class
:
""
,
description
:
"
The Status
"
,
hidden
:
0
,
"
default
"
:
{
jio_key
:
value
,
result
:
news
},
key
:
"
status
"
,
url
:
"
gadget_slapos_hosting_subscription_status.html
"
,
title
:
"
Status
"
,
type
:
"
GadgetField
"
}
};
result
.
data
.
rows
[
i
].
value
[
"
listbox_uid:list
"
]
=
{
key
:
"
listbox_uid:list
"
,
value
:
2713
...
...
@@ -72,7 +71,7 @@
var
column_list
=
[
[
'
title
'
,
'
Title
'
],
[
'
short_title
'
,
'
Short Title
'
],
[
'
monitoring_status
'
,
'
Status
'
]
[
'
HostingSubscription_getNewsDict
'
,
'
Status
'
]
];
return
form_list
.
render
({
erp5_document
:
{
...
...
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_service_list_js.xml
View file @
1aabfe3f
...
...
@@ -230,7 +230,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
97
2.32024.53732.3440
6
</string>
</value>
<value>
<string>
97
4.29121.45777.1136
6
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>
155
2957541.9
</float>
<float>
155
4257753.72
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_slapos_hosting_subscription_status_html.html
View file @
1aabfe3f
...
...
@@ -17,6 +17,10 @@
<
a
class
=
"
ui-btn ui-btn-icon-left ui-icon-desktop
"
href
=
"
{{monitor_url}}
"
target
=
_blank
>
{{
status_title
}}
<
/a></
div
><
/div
>
</script>
<script
id=
"inline-status-no-link-template"
type=
"text/x-handlebars-template"
>
<
div
class
=
"
ui-block-a
"
style
=
"
width:50%
"
><
div
class
=
"
ui-bar ui-corner-all first-child {{status_class}}
"
style
=
"
{{status_style}}
"
>
{{
status_title
}}
<
/div></
div
>
</script>
<script
id=
"loading-template"
type=
"text/x-handlebars-template"
>
<
button
data
-
i18n
=
"
loading
"
type
=
"
submit
"
class
=
"
responsive ui-btn ui-icon-spinner ui-icon-spin ui-btn-icon-center ui-disabled
"
style
=
"
border:none;
"
>
loading
<
/button
>
</script>
...
...
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_slapos_hosting_subscription_status_html.xml
View file @
1aabfe3f
...
...
@@ -272,7 +272,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
68.33074.267.61440
</string>
</value>
<value>
<string>
9
72.32024.53732.34406
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -290,7 +290,7 @@
</tuple>
<state>
<tuple>
<float>
15
30120259.86
</float>
<float>
15
54257675.61
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_slapos_hosting_subscription_status_js.js
View file @
1aabfe3f
...
...
@@ -7,7 +7,13 @@
inline_status_source
=
gadget_klass
.
__template_element
.
getElementById
(
"
inline-status-template
"
)
.
innerHTML
,
inline_status_template
=
Handlebars
.
compile
(
inline_status_source
);
inline_status_template
=
Handlebars
.
compile
(
inline_status_source
),
inline_status_no_link_source
=
gadget_klass
.
__template_element
.
getElementById
(
"
inline-status-no-link-template
"
)
.
innerHTML
,
inline_status_no_link_template
=
Handlebars
.
compile
(
inline_status_no_link_source
);
function
checkHostingSubscriptionStatus
(
options
)
{
var
message
,
...
...
@@ -16,12 +22,22 @@
error_amount
=
0
,
total_amount
=
0
;
if
((
!
options
)
||
(
options
&&
!
options
.
news
))
{
if
((
!
options
)
||
(
options
&&
!
options
.
instance
))
{
return
'
ui-btn-no-data
'
;
}
for
(
instance
in
options
.
news
)
{
message
=
options
.
news
[
instance
].
text
;
if
(
options
.
is_slave
)
{
return
'
ui-btn-is-slave
'
;
}
else
if
(
options
.
is_stopped
)
{
return
'
ui-btn-is-stopped
'
;
}
else
if
(
options
.
is_destroyed
)
{
return
'
ui-btn-is-destroyed
'
;
}
for
(
instance
in
options
.
instance
)
{
message
=
options
.
instance
[
instance
].
text
;
if
(
message
.
startsWith
(
"
#error
"
))
{
partition_class
=
'
ui-btn-warning
'
;
error_amount
++
;
...
...
@@ -33,9 +49,6 @@
return
partition_class
;
}
}
if
(
options
.
computer_partition
===
{})
{
return
'
ui-btn-no-data
'
;
}
if
(
error_amount
===
total_amount
)
{
// No need to continue the result will be a warnning
...
...
@@ -51,65 +64,75 @@
return
gadget
.
jio_get
(
gadget
.
options
.
value
.
jio_key
);
}
function
getMonitorParameterDict
(
gadget
,
doc
)
{
if
(
doc
.
portal_type
===
"
Hosting Subscription
"
)
{
return
gadget
.
jio_getAttachment
(
gadget
.
options
.
value
.
jio_key
,
gadget
.
props
.
hateoas_url
+
gadget
.
options
.
value
.
jio_key
+
"
/HostingSubscription_getMonitorParameterDict
"
);
}
}
function
getStatus
(
gadget
)
{
var
result
;
function
getStatus
(
gadget
,
result
)
{
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
getDoc
(
gadget
);
})
.
push
(
function
(
jio_doc
)
{
result
=
jio_doc
;
if
(
gadget
.
state
.
monitor_dict
===
undefined
||
!
gadget
.
state
.
has_monitor_info
)
{
return
getMonitorParameterDict
(
gadget
,
jio_doc
)
.
push
(
function
(
param_dict
)
{
return
gadget
.
changeState
({
monitor_dict
:
param_dict
,
has_monitor_info
:
true
});
});
}
})
.
push
(
function
()
{
var
monitor_url
,
connection_key
,
status_class
=
'
ui-btn-no-data
'
,
status_title
=
'
Instances
'
,
status_style
=
""
;
status_class
=
checkHostingSubscriptionStatus
(
result
)
;
if
(
gadget
.
state
.
monitor_dict
.
url
&&
gadget
.
state
.
monitor_dict
.
username
&&
gadget
.
state
.
monitor_dict
.
password
)
{
monitor_url
=
"
https://monitor.app.officejs.com/#page=settings_configurator&url=
"
+
gadget
.
state
.
monitor_dict
.
url
+
"
&username=
"
+
gadget
.
state
.
monitor_dict
.
username
+
"
&password=
"
+
gadget
.
state
.
monitor_dict
.
password
;
}
else
{
result
=
jio_doc
;
status_class
=
checkHostingSubscriptionStatus
(
result
.
news
);
// it should verify if the monitor-base-url is ready.
for
(
connection_key
in
result
.
connection_parameter_list
)
{
if
(
result
.
connection_parameter_list
[
connection_key
].
connection_key
===
"
monitor-setup-url
"
)
{
monitor_url
=
result
.
connection_parameter_list
[
connection_key
].
connection_value
;
}
}
if
(
monitor_url
===
""
)
{
monitor_url
=
'
https://monitor.app.officejs.com/#/?page=ojsm_dispatch&query=portal_type%3A%22Hosting%20Subscription%22%20AND%20title%3A
'
+
result
.
title
;
}
if
(
status_class
===
'
ui-btn-is-slave
'
)
{
status_class
=
'
ui-btn-no-data
'
;
status_style
=
"
color: white !important;
"
;
status_title
=
'
Slave Only
'
;
}
else
if
(
status_class
===
'
ui-btn-is-stopped
'
)
{
status_class
=
'
ui-btn-no-data
'
;
status_style
=
"
color: white !important;
"
;
status_title
=
'
Stopped
'
;
}
else
if
(
status_class
===
'
ui-btn-is-destroyed
'
)
{
status_class
=
'
ui-btn-no-data
'
;
status_style
=
"
color: white !important;
"
;
status_title
=
'
Destroyed
'
;
}
if
(
status_class
===
'
ui-btn-no-data
'
)
{
status_style
=
"
color: transparent !important;
"
;
gadget
.
element
.
innerHTML
=
inline_status_no_link_template
({
status_class
:
status_class
,
status_title
:
status_title
,
status_style
:
status_style
});
}
else
{
gadget
.
element
.
innerHTML
=
inline_status_template
({
monitor_url
:
monitor_url
,
status_class
:
status_class
,
status_title
:
status_title
,
status_style
:
status_style
});
}
gadget
.
element
.
innerHTML
=
inline_status_template
({
monitor_url
:
monitor_url
,
status_class
:
status_class
,
status_title
:
status_title
,
status_style
:
status_style
});
return
gadget
;
}
);
}
function
getStatusLoop
(
gadget
)
{
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
gadget
.
jio_get
(
gadget
.
options
.
value
.
jio_key
);
})
.
push
(
function
(
result
)
{
return
getStatus
(
gadget
,
result
);
});
}
gadget_klass
.
setState
({
has_monitor_info
:
false
...
...
@@ -122,26 +145,27 @@
});
})
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
jio_getAttachment
"
,
"
jio_getAttachment
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
translateHtml
"
,
"
translateHtml
"
)
.
declareMethod
(
"
getContent
"
,
function
()
{
return
{};
})
.
declareJob
(
"
getStatus
"
,
function
()
{
.
declareJob
(
"
getStatus
"
,
function
(
result
)
{
var
gadget
=
this
;
return
getStatus
(
gadget
);
return
getStatus
(
gadget
,
{
news
:
result
}
);
})
.
onLoop
(
function
()
{
var
gadget
=
this
;
return
getStatus
(
gadget
);
return
getStatus
Loop
(
gadget
);
},
300000
)
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
;
gadget
.
options
=
options
;
gadget
.
flag
=
options
.
value
.
jio_key
;
return
gadget
.
getStatus
();
return
gadget
.
getStatus
(
options
.
value
.
result
);
});
}(
window
,
rJS
,
RSVP
,
Handlebars
));
\ No newline at end of file
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_slapos_hosting_subscription_status_js.xml
View file @
1aabfe3f
...
...
@@ -257,7 +257,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
97
1.49164.31619.415
06
</string>
</value>
<value>
<string>
97
2.32024.53732.344
06
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -275,7 +275,7 @@
</tuple>
<state>
<tuple>
<float>
15
42713467.3
</float>
<float>
15
54257864.46
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/HostingSubscription_getNewsDict.py
View file @
1aabfe3f
return
[
instance
.
Base_getNewsDict
(
instance
)
for
instance
in
context
.
getSpecialiseRelatedValueList
(
portal_type
=
"Software Instance"
)]
news_dict
=
{
"instance"
:
[]}
if
context
.
getSlapState
()
==
'stop_requested'
:
news_dict
[
"is_stopped"
]
=
1
elif
context
.
getSlapState
()
==
'destroy_requested'
:
news_dict
[
"is_destroyed"
]
=
1
elif
context
.
getRootSlave
():
news_dict
[
"is_slave"
]
=
1
else
:
news_dict
[
"instance"
]
=
[
instance
.
SoftwareInstance_getNewsDict
()
for
instance
in
context
.
getSpecialiseRelatedValueList
(
portal_type
=
"Software Instance"
)]
return
news_dict
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