Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
name: 🐛 Bug Report
about: Create a report to help us improve Fast.BI
title: '[BUG] '
labels: ['bug', 'needs-triage']
assignees: ''
---

## 🐛 Bug Description
<!-- A clear and concise description of what the bug is -->

## 🔍 Steps to Reproduce
1.
2.
3.

## ✅ Expected Behavior
<!-- A clear and concise description of what you expected to happen -->

## ❌ Actual Behavior
<!-- A clear and concise description of what actually happened -->

## 🖥️ Environment
- **OS**: [e.g., macOS 13.0, Ubuntu 22.04, Windows 11]
- **Python Version**: [e.g., 3.9.7, 3.10.0]
- **Fast.BI Version**: [e.g., 1.0.0, main branch]
- **Deployment Type**: [e.g., GCP, On-Premise, AWS, Azure]
- **CLI Version**: [e.g., 1.0.0]

## 📋 Additional Information
<!-- Add any other context about the problem here -->

### Logs
<!-- Please include relevant logs, error messages, or screenshots -->

### Configuration
<!-- If applicable, include relevant configuration files (with sensitive data removed) -->

## 🔧 Possible Solution
<!-- If you have suggestions on a fix for the bug -->

## 📚 Related Documentation
<!-- Links to relevant documentation or discussions -->

---

**Note**: Please ensure you're using the latest version of Fast.BI and have checked existing issues for duplicates.
35 changes: 35 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: 💡 Feature Request
about: Suggest an idea for Fast.BI
title: '[FEATURE] '
labels: ['enhancement', 'needs-triage']
assignees: ''
---

## 💡 Feature Description
<!-- A clear and concise description of the feature you'd like to see -->

## 🎯 Use Case
<!-- Describe the problem this feature would solve and why it's needed -->

## 💭 Proposed Solution
<!-- A clear and concise description of how you envision this feature working -->

## 🔄 Alternatives Considered
<!-- A clear and concise description of any alternative solutions or features you've considered -->

## 📊 Impact
<!-- How would this feature benefit users? How many users would benefit? -->

## 🎨 Mockups/Examples
<!-- If applicable, add mockups, screenshots, or examples of similar features -->

## 🔗 Related Features
<!-- Is this feature related to any existing features or issues? -->

## 📚 Additional Context
<!-- Add any other context, references, or examples about the feature request -->

---

**Note**: Please search existing issues to ensure this feature hasn't already been requested.
13 changes: 13 additions & 0 deletions .github/changelog/custom-logo-feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
### Custom Logo Feature

**Added:**
- **Backend**: New endpoints `/ui-config/upload_logo`, `/ui-config/custom_logo`, and `/ui-config/logo_status` to handle custom company logo upload and serving.
- **Backend**: Context processor `inject_logo_path` to dynamically serve the correct logo path (custom or default) to Jinja2 templates, preventing UI flicker.
- **Frontend**: Long-press (15 seconds) functionality on the main logo to trigger an upload modal for Administrators.
- **Frontend**: AJAX handling for logo file upload.
- **UI**: Updated all HTML templates to use the dynamic `{{ logo_path }}` variable instead of hardcoded image sources.

**Changed:**
- Refactored logo image source in `home.html`, `index.html`, and all iframe templates to support dynamic loading.
- Ensured logo upload is restricted to users with 'Admin' or 'consoleAdmin' group membership.

22 changes: 22 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## Description
<!-- Describe your changes in detail -->

## Related Issue
<!-- Link to the issue this PR resolves -->

## Type of Change
<!-- Check the options that apply -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation update

## Checklist
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes

61 changes: 60 additions & 1 deletion app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
import urllib.parse
from urllib.parse import unquote
from datetime import datetime
from flask import Flask, redirect, url_for, render_template, flash, session, request, jsonify
from flask import Flask, redirect, url_for, render_template, flash, session, request, jsonify, send_from_directory
from werkzeug.utils import secure_filename
from flask_login import LoginManager, login_user, logout_user, current_user
from flask_sqlalchemy import SQLAlchemy
from flask_cors import CORS
Expand Down Expand Up @@ -1951,6 +1952,64 @@ def clear_cache():
app.logger.error(f"Error clearing cache: {str(e)}")
return jsonify({"error": str(e)}), 500

