-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
2,804 additions
and
15 deletions.
There are no files selected for viewing
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
2,671 changes: 2,671 additions & 0 deletions
2,671
paperboy/assets/static/fonts/fontawesome-webfont.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
from .models.base import Base # noqa: F401 | ||
from .job import JobSQLStorage # noqa: F401 | ||
from .notebook import NotebookSQLStorage # noqa: F401 | ||
from .output import OutputSQLStorage # noqa: F401 | ||
from .report import ReportSQLStorage # noqa: F401 | ||
from .user import UserSQLStorage # noqa: F401 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import logging | ||
from datetime import datetime | ||
from paperboy.config import OutputConfig | ||
from paperboy.storage import OutputStorage | ||
from .base import BaseSQLStorageMixin, justid | ||
from .models.report import ReportSQL | ||
from .models.output import OutputSQL | ||
|
||
|
||
class OutputSQLStorage(BaseSQLStorageMixin, OutputStorage): | ||
def status(self, user, params, session, *args, **kwargs): | ||
base = session.query(OutputSQL) \ | ||
.filter(OutputSQL.userId == int(user.id)) | ||
return {'total': base.count()} | ||
|
||
def form(self): | ||
'''Pass through to shared method in BaseSQLStorageMixin''' | ||
return self._form(OutputConfig) | ||
|
||
def search(self, user, params, session, *args, **kwargs): | ||
'''Pass through to shared method in BaseSQLStorageMixin''' | ||
return self._search(OutputSQL, 'Output', user, params, session, *args, **kwargs) | ||
|
||
def list(self, user, params, session, *args, **kwargs): | ||
'''Pass through to shared method in BaseSQLStorageMixin''' | ||
return self._list(OutputSQL, 'outputs', user, params, session, *args, **kwargs) | ||
|
||
def detail(self, user, params, session, *args, **kwargs): | ||
'''Pass through to shared method in BaseSQLStorageMixin''' | ||
return self._detail(OutputSQL, user, params, session, *args, **kwargs) | ||
|
||
def store(self, user, params, session, *args, **kwargs): | ||
name = params.get('name') | ||
reportid = params.get('report') | ||
data = params.get('data') | ||
report = session.query(ReportSQL).get(int(justid(reportid))) | ||
|
||
created = datetime.now() | ||
|
||
op = OutputSQL(name=name, | ||
reportId=reportid, | ||
report=report, | ||
created=created, | ||
data=data) | ||
|
||
session.add(op) | ||
|
||
# generate id | ||
session.flush() | ||
session.refresh(op) | ||
|
||
store = op.to_config(self.config).store() | ||
logging.critical("Storing output {}".format(op)) | ||
return store | ||
|
||
def delete(self, user, params, session, *args, **kwargs): | ||
# TODO only if allowed | ||
id = justid(params.get('id')) | ||
op = session.query(OutputSQL).filter(OutputSQL.id == id).first() | ||
session.delete(op) | ||
return [{"name": "", "type": "p", "value": "Success!", "required": False, "readonly": False, "hidden": False}, | ||
{"name": "", "type": "p", "value": "Successfully deleted output: " + id, "required": False, "readonly": False, "hidden": False}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters