Skip to content

Commit

Permalink
only display demo write button for instance with writable resources
Browse files Browse the repository at this point in the history
  • Loading branch information
sbernard31 committed Feb 7, 2020
1 parent 62f4ad1 commit 47fd022
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ angular.module('instanceDirectives', [])
scope.instance.del = {tooltip : "Delete <br/>" + scope.instance.path};
scope.instance.observe = {tooltip : "Observe <br/>" + scope.instance.path};

scope.writable = function() {
return scope.instance.resources.find(resource => resource.def.operations === "W" || resource.def.operations === "RW");
};

scope.read = function() {
var format = scope.settings.multi.format;
var uri = "api/clients/" + $routeParams.clientId + scope.instance.path;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
'btn-success': instance.read.status == 'SUCCESS'}">Read</button>
</div>
<div class="btn-group">
<button type="button" ng-click="instance.write.status = null; write()"
<button type="button" ng-click="instance.write.status = null; write()" ng_show="writable()"}
tooltip-html-unsafe={{instance.write.tooltip}} tooltip-placement="right" tooltip-animation="false" tooltip-append-to-body="true"
ng-class="{
'btn': true,
Expand Down

0 comments on commit 47fd022

Please sign in to comment.