Example #1
0
 sortItems = (sortBy, sortOrder) => {
   cookie.save('seafile-repo-dir-sort-by', sortBy);
   cookie.save('seafile-repo-dir-sort-order', sortOrder);
   this.setState({
     sortBy: sortBy,
     sortOrder: sortOrder,
     items: Utils.sortRepos(this.state.items, sortBy, sortOrder)
   });
 }
Example #2
0
 eventProxy.on('deleteLegend', name => {
     delete this.state.legend[name];
     cookie.save('bandStatus', this.state.legend);
     this.setState({
         legend: this.state.legend
     });
 });
Example #3
0
export const getLanguage = () => {
    let language
    if ((language = Cookie.load(Config.hash.cookie_lang)) === undefined || (language = Cookie.load(Config.hash.cookie_lang)) === 'undefined' || (language = Cookie.load(Config.hash.cookie_lang)) === null) {
        Cookie.save(Config.hash.cookie_lang, Config.defaults.default_lang)
        return Config.defaults.default_lang;
    }
    return language
}
Example #4
0
 eventProxy.on('loadBand', obj => {
     let legend = !self.isEmpty(self.state.legend[obj.name]) ? self.state.legend[obj.name] : {0: 'show'};
     self.state.legend[obj.name] = legend;
     cookie.save('bandStatus', self.state.legend);
     self.setState({
         legend: self.state.legend
     });
     eventProxy.trigger('bandVisible', legend);
 });
Example #5
0
    // Switch band display
    toggleBand(name) {
        let legend = this.state.legend;
        let chart = this.state.chart;
        let series = {};
        let bandSeries = this.props.bandSeries;
        let dataName = this.props.name;
        chart.series.forEach((item, index) => {
            if (item.name === name) {
                series = chart.series[index];
            }
        });
        bandSeries.forEach((item, index) => {
            legend[dataName][index] = '';
        });
        if (series.visible) {
            series.hide();
            bandSeries.forEach((item, i) => {
                if (item.name === name) {
                    if (legend[dataName][i] === 'show') {
                        legend[dataName][i] = '';
                    }
                    else {
                        legend[dataName][i] = '';
                    }
                }
            });
        }
        else {
            series.show();
            bandSeries.forEach((item, i) => {
                if (item.name === name) {
                    if (legend[dataName][i] === '') {
                        legend[dataName][i] = 'show';
                    }
                    else {
                        legend[dataName][i] = '';
                    }
                }
            });
            chart.series.forEach((item, index) => {
                if (item.userOptions.type === 'area') {
                    chart.series[index].hide();
                }
                if (item.name === name) {
                    series = chart.series[index];
                    chart.series[index].show();
                }
            });
        }
        cookie.save('bandStatus', legend);
        this.setState({
            legend: legend
        });

    }
Example #6
0
 constructor (props) {
   debug('Login', 'constructor')
   super(props)
   this.state = {
     working: false
   }
   this.store = AdminStore
   if (this.props.location && this.props.location.query.accessToken) {
     this.setState({loader: {visible: true, message: 'Controle en cours...'}})
     let accessToken = this.props.location.query.accessToken
     cookie.save('rememberMe', accessToken, { path: '/' })
   }
   this.handleGoogleLogin = () => {
     this.setState({working: true})
     window.location = Config.auth.google
   }
 }
Example #7
0
 loggin(values) {
     console.log(values);
     if(values.username == "user" && values.password == "password"){
         cookie.save('session', true, {path: '/'});
         this.setState({ loginError: false });
         window.location.reload();
     }else{
         this.setState({ loginError: true,});
     }
     // this.props.login(values, (response) => {
     //     cookie.save('session', response.data, { path: '/' });
     //     // cookie.save('session', true, {path: '/'});
     //     this.setState({ loginError: false });
     //     window.location.reload();
     // }, (error) => {
     //     if (error) {
     //         this.setState({ loginError: true});
     //     }
     // });
 }
Example #8
0
 initBand() {
     let bandSeries = this.props.bandSeries;
     let legend = cookie.load('bandStatus') || this.state.legend || {};
     let list = this.props.list;
     list.forEach(item => {
         if (this.isEmpty(legend[item.name])) {
             legend[item.name] = {};
             bandSeries.forEach((series, index) => {
                 if (!index) {
                     legend[item.name][index] = 'show';
                 }
                 else {
                     legend[item.name][index] = '';
                 }
             });
         }
     });
     cookie.save('bandStatus', legend);
     this.setState({
         legend
     });
 }
Example #9
0
export const setLanguage = (lang) => {
    Cookie.save(Config.hash.cookie_lang, lang)
    window.location.reload();
}