@app.context_processor
def inject_logo_path():
instance_path = os.path.abspath('instance')
logo_path = os.path.join(instance_path, 'custom_logo.png')
if os.path.exists(logo_path):
# Use a cache buster timestamp to ensure updates are seen immediately
# In a real scenario, we might check file modification time, but time.time() is sufficient for this purpose if called once per request or handled in JS.
# For context processor, we'll just provide the base path and let JS handle cache busting or rely on browser cache behavior.
# Actually, to avoid flicker, we should point directly to the custom logo endpoint.
return dict(logo_path='/ui-config/custom_logo')
else:
return dict(logo_path='/images/logo_transparent.png')

# Custom Logo Feature
@app.route('/ui-config/upload_logo', methods=['POST'])
def upload_logo():
if not oidc.user_loggedin:
return jsonify({'error': 'Unauthorized'}), 401

user_info = oidc.user_getinfo(['groups'])
user_groups = set(user_info.get('groups', []))
user_groups_lower = {group.lower() for group in user_groups}

# Check for Admin role (case-insensitive)
if not any(admin_group in user_groups_lower for admin_group in ['admin', 'consoleadmin']):
return jsonify({'error': 'Forbidden: Admin access required'}), 403

if 'logo' not in request.files:
return jsonify({'error': 'No file part'}), 400

file = request.files['logo']
if file.filename == '':
return jsonify({'error': 'No selected file'}), 400

if file:
filename = "custom_logo.png" # Force filename to ensure consistency
# Ensure instance directory exists
instance_path = os.path.abspath('instance')
if not os.path.exists(instance_path):
os.makedirs(instance_path)

file.save(os.path.join(instance_path, filename))
return jsonify({'message': 'Logo uploaded successfully'}), 200

@app.route('/ui-config/custom_logo')
def custom_logo():
instance_path = os.path.abspath('instance')
return send_from_directory(instance_path, 'custom_logo.png')

@app.route('/ui-config/logo_status')
def logo_status():
instance_path = os.path.abspath('instance')
logo_path = os.path.join(instance_path, 'custom_logo.png')
if os.path.exists(logo_path):
return jsonify({'has_custom_logo': True, 'url': '/ui-config/custom_logo'}), 200
else:
return jsonify({'has_custom_logo': False}), 200

if __name__ == "__main__":
# Determine the environment and configure Flask accordingly
if app.config['FLASK_ENV'] == "production":
Expand Down
7 changes: 7 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,10 @@ docker buildx build . \
--tag europe-central2-docker.pkg.dev/fast-bi-common/bi-platform/tsb-fastbi-web-core:${dbt_init_version} \
--platform linux/amd64 \
--push

