Skip to content
This repository has been archived by the owner on Jan 28, 2020. It is now read-only.

rc/0.14.0 #845

Merged
merged 35 commits into from Nov 9, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
39aa8ea
Added tasks API
Oct 26, 2015
74914b8
Merge pull request #802 from mitodl/refactor/gs/tasks_api
Oct 29, 2015
466c7bb
Renamed listing.js to JSX
Oct 30, 2015
07e57f7
Sorted terms in taxonomy panel
Oct 29, 2015
849917e
Bind demo branch to lore-demo app deployment
bdero Oct 30, 2015
6ae11ca
Merge pull request #818 from mitodl/feature/bdero/lore-demo-deploy
bdero Nov 2, 2015
dd513ab
Merge pull request #817 from mitodl/refactor/gs/move_listing_to_jsx
Nov 2, 2015
3d66577
Merge pull request #822 from mitodl/rc/0.13.0
pwilkins Nov 2, 2015
2e3032a
Merge pull request #815 from mitodl/feature/gs/sort_terms
Nov 3, 2015
247e6b5
Added compressor cache
Nov 3, 2015
6d1aba2
Merge pull request #827 from mitodl/refactor/gs/upgrade_django_compre…
Nov 3, 2015
5a95f23
Fixed intermittent test failures
Nov 3, 2015
19ff0a6
Merge pull request #829 from mitodl/fix/gs/intermittent_test_failure
Nov 3, 2015
c40c3fd
Added tests to verify index on course delete
Nov 3, 2015
73cbb55
Moved tests into separate files
Nov 2, 2015
722a615
Moved React components to separate files in new directories
Oct 30, 2015
d7ac892
Moved manage taxonomy tests into separate files
Nov 2, 2015
ff86fb2
Moved taxonomy React components to separate files
Nov 2, 2015
b10eb81
Merge pull request #831 from mitodl/tests/gs/course_tests
Nov 3, 2015
fbdc00c
Merge pull request #821 from mitodl/refactor/gs/move_react_components
Nov 3, 2015
fd935c3
Removed django-compressor-requirejs requirement
Nov 3, 2015
f40868c
Merge pull request #826 from mitodl/refactor/gs/remove_django_compres…
Nov 4, 2015
3b1dd30
Added parsing for display_name so we can use it if url_name isn't pre…
Nov 4, 2015
345a1e5
Implemented tracking import tasks
Oct 28, 2015
e20c3ad
Merge pull request #834 from mitodl/fix/gs/use_display_name
Nov 4, 2015
084a50d
Merge pull request #837 from mitodl/feature/gs/track_imports
Nov 4, 2015
97edb94
Fixed elasticsearch in docker-compose
Nov 4, 2015
3d08a72
Fixed preview link to use parent resource link if child has none
Nov 4, 2015
6fe1079
Merge pull request #839 from mitodl/fix/gs/make_elasticsearch_work
giocalitri Nov 5, 2015
f1f02b8
Merge pull request #836 from mitodl/fix/gs/use_parent_url_path
Nov 5, 2015
b704724
Fixed double resource import bug
Nov 4, 2015
48a544f
Merge pull request #835 from mitodl/fix/gs/dont_import_leaves
Nov 5, 2015
e6b3cca
Moved spinner into separate React class
Nov 5, 2015
5b4a7fe
Merge pull request #840 from mitodl/refactor/gs/spin_jsx
Nov 5, 2015
5e82429
Release 0.14.0
pwilkins Nov 9, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -24,6 +24,7 @@ deploy:
secure: CGv5mHV8SFnFkdwpRl2EGRU5kvnl7xfxZPgl5DvqJHZ6xBreDpGFQOyQDVVqRAt7s9Dq/JD8qMCvm15rVRdXN9rKMDFV9ilPiR2dTBPs5rzE+upA/W2N2+pkQrnXEP+80EF3Wy3ODUAUb4aUlCwG1NqZCWnn4NzuZNCtAYEqwuk=
app:
master: lore-ci
demo: lore-demo
release-candidate: lore-rc
release: lore-release
run:
Expand Down
28 changes: 25 additions & 3 deletions RELEASE.rst
@@ -1,6 +1,28 @@
Release Notes
-------------

