|
|
@@ -9206,6 +9206,121 @@ function homepageUptimeKuma(timeout){
|
|
|
timeouts[timeoutTitle] = setTimeout(function(){ homepageUptimeKuma(timeout); }, timeout);
|
|
|
delete timeout;
|
|
|
}
|
|
|
+function buildPromPageItem(array) {
|
|
|
+ var cards = '';
|
|
|
+ var options = array['options'];
|
|
|
+ var services = array['data'];
|
|
|
+ var tabName = '';
|
|
|
+ console.log(options)
|
|
|
+
|
|
|
+ var buildCard = function(name, data) {
|
|
|
+ if(data.status == true) {
|
|
|
+ var statusColor = 'success'; var imageText = 'fa fa-check-circle text-success'
|
|
|
+ } else {
|
|
|
+ var statusColor = 'danger animated-3 loop-animation flash'; var imageText = 'fa fa-times-circle text-danger'
|
|
|
+ }
|
|
|
+ tabName = data.name;
|
|
|
+ if(options['compact']) {
|
|
|
+ var card = `
|
|
|
+ <div class="col-xl-2 col-lg-3 col-md-4 col-sm-6 col-xs-12">
|
|
|
+ <div class="card bg-inverse text-white mb-3 monitorr-card">
|
|
|
+ <div class="card-body bg-org-alt pt-1 pb-1">
|
|
|
+ <div class="d-flex no-block align-items-center">
|
|
|
+ <div class="left-health bg-`+statusColor+`"></div>
|
|
|
+ <div class="ml-1 w-100">
|
|
|
+ <i class="`+imageText+` font-20 pull-right mt-3 mb-2"></i>
|
|
|
+ `;
|
|
|
+ card += `<h3 class="d-flex no-block align-items-center mt-2 mb-2"><img class="lazyload loginTitle"> `+data.name;
|
|
|
+ if (data.uptime != null && options.showUptime) {
|
|
|
+ card += `<span class="ml-3 font-12 align-self-center text-dark">`+ Math.round(data.uptime * 100) / 100 +`%</span></h3>`
|
|
|
+ }
|
|
|
+ card += `</h3>`
|
|
|
+ card += `<div class="clearfix"></div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>`;
|
|
|
+ } else {
|
|
|
+ var card = `
|
|
|
+ <div class="col-lg-2 col-md-3 col-sm-4 col-xs-6">
|
|
|
+ <div class="card bg-inverse text-white mb-3 monitorr-card">
|
|
|
+ <div class="card-body bg-org-alt text-center">
|
|
|
+ `;
|
|
|
+ card += `<div class="d-block">
|
|
|
+ <h3 class="mt-0 mb-2">`+data.name+`</h3>`
|
|
|
+
|
|
|
+ if (data.uptime != null && options.showUptime) {
|
|
|
+ card += `<p class="text-dark mb-0">`+ Math.round(data.uptime * 100) / 100 +`%</p>`
|
|
|
+ }
|
|
|
+
|
|
|
+ card += `</div>
|
|
|
+ <div class="d-inline-block mt-4 py-2 px-4 badge indicator bg-`+statusColor+`">
|
|
|
+ <p class="mb-0">`; if(data.status == true) { card += 'UP' } else { card += 'DOWN' } card+=`</p>
|
|
|
+ </div>
|
|
|
+ `;
|
|
|
+ card += `</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ `;
|
|
|
+ }
|
|
|
+ return card;
|
|
|
+ }
|
|
|
+ for(var key in services) {
|
|
|
+ cards += buildCard(key, services[key]);
|
|
|
+ };
|
|
|
+ return cards;
|
|
|
+}
|
|
|
+function buildPromPage(array) {
|
|
|
+ if(array === false){ return ''; }
|
|
|
+ if(array.error != undefined) {
|
|
|
+ organizrConsole('PromPage Function',array.error, 'error');
|
|
|
+ } else {
|
|
|
+ var html = `
|
|
|
+ <div id="allPromPage">
|
|
|
+ <div class="el-element-overlay row">`
|
|
|
+ if(array['options']['titleToggle']) {
|
|
|
+ html += `
|
|
|
+ <div class="col-md-12">
|
|
|
+ <h4 class="pull-left homepage-element-title"><span lang="en">`+array['options']['title']+`</span> : </h4>
|
|
|
+ <hr class="hidden-xs ml-2">
|
|
|
+ </div>
|
|
|
+ <div class="clearfix"></div>
|
|
|
+ `;
|
|
|
+ }
|
|
|
+ html += `
|
|
|
+ <div class="promPageCards">
|
|
|
+ `+buildPromPageItem(array)+`
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="clearfix"></div>
|
|
|
+ `;
|
|
|
+ }
|
|
|
+ return (array) ? html : '';
|
|
|
+}
|
|
|
+function homepagePromPage(timeout){
|
|
|
+ var timeout = (typeof timeout !== 'undefined') ? timeout : activeInfo.settings.homepage.refresh.homepagePromPageRefresh;
|
|
|
+ organizrAPI2('GET','api/v2/homepage/prompage/data').success(function(data) {
|
|
|
+ try {
|
|
|
+ let response = data.response;
|
|
|
+ document.getElementById('homepageOrderPromPage').innerHTML = '';
|
|
|
+ if(response.data !== null){
|
|
|
+ buildUptimeKuma(response.data)
|
|
|
+ $('#homepageOrderPromPage').html(buildPromPage(response.data));
|
|
|
+ }
|
|
|
+ }catch(e) {
|
|
|
+ console.log(e)
|
|
|
+ organizrCatchError(e,data);
|
|
|
+ }
|
|
|
+ }).fail(function(xhr) {
|
|
|
+ OrganizrApiError(xhr);
|
|
|
+ });
|
|
|
+ let timeoutTitle = 'PromPage-Homepage';
|
|
|
+ if(typeof timeouts[timeoutTitle] !== 'undefined'){ clearTimeout(timeouts[timeoutTitle]); }
|
|
|
+ timeouts[timeoutTitle] = setTimeout(function(){ homepagePromPage(timeout); }, timeout);
|
|
|
+ delete timeout;
|
|
|
+}
|
|
|
function homepageSpeedtest(timeout){
|
|
|
var timeout = (typeof timeout !== 'undefined') ? timeout : activeInfo.settings.homepage.refresh.homepageSpeedtestRefresh;
|
|
|
organizrAPI2('GET','api/v2/homepage/speedtest/data').success(function(data) {
|