mirror of
https://github.com/nikdoof/ohayodash.git
synced 2025-12-16 19:42:18 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
4c6234e2db
|
|||
|
99a7dfde6e
|
|||
|
17dadcc39e
|
|||
|
4f0d4e0313
|
|||
|
30543409e0
|
@@ -18,6 +18,8 @@ image:
|
|||||||
env:
|
env:
|
||||||
# -- Set the container timezone
|
# -- Set the container timezone
|
||||||
TZ: UTC
|
TZ: UTC
|
||||||
|
# -- Python date format string to use for rendering the date/time
|
||||||
|
DATE_FORMAT: "%Y-%m-%d %H:%M"
|
||||||
|
|
||||||
# -- Configures service settings for the chart.
|
# -- Configures service settings for the chart.
|
||||||
# @default -- See values.yaml
|
# @default -- See values.yaml
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import zoneinfo
|
|||||||
|
|
||||||
import kubernetes
|
import kubernetes
|
||||||
import yaml
|
import yaml
|
||||||
from flask import Blueprint, render_template
|
from flask import Blueprint, render_template, jsonify
|
||||||
|
|
||||||
ANNOTATION_BASE = 'ohayodash.github.io'
|
ANNOTATION_BASE = 'ohayodash.github.io'
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ def get_bookmarks() -> list:
|
|||||||
return bookmarks
|
return bookmarks
|
||||||
|
|
||||||
|
|
||||||
def get_greeting():
|
def get_greeting() -> tuple:
|
||||||
"""Generate the greeting string based on the defined timezone."""
|
"""Generate the greeting string based on the defined timezone."""
|
||||||
try:
|
try:
|
||||||
tz = zoneinfo.ZoneInfo(os.environ.get('TZ', 'UTC'))
|
tz = zoneinfo.ZoneInfo(os.environ.get('TZ', 'UTC'))
|
||||||
@@ -88,10 +88,15 @@ def get_greeting():
|
|||||||
current_time = datetime.datetime.now(tz)
|
current_time = datetime.datetime.now(tz)
|
||||||
|
|
||||||
if 0 < current_time.hour < 12:
|
if 0 < current_time.hour < 12:
|
||||||
return 'おはようございます!'
|
return 'おはようございます!', "Thats 'Good morning' in Japanese"
|
||||||
elif current_time.hour >= 19:
|
elif current_time.hour >= 19:
|
||||||
return 'こんばんは'
|
return 'こんばんは', "Thats 'Good evening' in Japanese"
|
||||||
return 'こんにちは'
|
return 'こんにちは', "Thats 'Good day' in Japanese"
|
||||||
|
|
||||||
|
|
||||||
|
@base.app_template_filter()
|
||||||
|
def format_datetime(value, format='medium'):
|
||||||
|
return value.strftime(os.environ.get('DATE_FORMAT', '%Y-%m-%d %H:%M')) # noqa: WPS323
|
||||||
|
|
||||||
|
|
||||||
@base.route('/')
|
@base.route('/')
|
||||||
@@ -102,3 +107,13 @@ def index():
|
|||||||
applications=get_k8s_applications(),
|
applications=get_k8s_applications(),
|
||||||
bookmarks=get_bookmarks(),
|
bookmarks=get_bookmarks(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@base.route('/api/applications')
|
||||||
|
def applications():
|
||||||
|
return jsonify(get_k8s_applications())
|
||||||
|
|
||||||
|
|
||||||
|
@base.route('/api/bookmarks')
|
||||||
|
def bookmarks():
|
||||||
|
return jsonify(get_bookmarks())
|
||||||
|
|||||||
@@ -52,8 +52,8 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="header">
|
<section id="header">
|
||||||
<h1>{{ greeting | default("Welcome")}}</h1>
|
<h1><span title="{{ greeting[1] }}">{{ greeting[0] | default("Welcome")}}</span></h1>
|
||||||
<h2>{{ now }}</h2>
|
<h2>{{ now | format_datetime }}</h2>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{% if applications %}
|
{% if applications %}
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
{% for app in applications %}
|
{% for app in applications %}
|
||||||
<div class="apps_item">
|
<div class="apps_item">
|
||||||
<div class="apps_icon">
|
<div class="apps_icon">
|
||||||
<span class="iconify icon" data-icon="mdi-{{ app.icon | default("application") }}"></span>
|
<a href="{{ app.url }}"><span class="iconify icon" data-icon="mdi-{{ app.icon | default("application") }}"></span></a>
|
||||||
</div>
|
</div>
|
||||||
<div class="apps_text">
|
<div class="apps_text">
|
||||||
<a href="{{ app.url }}">{{ app.name }}</a>
|
<a href="{{ app.url }}">{{ app.name }}</a>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = ohayodash
|
name = ohayodash
|
||||||
version = 0.1.1
|
version = 0.1.2
|
||||||
description = A Kubernetes driven start page and dashboard. All configuration is done by standard Kubernetes objects and ConfigMaps.
|
description = A Kubernetes driven start page and dashboard. All configuration is done by standard Kubernetes objects and ConfigMaps.
|
||||||
long_description = file: README.md, LICENSE
|
long_description = file: README.md, LICENSE
|
||||||
license = MIT
|
license = MIT
|
||||||
|
|||||||
Reference in New Issue
Block a user