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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
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 @@
...
@@ -276,7 +276,7 @@
"
url
"
:
"
gadget_slapos_hosting_subscription_status.html
"
,
"
url
"
:
"
gadget_slapos_hosting_subscription_status.html
"
,
"
sandbox
"
:
""
,
"
sandbox
"
:
""
,
"
key
"
:
"
monitoring_status
"
,
"
key
"
:
"
monitoring_status
"
,
"
hidden
"
:
gadget
.
state
.
doc
.
root_slave
===
1
,
"
hidden
"
:
0
,
"
type
"
:
"
GadgetField
"
"
type
"
:
"
GadgetField
"
},
},
"
my_monitor_scope
"
:
{
"
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 @@
...
@@ -230,7 +230,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
974.
49068.53964.3174
</string>
</value>
<value>
<string>
974.
50466.65103.30515
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -248,7 +248,7 @@
...
@@ -248,7 +248,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
1554
168123.0
9
</float>
<float>
1554
257716.7
9
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</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 @@
...
@@ -18,24 +18,23 @@
"
root_slave
"
];
"
root_slave
"
];
return
gadget
.
jio_allDocs
(
param_list
[
0
])
return
gadget
.
jio_allDocs
(
param_list
[
0
])
.
push
(
function
(
result
)
{
.
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
)
{
for
(
i
=
0
;
i
<
len
;
i
+=
1
)
{
if
(
1
||
(
result
.
data
.
rows
[
i
].
value
.
hasOwnProperty
(
"
root_slave
"
)))
{
if
(
1
||
(
result
.
data
.
rows
[
i
].
value
.
hasOwnProperty
(
"
HostingSubscription_getNewsDict
"
)))
{
if
(
result
.
data
.
rows
[
i
].
value
.
root_slave
!==
1
)
{
value
=
result
.
data
.
rows
[
i
].
id
;
value
=
result
.
data
.
rows
[
i
].
id
;
news
=
result
.
data
.
rows
[
i
].
value
.
HostingSubscription_getNewsDict
;
result
.
data
.
rows
[
i
].
value
.
monitoring_status
=
{
result
.
data
.
rows
[
i
].
value
.
HostingSubscription_getNewsDict
=
{
field_gadget_param
:
{
field_gadget_param
:
{
css_class
:
""
,
css_class
:
""
,
description
:
"
The Status
"
,
description
:
"
The Status
"
,
hidden
:
0
,
hidden
:
0
,
"
default
"
:
{
jio_key
:
value
},
"
default
"
:
{
jio_key
:
value
,
result
:
news
},
key
:
"
status
"
,
key
:
"
status
"
,
url
:
"
gadget_slapos_hosting_subscription_status.html
"
,
url
:
"
gadget_slapos_hosting_subscription_status.html
"
,
title
:
"
Status
"
,
title
:
"
Status
"
,
type
:
"
GadgetField
"
type
:
"
GadgetField
"
}
}
};
};
}
result
.
data
.
rows
[
i
].
value
[
"
listbox_uid:list
"
]
=
{
result
.
data
.
rows
[
i
].
value
[
"
listbox_uid:list
"
]
=
{
key
:
"
listbox_uid:list
"
,
key
:
"
listbox_uid:list
"
,
value
:
2713
value
:
2713
...
@@ -72,7 +71,7 @@
...
@@ -72,7 +71,7 @@
var
column_list
=
[
var
column_list
=
[
[
'
title
'
,
'
Title
'
],
[
'
title
'
,
'
Title
'
],
[
'
short_title
'
,
'
Short Title
'
],
[
'
short_title
'
,
'
Short Title
'
],
[
'
monitoring_status
'
,
'
Status
'
]
[
'
HostingSubscription_getNewsDict
'
,
'
Status
'
]
];
];
return
form_list
.
render
({
return
form_list
.
render
({
erp5_document
:
{
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 @@
...
@@ -230,7 +230,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<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>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -248,7 +248,7 @@
...
@@ -248,7 +248,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
155
2957541.9
</float>
<float>
155
4257753.72
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_slapos_hosting_subscription_status_html.html
View file @
1aabfe3f
...
@@ -17,6 +17,10 @@
...
@@ -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
>
<
a
class
=
"
ui-btn ui-btn-icon-left ui-icon-desktop
"
href
=
"
{{monitor_url}}
"
target
=
_blank
>
{{
status_title
}}
<
/a></
div
><
/div
>
</script>
</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"
>
<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
>
<
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>
</script>
...
...
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_slapos_hosting_subscription_status_html.xml
View file @
1aabfe3f
...
@@ -272,7 +272,7 @@
...
@@ -272,7 +272,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<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>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -290,7 +290,7 @@
...
@@ -290,7 +290,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
15
30120259.86
</float>
<float>
15
54257675.61
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_slapos_hosting_subscription_status_js.js
View file @
1aabfe3f
...
@@ -7,7 +7,13 @@
...
@@ -7,7 +7,13 @@
inline_status_source
=
gadget_klass
.
__template_element
inline_status_source
=
gadget_klass
.
__template_element
.
getElementById
(
"
inline-status-template
"
)
.
getElementById
(
"
inline-status-template
"
)
.
innerHTML
,
.
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
)
{
function
checkHostingSubscriptionStatus
(
options
)
{
var
message
,
var
message
,
...
@@ -16,12 +22,22 @@
...
@@ -16,12 +22,22 @@
error_amount
=
0
,
error_amount
=
0
,
total_amount
=
0
;
total_amount
=
0
;
if
((
!
options
)
||
(
options
&&
!
options
.
news
))
{
if
((
!
options
)
||
(
options
&&
!
options
.
instance
))
{
return
'
ui-btn-no-data
'
;
return
'
ui-btn-no-data
'
;
}
}
for
(
instance
in
options
.
news
)
{
if
(
options
.
is_slave
)
{
message
=
options
.
news
[
instance
].
text
;
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
"
))
{
if
(
message
.
startsWith
(
"
#error
"
))
{
partition_class
=
'
ui-btn-warning
'
;
partition_class
=
'
ui-btn-warning
'
;
error_amount
++
;
error_amount
++
;
...
@@ -33,9 +49,6 @@
...
@@ -33,9 +49,6 @@
return
partition_class
;
return
partition_class
;
}
}
}
}
if
(
options
.
computer_partition
===
{})
{
return
'
ui-btn-no-data
'
;
}
if
(
error_amount
===
total_amount
)
{
if
(
error_amount
===
total_amount
)
{
// No need to continue the result will be a warnning
// No need to continue the result will be a warnning
...
@@ -51,65 +64,75 @@
...
@@ -51,65 +64,75 @@
return
gadget
.
jio_get
(
gadget
.
options
.
value
.
jio_key
);
return
gadget
.
jio_get
(
gadget
.
options
.
value
.
jio_key
);
}
}
function
getMonitorParameterDict
(
gadget
,
doc
)
{
function
getStatus
(
gadget
,
result
)
{
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
;
return
new
RSVP
.
Queue
()
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
.
push
(
function
()
{
return
getDoc
(
gadget
);
return
getDoc
(
gadget
);
})
})
.
push
(
function
(
jio_doc
)
{
.
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
,
var
monitor_url
,
connection_key
,
status_class
=
'
ui-btn-no-data
'
,
status_class
=
'
ui-btn-no-data
'
,
status_title
=
'
Instances
'
,
status_title
=
'
Instances
'
,
status_style
=
""
;
status_style
=
""
;
status_class
=
checkHostingSubscriptionStatus
(
result
)
;
result
=
jio_doc
;
if
(
gadget
.
state
.
monitor_dict
.
url
&&
status_class
=
checkHostingSubscriptionStatus
(
result
.
news
);
gadget
.
state
.
monitor_dict
.
username
&&
// it should verify if the monitor-base-url is ready.
gadget
.
state
.
monitor_dict
.
password
)
{
for
(
connection_key
in
result
.
connection_parameter_list
)
{
monitor_url
=
"
https://monitor.app.officejs.com/#page=settings_configurator&url=
"
+
if
(
result
.
connection_parameter_list
[
connection_key
].
connection_key
===
"
monitor-setup-url
"
)
{
gadget
.
state
.
monitor_dict
.
url
+
"
&username=
"
+
monitor_url
=
result
.
connection_parameter_list
[
connection_key
].
connection_value
;
gadget
.
state
.
monitor_dict
.
username
+
"
&password=
"
+
}
gadget
.
state
.
monitor_dict
.
password
;
}
}
else
{
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
;
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
'
)
{
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
;
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
gadget_klass
.
setState
({
.
setState
({
has_monitor_info
:
false
has_monitor_info
:
false
...
@@ -122,26 +145,27 @@
...
@@ -122,26 +145,27 @@
});
});
})
})
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
jio_getAttachment
"
,
"
jio_getAttachment
"
)
.
declareAcquiredMethod
(
"
jio_getAttachment
"
,
"
jio_getAttachment
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
translateHtml
"
,
"
translateHtml
"
)
.
declareAcquiredMethod
(
"
translateHtml
"
,
"
translateHtml
"
)
.
declareMethod
(
"
getContent
"
,
function
()
{
.
declareMethod
(
"
getContent
"
,
function
()
{
return
{};
return
{};
})
})
.
declareJob
(
"
getStatus
"
,
function
()
{
.
declareJob
(
"
getStatus
"
,
function
(
result
)
{
var
gadget
=
this
;
var
gadget
=
this
;
return
getStatus
(
gadget
);
return
getStatus
(
gadget
,
{
news
:
result
}
);
})
})
.
onLoop
(
function
()
{
.
onLoop
(
function
()
{
var
gadget
=
this
;
var
gadget
=
this
;
return
getStatus
(
gadget
);
return
getStatus
Loop
(
gadget
);
},
300000
)
},
300000
)
.
declareMethod
(
"
render
"
,
function
(
options
)
{
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
;
var
gadget
=
this
;
gadget
.
options
=
options
;
gadget
.
options
=
options
;
gadget
.
flag
=
options
.
value
.
jio_key
;
gadget
.
flag
=
options
.
value
.
jio_key
;
return
gadget
.
getStatus
();
return
gadget
.
getStatus
(
options
.
value
.
result
);
});
});
}(
window
,
rJS
,
RSVP
,
Handlebars
));
}(
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 @@
...
@@ -257,7 +257,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<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>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -275,7 +275,7 @@
...
@@ -275,7 +275,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
15
42713467.3
</float>
<float>
15
54257864.46
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</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