Browse Source

Merge pull request #218 from Telaxus/refactor-status-bar

Refactor status bar
experimental
Paweł Jedwabny 4 years ago
committed by GitHub
parent
commit
e402a0a237
12 changed files with 153 additions and 733 deletions
  1. +94
    -8
      index.php
  2. +2
    -14
      modules/Base/StatusBar/StatusBar_0.php
  3. +0
    -54
      modules/Base/StatusBar/js/main.js
  4. +0
    -480
      modules/Base/StatusBar/js/nprogress.js
  5. +0
    -70
      modules/Base/StatusBar/theme/default.css
  6. +0
    -22
      modules/Base/StatusBar/theme/default.tpl
  7. BIN
      modules/Base/StatusBar/theme/loader.gif
  8. +0
    -74
      modules/Base/StatusBar/theme/nprogress.css
  9. +1
    -0
      package.json
  10. +20
    -9
      src/epesi.js
  11. +4
    -2
      src/index.js
  12. +32
    -0
      src/statusBar.js

+ 94
- 8
index.php View File

@@ -63,7 +63,7 @@ ob_start();
<link href='dist/styles.css' rel="stylesheet" type="text/css">
<style type="text/css">

#epesiStatus {
#epesi_loader {
font-weight: 300;
font-size: 15px;
background-color: white;
@@ -78,22 +78,22 @@ ob_start();
overflow: hidden;
padding-top: 20px;
}
#epesiStatus img {
#epesi_loader img {
padding: 15px;
}

#epesiStatus .text {
#epesi_loader .text {
margin-top: 10px;
margin-bottom: 25px;
font-size: 22px;
}

#epesiStatus .spinner {
#epesi_loader .spinner {
margin: 20px auto 20px;
text-align: center;
}

#epesiStatus .spinner > div {
#epesi_loader .spinner > div {
width: 18px;
height: 18px;
background-color: #333;
@@ -104,12 +104,87 @@ ob_start();
animation: sk-bouncedelay 1.4s infinite ease-in-out both;
}

#epesiStatus .spinner .bounce1 {
#epesi_loader .spinner .bounce1 {
-webkit-animation-delay: -0.32s;
animation-delay: -0.32s;
}

#epesiStatus .spinner .bounce2 {
#epesi_loader .spinner .bounce2 {
-webkit-animation-delay: -0.16s;
animation-delay: -0.16s;
}

@-webkit-keyframes sk-bouncedelay {
0%, 80%, 100% { -webkit-transform: scale(0) }
40% { -webkit-transform: scale(1.0) }
}

@keyframes sk-bouncedelay {
0%, 80%, 100% {
-webkit-transform: scale(0);
transform: scale(0);
} 40% {
-webkit-transform: scale(1.0);
transform: scale(1.0);
}
}





.Base_StatusBar_background {
z-index: 2001;
position: fixed;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
text-align: center;
vertical-align: middle;
background-color: rgba(255, 255, 255, 0.5);
}

.Base_StatusBar {
background-color: white;
position: fixed;
left: 50%;
top: 30%;
margin-left: -100px;
width: 200px;
text-align: center;
vertical-align: middle;
z-index: 2002;
overflow: hidden;
padding-top: 20px;
}

.Base_StatusBar .text {
font-size: 22px;
}

.Base_StatusBar .spinner {
margin: 20px auto 20px;
text-align: center;
}

.Base_StatusBar .spinner > div {
width: 18px;
height: 18px;
background-color: #333;

border-radius: 100%;
display: inline-block;
-webkit-animation: sk-bouncedelay 1.4s infinite ease-in-out both;
animation: sk-bouncedelay 1.4s infinite ease-in-out both;
}

.Base_StatusBar .spinner .bounce1 {
-webkit-animation-delay: -0.32s;
animation-delay: -0.32s;
}

.Base_StatusBar .spinner .bounce2 {
-webkit-animation-delay: -0.16s;
animation-delay: -0.16s;
}
@@ -142,7 +217,7 @@ ob_start();
<div id="error_box"></div>
</div>

