diff --git a/static/state.html b/static/state.html
index 3af67700..28f9c4f7 100644
--- a/static/state.html
+++ b/static/state.html
@@ -34,18 +34,18 @@
Compa
Modules
-
+
-
- -
-
+
-
+
{{mod.path}}
{{resFilter == "" ? '' : filteredRes.length+'/'}}{{Utils.keys(mod.resources).length}}
- -
{{r.name}}
diff --git a/static/terraboard.js b/static/terraboard.js
index be456a94..b8aca53d 100644
--- a/static/terraboard.js
+++ b/static/terraboard.js
@@ -295,10 +295,6 @@ app.controller("tbStateCtrl",
versionId: $scope.details.version.version_id
}
- // Init
- $scope.selectedmod = "";
- $scope.selectedres = "";
-
$scope.setSelected = function(m, r) {
$scope.selectedmod = m;
$scope.selectedres = r;
@@ -324,15 +320,26 @@ app.controller("tbStateCtrl",
return;
}
- if ($location.hash() != "") {
- // Default
- $scope.selectedmod = {};
+ // Sort the modules
+ mods.sort(function(a, b) {
+ return a.path.localeCompare(b.path);
+ });
+
+ for (i=0; i < mods.length; i++) {
+ mods[i].resources.sort(function(a, b) {
+ return a.name.localeCompare(b.name);
+ });
+ }
+ $scope.selectedmod = mods[0];
+ $scope.selectedres = $scope.selectedmod.resources[0];
+ if ($location.hash() != "") {
// Search for module in selected res
var targetRes = $location.hash();
for (i=0; i < mods.length; i++) {
if (targetRes.startsWith(mods[i].path+'.')) {
$scope.selectedmod = mods[i];
+ $scope.display.mod = mods[i];
}
}
@@ -343,9 +350,6 @@ app.controller("tbStateCtrl",
break;
}
}
-
- // Init display.mod
- $scope.display.mod = $scope.selectedmod;
}
});