data-sevc-controllet_ddr.html 4.42 KB
/********************************************************************************************************************************
<!--<script src="../shared_js/jquery-1.11.2.min.js"></script>-->
<!--<script src="../../bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>-->
<!--<script src="../shared_js/perfect-scrollbar/js/min/perfect-scrollbar.jquery.min.js"></script>-->
<!--<link rel="stylesheet" href="../shared_js/perfect-scrollbar/css/perfect-scrollbar.min.css">-->
/********************************************************************************************************************************

<link rel="import" href="../../bower_components/polymer/polymer.html">

<link rel="import" href="../page-slider-controllet/page-slider-controllet.html">
<link rel="import" href="../dataset-selection-controllet/dataset-selection-controllet.html">
<link rel="import" href="../tree-view-multi-table-controllet/tree-view-multi-table-controllet.html" />

<dom-module id="data-sevc-controllet">

    <template>

        <page-slider-controllet id="slider">

            <neon-animatable>

                <dataset-selection-controllet id="dataset_selection" datasets={{datasets}}></dataset-selection-controllet>

            </neon-animatable>

            <neon-animatable>

                <tree-view-multi-table-controllet id="tree_view_multi_table" root-name="data" opened-path="result,records" data-url={{dataUrl}}></tree-view-multi-table-controllet>

            </neon-animatable>

            <neon-animatable>
                <div class="page" style="background-color: #BBDEFB;"><p>Pagina due</p><p>Page two</p><p>P&aacute;gina dos</p></div>
            </neon-animatable>

        </page-slider-controllet>

    </template>

    <script>

        Polymer({

            is : 'data-sevc-controllet',

            listeners : {
                'page-slider-controllet_selected' : '_updateSlider',
                'dataset-selection-controllet_data-url' : '_updateDataUrl'
            },

            properties : {

                deepUrl : {
                    type : String,
                    value : undefined
                },

                dataletsListUrl : {
                    type : String ,
                    value : undefined
                },

                datasets : {
                    type : Array,
                    value : undefined
                },

                dataUrl : {
                    type  : String,
                    value : undefined
                },

                jsonData : {
                    type  : Object,
                    value : undefined
                }

            },

            ready : function(){
            },

            _updateSlider : function(e){
                switch (e.detail.selected) {
                    case 0:
                        slider.setTitle("SELECT DATASET", "Select, copy and paste or search the url of dataset.");
                        slider.chevronLeft(false);
                        slider.chevronRight(false);
                        this.$.dataset_selection._fireDataUrl();
                        http://designpieces.com/palette/google-new-logo-2015-color-palette-hex-and-rgb/
                        break;
                    case 1:
                        slider.setTitle("SELECT FIELDS", "Select the fields from tree-view. The multi-table will show the values related to the selected fields.");
                        slider.chevronRight(false);
                        this.$.tree_view_multi_table.ready();
                        break;
                    case 2:
                        slider.setTitle("SELECT DATALET", "Sbiricuda antani siempre!");
                }
            },

            _updateDataUrl : function(e){
                this.dataUrl = e.detail.url;

                $.ajax({
                    url: e.detail.url,
                    dataType: "json",
                    success: function(data){
//                        this.dataUrl = e.detail.url
//                        this.jsonData = JSON.stringify(data);
                        slider.chevronRight(true);
                    },
                    error: function(){
//                        this.jsonData = undefined;
                        slider.chevronRight(false);
                    }
                });
            }

        });

    </script>

</dom-module>