Skip to content

Commit be90f1c

Browse files
committed
Bug 1509142 - Should not display the 'Reveal Secret' link when secrets without 'data' field
1 parent 424cf01 commit be90f1c

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

app/views/browse/secret.html

+7-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ <h1 class="contains-actions">
1616
We'll use this as a best-effort check to see if we should show the
1717
button.
1818
-->
19-
<button ng-if="project.metadata.name | canIAddToProject"
19+
<button ng-if="(project.metadata.name | canIAddToProject) && secret.data"
2020
type="button"
2121
class="btn btn-default hidden-xs"
2222
ng-click="addToApplication()">
@@ -32,7 +32,7 @@ <h1 class="contains-actions">
3232
class="dropdown-toggle actions-dropdown-kebab visible-xs-inline"
3333
data-toggle="dropdown"><i class="fa fa-ellipsis-v" aria-hidden="true"></i><span class="sr-only">Actions</span></a>
3434
<ul class="dropdown-menu dropdown-menu-right actions action-button">
35-
<li ng-if="project.metadata.name | canIAddToProject" class="visible-xs">
35+
<li ng-if="(project.metadata.name | canIAddToProject) && secret.data" class="visible-xs">
3636
<a href="" role="button" ng-click="addToApplication()">Add to Application</a>
3737
</li>
3838
<li ng-if="'secrets' | canI : 'update'">
@@ -61,7 +61,7 @@ <h1 class="contains-actions">
6161
<div class="resource-details">
6262
<h2 class="mar-top-none">
6363
{{secret.type}}
64-
<small class="mar-left-sm"><a href="" ng-click="view.showSecret = !view.showSecret">{{view.showSecret ? "Hide" : "Reveal"}} Secret</a></small>
64+
<small class="mar-left-sm"><a href="" ng-if="secret.data" ng-click="view.showSecret = !view.showSecret">{{view.showSecret ? "Hide" : "Reveal"}} Secret</a></small>
6565
</h2>
6666
<dl class="secret-data left">
6767
<div ng-repeat="(secretDataName, secretData) in decodedSecretData" class="image-source-item">
@@ -90,6 +90,10 @@ <h2 class="mar-top-none">
9090
</div>
9191
</div>
9292
</dl>
93+
<div ng-if="!secret.data" class="empty-state-message text-center">
94+
<h2>No data.</h2>
95+
<p>This secret has no data.</p>
96+
</div>
9397
<annotations annotations="secret.metadata.annotations"></annotations>
9498
</div>
9599
</div><!-- /col-* -->

dist/scripts/templates.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -3576,7 +3576,7 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
35763576
"<h1 class=\"contains-actions\">\n" +
35773577
"<div class=\"pull-right dropdown\">\n" +
35783578
"\n" +
3579-
"<button ng-if=\"project.metadata.name | canIAddToProject\" type=\"button\" class=\"btn btn-default hidden-xs\" ng-click=\"addToApplication()\">\n" +
3579+
"<button ng-if=\"(project.metadata.name | canIAddToProject) && secret.data\" type=\"button\" class=\"btn btn-default hidden-xs\" ng-click=\"addToApplication()\">\n" +
35803580
"Add to Application\n" +
35813581
"</button>\n" +
35823582
"<button type=\"button\" class=\"dropdown-toggle btn btn-default actions-dropdown-btn hidden-xs\" data-toggle=\"dropdown\" ng-hide=\"!('secrets' | canIDoAny)\">\n" +
@@ -3586,7 +3586,7 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
35863586
"\n" +
35873587
"<a href=\"\" ng-if=\"project.metadata.name | canIAddToProject\" class=\"dropdown-toggle actions-dropdown-kebab visible-xs-inline\" data-toggle=\"dropdown\"><i class=\"fa fa-ellipsis-v\" aria-hidden=\"true\"></i><span class=\"sr-only\">Actions</span></a>\n" +
35883588
"<ul class=\"dropdown-menu dropdown-menu-right actions action-button\">\n" +
3589-
"<li ng-if=\"project.metadata.name | canIAddToProject\" class=\"visible-xs\">\n" +
3589+
"<li ng-if=\"(project.metadata.name | canIAddToProject) && secret.data\" class=\"visible-xs\">\n" +
35903590
"<a href=\"\" role=\"button\" ng-click=\"addToApplication()\">Add to Application</a>\n" +
35913591
"</li>\n" +
35923592
"<li ng-if=\"'secrets' | canI : 'update'\">\n" +
@@ -3611,7 +3611,7 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
36113611
"<div class=\"resource-details\">\n" +
36123612
"<h2 class=\"mar-top-none\">\n" +
36133613
"{{secret.type}}\n" +
3614-
"<small class=\"mar-left-sm\"><a href=\"\" ng-click=\"view.showSecret = !view.showSecret\">{{view.showSecret ? \"Hide\" : \"Reveal\"}} Secret</a></small>\n" +
3614+
"<small class=\"mar-left-sm\"><a href=\"\" ng-if=\"secret.data\" ng-click=\"view.showSecret = !view.showSecret\">{{view.showSecret ? \"Hide\" : \"Reveal\"}} Secret</a></small>\n" +
36153615
"</h2>\n" +
36163616
"<dl class=\"secret-data left\">\n" +
36173617
"<div ng-repeat=\"(secretDataName, secretData) in decodedSecretData\" class=\"image-source-item\">\n" +
@@ -3636,6 +3636,10 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
36363636
"</div>\n" +
36373637
"</div>\n" +
36383638
"</dl>\n" +
3639+
"<div ng-if=\"!secret.data\" class=\"empty-state-message text-center\">\n" +
3640+
"<h2>No data.</h2>\n" +
3641+
"<p>This secret has no data.</p>\n" +
3642+
"</div>\n" +
36393643
"<annotations annotations=\"secret.metadata.annotations\"></annotations>\n" +
36403644
"</div>\n" +
36413645
"</div>\n" +

0 commit comments

Comments
 (0)