Version 0.14.0
==============

- Moved spinner into separate React class.
- Fixed double resource import bug.
- Fixed preview link to use parent resource link if child has none.
- Fixed Elasticsearch in docker-compose.
- Implemented tracking import tasks.
- Added parsing for ``display_name`` so we can use it if ``url_name`` isn't present.
- Removed ``django-compressor-requirejs`` requirement.
- Moved taxonomy React components to separate files.
- Moved manage taxonomy tests into separate files.
- Moved React components to separate files in new directories.
- Moved tests into separate files.
- Added tests to verify index on course delete.
- Fixed intermittent test failures.
- Added compressor cache.
- Bound demo branch to lore-demo app deployment.
- Sorted terms in taxonomy panel.
- Renamed ``listing.js`` to JSX.
- Added tasks API.

Version 0.13.0
==============

Expand All @@ -9,7 +31,7 @@ Version 0.13.0
- Added custom slugify function to allow any name for Repo, Vocab, Term.
- Fixed index mapping of terms and vocabularies.
- Set Elasticsearch log level higher during testing.
- Set Spinner `zIndex` to 0 to not have it float above everything else.
- Set Spinner ``zIndex`` to 0 to not have it float above everything else.
- Added loader on save.
- Removed unused functions.
- Fixed link click behavior for term edit and delete.
Expand Down Expand Up @@ -78,8 +100,8 @@ Version 0.11.0
Version 0.10.1
==============

- Fixed exact repository search bug
- Fixed clear export bug
- Fixed exact repository search bug.
- Fixed clear export bug.

Version 0.10.0
==============
Expand Down
86 changes: 85 additions & 1 deletion apiary.apib
Expand Up @@ -89,6 +89,86 @@ Page numbering is 1-based. Omitting the `?page` parameter will return the first
]
}

## Group Tasks

## Tasks Collection [/tasks/]

### List All Tasks [GET]

List all recent tasks for a user.

+ Response 200 (application/json)

{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": "45e3c830-0ff8-4d84-85b4-c0a6e3ce81b3",
"status": "processing",
"result": {
"url": "/media/resource_exports/sarah_exports.tar.gz",
"collision": false
},
"task_type": "resource_export",
"task_info": {
"repo_slug": "repo",
"ids": [
23517,
23518
]
}
}
]
}

### Create a New Task [POST]

Queue a new task.

+ Request (application/json)

{
"task_info": {
"repo_slug": "repo",
"ids": [1]
},
"task_type": "resource_export"
}

+ Response 200 (application/json)

{
"id": "45e3c830-0ff8-4d84-85b4-c0a6e3ce81b3"
}

## Task [/tasks/{task_id}/]

+ Parameters
+ task_id: `45e3c830-0ff8-4d84-85b4-c0a6e3ce81b3` (string, required) - task identifier

### Retrieve a Task [GET]

+ Response 200 (application/json)

{
"id": "45e3c830-0ff8-4d84-85b4-c0a6e3ce81b3",
"status": "processing",
"result": {
"url": "/media/resource_exports/sarah_exports.tar.gz",
"collision": false
},
"task_type": "resource_export",
"task_info": {
"repo_slug": "repo",
"ids": [
23517,
23518
]
}
}

## Group Repositories

## Repository Collection [/repositories/]
Expand Down Expand Up @@ -477,6 +557,8 @@ Clears the export list for this repository.

## LearningResourceExportTasks Collection [/repositories/{repo_slug}/learning_resource_export_tasks/]

Deprecated. Use /api/v1/tasks/ instead.

+ Parameters
+ repo_slug: `physics-1` (string, required) - slug for the repository

Expand Down Expand Up @@ -515,7 +597,9 @@ Queue a new LearningResourceExportTask task for the given LearningResource ids.
"id": "45e3c830-0ff8-4d84-85b4-c0a6e3ce81b3"
}