<div id="epesiStatus" class="panel panel-default">
<div id="epesi_loader" class="panel panel-default">
<img src="images/epesi_logo_RGB_Solid.png">
<div class="lead text" id="epesiStatusText"><?php print(STARTING_MESSAGE);?></div>
<div class="spinner">
@@ -151,6 +226,17 @@ ob_start();
<div class="bounce3"></div>
</div>
</div>
<div id="Base_StatusBar" class="Base_StatusBar_background">
<div class="Base_StatusBar panel panel-default">
<p id="statusbar_text" class="lead">Loading...</p>
<div class="spinner">
<div class="bounce1"></div>
<div class="bounce2"></div>
<div class="bounce3"></div>
</div>
<div id="dismiss">Click anywhere to dismiss</div>
</div>
</div>
</div>
<?php
/*


+ 2
- 14
modules/Base/StatusBar/StatusBar_0.php View File

@@ -14,25 +14,13 @@ defined("_VALID_ACCESS") || die('Direct access forbidden');
class Base_StatusBar extends Module {

public function body() {
$theme = $this->init_module("Base/Theme");
$theme->assign('statusbar_id','Base_StatusBar');
$theme->assign('text_id','statusbar_text');
$theme->assign('close_text', __('Click anywhere to dismiss'));
$theme->display();
$this->load_js();
$close_text = __('Click anywhere to dismiss');
eval_js("document.getElementById('dismiss').innerHTML = '{$close_text}'");
on_exit(array($this, 'messages'),null,false);
}

public function messages() {
eval_js("statusbar_message('".Epesi::escapeJS(Base_StatusBarCommon::$message,false)."')");
}

private function load_js() {
load_js('modules/Base/StatusBar/js/main.js');
load_js('modules/Base/StatusBar/js/nprogress.js');
load_css('modules/Base/StatusBar/theme/nprogress.css');
}


}
?>

+ 0
- 54
modules/Base/StatusBar/js/main.js View File

@@ -1,54 +0,0 @@
var statusbar_message_t='';
statusbar_message=function(text){
statusbar_message_t=text;
};
statusbar_fade_count = 0;
statusbar_fade=function(fade_count){
NProgress.configure({parent: '#nano-bar'});
NProgress.start();
if (fade_count && statusbar_fade_count!=fade_count) return;
var seconds = 0.2;
wait_while_null('jq(\'#Base_StatusBar\').get(0)','jq(\'#Base_StatusBar\').fadeOut();NProgress.done();');
jq('#Base_StatusBar').get(0).onclick = null;
setTimeout('statusbar_fade_double_check('+statusbar_fade_count+')',seconds*1000+50);
};
statusbar_fade_double_check = function(fade_count) {
if (fade_count && statusbar_fade_count!=fade_count) jq('#Base_StatusBar').show();
else jq('#Base_StatusBar').get(0).onclick = Function("if(!Epesi.procOn)statusbar_fade();");
};
updateEpesiIndicatorFunction=function(){
Epesi.indicator_text='statusbar_text';
Epesi.indicator='Base_StatusBar';
statbar = jq('#Base_StatusBar').get(0);
if (!statbar) {
setTimeout('updateEpesiIndicatorFunction();',3000);
return;
}
jq('#epesiStatus').hide();
jq('#main_content').show();
statbar.onclick = Function("if(!Epesi.procOn)statusbar_fade();");
statbar.style.display='none';
Epesi.updateIndicator=function(){
statbar = jq('#Base_StatusBar').get(0);
statusbar_fade_count++;
if(Epesi.procOn){
jq('#dismiss').hide();
statbar.style.display='block';
cache_pause=true;
}else{
if(statusbar_message_t!='') {
jq('#dismiss').show();
t=jq('#statusbar_text');
if(t.length>0)t.html(statusbar_message_t);
statusbar_message('');
setTimeout('statusbar_fade('+statusbar_fade_count+')',5000);
}else{
statusbar_fade();
};
cache_pause=false;
};
};
};
updateEpesiIndicatorFunction();

+ 0
- 480
modules/Base/StatusBar/js/nprogress.js View File

@@ -1,480 +0,0 @@
/* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress
* @license MIT */

