コード例 #1
0
 def no_settings_notice():
     return a.notice("Server Code Repository Is Not Configured",
                     """
             You have not defined your source code repository yet. <br>
             To deploy your codebase to the Exec service, you must use a Git repository. <br>
             Please create one if you don't have it and define it in the settings below.
         """,
                     style="danger")
コード例 #2
0
 def about_notice():
     return a.notice("About The Server Code",
                     """
             The Server Code is a way to deploy restricted application-independent code to the exec service. <br>
             Users cannot call the Server Code, but other services can. Therefore, services that have no
             application context can call functions on exec service with Server Code. <br>
             Please refer to the API for more information.
         """,
                     style="info")
コード例 #3
0
 def no_commit_notice():
     return a.notice("The Server Code is disabled",
                     """
             The server code is not attached to any commit for the Git repository. <br>
             Therefore, running source code for the server code is not possible. <br>
             Please attach the version to a commit using either "Update To The Last Commit", 
             or by clicking "Use This" on a commit of the resent commits history.
         """,
                     style="danger")
コード例 #4
0
 def no_commit_notice(app_version):
     return a.notice("This version ({0}) is disabled".format(app_version),
                     """
             The version {0} is not attached to any commit for the Git repository. <br>
             Therefore, running source code for this version is not possible. <br>
             Please attach the version to a commit using either "Update To The Last Commit", 
             or by clicking "Use This" on a commit of the resent commits history.
         """.format(app_version),
                     style="danger")
コード例 #5
0
 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"),
         ])
     ]
コード例 #6
0
    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
コード例 #7
0
    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
コード例 #8
0
    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