docker buildx build . \
--pull \
--tag 4fastbi/data-platform-ui-core:dev-latest \
--tag 4fastbi/data-platform-ui-core:dev-v0.1.3 \
--platform linux/amd64 \
--push
2 changes: 1 addition & 1 deletion fastbi-platform/403.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
z-index: 1000;
}
</style>
<li class="rj-item rj-img-logo"><a href="/homepage"><img src="/images/logo_transparent.png" alt="Fast.BI" title="Fast.BI"></a></li>
<li class="rj-item rj-img-logo"><a href="/homepage"><img src="{{ logo_path }}" alt="Fast.BI" title="Fast.BI"></a></li>
<li id="home" class="rj-item"><a class="rj-link"href="/homepage"><i class="fa-solid fa-house"></i> <b class="rj-title-link"> Home</b></a></li>
<li class="line"></li>
<li id="init" class="rj-item"><a class="rj-link"href="/dbt-init"><i class="fa-regular fa-circle-play"></i> <b class="rj-title-link"> Data Project Initialization</b></a></li>
Expand Down
2 changes: 1 addition & 1 deletion fastbi-platform/503_dc.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
z-index: 1000;
}
</style>
<li class="rj-item rj-img-logo"><a href="/homepage"><img src="/images/logo_transparent.png" alt="Fast.BI" title="Fast.BI"></a></li>
<li class="rj-item rj-img-logo"><a href="/homepage"><img src="{{ logo_path }}" alt="Fast.BI" title="Fast.BI"></a></li>
<li id="home" class="rj-item"><a class="rj-link"href="/homepage"><i class="fa-solid fa-house"></i> <b class="rj-title-link"> Home</b></a></li>
<li class="line"></li>
<li id="init" class="rj-item"><a class="rj-link"href="/dbt-init"><i class="fa-regular fa-circle-play"></i> <b class="rj-title-link"> Data Project Initialization</b></a></li>
Expand Down
2 changes: 1 addition & 1 deletion fastbi-platform/503_dq.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
z-index: 1000;
}
</style>
<li class="rj-item rj-img-logo"><a href="/homepage"><img src="/images/logo_transparent.png" alt="Fast.BI" title="Fast.BI"></a></li>
<li class="rj-item rj-img-logo"><a href="/homepage"><img src="{{ logo_path }}" alt="Fast.BI" title="Fast.BI"></a></li>
<li id="home" class="rj-item"><a class="rj-link"href="/homepage"><i class="fa-solid fa-house"></i> <b class="rj-title-link"> Home</b></a></li>
<li class="line"></li>
<li id="init" class="rj-item"><a class="rj-link"href="/dbt-init"><i class="fa-regular fa-circle-play"></i> <b class="rj-title-link"> Data Project Initialization</b></a></li>
Expand Down
2 changes: 1 addition & 1 deletion fastbi-platform/airbyte_iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
}
</style>
<li class="rj-item rj-img-logo">
<a href="/homepage"><img src="/images/logo_transparent.png" alt="Fast.BI" title="Fast.BI"></a>
<a href="/homepage"><img src="{{ logo_path }}" alt="Fast.BI" title="Fast.BI"></a>
</li>

<li id="home" class="rj-item">
Expand Down
2 changes: 1 addition & 1 deletion fastbi-platform/airflow_iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
}
</style>
<li class="rj-item rj-img-logo">
<a href="/homepage"><img src="/images/logo_transparent.png" alt="Fast.BI" title="Fast.BI"></a>
<a href="/homepage"><img src="{{ logo_path }}" alt="Fast.BI" title="Fast.BI"></a>
</li>

<li id="home" class="rj-item">
Expand Down
2 changes: 1 addition & 1 deletion fastbi-platform/cicd_workflow_iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
}
</style>
<li class="rj-item rj-img-logo">
<a href="/homepage"><img src="/images/logo_transparent.png" alt="Fast.BI" title="Fast.BI"></a>
<a href="/homepage"><img src="{{ logo_path }}" alt="Fast.BI" title="Fast.BI"></a>
</li>

<li id="home" class="rj-item">
Expand Down
2 changes: 1 addition & 1 deletion fastbi-platform/configuration.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
}
</style>
<li class="rj-item rj-img-logo">
<a href="/homepage"><img src="/images/logo_transparent.png" alt="Fast.BI" title="Fast.BI"></a>
<a href="/homepage"><img src="{{ logo_path }}" alt="Fast.BI" title="Fast.BI"></a>
</li>

<li id="home" class="rj-item">
Expand Down
2 changes: 1 addition & 1 deletion fastbi-platform/data_catalog.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
}
</style>
<li class="rj-item rj-img-logo">
<a href="/homepage"><img src="/images/logo_transparent.png" alt="Fast.BI" title="Fast.BI"></a>
<a href="/homepage"><img src="{{ logo_path }}" alt="Fast.BI" title="Fast.BI"></a>
</li>

<li id="home" class="rj-item">
Expand Down
2 changes: 1 addition & 1 deletion fastbi-platform/data_catalog_iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
}
</style>
<li class="rj-item rj-img-logo">
<a href="/homepage"><img src="/images/logo_transparent.png" alt="Fast.BI" title="Fast.BI"></a>
<a href="/homepage"><img src="{{ logo_path }}" alt="Fast.BI" title="Fast.BI"></a>
</li>

<li id="home" class="rj-item">
Expand Down
2 changes: 1 addition & 1 deletion fastbi-platform/data_quality.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
}
</style>
<li class="rj-item rj-img-logo">
<a href="/homepage"><img src="/images/logo_transparent.png" alt="Fast.BI" title="Fast.BI"></a>
<a href="/homepage"><img src="{{ logo_path }}" alt="Fast.BI" title="Fast.BI"></a>
</li>

