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
1
Merge Requests
1
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
Romain Courteaud
slapos.core
Commits
85794c9d
Commit
85794c9d
authored
Oct 08, 2021
by
Romain Courteaud
🐙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_jio: xxx status gadget
parent
f1070df6
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
910 additions
and
2 deletions
+910
-2
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_slapos_status_html.html
...teItem/web_page_module/rjs_gadget_slapos_status_html.html
+26
-0
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_slapos_status_html.xml
...ateItem/web_page_module/rjs_gadget_slapos_status_html.xml
+373
-0
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_slapos_status_js.js
...mplateItem/web_page_module/rjs_gadget_slapos_status_js.js
+136
-0
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_slapos_status_js.xml
...plateItem/web_page_module/rjs_gadget_slapos_status_js.xml
+369
-0
master/bt5/slapos_jio/bt/template_keep_last_workflow_history_only_path_list
...jio/bt/template_keep_last_workflow_history_only_path_list
+2
-0
master/bt5/slapos_jio/bt/template_path_list
master/bt5/slapos_jio/bt/template_path_list
+4
-2
No files found.
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_slapos_status_html.html
0 → 100644
View file @
85794c9d
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<title>
Background
</title>
<script
src=
"rsvp.js"
></script>
<script
src=
"renderjs.js"
></script>
<script
src=
"handlebars.js"
></script>
<script
src=
"gadget_slapos_status.js"
></script>
<link
href=
"gadget_slapos_compute_node_status.css"
rel=
"stylesheet"
type=
"text/css"
/>
<script
id=
"inline-status-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}}
"
>
<
a
class
=
"
ui-btn ui-btn-icon-left ui-icon-desktop
"
href
=
{{
monitor_url
}}
target
=
_blank
>
{{
status_title
}}
<
/a></
div
><
/div
>
<
div
class
=
"
ui-block-c
"
style
=
"
width:50%
"
><
div
class
=
"
ui-bar ui-corner-all last-child {{right_class}}
"
style
=
"
{{right_style}}
"
>
<
a
class
=
"
ui-btn ui-btn-icon-left ui-icon-desktop
"
href
=
"
{{monitor_url}}
"
target
=
_blank
>
{{
right_title
}}
<
/a></
div
><
/div
>
</script>
</head>
<body>
</body>
</html>
\ No newline at end of file
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_slapos_status_html.xml
0 → 100644
View file @
85794c9d
This diff is collapsed.
Click to expand it.
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_slapos_status_js.js
0 → 100644
View file @
85794c9d
/*globals window, rJS, Handlebars*/
/*jslint indent: 2, nomen: true, maxlen: 80*/
(
function
(
window
,
rJS
,
Handlebars
)
{
"
use strict
"
;
var
gadget_klass
=
rJS
(
window
),
inline_status_source
=
gadget_klass
.
__template_element
.
getElementById
(
"
inline-status-template
"
)
.
innerHTML
,
inline_status_template
=
Handlebars
.
compile
(
inline_status_source
);
function
checkComputeNodeStatus
(
options
)
{
if
(
!
options
||
!
options
.
news
||
!
options
.
news
.
text
)
{
return
'
ui-btn-no-data
'
;
}
if
(
options
.
news
.
text
.
startsWith
(
"
#access
"
))
{
if
(
options
.
news
.
no_data_since_15_minutes
)
{
return
'
ui-btn-error
'
;
}
if
(
options
.
news
.
no_data_since_5_minutes
)
{
return
'
ui-btn-warning
'
;
}
return
'
ui-btn-ok
'
;
}
if
(
options
.
news
.
no_data
)
{
return
'
ui-btn-no-data
'
;
}
return
'
ui-btn-error
'
;
}
function
checkComputePartitionStatus
(
options
)
{
var
message
,
compute_partition
,
partition_class
=
'
ui-btn-ok
'
,
error_amount
=
0
,
total_amount
=
0
;
if
(
!
options
||
!
options
.
compute_partition_news
)
{
return
'
ui-btn-no-data
'
;
}
for
(
compute_partition
in
options
.
compute_partition_news
)
{
if
(
options
.
compute_partition_news
.
hasOwnProperty
(
compute_partition
)
&&
options
.
compute_partition_news
[
compute_partition
].
text
)
{
message
=
options
.
compute_partition_news
[
compute_partition
].
text
;
if
(
message
.
startsWith
(
"
#error
"
))
{
partition_class
=
'
ui-btn-warning
'
;
error_amount
+=
1
;
}
total_amount
+=
1
;
if
((
error_amount
>
0
)
&&
(
error_amount
<
total_amount
))
{
// No need to continue the result will be a warnning
return
partition_class
;
}
}
}
if
(
total_amount
===
0
)
{
return
'
ui-btn-no-data
'
;
}
if
(
error_amount
===
total_amount
)
{
// No need to continue the result will be a warnning
return
'
ui-btn-error
'
;
}
return
partition_class
;
}
function
getStatus
(
gadget
,
result
)
{
var
monitor_url
,
status_class
=
'
ui-btn-no-data
'
,
status_title
=
'
Compute Node
'
,
right_title
=
'
Partitions
'
,
right_class
=
'
ui-btn-no-data
'
,
status_style
=
''
,
right_style
=
''
;
if
(
result
&&
result
.
news
&&
result
.
news
.
compute_node
)
{
status_class
=
checkComputeNodeStatus
({
news
:
result
.
news
.
compute_node
});
}
if
((
status_class
===
'
ui-btn-error
'
)
||
(
status_class
===
'
ui-btn-no-data
'
))
{
right_class
=
status_class
;
}
else
{
if
(
result
&&
result
.
news
&&
result
.
news
.
partition
)
{
right_class
=
checkComputePartitionStatus
(
{
compute_partition_news
:
result
.
news
.
partition
}
);
}
}
monitor_url
=
'
https://monitor.app.officejs.com/#/
'
+
'
?page=ojsm_dispatch&query=portal_type%3A%22Software%20Instance%22%20
'
+
'
AND%20aggregate_reference%3A%22
'
+
result
.
reference
+
'
%22
'
;
gadget
.
element
.
innerHTML
=
inline_status_template
({
monitor_url
:
monitor_url
,
status_class
:
status_class
,
status_title
:
status_title
,
status_style
:
status_style
,
right_class
:
right_class
,
right_title
:
right_title
,
right_style
:
right_style
});
return
gadget
;
}
gadget_klass
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareMethod
(
"
getContent
"
,
function
()
{
return
{};
})
.
declareJob
(
"
getStatus
"
,
function
(
result
)
{
return
getStatus
(
this
,
{
news
:
result
});
})
.
onLoop
(
function
()
{
var
gadget
=
this
;
if
(
gadget
.
state
.
jio_key
)
{
return
gadget
.
jio_get
(
gadget
.
state
.
jio_key
)
.
push
(
function
(
result
)
{
return
gadget
.
changeState
(
result
);
});
}
},
300000
)
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
state_dict
=
options
.
value
.
result
;
state_dict
.
jio_key
=
options
.
value
.
jio_key
;
return
this
.
changeState
(
state_dict
);
})
.
onStateChange
(
function
()
{
return
getStatus
(
this
,
this
.
state
);
});
}(
window
,
rJS
,
Handlebars
));
\ No newline at end of file
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_slapos_status_js.xml
0 → 100644
View file @
85794c9d
This diff is collapsed.
Click to expand it.
master/bt5/slapos_jio/bt/template_keep_last_workflow_history_only_path_list
View file @
85794c9d
image_module/gadget_slapos_panel_png
image_module/gadget_slapos_invoice_logo_png
web_page_module/rjs_gadget_slapos_status_html
web_page_module/rjs_gadget_slapos_status_js
web_page_module/gadget_erp5_page_slap_cloud_contract_view_html
web_page_module/gadget_erp5_page_slap_cloud_contract_view_js
web_page_module/gadget_erp5_page_slap_request_contract_activation_html
...
...
master/bt5/slapos_jio/bt/template_path_list
View file @
85794c9d
...
...
@@ -40,14 +40,14 @@ web_page_module/rjs_gadget_erp5_page_slap_compute_node_get_token_html
web_page_module/rjs_gadget_erp5_page_slap_compute_node_get_token_js
web_page_module/rjs_gadget_erp5_page_slap_compute_node_list_html
web_page_module/rjs_gadget_erp5_page_slap_compute_node_list_js
web_page_module/rjs_gadget_erp5_page_slap_computer_network_view_html
web_page_module/rjs_gadget_erp5_page_slap_computer_network_view_js
web_page_module/rjs_gadget_erp5_page_slap_compute_node_request_certificate_html
web_page_module/rjs_gadget_erp5_page_slap_compute_node_request_certificate_js
web_page_module/rjs_gadget_erp5_page_slap_compute_node_revoke_certificate_html
web_page_module/rjs_gadget_erp5_page_slap_compute_node_revoke_certificate_js
web_page_module/rjs_gadget_erp5_page_slap_compute_node_view_html
web_page_module/rjs_gadget_erp5_page_slap_compute_node_view_js
web_page_module/rjs_gadget_erp5_page_slap_computer_network_view_html
web_page_module/rjs_gadget_erp5_page_slap_computer_network_view_js
web_page_module/rjs_gadget_erp5_page_slap_controller_html
web_page_module/rjs_gadget_erp5_page_slap_controller_js
web_page_module/rjs_gadget_erp5_page_slap_delete_network_html
...
...
@@ -204,6 +204,8 @@ web_page_module/rjs_gadget_slapos_project_status_html
web_page_module/rjs_gadget_slapos_project_status_js
web_page_module/rjs_gadget_slapos_site_status_html
web_page_module/rjs_gadget_slapos_site_status_js
web_page_module/rjs_gadget_slapos_status_html
web_page_module/rjs_gadget_slapos_status_js
web_page_module/rjs_gadget_slapos_translation_data_js
web_page_module/rjs_gadget_slapos_translation_html
web_page_module/rjs_gadget_slapos_utils_js
...
...
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