def GET(self): search_term = self.request.get_param("s") if search_term: search_term = search_term.replace("tag:", "tags:") searcher = PhotSearcher() phots_hidden_filter = dbu.rql_where_not(pm.Phot.table, "disable", True, raw=True) ids = searcher.search(search_term, collection=True, pre_filter=phots_hidden_filter) if ids is not None: ids.fetch() page = Paginate(ids, self.request, "title", sort_direction_default="desc") return page return {"page": None, "pail": None} return {"error": "No search (s) term provided."}
def GET(self): self.view.partial("sidebar", "partials/public/sidebar_links", {"command": "new_container"}) if self.request.id == "step-1" or not self.request.id: q = dbu.rql_where_not(im.Image.table, "disable", True)\ .filter({"user_id": self.request.session.id}).order_by("name") q = dbu.rql_highest_revs(q, "name") res = RethinkCollection(im.Image, query=q).fetch() if not res: self.request.session.push_alert("You have no images to make a container from. Please create an image first by uploading a Dockerfile to build.") return Redirect("/new") self.view.data = {"images": res} elif self.request.id == "step-2": if not "c_name" in self.request.session: self.request.session.push_alert("Missing vital info (Please fill out a name for the container before procceding to step 2)!", level="error") return Redirect("/new/container/step-1") ports = im.Image(self.request.session.c_image).ports self.view.title = "New Container - Step 2" self.view.template = "public/new/container_step_2" self.view.data = {"ports": ports} return self.view
def GET(self): base_query = dbu.rql_where_not(pm.Phot.table, "disable", True) raw_tags = base_query\ .concat_map(lambda doc: doc["tags"])\ .distinct()\ .coerce_to('array').run() return {"tags": raw_tags}
def GET(self): self.view.partial("sidebar", "partials/public/sidebar_links", {"command": "images"}) q = dbu.rql_where_not(im.Image.table, "disable", True).filter({"user_id": self.request.session.id}) q = dbu.rql_highest_revs(query=q, field="name") res = RethinkCollection(im.Image, query=q) page = Paginate(res, self.request, "name") self.view.data = {"page": page} return self.view
def GET(self): orig = self.request.get_param("filter", "all") filt = dbu.phot_filter(orig) query = dbu.rql_where_not(pm.Phot.table, "disable", True) query = query.filter(lambda doc: doc["filename"].match(filt)) res = RethinkCollection(pm.Phot, query=query) page = Paginate(res, self.request, "title") return page
def GET(self): self.view.partial("sidebar", "partials/public/sidebar_links", {"command": "containers"}) q = dbu.rql_where_not(cm.Container.table, "disable", True)\ .filter({"user_id": self.request.session.id}) res = RethinkCollection(cm.Container, query=q) page = Paginate(res, self.request, "name") self.view.data = {"page": page} return self.view
def GET(self): view = self.request.get_param("v") q = dbu.rql_where_not(pm.Phot.table, "disable", True) all_tags = q\ .concat_map(lambda doc: doc["tags"])\ .distinct()\ .coerce_to('array').run() if "phot_view" in self.session.data: if not view: view = self.session.data.phot_view else: self.session.data.phot_view = "cards" view = "cards" self.session.data.phot_view = view self.view.data = { "tags": all_tags, "phot_page": None } search_term = self.request.get_param("s") if search_term: search_term = search_term.replace("tag:", "tags:") searcher = PhotSearcher() phots_hidden_filter = dbu.rql_where_not(pm.Phot.table, "disable", True, raw=True) ids = searcher.search(search_term, collection=True, pre_filter=phots_hidden_filter) if ids is not None: ids.fetch() page = Paginate(ids, self.request, "title", sort_direction_default="desc") self.view.data = {"phot_page": page, "v": view} self.view.template = "public/phots/search/results" return self.view
def GET(self): self.view.partial("sidebar", "partials/admin/sidebar_links", {"command": "containers"}) disabled = self.request.getParam("d", True) if disabled: q = dbu.rql_where_not(cm.Container.table, "disable", True) res = RethinkCollection(cm.Container, query=q) else: res = RethinkCollection(cm.Container) page = Paginate(res, self.request, "name") self.view.data = {"page": page} return self.view
def GET(self): self.view.partial("sidebar", "partials/admin/sidebar", {"command": "users"}) disabled = self.request.get_param("d", True) if disabled: q = dbu.rql_where_not(um.User.table, "disable", True) res = RethinkCollection(um.User, query=q) else: res = RethinkCollection(um.User) page = Paginate(res, self.request, "username") self.view.data = {"page": page} return self.view
def GET(self): orig = self.request.get_param("filter", "all") filt = dbu.phot_filter(orig) q = dbu.rql_where_not(pm.Phot.table, "disable", True) q = q.filter(lambda doc: doc["filename"].match(filt)) all_tags = q\ .concat_map(lambda doc: doc["tags"])\ .distinct()\ .coerce_to('array').run() self.view.template = "public/phots/tags" self.view.data = {"tags": all_tags} return self.view
def GET(self): base_query = dbu.rql_where_not(pm.Phot.table, "disable", True) raw_tags = base_query\ .concat_map(lambda doc: doc["tags"])\ .distinct()\ .coerce_to('array').run() all_tags = [] for tag in raw_tags: res = { "value": tag.replace("_", " "), "tokens": tag.replace("_", " ").split(" ") } all_tags.append(res) return {"tags": all_tags}