TrooperT / ClarityUI-Python-Example

A simple example of using ClarityUI with Python Flask to create a webpage.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ClarityUI - Python Flask Example

This is a simple example of creating a Python Flask WebApp using Clarity UI

There are a couple features in this page

  • Simple login functionality using the Clarity login control
  • API connectivity to a rest API endpoint that lists out virtual machines
  • API Connectivity to a vRO endpoint that lists out all vRO workflows with their Item HREF
  • Jinja templating used extensively
  • Session details carried between pages

Angular functionality is missing from the ClarityUI so it's purely the CSS/JS components.

Flask Overview

Flask is essentially a web platform for hosting page leveraging Python. It follows a traditional web application model for how it functions. Jinja templating is used to embed pages wtihin pages. You can see this example in how we include the header.html file in all other pages using the {% includes 'header.html' %} syntax.

Component Examples

header.html

Includes jinja templating references to carry this page int oothers

index.html

Simple login form using Clarity UI. Uses the flask sessions module to tag sessions as "logged_in" = True to allow you to restrict certain pages if you wish

vms.html

We feed in a variable thats defined in our app.py and the iterate over it, using the table compononent from clarity to render the page. It's good and good for you. We do a simple for i in vms to iterate over it, and then drop a row component for each.

workflows.html

We do a similar thing to what we did in vms.html but we iterate deeper into the array in this example

Enjoy!

About

A simple example of using ClarityUI with Python Flask to create a webpage.


Languages

Language:JavaScript 59.9%Language:HTML 25.9%Language:Python 13.8%Language:CSS 0.5%