;(function(root, factory) {

if (typeof define === 'function' && define.amd) {
define(factory);
} else if (typeof exports === 'object') {
module.exports = factory();
} else {
root.NProgress = factory();
}

})(this, function() {
var NProgress = {};

NProgress.version = '0.2.0';

var Settings = NProgress.settings = {
minimum: 0.08,
easing: 'linear',
positionUsing: '',
speed: 200,
trickle: true,
trickleSpeed: 200,
showSpinner: true,
barSelector: '[role="bar"]',
spinnerSelector: '[role="spinner"]',
parent: 'body',
template: '<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'
};

/**
* Updates configuration.
*
* NProgress.configure({
* minimum: 0.1
* });
*/
NProgress.configure = function(options) {
var key, value;
for (key in options) {
value = options[key];
if (value !== undefined && options.hasOwnProperty(key)) Settings[key] = value;
}

return this;
};

/**
* Last number.
*/

NProgress.status = null;

/**
* Sets the progress bar status, where `n` is a number from `0.0` to `1.0`.
*
* NProgress.set(0.4);
* NProgress.set(1.0);
*/

NProgress.set = function(n) {
var started = NProgress.isStarted();

n = clamp(n, Settings.minimum, 1);
NProgress.status = (n === 1 ? null : n);

var progress = NProgress.render(!started),
bar = progress.querySelector(Settings.barSelector),
speed = Settings.speed,
ease = Settings.easing;

progress.offsetWidth; /* Repaint */

queue(function(next) {
// Set positionUsing if it hasn't already been set
if (Settings.positionUsing === '') Settings.positionUsing = NProgress.getPositioningCSS();

// Add transition
css(bar, barPositionCSS(n, speed, ease));

if (n === 1) {
// Fade out
css(progress, {
transition: 'none',
opacity: 1
});
progress.offsetWidth; /* Repaint */

setTimeout(function() {
css(progress, {
transition: 'all ' + speed + 'ms linear',
opacity: 0
});
setTimeout(function() {
NProgress.remove();
next();
}, speed);
}, speed);
} else {
setTimeout(next, speed);
}
});

return this;
};

NProgress.isStarted = function() {
return typeof NProgress.status === 'number';
};

/**
* Shows the progress bar.
* This is the same as setting the status to 0%, except that it doesn't go backwards.
*
* NProgress.start();
*
*/
NProgress.start = function() {
if (!NProgress.status) NProgress.set(0);

var work = function() {
setTimeout(function() {
if (!NProgress.status) return;
NProgress.trickle();
work();
}, Settings.trickleSpeed);
};

if (Settings.trickle) work();

return this;
};

/**
* Hides the progress bar.
* This is the *sort of* the same as setting the status to 100%, with the
* difference being `done()` makes some placebo effect of some realistic motion.
*
* NProgress.done();
*
* If `true` is passed, it will show the progress bar even if its hidden.
*
* NProgress.done(true);
*/

NProgress.done = function(force) {
if (!force && !NProgress.status) return this;

return NProgress.inc(0.3 + 0.5 * Math.random()).set(1);
};

/**
* Increments by a random amount.
*/

NProgress.inc = function(amount) {
var n = NProgress.status;

if (!n) {
return NProgress.start();
} else if(n > 1) {
return;
} else {
if (typeof amount !== 'number') {
if (n >= 0 && n < 0.2) { amount = 0.1; }
else if (n >= 0.2 && n < 0.5) { amount = 0.04; }
else if (n >= 0.5 && n < 0.8) { amount = 0.02; }
else if (n >= 0.8 && n < 0.99) { amount = 0.005; }
else { amount = 0; }
}

n = clamp(n + amount, 0, 0.994);
return NProgress.set(n);
}
};

NProgress.trickle = function() {
return NProgress.inc();
};

/**
* Waits for all supplied jQuery promises and
* increases the progress as the promises resolve.
*
* @param $promise jQUery Promise
*/
(function() {
var initial = 0, current = 0;

NProgress.promise = function($promise) {
if (!$promise || $promise.state() === "resolved") {
return this;
}

if (current === 0) {
NProgress.start();
}

initial++;
current++;

$promise.always(function() {
current--;
if (current === 0) {
initial = 0;
NProgress.done();
} else {
NProgress.set((initial - current) / initial);
}
});

return this;
};

})();

/**
* (Internal) renders the progress bar markup based on the `template`
* setting.
*/

NProgress.render = function(fromStart) {
if (NProgress.isRendered()) return document.getElementById('nprogress');

addClass(document.documentElement, 'nprogress-busy');

var progress = document.createElement('div');
progress.id = 'nprogress';
progress.innerHTML = Settings.template;

var bar = progress.querySelector(Settings.barSelector),
perc = fromStart ? '-100' : toBarPerc(NProgress.status || 0),
parent = document.querySelector(Settings.parent),
spinner;

css(bar, {
transition: 'all 0 linear',
transform: 'translate3d(' + perc + '%,0,0)'
});

if (!Settings.showSpinner) {
spinner = progress.querySelector(Settings.spinnerSelector);
spinner && removeElement(spinner);
}

if (parent != document.body) {
addClass(parent, 'nprogress-custom-parent');
}

parent.appendChild(progress);
return progress;
};

/**
* Removes the element. Opposite of render().
*/

NProgress.remove = function() {
removeClass(document.documentElement, 'nprogress-busy');
removeClass(document.querySelector(Settings.parent), 'nprogress-custom-parent');
var progress = document.getElementById('nprogress');
progress && removeElement(progress);
};

/**
* Checks if the progress bar is rendered.
*/

NProgress.isRendered = function() {
return !!document.getElementById('nprogress');
};

/**
* Determine which positioning CSS rule to use.
*/

NProgress.getPositioningCSS = function() {
// Sniff on document.body.style
var bodyStyle = document.body.style;

// Sniff prefixes
var vendorPrefix = ('WebkitTransform' in bodyStyle) ? 'Webkit' :
('MozTransform' in bodyStyle) ? 'Moz' :
('msTransform' in bodyStyle) ? 'ms' :
('OTransform' in bodyStyle) ? 'O' : '';

if (vendorPrefix + 'Perspective' in bodyStyle) {
// Modern browsers with 3D support, e.g. Webkit, IE10
return 'translate3d';
} else if (vendorPrefix + 'Transform' in bodyStyle) {
// Browsers without 3D support, e.g. IE9
return 'translate';
} else {
// Browsers without translate() support, e.g. IE7-8
return 'margin';
}
};

/**
* Helpers
*/

function clamp(n, min, max) {
if (n < min) return min;
if (n > max) return max;
return n;
}

/**
* (Internal) converts a percentage (`0..1`) to a bar translateX
* percentage (`-100%..0%`).
*/

function toBarPerc(n) {
return (-1 + n) * 100;
}


/**
* (Internal) returns the correct CSS for changing the bar's
* position given an n percentage, and speed and ease from Settings
*/

function barPositionCSS(n, speed, ease) {
var barCSS;

if (Settings.positionUsing === 'translate3d') {
barCSS = { transform: 'translate3d('+toBarPerc(n)+'%,0,0)' };
} else if (Settings.positionUsing === 'translate') {
barCSS = { transform: 'translate('+toBarPerc(n)+'%,0)' };
} else {
barCSS = { 'margin-left': toBarPerc(n)+'%' };
}

barCSS.transition = 'all '+speed+'ms '+ease;

return barCSS;
}

/**
* (Internal) Queues a function to be executed.
*/

var queue = (function() {
var pending = [];

function next() {
var fn = pending.shift();
if (fn) {
fn(next);
}
}

return function(fn) {
pending.push(fn);
if (pending.length == 1) next();
};
})();

/**
* (Internal) Applies css properties to an element, similar to the jQuery
* css method.
*
* While this helper does assist with vendor prefixed property names, it
* does not perform any manipulation of values prior to setting styles.
*/

var css = (function() {
var cssPrefixes = [ 'Webkit', 'O', 'Moz', 'ms' ],
cssProps = {};

function camelCase(string) {
return string.replace(/^-ms-/, 'ms-').replace(/-([\da-z])/gi, function(match, letter) {
return letter.toUpperCase();
});
}

function getVendorProp(name) {
var style = document.body.style;
if (name in style) return name;

var i = cssPrefixes.length,
capName = name.charAt(0).toUpperCase() + name.slice(1),
vendorName;
while (i--) {
vendorName = cssPrefixes[i] + capName;
if (vendorName in style) return vendorName;
}

return name;
}

function getStyleProp(name) {
name = camelCase(name);
return cssProps[name] || (cssProps[name] = getVendorProp(name));
}

function applyCss(element, prop, value) {
prop = getStyleProp(prop);
element.style[prop] = value;
}

return function(element, properties) {
var args = arguments,
prop,
value;

if (args.length == 2) {
for (prop in properties) {
value = properties[prop];
if (value !== undefined && properties.hasOwnProperty(prop)) applyCss(element, prop, value);
}
} else {
applyCss(element, args[1], args[2]);
}
}
})();

/**
* (Internal) Determines if an element or space separated list of class names contains a class name.
*/

function hasClass(element, name) {
var list = typeof element == 'string' ? element : classList(element);
return list.indexOf(' ' + name + ' ') >= 0;
}

/**
* (Internal) Adds a class to an element.
*/

function addClass(element, name) {
var oldList = classList(element),
newList = oldList + name;

if (hasClass(oldList, name)) return;

// Trim the opening space.
element.className = newList.substring(1);
}

/**
* (Internal) Removes a class from an element.
*/

function removeClass(element, name) {
var oldList = classList(element),
newList;

if (!hasClass(element, name)) return;

// Replace the class name.
newList = oldList.replace(' ' + name + ' ', ' ');

// Trim the opening and closing spaces.
element.className = newList.substring(1, newList.length - 1);
}

/**
* (Internal) Gets a space separated list of the class names on the element.
* The list is wrapped with a single space on each end to facilitate finding
* matches within the list.
*/

function classList(element) {
return (' ' + (element && element.className || '') + ' ').replace(/\s+/gi, ' ');
}

/**
* (Internal) Removes an element from the DOM.
*/

function removeElement(element) {
element && element.parentNode && element.parentNode.removeChild(element);
}

return NProgress;
});

