From 51a09bf9733dff85dc2afe2856899e84d57ee894 Mon Sep 17 00:00:00 2001 From: "boyan.tonchev" Date: Wed, 24 Jan 2024 10:57:41 +0200 Subject: [PATCH] GDB-9366: Drop-down list in Resource view should not be accessible from Context tab ## What When opening the "Resource" view and clicking on the "inference-select" dropdown, there is an empty option. If a new option is selected, the empty option disappear. ## Why This can happen if the select does not match any option with the value of "nb-model". [More explanation](https://stackoverflow .com/questions/12654631/why-does-angularjs-include-an-empty-option-in-select/12654812#12654812). The problem in our code is that the value of the select is an id of a context type, but during initialization, an instance of the context type is used instead of the id. This causes the select not to match the initial value with a passed option. ## How Fixed the initial value to be the ID of the context type instead of the instance. Renamed the variable "currentContextType" to "currentContextTypeId" for more clarity regarding the expected value. --- src/js/angular/explore/controllers.js | 2 +- src/pages/explore.html | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/js/angular/explore/controllers.js b/src/js/angular/explore/controllers.js index eba2f4018..2a8c54811 100644 --- a/src/js/angular/explore/controllers.js +++ b/src/js/angular/explore/controllers.js @@ -59,7 +59,7 @@ function ExploreCtrl( $scope.ContextTypes = ContextTypes; $scope.contextTypes = ContextType.getAllType(); - $scope.currentContextType = ContextTypes.EXPLICIT; + $scope.currentContextTypeId = ContextTypes.EXPLICIT.id; $scope.roles = [RoleType.SUBJECT, RoleType.PREDICATE, RoleType.OBJECT, RoleType.CONTEXT, RoleType.ALL]; $scope.resourceInfo = undefined; diff --git a/src/pages/explore.html b/src/pages/explore.html index 98557f104..882f7836c 100644 --- a/src/pages/explore.html +++ b/src/pages/explore.html @@ -60,8 +60,8 @@