github.com/tuotoo/go-ethereum@v1.7.4-0.20171121184211-049797d40a24/dashboard/assets/components/Common.jsx (about)

     1  // Copyright 2017 The go-ethereum Authors
     2  // This file is part of the go-ethereum library.
     3  //
     4  // The go-ethereum library is free software: you can redistribute it and/or modify
     5  // it under the terms of the GNU Lesser General Public License as published by
     6  // the Free Software Foundation, either version 3 of the License, or
     7  // (at your option) any later version.
     8  //
     9  // The go-ethereum library is distributed in the hope that it will be useful,
    10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    12  // GNU Lesser General Public License for more details.
    13  //
    14  // You should have received a copy of the GNU Lesser General Public License
    15  // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
    16  
    17  // isNullOrUndefined returns true if the given variable is null or undefined.
    18  export const isNullOrUndefined = variable => variable === null || typeof variable === 'undefined';
    19  
    20  export const LIMIT = {
    21      memory:  200, // Maximum number of memory data samples.
    22      traffic: 200, // Maximum number of traffic data samples.
    23      log:     200, // Maximum number of logs.
    24  };
    25  // The sidebar menu and the main content are rendered based on these elements.
    26  export const TAGS = (() => {
    27      const T = {
    28          home:         { title: "Home", },
    29          chain:        { title: "Chain", },
    30          transactions: { title: "Transactions", },
    31          network:      { title: "Network", },
    32          system:       { title: "System", },
    33          logs:         { title: "Logs", },
    34      };
    35      // Using the key is circumstantial in some cases, so it is better to insert it also as a value.
    36      // This way the mistyping is prevented.
    37      for(let key in T) {
    38          T[key]['id'] = key;
    39      }
    40      return T;
    41  })();
    42  
    43  export const DATA_KEYS = (() => {
    44      const DK = {};
    45      ["memory", "traffic", "logs"].map(key => {
    46         DK[key] = key;
    47      });
    48      return DK;
    49  })();
    50  
    51  // Temporary - taken from Material-UI
    52  export const DRAWER_WIDTH = 240;