## LearningResourceExportTask [/repositories/{repo_slug}/learning_resource_export_tasks/{task_id}/
## LearningResourceExportTask [/repositories/{repo_slug}/learning_resource_export_tasks/{task_id}/]

Deprecated. Use /api/v1/tasks/ instead.

+ Parameters
+ repo_slug: `physics-1` (string, required) - slug for the repository
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Expand Up @@ -8,6 +8,7 @@ redis:
- "6379"
elastic:
image: elasticsearch
command: elasticsearch -Des.network.host=0.0.0.0
ports:
- "9200"
stats:
Expand Down
16 changes: 12 additions & 4 deletions exporter/tasks.py
Expand Up @@ -4,6 +4,8 @@

from __future__ import unicode_literals

from django.core.files.storage import default_storage

from lore.celery import async
from exporter.api import export_resources_to_tarball

Expand All @@ -18,8 +20,14 @@ def export_resources(learning_resources, username):
LearningResources to export in tarball
username (unicode): Name of user
Returns:
(unicode, bool):
First item is newly created temp directory with files inside of it.
Second item is True if a static asset collision was detected.
dict:
name is path of tarball.
url is URL of tarball using django-storage.
collision is True if a static asset collision was detected.
"""
return export_resources_to_tarball(learning_resources, username)
name, collision = export_resources_to_tarball(learning_resources, username)
return {
"name": name,
"url": default_storage.url(name),
"collision": collision
}
4 changes: 3 additions & 1 deletion exporter/tests/test_export.py
Expand Up @@ -175,8 +175,10 @@ def test_export_task(self):
"""Test exporting resources task."""
resources = LearningResource.objects.all()

path, collision = export_resources.delay(
result = export_resources.delay(
resources, self.user.username).get()
path = result['name']
collision = result['collision']
tempdir = mkdtemp()

self.assertTrue(collision)
Expand Down
29 changes: 25 additions & 4 deletions importer/api/__init__.py
Expand Up @@ -144,6 +144,19 @@ def import_course(bundle, repo_id, user_id, static_dir):
return course


def is_leaf_tag(tag):
"""
Should we look for resources within elements with this tag?

Args:
tag (unicode): Element tag
Returns:
bool: Whether tag is leaf tag
"""
return tag in {'video', 'html', 'problem', 'discussion'}


# pylint: disable=too-many-branches
def import_children(course, element, parent, parent_dpath):
"""
Create LearningResource instances for each element
Expand All @@ -166,12 +179,16 @@ def import_children(course, element, parent, parent_dpath):
desc_path = MissingTitle.for_desc_path_field
mpath = etree.ElementTree(element).getpath(element)
dpath = join_description_paths(parent_dpath, desc_path)
url_name = element.attrib.get(
"url_name",
element.attrib.get("display_name", None)
)
resource = create_resource(
course=course, parent=parent, resource_type=element.tag,
title=title,
content_xml=etree.tostring(element),
mpath=mpath,
url_name=element.attrib.get("url_name", None),
url_name=url_name,
dpath=dpath,
)
# temp variable to store static assets for bulk insert
Expand Down Expand Up @@ -226,6 +243,10 @@ def import_children(course, element, parent, parent_dpath):
]
)

for child in element.getchildren():
if child.tag in DESCRIPTOR_TAGS:
import_children(course, child, resource, dpath)
# Try to protect against bad data, specifically <problem><problem>...
# imports. The two tags will still appear in content_xml but there will
# be only one resource for the outer one.
if not is_leaf_tag(element.tag):
for child in element.getchildren():
if child.tag in DESCRIPTOR_TAGS:
import_children(course, child, resource, dpath)
2 changes: 1 addition & 1 deletion importer/tests/test_forms.py
Expand Up @@ -36,7 +36,7 @@ def test_init(self):
{"course_file": self.get_upload_file(".zip")},
)
self.assertTrue(form.is_valid())
form.save(self.user.id, self.repo.id)
form.save(self.user.id, self.repo.id, self.client.session)

def test_extensions(self):
"""Only certain extensions are valid."""
Expand Down