Skip to content

Commit

Permalink
chore: resolve merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
SoryRawyer committed Aug 7, 2023
2 parents 0abf8f6 + f8e70b5 commit 2a9074c
Show file tree
Hide file tree
Showing 53 changed files with 106 additions and 540 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/bump-version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,13 @@ jobs:
- name: Push branch
if: steps.tag_version.outputs.new_version
run: |
git checkout -b bot/v${{ steps.tag_version.outputs.new_version }}
git push -d origin bot/v${{ steps.tag_version.outputs.new_version }}
git push origin bot/v${{ steps.tag_version.outputs.new_version }}
branch_name="bot/v${{ steps.tag_version.outputs.new_version }}"
git fetch --prune origin
if git show-ref --quiet refs/remotes/origin/$branch_name; then
git push --delete origin $branch_name
fi
git checkout -b $branch_name || git checkout $branch_name
git push origin $branch_name
- name: Create Pull Request
if: steps.tag_version.outputs.new_version
id: cpr
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/compile-translations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ jobs:
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Push branch
run: |
git status
git log -l 3
git checkout -b bot/translations/${{ steps.date.outputs.date }}
git push -d origin bot/translations/${{ steps.date.outputs.date }}
git push origin bot/translations/${{ steps.date.outputs.date }}
branch_name="bot/translations/${{ steps.date.outputs.date }}"
git fetch --prune origin
if git show-ref --quiet refs/remotes/origin/$branch_name; then
git push --delete origin $branch_name
fi
git checkout -b $branch_name || git checkout $branch_name
git push origin $branch_name
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
Expand Down
39 changes: 39 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,45 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## v0.24.0 - 2023-08-04

### [0.24.0](https://github.com/openedx/tutor-contrib-aspects/compare/v0.23.2...v0.24.0) (2023-08-04)

#### Features

- add superset owners configurable variable ([870a9d9](https://github.com/openedx/tutor-contrib-aspects/commit/870a9d9dd03e7ef1f0715b459d7d6150342ef117))
- allow to translate markdown elements ([ceaf898](https://github.com/openedx/tutor-contrib-aspects/commit/ceaf89893f8ebe0c4e1296fdd4566d5b21808654))

## v0.23.2 - 2023-08-04

### [0.23.2](https://github.com/openedx/tutor-contrib-aspects/compare/v0.23.1...v0.23.2) (2023-08-04)

### Bug Fixes

- remove loading locale file before processing ([3401796](https://github.com/openedx/tutor-contrib-aspects/commit/3401796061b62e39f2c9cc6414b59a78565c5f80))

## v0.23.1 - 2023-08-04

### [0.23.1](https://github.com/openedx/tutor-contrib-aspects/compare/v0.23.0...v0.23.1) (2023-08-04)

### Bug Fixes

- use yaml delimiter to separate translations ([a95706d](https://github.com/openedx/tutor-contrib-aspects/commit/a95706d048f69762b03572498fd5c748020d931e))

## v0.23.0 - 2023-08-03

### [0.23.0](https://github.com/openedx/tutor-contrib-aspects/compare/v0.22.0...v0.23.0) (2023-08-03)

#### Features

- include current day in instructor dashboard ([19b7b47](https://github.com/openedx/tutor-contrib-aspects/commit/19b7b472dad2dc09c3f1900a3fc25055b92e879c)), closes [#246](https://github.com/openedx/tutor-contrib-aspects/issues/246)

#### Bug Fixes

- allow to translate dashboard headers ([12bc030](https://github.com/openedx/tutor-contrib-aspects/commit/12bc03018d1e82621562f531027e92c6ba8f313a))
- remove extra parens from org filters ([dfef41c](https://github.com/openedx/tutor-contrib-aspects/commit/dfef41cbe6020b444a4701303c7e1c2d9b55927c)), closes [#258](https://github.com/openedx/tutor-contrib-aspects/issues/258)
- upgrade event-routing-backends to 5.5.4 ([454063c](https://github.com/openedx/tutor-contrib-aspects/commit/454063c226860f7477d24020b38e27b0b811bbc8))

## v0.22.0 - 2023-08-02

### [0.22.0](https://github.com/openedx/tutor-contrib-aspects/compare/v0.21.0...v0.22.0) (2023-08-02)
Expand Down
6 changes: 3 additions & 3 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ click==8.1.6
# black
# transifex-python
# tutor
cryptography==41.0.2
cryptography==41.0.3
# via secretstorage
dill==0.3.7
# via pylint
Expand Down Expand Up @@ -97,7 +97,7 @@ mccabe==0.7.0
# via pylint
mdurl==0.1.2
# via markdown-it-py
more-itertools==10.0.0
more-itertools==10.1.0
# via jaraco-classes
mypy==1.4.1
# via
Expand Down Expand Up @@ -142,7 +142,7 @@ pycryptodome==3.18.0
# via
# -r requirements/base.txt
# tutor
pygments==2.15.1
pygments==2.16.1
# via
# readme-renderer
# rich
Expand Down
4 changes: 2 additions & 2 deletions requirements/pip-tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ click==8.1.6
# via pip-tools
packaging==23.1
# via build
pip-tools==7.1.0
pip-tools==7.2.0
# via -r requirements/pip-tools.in
pyproject-hooks==1.0.0
# via build
Expand All @@ -19,7 +19,7 @@ tomli==2.0.1
# build
# pip-tools
# pyproject-hooks
wheel==0.41.0
wheel==0.41.1
# via pip-tools

# The following packages are considered to be unsafe in a requirements file:
Expand Down
2 changes: 1 addition & 1 deletion requirements/pip.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# make upgrade
#
wheel==0.41.0
wheel==0.41.1
# via -r requirements/pip.in

# The following packages are considered to be unsafe in a requirements file:
Expand Down
6 changes: 5 additions & 1 deletion scripts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ def extract_text(asset, type):
if meta.get("text"):
strings.append(meta["text"])

if meta.get("code"):
strings.append(meta["code"])

elif type == "charts":
strings.append(asset["slice_name"])
elif type == "databases":
Expand Down Expand Up @@ -101,9 +104,10 @@ def compile_translations(root_path):
translation = tx.get_translation(string, language, None)
translations[language][string] = translation if translation else ""

file.write("---\n")
file.write(yaml.dump(translations))

file.write("{{ patch('superset-extra-asset-translations')}}\n")
file.write("\n{{ patch('superset-extra-asset-translations')}}\n")


def push_translations(root_path):
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[bumpversion]
current_version = 0.22.0
current_version = 0.24.0
commit = False
tag = False
2 changes: 1 addition & 1 deletion tutoraspects/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Expose some package metadata.
"""

__version__ = "0.22.0"
__version__ = "0.24.0"
5 changes: 3 additions & 2 deletions tutoraspects/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
(
"OPENEDX_EXTRA_PIP_REQUIREMENTS",
[
"openedx-event-sink-clickhouse==0.1.0",
"edx-event-routing-backends==5.5.0",
"openedx-event-sink-clickhouse==0.1.1",
"edx-event-routing-backends==5.5.5",
],
),
# ClickHouse xAPI settings
Expand Down Expand Up @@ -165,6 +165,7 @@
},
),
("SUPERSET_ADMIN_EMAIL", "[email protected]"),
("SUPERSET_OWNERS", []),
# Set to 0 to have no row limit.
("SUPERSET_ROW_LIMIT", 100_000),
("SUPERSET_SENTRY_DSN", ""),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,43 +1,6 @@
{% include 'openedx-assets/Open_edX_Admin_Dashboard_2.yaml' %}
{% include 'openedx-assets/xapi_events_all_parsed.yaml' %}
{% include 'openedx-assets/xAPI_problem_events_by_block_7.yaml' %}
{% include 'openedx-assets/xAPI_events_by_course_11.yaml' %}
{% include 'openedx-assets/OpenedX_Clickhouse.yaml' %}
{% include 'openedx-assets/course_overviews.yaml' %}
{% include 'openedx-assets/Instructor_dashboard_9.yaml' %}
{% include 'openedx-assets/Watches_per_video_10.yaml' %}
{% include 'openedx-assets/fact_video_plays.yaml' %}
{% include 'openedx-assets/Transcript_closed_captioning_usage_per_video_11.yaml' %}
{% include 'openedx-assets/fact_transcript_usage.yaml' %}
{% include 'openedx-assets/Cumulative_enrollments_by_mode_15.yaml' %}
{% include 'openedx-assets/fact_enrollments.yaml' %}
{% include 'openedx-assets/Enrollment_events_per_day_16.yaml' %}
{% include 'openedx-assets/course_blocks.yaml' %}
{% include 'openedx-assets/dim_courses.yaml' %}
{% include 'openedx-assets/Enrolled_learners_per_day_36.yaml' %}
{% include 'openedx-assets/fact_enrollments_by_day.yaml' %}
{% include 'openedx-assets/Attempts_to_first_success_42.yaml' %}
{% include 'openedx-assets/Hints_and_answers_displayed_per_correct_answer_43.yaml' %}
{% include 'openedx-assets/Problem_submission_counts_38.yaml' %}
{% include 'openedx-assets/Response_distribution_39.yaml' %}
{% include 'openedx-assets/dim_course_problems.yaml' %}
{% include 'openedx-assets/fact_learner_problem_summary.yaml' %}
{% include 'openedx-assets/fact_problem_responses.yaml' %}
{% include 'openedx-assets/hints_per_success.yaml' %}
{% include 'openedx-assets/dim_course_videos.yaml' %}
{% include 'openedx-assets/fact_watched_video_segments.yaml' %}
{% include 'openedx-assets/Watched_video_segments_51.yaml' %}
{% include 'openedx-assets/Actor_IDs_over_time_47.yaml' %}
{% include 'openedx-assets/Courses_44.yaml' %}
{% include 'openedx-assets/Event_type_45.yaml' %}
{% include 'openedx-assets/Events_per_course_46.yaml' %}
{% include 'openedx-assets/Last_course_syncronized_41.yaml' %}
{% include 'openedx-assets/Last_received_xAPI_events_40.yaml' %}
{% include 'openedx-assets/Operator_Dashboard_5.yaml' %}
{% include 'openedx-assets/Organizations_42.yaml' %}
{% include 'openedx-assets/Synchronized_Courses_39.yaml' %}
{% include 'openedx-assets/Unique_actors_43.yaml' %}
{% include 'openedx-assets/xAPI_events_38.yaml' %}
{% for file in "openedx-assets/assets/"|walk_templates %}
{% include file %}
{% endfor %}


{{ patch("superset-extra-assets") }}
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,21 @@
ASSETS_FILE_PATH = "/app/pythonpath/assets.yaml"
ASSETS_ZIP_PATH = "/app/assets/assets.zip"

ASSETS_TRANSLATIONS = yaml.load(
open(TRANSLATIONS_FILE_PATH, "r"), Loader=yaml.FullLoader
)
merged_data = {}
with open(TRANSLATIONS_FILE_PATH, "r") as file:
yaml_content = file.read()
yaml_documents = yaml_content.split("\n---\n")

for doc in yaml_documents:
data = yaml.safe_load(doc)
if data is not None:
for lang, translations in data.items():
if lang not in merged_data:
merged_data[lang] = {}
merged_data[lang].update(translations)


ASSETS_TRANSLATIONS = merged_data


def main():
Expand Down Expand Up @@ -137,7 +149,7 @@ def generate_translated_dashboard_elements(copy, language):
"""Generate translated elements for a dashboard"""
position = copy.get("position", {})

SUPPORTED_TYPES = ["TAB", "HEADER"]
SUPPORTED_TYPES = {"TAB": "text", "HEADER": "text", "MARKDOWN": "code"}

for element in position.values():
if not isinstance(element, dict):
Expand All @@ -158,16 +170,17 @@ def generate_translated_dashboard_elements(copy, language):
meta["sliceName"] = translation
meta["uuid"] = element_id

elif element.get("type") in SUPPORTED_TYPES:
elif element.get("type") in SUPPORTED_TYPES.keys():
text_key = SUPPORTED_TYPES.get(element["type"])
chart_body_id = element.get("id")
if not meta or not meta.get("text"):
if not meta or not meta.get(text_key):
continue

element_type = element.get("type")
element_id = chart_body_id
translation = get_translation(meta["text"], language)
translation = get_translation(meta[text_key], language)

meta["text"] = translation
meta[text_key] = translation

if translation and element_type and element_id:
print(
Expand Down Expand Up @@ -215,11 +228,22 @@ def create_zip_and_import_assets():

def update_dashboard_roles(roles):
"""Update the roles of the dashboards"""
owners_username = {{SUPERSET_OWNERS}}

owners = []

for owner in owners_username:
user = security_manager.find_user(username=owner)
if user:
owners.append(user)

for dashboard_uuid, role_ids in roles.items():
dashboard = db.session.query(Dashboard).filter_by(uuid=dashboard_uuid).one()
print("Importing dashboard roles", dashboard_uuid, role_ids)
dashboard.roles = role_ids
dashboard.published = True
if owners:
dashboard.owners = owners
db.session.commit()


Expand Down
Loading

0 comments on commit 2a9074c

Please sign in to comment.