From cc103ada941678b22dd7fec2492716f3fe87dc30 Mon Sep 17 00:00:00 2001
From: Ken Fukuyama <kenfdev@gmail.com>
Date: Sat, 16 Dec 2017 00:12:48 +0900
Subject: [PATCH] added repo link to func store. will open repo page on new
 window or tab

Signed-off-by: Ken Fukuyama <kenfdev@gmail.com>
---
 gateway/assets/img/icons/ic_link_black_24px.svg | 4 ++++
 gateway/assets/index.html                       | 2 +-
 gateway/assets/script/funcstore.js              | 6 +++++-
 gateway/assets/style/bootstrap.css              | 8 ++++++++
 gateway/assets/templates/funcstore.html         | 1 +
 5 files changed, 19 insertions(+), 2 deletions(-)
 create mode 100644 gateway/assets/img/icons/ic_link_black_24px.svg

diff --git a/gateway/assets/img/icons/ic_link_black_24px.svg b/gateway/assets/img/icons/ic_link_black_24px.svg
new file mode 100644
index 00000000..6d46cab6
--- /dev/null
+++ b/gateway/assets/img/icons/ic_link_black_24px.svg
@@ -0,0 +1,4 @@
+<svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
+    <path d="M0 0h24v24H0z" fill="none"/>
+    <path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/>
+</svg>
\ No newline at end of file
diff --git a/gateway/assets/index.html b/gateway/assets/index.html
index 5fe56ba6..0675996f 100644
--- a/gateway/assets/index.html
+++ b/gateway/assets/index.html
@@ -38,7 +38,7 @@
                 <md-content layout-padding>
                     <md-list>
                         <md-list-item class="primary-item" ng-disabled="isFunctionBeingCreated" ng-click="newFunction()">
-                            <md-icon style="margin-right: 16px; opacity:0.6" md-svg-icon="img/icons/ic_shop_two_black_24px.svg"></md-icon>
+                            <md-icon style="margin-right: 16px" md-svg-icon="img/icons/ic_shop_two_black_24px.svg"></md-icon>
                             <p>Deploy New Function</p>
                         </md-list-item>
                     </md-list>
diff --git a/gateway/assets/script/funcstore.js b/gateway/assets/script/funcstore.js
index 0fd8aa88..c39ad783 100644
--- a/gateway/assets/script/funcstore.js
+++ b/gateway/assets/script/funcstore.js
@@ -17,7 +17,7 @@ funcStoreModule.component('funcStore', {
         selectedFunc: '<',
         onSelected: '&',
     },
-    controller: ['FuncStoreService', '$mdDialog', function FuncStoreController(FuncStoreService, $mdDialog) {
+    controller: ['FuncStoreService', '$mdDialog', '$window', function FuncStoreController(FuncStoreService, $mdDialog, $window) {
         var self = this;
 
         this.storeUrl = 'https://raw.githubusercontent.com/openfaas/store/master/store.json';
@@ -70,6 +70,10 @@ funcStoreModule.component('funcStore', {
             );
         }
 
+        this.openRepo = function (url) {
+            $window.open(url, '_blank');
+        }
+
         this.loadStore();
 
     }]
diff --git a/gateway/assets/style/bootstrap.css b/gateway/assets/style/bootstrap.css
index 61bbddfc..8f9fc17c 100644
--- a/gateway/assets/style/bootstrap.css
+++ b/gateway/assets/style/bootstrap.css
@@ -67,3 +67,11 @@ span.md-avatar {
     background-color: #1398D6;
     color: white;
 }
+
+md-icon {
+    opacity: 0.6;
+}
+
+md-icon.link {
+    fill: #303AA5;
+}
\ No newline at end of file
diff --git a/gateway/assets/templates/funcstore.html b/gateway/assets/templates/funcstore.html
index 2aceb3d3..4fa79f65 100644
--- a/gateway/assets/templates/funcstore.html
+++ b/gateway/assets/templates/funcstore.html
@@ -19,6 +19,7 @@
                 <h3>{{ func.title }}</h3>
                 <p>{{ func.description }}</p>
             </div>
+            <md-icon ng-if="func.repo_url" class="link md-secondary" ng-click="$ctrl.openRepo(func.repo_url)" aria-label="repo-link" md-svg-src="img/icons/ic_link_black_24px.svg"></md-icon>
             <md-divider md-inset ng-if="!$last"></md-divider>
         </md-list-item>
     </md-list>
-- 
GitLab