def render(self, data): return [ a.breadcrumbs([], "Create New"), a.form( "Create New Blog", fields={ "name": a.field("Blog Name", "text", "primary", "non-empty", order=1), "schema": a.field( "Blog Schema", "json", "primary", order=2, description= "A JSON Scheme every blog entry will be matched on. " "See docs below for more information."), "enabled": a.field("Enabled", "switch", "primary", order=3) }, methods={"create": a.method("Create", "primary")}, data=data), a.links("Navigate", [ a.link("index", "Go back", icon="chevron-left"), a.link( "https://spacetelescope.github.io/understanding-json-schema/index.html", "See docs", icon="book") ]) ]
def render(self, data): return [ a.breadcrumbs([], "File Hosting"), a.links("Navigate", [ a.link("settings", "Deployment Settings", icon="cog") ]) ]
def render(self, data): app_name = self.context.get("app_name") return [ a.breadcrumbs([ a.link("index", "Reports"), a.link("apps", "Applications"), ], data["app_title"]), a.links("Application '{0}' versions".format(data["app_name"]), links=[ a.link("app_version", v_name, icon="tags", app_name=app_name, app_version=v_name) for v_name in data["versions"] ]), a.links("Navigate", [ a.link("apps", "Go back", icon="chevron-left"), a.link("/environment/app", "Manage app '{0}' at 'Environment' service.".format( data["app_title"]), icon="link text-danger", record_id=data["app_record_id"]), ]) ]
def render(self, data): new_entry = self.context.get("clone", None) is None return [ a.breadcrumbs([ a.link("blog", data["blog_name"], blog_id=self.context.get("blog_id")) ], "New Blog Entry" if new_entry else "Clone Blog Entry"), a.form("Blog Entry", fields={ "data": a.field("Entry", "dorn", "primary", schema=data["blog_schema"], order=1), "enabled": a.field("Enabled", "switch", "primary", order=2) }, methods={ "create": a.method("Create" if new_entry else "Clone", "primary") }, data=data), a.links("Navigate", [ a.link("blog", "Go back", icon="chevron-left", blog_id=self.context.get("blog_id")), a.link("blog_settings", "Edit Blog Settings", icon="cogs", blog_id=self.context.get("blog_id")) ]) ]
def render(self, data): r = [ a.breadcrumbs([ a.link("server", "Server Code"), ], "Server Code Settings"), ServerCodeController.about_notice() ] if not data["repository_url"]: r.append(ServerCodeSettingsController.no_settings_notice()) r.extend([ a.form( "Server Code Settings", fields={ "repository_url": a.field("Git source code repository url (ssh only)", "text", "primary", description=""" You need to use SSH remote url in order to deploy source code to this service. See <a href="https://help.github.com/articles/which-remote-url-should-i-use/#cloning-with-ssh-urls" target="_blank">this</a>. """, order=1), "repository_branch": a.field("Git branch to use on the source code repository", "text", "primary", order=2), "ssh_private_key": a.field("Private SSH key", "text", "primary", multiline=6, description=""" Please generate SSH key pair, paste private key (for example, <span class="label label-default">id_rsa</span>) here, and add public key (for example, <span class="label label-default">id_rsa.pub</span>) into user's SSH keys with read access to the repository above. For example, on GitHub, it can be done <a href="https://github.com/settings/keys" target="_blank">here</a>. """, order=3) }, methods={ "update_settings": a.method("Update Settings", "primary") }, data=data), a.links("Navigate", [ a.link("server", "Go back", icon="chevron-left"), ]) ]) return r
def render(self, data): tbl_rows = [{ "edit": [ a.link("blog_entry", entry.data["title"]["en"] if entry.data.get( "title", {}).get("en", None) is not None else entry.entry_id, icon="rss", blog_id=self.context.get("blog_id"), entry_id=entry.entry_id) ], "enabled": [ a.status("Yes" if entry.enabled else "No", "success" if entry.enabled else "danger") ], "created": str(entry.create_date), "updated": str(entry.update_date) } for entry in data["entries"]] return [ a.breadcrumbs([], data["blog_name"]), a.content("Entries", [{ "id": "edit", "title": "Edit" }, { "id": "enabled", "title": "Enabled" }, { "id": "created", "title": "Created" }, { "id": "updated", "title": "Updated" }], tbl_rows, "default", empty="No blog entries"), a.pages(data["pages"]), a.links("Navigate", [ a.link("index", "Go back", icon="chevron-left"), a.link("new_blog_entry", "New Blog Entry", icon="plus", blog_id=self.context.get("blog_id")), a.link("blog_settings", "Settings", icon="cogs", blog_id=self.context.get("blog_id")) ]) ]
def render(self, data): return [ a.breadcrumbs([], "Functions"), a.links("Functions", [ a.link("function", f.name, icon="code", function_name=f.name) for f in data["functions"] ]), a.notice( "Notice", "Please note that the function should be bound " "to the application in order to be called."), a.links("Navigate", [ a.link("index", "Go back", icon="chevron-left"), a.link("new_function", "New function", icon="plus"), ]) ]
def render(self, data): return [ a.breadcrumbs([], "Applications"), a.links("Select application", links=[ a.link("app", app_name, icon="mobile", app_id=app_id) for app_id, app_name in data["apps"].items() ]), a.links("Navigate", [ a.link("index", "Go back", icon="chevron-left"), a.link("/environment/apps", "Manage apps", icon="link text-danger"), ]) ]
def render(self, data): return [ a.breadcrumbs([ a.link( "blog", data["name"], blog_id=self.context.get("blog_id")) ], "Settings"), a.form( "Blog Settings", fields={ "name": a.field("Blog Name", "text", "primary", "non-empty", order=1), "schema": a.field( "Blog Schema", "json", "primary", order=2, description= "A JSON Scheme every blog entry will be matched on. " "See docs below for more information."), "enabled": a.field("Enabled", "switch", "primary", order=3) }, methods={"update": a.method("Update", "primary")}, data=data), a.form("Danger", fields={}, methods={ "delete": a.method("Delete This Blog Forever", "danger") }, data=data, icon="warning"), a.links("Navigate", [ a.link("index", "Go back", icon="chevron-left"), a.link( "https://spacetelescope.github.io/understanding-json-schema/index.html", "See docs", icon="book") ]) ]
def render(self, data): r = [a.breadcrumbs([a.link("apps", "Applications")], data["app_name"])] if data["has_no_settings"]: r.append(ApplicationSettingsController.no_settings_notice()) commits = data["commits"] def get_version_commit(version): commit = commits.get(version, None) if commit is not None: return commit.repository_commit[:7] return None r.extend([ a.links("Application '{0}' versions".format(data["app_name"]), links=[ a.link("app_version", v_name, icon="tags", badge=get_version_commit(v_name), app_id=self.context.get("app_id"), app_version=v_name) for v_name, v_id in data["versions"].items() ]), a.links("Navigate", [ a.link("app_settings", "Application Settings", icon="cogs", app_id=self.context.get("app_id")), a.link("apps", "Go back", icon="chevron-left"), a.link("/environment/app", "Manage app '{0}' at 'Environment' service.".format( data["app_name"]), icon="link text-danger", record_id=data["app_record_id"]), ]) ]) return r
def render(self, data): return [ a.breadcrumbs([ a.link("blog", data["blog_name"], blog_id=self.context.get("blog_id")) ], "Blog Entry #{0}".format(self.context.get("entry_id"))), a.form("Blog Entry", fields={ "data": a.field("Entry", "dorn", "primary", schema=data["blog_schema"], order=1), "enabled": a.field("Enabled", "switch", "primary", order=2) }, methods={ "update": a.method("Update", "primary"), "delete": a.method("Delete", "danger") }, data=data), a.links("Navigate", [ a.link("blog", "Go back", icon="chevron-left", blog_id=self.context.get("blog_id")), a.link("new_blog_entry", "Clone This Entry", icon="clone", blog_id=self.context.get("blog_id"), clone=self.context.get("entry_id")), a.link("blog_settings", "Edit Blog Settings", icon="cogs", blog_id=self.context.get("blog_id")) ]) ]
def render(self, data): r = [ a.breadcrumbs([ a.link("index", "File Hosting"), ], "Settings"), a.form("Deployment method", fields={ "deployment_method": a.field( "Deployment method", "select", "primary", "non-empty", values=data["deployment_methods"] ) }, methods={ "update_deployment_method": a.method("Switch deployment method", "primary") }, data=data) ] deployment_method = data["deployment_method"] deployment_data = data["deployment_data"] if deployment_method: m = DeploymentMethods.get(deployment_method) if m.has_admin(): r.append(a.form("Update deployment", fields=m.render(a), methods={ "update_deployment": a.method("Update", "primary") }, data=deployment_data)) else: r.append(a.notice( "Please select deployment method", """ Players cannot upload files until the deployment is configured """)) r.extend([ a.links("Navigate", [ a.link("index", "Back", icon="chevron-left"), ]) ]) return r
def render(self, data): return [ a.breadcrumbs([], "Reports"), a.links("Navigate", [a.link("apps", "Applications", icon="mobile")]) ]
def render(self, data): reports = [{ "see": [ a.link("report", str(r.report_id), icon="flag", report_id=r.report_id) ], "account_id": [ a.link("app_version", str(r.account_id), icon="filter", app_name=self.context.get("app_name"), app_version=self.context.get("app_version"), account_id=r.account_id) ], "message": r.message, "category": [ a.link("app_version", str(r.category), icon="filter", app_name=self.context.get("app_name"), app_version=self.context.get("app_version"), category=r.category) ], "info": [a.json_view(r.info)], "time": str(r.time) } for r in data["reports"]] methods = { "filter": a.method("Filter reports", "primary", order=1), "export_reports": a.method("Export reports to CSV", "default", icon="download", order=3), } if self.context.get("account_id") or self.context.get("info"): methods["clear_filters"] = a.method("Clear filters", "default", order=2) r = [ a.breadcrumbs([ a.link("index", "Reports"), a.link("apps", "Applications"), a.link("app", data["app_title"], app_name=self.context.get("app_name")), ], self.context.get("app_version")), a.content("Reports: {0} total".format(data["total_count"]), [{ "id": "see", "title": "See" }, { "id": "message", "title": "Report Message" }, { "id": "category", "title": "Report Category" }, { "id": "account_id", "title": "Reporter" }, { "id": "info", "title": "Report info" }, { "id": "time", "title": "Report Time" }], reports, "default", empty="No reports to display") ] if data["pages_count"]: r.append(a.pages(data["pages_count"])) r.extend([ a.form("Filters", fields={ "account_id": a.field("Reporter Account", "text", "primary", order=1), "report_message": a.field("Report Message", "text", "primary", order=2), "category": a.field("Report Category", "text", "primary", order=3), "info": a.field("Report Info", "json", "primary", order=4, height=120), }, methods=methods, data=data, icon="filter"), a.links("Navigate", [ a.link("app", "Go back", icon="chevron-left", app_name=self.context.get("app_name")) ]) ]) return r
def render(self, data): r = [ a.breadcrumbs([ a.link("index", "Reports"), a.link("apps", "Applications"), a.link("app", data["app_title"], app_name=data["app_name"]), a.link("app_version", data["app_version"], app_name=data["app_name"], app_version=data["app_version"]), ], "Report {0}".format(self.context.get("report_id"))) ] report_format = data["format"] if report_format == ReportFormat.JSON: r.append( a.form("Contents", fields={ "payload": a.field("Report Contents", "json", "primary", height=400, parse=True) }, methods={}, data=data)) elif report_format == ReportFormat.TEXT: r.append( a.form("Contents", fields={ "payload": a.field("Report Contents", "text", "primary", multiline=20) }, methods={}, data=data)) r.extend([ a.links("Download", [ a.link("report", "Download the Report", icon="download", report_id=self.context.get("report_id"), download=True) ]), a.form("Report Information", fields={ "account_id": a.field("Reporter Account", "text", "primary", order=1), "category": a.field("Report Category", "status", "default", order=2), "message": a.field("Report Message", "text", "primary", multiline=3, order=3), "info": a.field("Report Info", "json", "primary", height=140, order=4), "time": a.field("Report Time", "text", "primary", order=5), "format_title": a.field("Report Format", "text", "primary", order=6) }, methods={}, data=data), a.links("Navigate", [ a.link("app_version", "Go back", icon="chevron-left", app_name=data["app_name"]) ]) ]) return r
def render(self, data): r = [a.breadcrumbs([], "Server Code")] if data["commits_history"] is None: if data["server_fetch_error"]: r.append( a.notice( "Failed to update repository", "Please check repository settings: {0}".format( data["server_fetch_error"]), "danger")) else: r.append( a.notice("Repository is in progress", "Please wait until repository is updated")) else: methods = { "switch_to_latest_commit": a.method("Update To The Last Commit", "primary", order=1), "pull_updates": a.method("Pull Updates", "default", order=2), } if data["current_commit"]: methods["detach_version"] = a.method( "Disable Server Code", "danger", order=3, danger= "Are you sure you would like to disable the Server Code from launching? After this action, " "services would not be able to call functions on the Server Code." ) else: r.append(ServerCodeController.no_commit_notice()) r.extend([ a.form("Actions", fields={}, methods=methods, data=data), a.content( title="Recent Commits History", headers=[{ "id": "actions", "title": "Actions" }, { "id": "message", "title": "Commit Message" }, { "id": "hash", "title": "Commit Hash" }, { "id": "date", "title": "Commit Date" }, { "id": "author", "title": "Commit Author" }], items=[{ "hash": [a.status(commit.hexsha[:7], "default")], "message": commit.message[:48], "date": str(commit.committed_datetime), "author": str(commit.author.name) + " (" + commit.author.email + ")", "actions": [ a.status("Current Commit", "success", "check") if data["current_commit"] == commit.hexsha else a.button("server", "Use This", "primary", _method="switch_commit_context", commit=str(commit.hexsha)) ] } for commit in data["commits_history"]], style="primary") ]) r.extend([ ServerCodeController.about_notice(), a.links("Navigate", [ a.link("index", "Go back", icon="chevron-left"), a.link("server_settings", "Server Code Settings", icon="cogs") ]) ]) return r
def render(self, data): r = [ a.breadcrumbs([ a.link("apps", "Applications"), a.link("app", data["app_name"], app_id=self.context.get("app_id")), ], self.context.get("app_version")) ] if data["commits_history"] is None: r.append( a.notice("Repository is in progress", "Please wait until repository is updated")) else: methods = { "switch_to_latest_commit": a.method("Update To The Last Commit", "primary", order=1), "pull_updates": a.method("Pull Updates", "default", order=2), } if data["current_commit"]: methods["detach_version"] = a.method( "Disable This Version", "danger", order=3, danger= "Are you sure you would like to disable this version from launching? After this action, " "users would not be able to open sessions on this version." ) else: r.append( ApplicationVersionController.no_commit_notice( self.context.get("app_version"))) r.extend([ a.form("Actions", fields={}, methods=methods, data=data), a.content( title="Recent Commits History", headers=[{ "id": "actions", "title": "Actions" }, { "id": "message", "title": "Commit Message" }, { "id": "hash", "title": "Commit Hash" }, { "id": "date", "title": "Commit Date" }, { "id": "author", "title": "Commit Author" }], items=[{ "hash": [a.status(commit.hexsha[:7], "default")], "message": commit.message[:48], "date": str(commit.committed_datetime), "author": str(commit.author.name) + " (" + commit.author.email + ")", "actions": [ a.status("Current Commit", "success", "check") if data["current_commit"] == commit.hexsha else a.button( "app_version", "Use This", "primary", _method="switch_commit_context", commit=str(commit.hexsha), app_id=self.context.get("app_id"), app_version=self.context.get("app_version")) ] } for commit in data["commits_history"]], style="primary") ]) r.extend([ a.links("Navigate", [ a.link("app", "Go back", icon="chevron-left", app_id=self.context.get("app_id")) ]) ]) return r