+ 0
- 70
modules/Base/StatusBar/theme/default.css View File

@@ -1,70 +0,0 @@
.Base_StatusBar_background {
z-index: 2001;
position: fixed;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
text-align: center;
vertical-align: middle;
background-color: rgba(255, 255, 255, 0.5);
}

.Base_StatusBar {
background-color: white;
position: fixed;
left: 50%;
top: 30%;
margin-left: -100px;
width: 200px;
text-align: center;
vertical-align: middle;
z-index: 2002;
overflow: hidden;
padding-top: 20px;
}

.Base_StatusBar .text {
font-size: 22px;
}

.Base_StatusBar .spinner {
margin: 20px auto 20px;
text-align: center;
}

.Base_StatusBar .spinner > div {
width: 18px;
height: 18px;
background-color: #333;

border-radius: 100%;
display: inline-block;
-webkit-animation: sk-bouncedelay 1.4s infinite ease-in-out both;
animation: sk-bouncedelay 1.4s infinite ease-in-out both;
}

.Base_StatusBar .spinner .bounce1 {
-webkit-animation-delay: -0.32s;
animation-delay: -0.32s;
}

.Base_StatusBar .spinner .bounce2 {
-webkit-animation-delay: -0.16s;
animation-delay: -0.16s;
}

@-webkit-keyframes sk-bouncedelay {
0%, 80%, 100% { -webkit-transform: scale(0) }
40% { -webkit-transform: scale(1.0) }
}