<li id="home" class="rj-item">
Expand Down
2 changes: 1 addition & 1 deletion fastbi-platform/data_quality_iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
}
</style>
<li class="rj-item rj-img-logo">
<a href="/homepage"><img src="/images/logo_transparent.png" alt="Fast.BI" title="Fast.BI"></a>
<a href="/homepage"><img src="{{ logo_path }}" alt="Fast.BI" title="Fast.BI"></a>
</li>

<li id="home" class="rj-item">
Expand Down
2 changes: 1 addition & 1 deletion fastbi-platform/datahub_iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
}
</style>
<li class="rj-item rj-img-logo">
<a href="/homepage"><img src="/images/logo_transparent.png" alt="Fast.BI" title="Fast.BI"></a>
<a href="/homepage"><img src="{{ logo_path }}" alt="Fast.BI" title="Fast.BI"></a>
</li>

<li id="home" class="rj-item">
Expand Down
2 changes: 1 addition & 1 deletion fastbi-platform/dbt-project-initialization.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
}
</style>
<li class="rj-item rj-img-logo">
<a href="/homepage"><img src="/images/logo_transparent.png" alt="Fast.BI"
<a href="/homepage"><img src="{{ logo_path }}" alt="Fast.BI"
title="Fast.BI"></a>
</li>

Expand Down
2 changes: 1 addition & 1 deletion fastbi-platform/dbt-project-management.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
}
</style>
<li class="rj-item rj-img-logo">
<a href="/homepage"><img src="/images/logo_transparent.png" alt="Fast.BI"
<a href="/homepage"><img src="{{ logo_path }}" alt="Fast.BI"
title="Fast.BI"></a>
</li>

Expand Down
2 changes: 1 addition & 1 deletion fastbi-platform/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
}
</style>
<li class="rj-item rj-img-logo">
<a href="/homepage"><img src="/images/logo_transparent.png" alt="Fast.BI" title="Fast.BI"></a>
<a href="/homepage"><img src="{{ logo_path }}" alt="Fast.BI" title="Fast.BI"></a>
</li>

<li id="home" class="rj-item">
Expand Down
2 changes: 1 addition & 1 deletion fastbi-platform/ide_iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
}
</style>
<li class="rj-item rj-img-logo">
<a href="/homepage"><img src="/images/logo_transparent.png" alt="Fast.BI" title="Fast.BI"></a>
<a href="/homepage"><img src="{{ logo_path }}" alt="Fast.BI" title="Fast.BI"></a>
</li>

<li id="home" class="rj-item">
Expand Down
2 changes: 1 addition & 1 deletion fastbi-platform/ide_iframe_admin_panel.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
}
</style>
<li class="rj-item rj-img-logo">
<a href="/homepage"><img src="/images/logo_transparent.png" alt="Fast.BI" title="Fast.BI"></a>
<a href="/homepage"><img src="{{ logo_path }}" alt="Fast.BI" title="Fast.BI"></a>
</li>

<li id="home" class="rj-item">
Expand Down
2 changes: 1 addition & 1 deletion fastbi-platform/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<div class="users-container users-login">
<div class="container-left">
<div class="site-logo">
<img src="/images/{{ logo_image_name }}" alt="FastBI Logo">
<img src="{{ logo_path }}" alt="FastBI Logo">
<a href="">
<h1>Data</h1>
<h1>Development</h1>
Expand Down
6 changes: 3 additions & 3 deletions fastbi-platform/stats.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
z-index: 1000;
}
</style>
<li class="rj-item rj-img-logo">
<a href="/homepage"><img src="/images/logo_transparent.png" alt="Fast.BI" title="Fast.BI"></a>
</li>
<li class="rj-item rj-img-logo">
<a href="/homepage"><img src="{{ logo_path }}" alt="Fast.BI" title="Fast.BI"></a>
</li>

<li id="home" class="rj-item">
<a class="rj-link" href="/homepage"><i class="fa-solid fa-house"></i> <b class="rj-title-link"> Home</b></a>
Expand Down
Loading