diff --git a/aws_workflow/aws.py b/aws_workflow/aws.py index 883f141..8fe1821 100644 --- a/aws_workflow/aws.py +++ b/aws_workflow/aws.py @@ -47,7 +47,8 @@ def get_s3_buckets(): continue log.error(e) else: - for tag in tags.get('TagSet', []): + bucket['TagSet'] = tags.get('TagSet', []) + for tag in bucket['TagSet']: bucket['facets'][tag['Key'].lower()] = tag['Value'] finally: buckets.append(bucket) diff --git a/aws_workflow/base.py b/aws_workflow/base.py index 70dc56e..986c554 100644 --- a/aws_workflow/base.py +++ b/aws_workflow/base.py @@ -145,4 +145,5 @@ def find_s3_bucket(wf, profile, region_name, terms, facets, quicklook_baseurl): uid=uid, icon='icons/s3_bucket.png', type='default', + quicklookurl=quicklookurl ) diff --git a/quicklook_server.py b/quicklook_server.py index c04e3a3..215544a 100644 --- a/quicklook_server.py +++ b/quicklook_server.py @@ -18,10 +18,22 @@ def get(self): self.write(template.render(**context)) +class S3QuicklookHandler(tornado.web.RequestHandler): + def enrich(self, context): + pass + + def get(self): + template = templates.get_template('s3.html.j2') + context = json.loads(self.get_argument('context', '{}')) + self.enrich(context) + self.write(template.render(**context)) + + def make_app(): return tornado.web.Application([ (r'/static/(.*)', tornado.web.StaticFileHandler, {'path': os.path.join(os.getcwd(), 'static')}), (r'/quicklook/ec2', Ec2QuicklookHandler), + (r'/quicklook/s3', S3QuicklookHandler), ]) diff --git a/templates/s3.html.j2 b/templates/s3.html.j2 new file mode 100644 index 0000000..04968da --- /dev/null +++ b/templates/s3.html.j2 @@ -0,0 +1,27 @@ + +
+Creation Date: | +{{ bucket.CreationDate }} | +
Tags: | +
+
|
+