@keyframes sk-bouncedelay {
0%, 80%, 100% {
-webkit-transform: scale(0);
transform: scale(0);
} 40% {
-webkit-transform: scale(1.0);
transform: scale(1.0);
}
}

+ 0
- 22
modules/Base/StatusBar/theme/default.tpl View File

@@ -1,22 +0,0 @@
{*<div id="{$statusbar_id}" class="Base_StatusBar">*}
{*<div class="layer">*}
{*<div class="shadow_15px" id="statusbar_content">*}
{*<div id="{$text_id}" class="message loading">*}
{*Loading...*}
{*</div>*}
{*<div id="dismiss">{$close_text}</div>*}
{*</div>*}
{*</div>*}
{*</div>*}

<div id="{$statusbar_id}" class="Base_StatusBar_background">
<div class="Base_StatusBar panel panel-default">
<p id="{$text_id}" class="lead">Loading...</p>
<div class="spinner">
<div class="bounce1"></div>
<div class="bounce2"></div>
<div class="bounce3"></div>
</div>
<div id="dismiss">{$close_text}</div>
</div>
</div>

BIN
modules/Base/StatusBar/theme/loader.gif View File

Before After
Width: 31  |  Height: 31  |  Size: 1.2 KiB

+ 0
- 74
modules/Base/StatusBar/theme/nprogress.css View File

@@ -1,74 +0,0 @@
/* Make clicks pass-through */
#nprogress {
pointer-events: none;
}

#nprogress .bar {
background: #29d;

position: fixed;
z-index: 1031;
top: 0;
left: 0;

width: 100%;
height: 3px;
}

/* Fancy blur effect */
#nprogress .peg {
display: block;
position: absolute;
right: 0px;
width: 100px;
height: 100%;
box-shadow: 0 0 10px #29d, 0 0 5px #29d;
opacity: 1.0;

-webkit-transform: rotate(3deg) translate(0px, -4px);
-ms-transform: rotate(3deg) translate(0px, -4px);
transform: rotate(3deg) translate(0px, -4px);
}

/* Remove these to get rid of the spinner */
#nprogress .spinner {
display: block;
position: fixed;
z-index: 1031;
top: 15px;
right: 15px;
}

