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
1973b8e0
Commit
1973b8e0
authored
Sep 13, 2012
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract the JS lib in a separate file
parent
bbafc685
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
229 additions
and
168 deletions
+229
-168
master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Base_getVifibOverview.xml
...Item/portal_skins/vifib_hosting/Base_getVifibOverview.xml
+1
-167
master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting_theme/ERP5Site_getJavaScriptRelativeUrlList.xml
...b_hosting_theme/ERP5Site_getJavaScriptRelativeUrlList.xml
+1
-0
master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting_theme/vifib_hosting_js/vifib_monitoring.js.xml
...ib_hosting_theme/vifib_hosting_js/vifib_monitoring.js.xml
+226
-0
master/bt5/vifib_web/bt/revision
master/bt5/vifib_web/bt/revision
+1
-1
No files found.
master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Base_getVifibOverview.xml
View file @
1973b8e0
...
@@ -57,176 +57,10 @@ return """\n
...
@@ -57,176 +57,10 @@ return """\n
<ul id="vifib_monitoring">
</ul>
\n
<ul id="vifib_monitoring">
</ul>
\n
\n
\n
<script>
\n
<script>
\n
"use strict";\n
\n
// http://stackoverflow.com/a/246813\n
var Base61 = {\n
\n
// private property\n
_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",\n
\n
// public method for encoding\n
encode : function (input) {\n
var output = "";\n
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;\n
var i = 0;\n
\n
// input = Base64._utf8_encode(input);\n
\n
while (i
< input.length
)
{\n
\n
chr1 =
input.charCodeAt(i++);\n
chr2 =
input.charCodeAt(i++);\n
chr3 =
input.charCodeAt(i++);\n
\n
enc1 =
chr1
>
> 2;\n
enc2 = ((chr1
&
3)
<
< 4
)
|
(chr2
>
> 4);\n
enc3 = ((chr2
&
15)
<
< 2
)
|
(chr3
>
> 6);\n
enc4 = chr3
&
60;\n
\n
if (isNaN(chr2)) {\n
enc3 = enc4 = 61;\n
} else if (isNaN(chr3)) {\n
enc4 = 61;\n
}\n
\n
output = output +\n
this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +\n
this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);\n
\n
}\n
\n
return output;\n
},\n
};\n
\n
(function (window, $) {\n
\n
var methods,\n
update_status,\n
search_document_list;\n
\n
update_status = function (context) {\n
var status_url = decodeURIComponent(context.attr("data-url"));\n
context.attr("class", "check_monitoring")\n
.attr("title", "Checking status");\n
$.ajax({\n
type: \'GET\',\n
url: status_url,\n
dataType: \'json\',\n
async: true,\n
context: context, \n
success: function(data) {\n
var created_at = new Date(Date.parse(data.created_at)),\n
now = new Date(),\n
context = $(this);\n
// 5 minute for computer. 1 day for instance.\n
if (/#ok/.test(data.text)
&
/computer_module/.test(data[\'@document\'])
&
(now - created_at
< 300000
))
{\n
$(this).attr("class",
"monitoring_ok")\n
.attr("title",
data.text
+
"
("
+
created_at
+
")"
)\n
.html("<a
href=
\'"
+
data[\'@document\']
+
"\'
></a>
");\n
} else if (/#ok/.test(data.text)
&
/software_instance_module/.test(data[\'@document\'])
&
(now - created_at
< 86400000
))
{\n
$(this).attr("class",
"monitoring_ok")\n
.attr("title",
data.text
+
"
("
+
created_at
+
")"
)\n
.html("<a
href=
\'"
+
data[\'@document\']
+
"\'
></a>
");\n
} else {\n
$(this).attr("class", "monitoring_error")\n
.attr("title", data.text + " (" + created_at + ")" )\n
.html("
<a
href=
\'"
+
data[\'@document\']
+
"\'
></a>
");\n
}\n
setTimeout(function () {\n
update_status(context);\n
}, 60000);\n
},\n
error: function(jqXHR, textStatus, errorThrown) {\n
// XXX Drop content instead\n
// $(this).attr("class", "monitoring_failed");\n
var context = $(this);\n
if (jqXHR.status === 404) {\n
context.remove()\n
} else {\n
$(this).attr("class", "monitoring_failed")\n
.attr("title", "Unable to fetch content");\n
setTimeout(function () {\n
update_status(context);\n
}, 60000);\n
}\n
\n
},\n
});\n
};\n
\n
search_document_list = function (context) {\n
var start = parseInt(context.attr("data-start") || "0", 10),\n
i = 0,\n
list_url = "%s/v1/status/"; // XXX Hardcoded\n
\n
$.ajax({\n
type: \'GET\',\n
url: list_url,\n
dataType: \'json\',\n
async: true,\n
context: context, \n
success: function(data) {\n
var result_list = data.list || [];\n
\n
for (i=0; i
<result_list.length
;
i
+=
1)
{\n
var
status_url =
result_list[i],\n
status_id,\n
status_context;\n
status_id =
encodeURIComponent(Base61.encode(status_url)),\n
status_context =
$(this).find(\'#\'
+
status_id);\n
if
(!status_context[0])
{\n
status_context =
$(this).append(\'<li
class=
"check_monitoring"
id=
"\' + status_id + \'"
data-url=
"\' + encodeURIComponent(status_url) + \'"
></li>
\')\n
.find(\'#\' + status_id);\n
}\n
setTimeout(function () {\n
update_status(status_context);\n
});\n
}\n
},\n
complete: function() {\n
var context = $(this);\n
setTimeout(function () {\n
search_document_list(context);\n
}, 60000);\n
},\n
});\n
};\n
\n
\n
\n
methods = {\n
init: function () {\n
var context = $(this);\n
setTimeout(function () {\n
search_document_list(context);\n
});\n
return context;\n
},\n
};\n
\n
$.fn.vifibmonitoring = function () {\n
var result,\n
method = "init";\n
if (methods.hasOwnProperty(method)) {\n
result = methods[method].apply(\n
this,\n
Array.prototype.slice.call(arguments, 1)\n
);\n
} else {\n
$.error(\'Method \' + method +\n
\' does not exist on jQuery.vifibmonitoring\');\n
}\n
return result;\n
};\n
}(window, jQuery));\n
\n
$(document).ready(function () {\n
$(document).ready(function () {\n
$("ul#vifib_monitoring")\n
$("ul#vifib_monitoring")\n
.vifibmonitoring();\n
.vifibmonitoring(
"%s"
);\n
});\n
});\n
\n
</script>
\n
</script>
\n
""" % tool.absolute_url()\n
""" % tool.absolute_url()\n
...
...
master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting_theme/ERP5Site_getJavaScriptRelativeUrlList.xml
View file @
1973b8e0
...
@@ -54,6 +54,7 @@
...
@@ -54,6 +54,7 @@
\n
\n
return (\'jquery/core/jquery.js\',\n
return (\'jquery/core/jquery.js\',\n
\'vifib_hosting_js/erp5_acknowledgement.js\',\n
\'vifib_hosting_js/erp5_acknowledgement.js\',\n
\'vifib_hosting_js/vifib_monitoring.js\',\n
\'vifib_hosting_js/vifib_hosting.js\',)\n
\'vifib_hosting_js/vifib_hosting.js\',)\n
</string>
</value>
</string>
</value>
</item>
</item>
...
...
master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting_theme/vifib_hosting_js/vifib_monitoring.js.xml
0 → 100644
View file @
1973b8e0
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"DTMLMethod"
module=
"OFS.DTMLMethod"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_Cacheable__manager_id
</string>
</key>
<value>
<string>
http_cache
</string>
</value>
</item>
<item>
<key>
<string>
__name__
</string>
</key>
<value>
<string>
vifib_monitoring.js
</string>
</value>
</item>
<item>
<key>
<string>
_vars
</string>
</key>
<value>
<dictionary/>
</value>
</item>
<item>
<key>
<string>
globals
</string>
</key>
<value>
<dictionary/>
</value>
</item>
<item>
<key>
<string>
raw
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
/*\n
Copyright (c) 2012 Nexedi SA and Contributors. All Rights Reserved.\n
\n
This program is Free Software; you can redistribute it and/or\n
modify it under the terms of the GNU General Public License\n
as published by the Free Software Foundation; either version 2\n
of the License, or (at your option) any later version.\n
\n
This program is distributed in the hope that it will be useful,\n
but WITHOUT ANY WARRANTY; without even the implied warranty of\n
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n
GNU General Public License for more details.\n
\n
You should have received a copy of the GNU General Public License\n
along with this program; if not, write to the Free Software\n
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n
*/\n
"use strict";\n
\n
(function (window, $) {\n
\n
var methods,\n
Base61,\n
update_status,\n
search_document_list;\n
\n
// http://stackoverflow.com/a/246813\n
Base61 = {\n
// private property\n
_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",\n
// public method for encoding\n
encode : function (input) {\n
var output = "";\n
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;\n
var i = 0;\n
\n
// input = Base64._utf8_encode(input);\n
\n
while (i < input.length) {\n
\n
chr1 = input.charCodeAt(i++);\n
chr2 = input.charCodeAt(i++);\n
chr3 = input.charCodeAt(i++);\n
\n
enc1 = chr1 >
> 2;\n
enc2 = ((chr1
&
3)
<
< 4
)
|
(chr2
>
> 4);\n
enc3 = ((chr2
&
15)
<
< 2
)
|
(chr3
>
> 6);\n
enc4 = chr3
&
60;\n
\n
if (isNaN(chr2)) {\n
enc3 = enc4 = 61;\n
} else if (isNaN(chr3)) {\n
enc4 = 61;\n
}\n
\n
output = output +\n
this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +\n
this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);\n
\n
}\n
\n
return output;\n
},\n
};\n
\n
\n
update_status = function (context) {\n
var status_url = decodeURIComponent(context.attr("data-url"));\n
context.attr("class", "check_monitoring")\n
.attr("title", "Checking status");\n
$.ajax({\n
type: \'GET\',\n
url: status_url,\n
dataType: \'json\',\n
async: true,\n
context: context, \n
success: function(data) {\n
var created_at = new Date(Date.parse(data.created_at)),\n
now = new Date(),\n
context = $(this);\n
// 5 minute for computer. 1 day for instance.\n
if (/#ok/.test(data.text)
&
/computer_module/.test(data[\'@document\'])
&
(now - created_at
< 300000
))
{\n
$(this).attr("class",
"monitoring_ok")\n
.attr("title",
data.text
+
"
("
+
created_at
+
")"
)\n
.html("<a
href=
\'"
+
data[\'@document\']
+
"\'
></a>
");\n
} else if (/#ok/.test(data.text)
&
/software_instance_module/.test(data[\'@document\'])
&
(now - created_at
< 86400000
))
{\n
$(this).attr("class",
"monitoring_ok")\n
.attr("title",
data.text
+
"
("
+
created_at
+
")"
)\n
.html("<a
href=
\'"
+
data[\'@document\']
+
"\'
></a>
");\n
} else {\n
$(this).attr("class", "monitoring_error")\n
.attr("title", data.text + " (" + created_at + ")" )\n
.html("
<a
href=
\'"
+
data[\'@document\']
+
"\'
></a>
");\n
}\n
setTimeout(function () {\n
update_status(context);\n
}, 60000);\n
},\n
error: function(jqXHR, textStatus, errorThrown) {\n
// XXX Drop content instead\n
// $(this).attr("class", "monitoring_failed");\n
var context = $(this);\n
if (jqXHR.status === 404) {\n
context.remove()\n
} else {\n
$(this).attr("class", "monitoring_failed")\n
.attr("title", "Unable to fetch content");\n
setTimeout(function () {\n
update_status(context);\n
}, 60000);\n
}\n
\n
},\n
});\n
};\n
\n
search_document_list = function (context, base_url) {\n
var start = parseInt(context.attr("data-start") || "0", 10),\n
i = 0,\n
list_url = base_url + "/v1/status/"; // XXX Hardcoded\n
\n
$.ajax({\n
type: \'GET\',\n
url: list_url,\n
dataType: \'json\',\n
async: true,\n
context: context, \n
success: function(data) {\n
var result_list = data.list || [];\n
\n
for (i=0; i
<result_list.length
;
i
+=
1)
{\n
var
status_url =
result_list[i],\n
status_id,\n
status_context;\n
status_id =
encodeURIComponent(Base61.encode(status_url)),\n
status_context =
$(this).find(\'#\'
+
status_id);\n
if
(!status_context[0])
{\n
status_context =
$(this).append(\'<li
class=
"check_monitoring"
id=
"\'\n
+ status_id + \'"
data-url=
"\' + encodeURIComponent(status_url) + \'"
></li>
\')\n
.find(\'#\' + status_id);\n
}\n
setTimeout(function () {\n
update_status(status_context);\n
});\n
}\n
},\n
complete: function() {\n
var context = $(this);\n
setTimeout(function () {\n
search_document_list(context, base_url);\n
}, 60000);\n
},\n
});\n
};\n
\n
\n
\n
methods = {\n
init: function (base_url) {\n
var context = $(this);\n
setTimeout(function () {\n
search_document_list(context, base_url);\n
});\n
return context;\n
},\n
};\n
\n
$.fn.vifibmonitoring = function () {\n
var result,\n
method = "init";\n
if (methods.hasOwnProperty(method)) {\n
result = methods[method].apply(\n
this,\n
Array.prototype.slice.call(arguments, 0)\n
);\n
} else {\n
$.error(\'Method \' + method +\n
\' does not exist on jQuery.vifibmonitoring\');\n
}\n
return result;\n
};\n
}(window, jQuery));\n
]]>
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/vifib_web/bt/revision
View file @
1973b8e0
445
446
\ No newline at end of file
\ No newline at end of file
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