finished dict
This commit is contained in:
parent
6fbe471af5
commit
f29f6d7b9e
@ -119,52 +119,39 @@ class Services(object):
|
||||
:param str environment: Optional service environment. Influeces
|
||||
"repository" field
|
||||
"""
|
||||
res = {}
|
||||
service_list = []
|
||||
service_dict = {}
|
||||
# {
|
||||
# "services": [
|
||||
# {
|
||||
# "name": ECS,
|
||||
# "doc_types": [
|
||||
# ...
|
||||
# ]
|
||||
# }
|
||||
# ],
|
||||
|
||||
# "doc_types": [
|
||||
# "umn",
|
||||
# ]
|
||||
|
||||
doc_types = []
|
||||
res = []
|
||||
# for doc in self.all_docs_full(environment="public"):
|
||||
# res.append(doc)
|
||||
|
||||
for service in self.all_services:
|
||||
if not service["service_title"]:
|
||||
continue
|
||||
if not service["service_type"]:
|
||||
continue
|
||||
|
||||
|
||||
doc_list = []
|
||||
for doc in self.all_docs:
|
||||
if "environment" in doc:
|
||||
if doc["environment"] != environment:
|
||||
continue
|
||||
if doc["service_type"] == service["service_type"]:
|
||||
doc_list.append({
|
||||
"title": doc["title"],
|
||||
"type": doc["type"]
|
||||
})
|
||||
|
||||
if doc["type"] not in doc_types:
|
||||
doc_types.append(doc["type"])
|
||||
|
||||
service_list.append({
|
||||
"service_title": service["service_title"],
|
||||
"service_type": service["service_type"]
|
||||
"service_type": service["service_type"],
|
||||
"docs": doc_list
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# for doc in self.all_docs:
|
||||
|
||||
|
||||
# doc_types.append(doc["type"])
|
||||
|
||||
# service_dict = {
|
||||
# "name": services.get(
|
||||
# }
|
||||
res = {
|
||||
"services": service_list,
|
||||
"doc_types": doc_types
|
||||
}
|
||||
|
||||
return res
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user