Show mysql addon only if the app uses it

This commit is contained in:
Johannes Zellner
2017-08-17 11:29:49 +02:00
committed by Girish Ramakrishnan
parent 52db28e876
commit ee3c5f67af
2 changed files with 7 additions and 2 deletions

View File

@@ -14,7 +14,7 @@
<!-- terminal actions -->
<!-- <button class="btn btn-default pull-right" ng-click="" ng-show="terminalVisible">Upload</button> -->
<!-- <button class="btn btn-default pull-right" ng-click="" ng-show="terminalVisible">Download</button> -->
<button class="btn btn-default pull-right" ng-click="terminalInjectMysql()" ng-show="terminalVisible">Mysql</button>
<button class="btn btn-default pull-right" ng-click="terminalInjectMysql()" ng-show="terminalVisible && usesAddon('mysql')">Mysql</button>
</div>
</div>

View File

@@ -27,12 +27,17 @@ angular.module('Application').controller('DebugController', ['$scope', '$locatio
$scope.logs.push({ name: 'Mail', type: 'platform', value: 'mail', url: Client.makeURL('/api/v1/cloudron/logs?units=mail') });
Client.getInstalledApps().forEach(function (app) {
$scope.logs.push({ name: app.fqdn + ' (' + app.manifest.title + ')', type: 'app', value: app.id, url: Client.makeURL('/api/v1/apps/' + app.id + '/logs') });
$scope.logs.push({ name: app.fqdn + ' (' + app.manifest.title + ')', type: 'app', value: app.id, url: Client.makeURL('/api/v1/apps/' + app.id + '/logs'), addons: app.manifest.addons });
});
$scope.selected = $scope.logs[0];
};
$scope.usesAddon = function (addon) {
if (!$scope.selected || !$scope.selected.addons) return false;
return !!Object.keys($scope.selected.addons).find(function (a) { return a === addon; });
};
function reset() {
// close the old event source so we wont receive any new logs
if ($scope.activeEventSource) {