Changeset 2069 for lliurex-mirror


Ignore:
Timestamp:
Jun 30, 2016, 12:13:52 AM (3 years ago)
Author:
kbut
Message:

code enhanced

Location:
lliurex-mirror/trunk/fuentes/admin-center-lliurex-mirror.install/lliurex-mirror/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • lliurex-mirror/trunk/fuentes/admin-center-lliurex-mirror.install/lliurex-mirror/src/css/lliurex-mirror.css

    r2068 r2069  
    2020
    2121#llxmirrorconfiguration.llxmirrordisabled{
    22         background-color:black;
     22        background-color:yellow;
    2323        transition: max-height 1s;
    2424        max-height: 0px;
     
    2727
    2828#llxmirrorconfiguration.llxmirroractivate{
    29         background-color:black;
     29        background-color:yellow;
    3030        transition: max-height 1s;
    3131        max-height: 400px;
    3232        overflow: hidden;
    3333}
     34
     35.mio{
     36        width: 100px;
     37}
     38#llxmirrorconfiguration{
     39        width: 100px;
     40        margin:10 auto;
     41}
  • lliurex-mirror/trunk/fuentes/admin-center-lliurex-mirror.install/lliurex-mirror/src/js/lliurex-mirror.js

    r2068 r2069  
    22  this.distros = ['llx16'];
    33  this.defaultdistro = 0;
    4   this.progresscolors = {'ok' : '#4caf50' , 'error' : 'red', 'working':'yellow','default':'black'};
     4  this.progresscolors = {'new':'#4caf50' ,'ok' : '#4caf50' , 'error' : 'red', 'working':'yellow','default':'black'};
    55  this.bars = {};
    66  this.edit = null;
    7 
     7  this.progressoptionsdefault = {color:this.progresscolors['ok'], trailcolor:'#9f9f9f', trailWidth:3, strokeWidth: 3, easing: 'easeInOut', text: {value:''}};
    88}
    99
     
    1414    Utils.n4d('', 'VariablesManager', 'get_variable', ['LLIUREXMIRROR'], function get_variables(response){
    1515      self.mirrorinfo = response;
    16       progressoptions = {
    17         color:self.progresscolors['ok'],
    18         trailcolor:'#9f9f9f',
    19         trailWidth:3,
    20         strokeWidth: 3,
    21         easing: 'easeInOut',
    22         text: {value:''}
    23       };
    24       status_mirror = self.mirrorinfo[distro]['status_mirror'].toLowerCase();
     16      var progressoptions = self.progressoptionsdefault;
     17      var status_mirror = self.mirrorinfo[distro]['status_mirror'].toLowerCase();
    2518      progressoptions['color'] = self.progresscolors.hasOwnProperty(status_mirror) ? self.progresscolors[status_mirror] : self.progresscolors['default']; 
    2619      progressoptions['text']['value'] = distro;
    2720      self.bars[distro] = new ProgressBar.Circle('#llxmirrorprogress', progressoptions);
     21
    2822      self.bars[distro].animate(1 - (100 - self.mirrorinfo[distro]['progress']) / 100 );
    2923      self.showOrigin();
     
    3327  });
    3428  $("#llxmirrormenuarch").on('click',function modifyarch(e,args){
    35     var configuration = document.querySelectorAll('#llxmirrorconfiguration')[0];
    36     if (self.edit != "#llxmirrormenuarch" & self.edit != null){
     29    self.showOptionsMenu(self,'#llxmirrormenuarch',self.buildArchMenuConfig);
     30  });
     31
     32  $("#llxmirrormenuorig").on('click',function modifyarch(e,args){
     33    self.showOptionsMenu(self,'#llxmirrormenuorig');
     34  });
     35};
     36
     37
     38LliurexMirror.prototype.showOptionsMenu = function showOptionsMenu(self,menuid,buildfunction){
     39  var configuration = document.querySelectorAll('#llxmirrorconfiguration')[0];
     40    if (self.edit != menuid & self.edit != null){
    3741      document.querySelector(self.edit).click();
    38       setTimeout(function() {document.querySelector("#llxmirrormenuarch").click();}, 1000);
     42      setTimeout(function() {document.querySelector(menuid).click();}, 1000);
    3943    }
    4044    else{
     
    4549      else{
    4650       configuration.classList = ['llxmirroractivate'];
    47        configuration.innerHTML = "<h1>Hola</h1>";
    48        self.edit = "#llxmirrormenuarch";
     51       self.edit = menuid;
     52       buildfunction('#llxmirrorconfiguration');
    4953      }
    5054    }
    51   });
     55}
    5256
    53   $("#llxmirrormenuorig").on('click',function modifyarch(e,args){
    54     var configuration = document.querySelectorAll('#llxmirrorconfiguration')[0];
    55     if (self.edit != "#llxmirrormenuorig" & self.edit != null){
    56       document.querySelector(self.edit).click();
    57       setTimeout(function() {document.querySelector("#llxmirrormenuorig").click();}, 1000);
    58     }
    59     else{
    60       if (configuration.classList.contains('llxmirroractivate')){
    61        configuration.classList = ['llxmirrordisabled'];
    62        self.edit = null;
    63       }
    64       else{
    65        configuration.classList = ['llxmirroractivate'];
    66        configuration.innerHTML = "<h1 >Adios</h1>";
    67        self.edit = "#llxmirrormenuorig";
    68       }
    69     }
    70   });
    71 };
     57LliurexMirror.prototype.buildArchMenuConfig = function buildArchMenuConfig(idcontainer){
     58  var buttonGroups = '<div class="btn-group btn-group-justified btn-group-raised mio">\
     59                        <div class="togglebutton">\
     60                          <label>\
     61                            <input type="checkbox" checked> 32 Bits\
     62                          </label>\
     63                        </div>\
     64                      <div class="togglebutton">\
     65                          <label>\
     66                            <input type="checkbox" checked> 64 Bits\
     67                          </label>\
     68                        </div>\
     69                      </div>';
     70  document.querySelector(idcontainer).innerHTML = buttonGroups;
     71}
     72
     73
    7274
    7375LliurexMirror.prototype.showOrigin = function showOrigin(){
     76  var self = this;
    7477        var credentials=[sessionStorage.username , sessionStorage.password];
    7578        var n4dclass="MirrorManager";
    7679        var n4dmethod="get_mirror_orig";
    77         var arglist=['llx16'];
     80        var arglist=[self.distros[self.defaultdistro]];
    7881        Utils.n4d(credentials, n4dclass, n4dmethod, arglist, function getmirrororig(response){
    7982    if(response != null && response['status'] == true)
     
    8386
    8487LliurexMirror.prototype.showArchitecture = function showArchitecture(){
     88  var self = this;
    8589        var credentials=[sessionStorage.username , sessionStorage.password];
    8690        var n4dclass="MirrorManager";
    8791        var n4dmethod="get_mirror_architecture";
    88         var arglist=['llx16'];
     92        var arglist=[self.distros[self.defaultdistro]];
    8993        Utils.n4d(credentials, n4dclass, n4dmethod, arglist, function getmirrorarchitecture(response){
    9094    if(response != null && response['status'] == true){
     
    100104
    101105LliurexMirror.prototype.showMirrorSize = function showMirrorSize(){
     106  var self = this;
    102107  var credentials=[sessionStorage.username , sessionStorage.password];
    103108  var n4dclass="VariablesManager";
    104109  var n4dmethod="get_variable";
    105110  var arglist=['LLIUREXMIRROR'];
     111  var distro = self.distros[self.defaultdistro];
    106112  Utils.n4d(credentials, n4dclass, n4dmethod, arglist, function getvariable(response){
    107113    mirrorinfo = response;
    108     if ( ! mirrorinfo.hasOwnProperty('internal') ){
    109       return ;
     114    if ( ! mirrorinfo.hasOwnProperty(self.distros[self.defaultdistro])){
     115      return;
    110116    }
    111     if ( mirrorinfo['internal'].hasOwnProperty('mirror_size')){
    112       $("#llxmirrorsize").text(mirrorinfo['internal']['mirror_size'] + "Gb");
     117    if ( mirrorinfo[distro].hasOwnProperty('mirror_size')){
     118      $("#llxmirrorsize").text(mirrorinfo[distro]['mirror_size'] + "Gb");
    113119    }
    114120    else{
     
    118124}
    119125
     126LliurexMirror.prototype.setArchitecture = function setArchitecture(archs){
     127  var self = this;
     128  var credentials=[sessionStorage.username , sessionStorage.password];
     129  var n4dclass="MirrorManager";
     130  var n4dmethod="set_mirror_architecture";
     131  var distro = self.distros[self.defaultdistro];
     132  var arglist=[distro,archs];
     133  Utils.n4d(credentials, n4dclass, n4dmethod, arglist, function getvariable(response){
     134    continue;
     135  });
     136}
     137
    120138
    121139
  • lliurex-mirror/trunk/fuentes/admin-center-lliurex-mirror.install/lliurex-mirror/src/main2.html

    r2068 r2069  
    2424        <div class="row" >
    2525        <div id="llxmirrorconfiguration" class='llxmirrordisable' >
    26                
    27                
     26                <h1>LliureX</h1>
    2827        </div>
    2928        </div>
Note: See TracChangeset for help on using the changeset viewer.