#nprogress .spinner-icon {
width: 18px;
height: 18px;
box-sizing: border-box;

border: solid 2px transparent;
border-top-color: #29d;
border-left-color: #29d;
border-radius: 50%;

-webkit-animation: nprogress-spinner 400ms linear infinite;
animation: nprogress-spinner 400ms linear infinite;
}

.nprogress-custom-parent {
overflow: hidden;
position: relative;
}

.nprogress-custom-parent #nprogress .spinner,
.nprogress-custom-parent #nprogress .bar {
position: absolute;
}

@-webkit-keyframes nprogress-spinner {
0% { -webkit-transform: rotate(0deg); }
100% { -webkit-transform: rotate(360deg); }
}
@keyframes nprogress-spinner {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}


+ 1
- 0
package.json View File

@@ -49,6 +49,7 @@
"gentelella": "^1.3.0",
"jquery": "^2.x.x",
"jquery-ui": "^1.12.1",
"nprogress": "^0.2.0",
"qs": "^6.5.1",
"select2": "^4.0.3"
}


+ 20
- 9
src/epesi.js View File

@@ -9,6 +9,7 @@ import Loader from './loader';
import axios from 'axios';
import qs from 'qs';
import ConfirmLeave from './confirmLeave';
import StatusBar from './statusBar';

class Epesi {
loader = new Loader();
@@ -17,8 +18,8 @@ class Epesi {
procOn = 0;
client_id = 0;
process_file = 'process.php';
indicator = 'epesiStatus';
indicator_text = 'epesiStatusText';
statusBar = new StatusBar();
message = null;

constructor(client_id, process_file_path, params = '') {
this.client_id=client_id;
@@ -33,21 +34,31 @@ class Epesi {
this.history_add(0);

if(!params) params = '';
this.request(params,0);

window.statusbar_message = message => this.message = message;
let statbar = document.getElementById('Base_StatusBar');
statbar.addEventListener('click', () => {if(!this.procOn)this.statusBar.fadeOut()});
statbar.style.display='none';

this.request(params,0).then(() => {
document.getElementById('epesi_loader').style.display = 'none';
document.getElementById('main_content').style.display = '';
});

window.addEventListener('popstate', ({state: {history_id}}) => this.request('', history_id));
window._chj = this.href;
};

updateIndicator = () => {
document.getElementById(this.indicator).style.display = this.procOn ? '' : 'none';
if (!this.procOn) document.getElementById('main_content').style.display = '';
if(this.procOn) this.statusBar.fadeIn();
else if(this.message) {
this.statusBar.showMessage(this.message);
this.message = null;
}
else this.statusBar.fadeOut()
};

updateIndicatorText = (text) => {
document.getElementById(this.indicator_text).innerHTML = text;
document.getElementById(this.indicator_text).innerHTML = text;
};
updateIndicatorText = text => this.statusBar.setIndicatorText(text);

history_add = (id) => {
window.history.pushState({history_id: id}, '');


+ 4
- 2
src/index.js View File

@@ -11,14 +11,16 @@ import 'select2';
import 'select2/dist/css/select2.css';

import 'script-loader!../libs/jquery.clonePosition.js';

import Chart from 'chart.js';
window.Chart = Chart;

import 'gentelella/production/less/custom.css';
import 'font-awesome/css/font-awesome.css';

window.Chart = Chart;
import 'font-awesome/css/font-awesome.css';

import Epesi from './epesi';

window.EpesiClass = Epesi;

window.focus_by_id = (idd) => {


+ 32
- 0
src/statusBar.js View File

@@ -0,0 +1,32 @@
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';

class StatusBar {
indicator = 'Base_StatusBar';
indicator_text = 'statusbar_text';

fadeOut = () => {
if (document.getElementById('nano-bar') !== null) NProgress.configure({parent: '#nano-bar'});

NProgress.start();
let statbar = document.getElementById(this.indicator);
jQuery(statbar).fadeOut();
NProgress.done();
};

fadeIn = () => {
document.getElementById('dismiss').style.display = 'none';
let statbar = document.getElementById(this.indicator);
jQuery(statbar).fadeIn();
};

showMessage = (message) => {
document.getElementById('dismiss').style.display = '';
this.setIndicatorText(message);
setTimeout(this.fadeOut, 5000);
};

setIndicatorText = text => document.getElementById(this.indicator_text).innerHTML = text;
}

export default StatusBar

Loading…
Cancel
Save