From 672cad2e4713bc4599a7d3f82ea16712290d90b6 Mon Sep 17 00:00:00 2001 From: checktheroads Date: Tue, 24 Mar 2020 11:08:42 -0700 Subject: [PATCH] add default_color_mode option --- docs/docs/ui.mdx | 15 +- hyperglass/configuration/models/web.py | 1 + hyperglass/constants.py | 2 +- hyperglass/examples/hyperglass.yaml | 153 ------------------ .../ui/components/HyperglassProvider.js | 2 +- install.sh | 2 +- pyproject.toml | 2 +- 7 files changed, 17 insertions(+), 160 deletions(-) diff --git a/docs/docs/ui.mdx b/docs/docs/ui.mdx index 97f065d..9bfc637 100644 --- a/docs/docs/ui.mdx +++ b/docs/docs/ui.mdx @@ -2,7 +2,7 @@ id: ui title: Web UI sidebar_label: Web UI -keywords: [web ui, gui, theme, colors, branding] +keywords: [hyperglass, looking glass, web ui, gui, theme, colors, branding] description: hyperglass Web UI Configuration --- @@ -68,6 +68,7 @@ web: title: hyperglass title_mode: text_only theme: + default_color_mode: light colors: black: "#262626" blue: "#314cb6" @@ -173,12 +174,20 @@ The `title_mode` parameter behaves in the following manner: ## `theme` +### Parameters + +| Parameter | Type | Description | +| :------------------- | :----: | :----------------------------------------------------------------------------------------------------------------------------------------------- | +| `default_color_mode` | String | Sets the default color mode. Must be `light` or `dark`. If no default mode is specified, hyperglass will use the browser's preferred color mode. | + +### Sections + | Section | Description | All Options | | :------- | :----------- | :----------------------------------: | | `colors` | Theme colors | ➡️ | | `fonts` | Theme fonts | ➡️ | -### `colors` +#### `colors` | Parameter | Type | Default | Description | | :---------- | :----: | :--------------------- | :------------------------------------- | @@ -201,7 +210,7 @@ The `title_mode` parameter behaves in the following manner: | `purple` | String | | | | `gray` | String | | | -### `fonts` +#### `fonts` Currently, only [Google Fonts](https://fonts.google.com/) are supported. diff --git a/hyperglass/configuration/models/web.py b/hyperglass/configuration/models/web.py index 5bdf820..c48c4d8 100644 --- a/hyperglass/configuration/models/web.py +++ b/hyperglass/configuration/models/web.py @@ -197,6 +197,7 @@ class Theme(HyperglassLevel3): """Validation model for theme variables.""" colors: ThemeColors = ThemeColors() + default_color_mode: Optional[constr(regex=r"light|dark")] fonts: ThemeFonts = ThemeFonts() diff --git a/hyperglass/constants.py b/hyperglass/constants.py index 709453e..bd5d542 100644 --- a/hyperglass/constants.py +++ b/hyperglass/constants.py @@ -4,7 +4,7 @@ import sys from datetime import datetime __name__ = "hyperglass" -__version__ = "1.0.0-beta.9" +__version__ = "1.0.0-beta.10" __author__ = "Matt Love" __copyright__ = f"Copyright {datetime.now().year} Matthew Love" __license__ = "BSD 3-Clause Clear License" diff --git a/hyperglass/examples/hyperglass.yaml b/hyperglass/examples/hyperglass.yaml index 5e94954..e69de29 100644 --- a/hyperglass/examples/hyperglass.yaml +++ b/hyperglass/examples/hyperglass.yaml @@ -1,153 +0,0 @@ ---- -# cache: -# database: 0 -# host: localhost -# port: 6379 -# show_text: true -# timeout: 120 -# cors_origins: [] -# debug: true -# developer_mode: false -# docs: -# base_url: https://lg.example.net -# description: "" -# devices: -# description: List of all devices/locations with associated identifiers, display names, networks, & VRFs. -# summary: Devices List -# title: Devices -# enable: true -# mode: redoc -# openapi_uri: /openapi.json -# queries: -# description: List of supported query types. -# summary: Query Types -# title: Supported Queries -# query: -# description: Request a query response per-location. -# summary: Query the Looking Glass -# title: Submit Query -# title: "{site_title} API Documentation" -# uri: /api/docs -# listen_address: 0.0.0.0 -# listen_port: 8001 -# log_file: /tmp/hyperglass_20204821-134836.log -# messages: -# acl_denied: "{target} is a member of {denied_network}, which is not allowed." -# acl_not_allowed: "{target} is not allowed." -# authentication_error: Authentication error occurred. -# connection_error: "Error connecting to {device_name}: {error}" -# feature_not_enabled: "{feature} is not enabled for {device_name}." -# general: Something went wrong. -# invalid_field: "{input} is an invalid {field}." -# invalid_input: "{target} is not a valid {query_type} target." -# no_input: "{field} must be specified." -# no_output: No output. -# no_response: No response. -# request_timeout: Request timed out. -# vrf_not_associated: VRF {vrf_name} is not associated with {device_name}. -# vrf_not_found: VRF {vrf_name} is not defined. -# org_name: Beloved Hyperglass User -# primary_asn: "65001" -# queries: -# bgp_aspath: -# display_name: BGP AS Path -# enable: true -# pattern: -# asdot: ^(\^|^\_)((\d+\.\d+)\_|(\d+\.\d+)\$|(\d+\.\d+)\(\_\.\+\_\))+$ -# asplain: ^(\^|^\_)(\d+\_|\d+\$|\d+\(\_\.\+\_\))+$ -# mode: asplain -# bgp_community: -# display_name: BGP Community -# enable: true -# pattern: -# decimal: ^[0-9]{1,10}$ -# extended_as: ^([0-9]{0,5})\:([0-9]{1,5})$ -# large: ^([0-9]{1,10})\:([0-9]{1,10})\:[0-9]{1,10}$ -# bgp_route: -# display_name: BGP Route -# enable: true -# ping: -# display_name: Ping -# enable: true -# traceroute: -# display_name: Traceroute -# enable: true -# request_timeout: 30 -# site_description: Beloved Hyperglass User Network Looking Glass -# site_keywords: -# - hyperglass -# - looking glass -# - lg -# - peer -# - peering -# - ipv4 -# - ipv6 -# - transit -# - community -# - communities -# - bgp -# - routing -# - network -# - isp -# site_title: hyperglass -# web: -# credit: -# enable: true -# dns_provider: -# name: google -# url: https://dns.google/resolve -# external_link: -# enable: true -# title: PeeringDB -# url: https://www.peeringdb.com/asn/{primary_asn} -# help_menu: -# enable: true -# file: null -# title: Help -# logo: -# dark: images/hyperglass-dark.png -# favicons: ui/images/favicons/ -# height: null -# light: images/hyperglass-light.png -# width: 384 -# opengraph: -# height: 1132 -# image: images/hyperglass-opengraph.png -# width: 7355 -# terms: -# enable: true -# file: null -# title: Terms -# text: -# cache: Results will be cached for 2 minutes. -# fqdn_tooltip: Use {protocol} -# query_location: Location -# query_target: Target -# query_type: Query Type -# query_vrf: Routing Table -# subtitle: AS65001 -# title: hyperglass -# title_mode: logo_only -# theme: -# colors: -# black: "#262626" -# blue: "#314cb6" -# cyan: "#118ab2" -# danger: "#d84b4b" -# error: "#ff6b35" -# gray: "#c1c7cc" -# green: "#35b246" -# orange: "#ff6b35" -# pink: "#f2607d" -# primary: "#118ab2" -# purple: "#8d30b5" -# red: "#d84b4b" -# secondary: "#314cb6" -# success: "#35b246" -# teal: "#35b299" -# warning: "#edae49" -# white: "#f7f7f7" -# yellow: "#edae49" -# fonts: -# body: Nunito -# mono: Fira Code diff --git a/hyperglass/ui/components/HyperglassProvider.js b/hyperglass/ui/components/HyperglassProvider.js index 67d0cab..5441c45 100644 --- a/hyperglass/ui/components/HyperglassProvider.js +++ b/hyperglass/ui/components/HyperglassProvider.js @@ -19,7 +19,7 @@ export const HyperglassProvider = ({ config, children }) => { return ( - + {children} diff --git a/install.sh b/install.sh index a679330..1a93afb 100755 --- a/install.sh +++ b/install.sh @@ -2,7 +2,7 @@ set -e -HYPERGLASS_VERSION="1.0.0b9" +HYPERGLASS_VERSION="1.0.0b10" MIN_PYTHON_MAJOR="3" MIN_PYTHON_MINOR="6" diff --git a/pyproject.toml b/pyproject.toml index 535b512..5ca502b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.masonry.api" [tool.poetry] name = "hyperglass" -version = "1.0.0-beta.9" +version = "1.0.0-beta.10" description = "hyperglass is the modern network looking glass that tries to make the internet better." authors = ["Matt Love "] readme = "README.md"