Git Product home page Git Product logo

giotto's People

Contributors

acivitillo avatar github-actions[bot] avatar malinaa96 avatar pmarekk avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

malinaa96

giotto's Issues

Create Transformer class

We want to have a class to pull and transform data which will be later used by a component.

The structure of the app will be like this

## transformers
tranformers here
## components
components fetching from above transformers
## templates
page
frames

The transformer will look more or less like this

class Transformer:
    data: Any
   
    @classmethod
    def from_api(cls, route: str):
        data = urllib3.get(route, params=name... etc.).content
        return cls(data=data)
        
    def transform(self):
        # some default transformation
        pass


class UserTransformer(Transformer):
    
    def transform_1(self):
        data = deepcopy(self.data[0])
        return data

    def transform_2(self):
        data = deepcopy(self.data[1])
        return data

data = UserTransformer.from_api(...)
table_1 = Table(**data.transform_1())
table_2 = Table(**data.transform_2())

Create Site class

This class will create FastApi app with mounted giotto static files. Users will be adding their apps with add_view method

site = Site()
site.add_view(TestAppLayout())
site.add_view(FiltersFrame())

table bulk editor

HTML tables can be used to send data in bulk back to the server for sql bulk loads via json. Here below is the prototype stimulus controller to turn a table into a json and post it to an api endpoint.

//https://j.hn/html-table-to-json/
import { Controller } from "stimulus"

export default class extends Controller {
    run() {
        var headers = [];
        var data = {}; // first row needs to be headers var headers = [];
        const table = document.getElementById("tablename")
        for (var i = 0; i < table.rows[0].cells.length; i++) {
            headers[i] = table.rows[0].cells[i].innerHTML.toLowerCase().replace(/ /gi, '');
        };
        // go through cells text_item
        for (var i = 1; i < table.rows.length; i++) {
            var tableRow = table.rows[i]; var rowData = {};
            for (var j = 0; j < tableRow.cells.length; j++) {
                for (var node of tableRow.cells[j].childNodes) {
                    if (node.nodeType == 1) {
                        if (node.innerHTML == "") {
                            switch (node.name) {
                                case "check":
                                    var value = node.checked
                                    break;
                                case "input_text":
                                    var value = node.value
                                    break;
                            };
                        } else {
                            var value = node.innerHTML
                        };
                    }
                };
                if (!(headers[j] in data)) {
                    data[headers[j]] = [];
                }
                data[headers[j]].push(value);
            }
        }
        const json = JSON.stringify({ item: data })
        fetch('/submit', {
            method: 'POST',
            headers: {
                "Content-Type": "application/json",
                "Accept": "application/json"
            },
            body: json
        });
        console.log(json);
        return data;
    };
}

search with autocomplete

We need an input search element (Search()?) with autocomplete, the controller prototype is this:

import { Controller } from "stimulus"

export default class extends Controller {
    static get targets() {
        return ["dropdownItem", "userinput", "ddContent"]
    };
    initialize() {
        this.dropdownItemTargets.forEach((element, index) => {
            element.classList.add("is-hidden");
        });
        this.content.classList.add("is-hidden");
    };
    clear() {
        if (this.input == null) {
            this.content.classList.add("is-hidden")
        }
    };
    search() {
        if (this.input == "") {
            this.content.classList.add("is-hidden");
            this.dropdownItemTargets.forEach((element, index) => {
                element.classList.add("is-hidden");
            });
        } else {
            this.content.classList.remove("is-hidden");
            this.dropdownItemTargets.forEach((element, index) => {
                if (element.innerText.includes(this.input)) {
                    element.classList.remove("is-hidden");
                } else {
                    element.classList.add("is-hidden");
                };
            });
        }
    };

    set(event) {
        event.preventDefault()
        const value = event.target.dataset.value;
        const href = event.target.dataset.href
        this.input = value;
        this.content.classList.add("is-hidden");

        const url = `${window.location.pathname}?job_name=${value}`;
        Turbo.clearCache();
        Turbo.visit(url);
    };

    get content() {
        return this.ddContentTarget
    }

    get items() {
        return this.itemTarget.value
    };

    get input() {
        return this.userinputTarget.value
    };

    set input(value) {
        return this.userinputTarget.value = value
    };
};

Add a barchart component

It will be used in scheduling dashboard in the scheduler app.
I would start with a bar chart for Job Runs, similar to the one below in Flow Runs (but we can use another figure to represent them as I think this radius pie-chart or whatever it is can be hard to reproduce).

Probably harder version:
image

Simpler version:
image

Make giotto a library

  • Create setup.py file
  • Figure out how to store static files
  • Test with some real app

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.