From 13b659c52f1139dd7d636c4e3bdccdb6dad33bb4 Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Wed, 5 Oct 2022 17:17:22 +0200 Subject: [PATCH] Move applink, proxy add buttons to appstore view --- src/theme.scss | 20 +++--- src/views/apps.html | 72 +-------------------- src/views/apps.js | 63 +------------------ src/views/appstore.html | 134 ++++++++++++++++++++++++++++++---------- src/views/appstore.js | 68 ++++++++++++++++++++ 5 files changed, 183 insertions(+), 174 deletions(-) diff --git a/src/theme.scss b/src/theme.scss index b4f10f25c..ee30573c3 100644 --- a/src/theme.scss +++ b/src/theme.scss @@ -836,16 +836,15 @@ multiselect { } } -.appstore-toolbar { - position: fixed; - padding: 0; - background: transparent; - z-index: 2; - padding-top: 20px; - padding-bottom: 15px; +.appstore-layout { + display: block; + height: 100%; + width: 100%; +} - // below to not hide the scrollbar partly - width: calc(100% - 30px); +.appstore-toolbar { + padding: 15px 0; + background: transparent; margin: 0 15px; .appstore-toolbar-content { @@ -883,7 +882,8 @@ multiselect { .appstore-grid { margin: auto; - margin-top: 65px; + overflow: auto; + height: calc(100% - 65px); // offset navigation bar width: calc(100% - 30px); // -30px to offset .row margins max-width: 1200px; diff --git a/src/views/apps.html b/src/views/apps.html index b44afd21d..6f54fa3df 100644 --- a/src/views/apps.html +++ b/src/views/apps.html @@ -31,68 +31,6 @@ - - -
diff --git a/src/views/apps.js b/src/views/apps.js index aff441b1e..ddea12069 100644 --- a/src/views/apps.js +++ b/src/views/apps.js @@ -3,9 +3,7 @@ /* global angular:false */ /* global $:false */ /* global APP_TYPES */ -/* global HSTATES */ -/* global ISTATES */ -/* global RSTATES */ +/* global onAppClick */ angular.module('Application').controller('AppsController', ['$scope', '$translate', '$interval', '$location', 'Client', function ($scope, $translate, $interval, $location, Client) { var ALL_DOMAINS_DOMAIN = { _alldomains: true, domain: 'All Domains' }; // dummy record for the single select filter @@ -108,65 +106,6 @@ angular.module('Application').controller('AppsController', ['$scope', '$translat } }; - $scope.applinksAdd = { - error: {}, - busy: false, - upstreamUri: '', - label: '', - tags: '', - accessRestrictionOption: 'any', - accessRestriction: { users: [], groups: [] }, - - isAccessRestrictionValid: function () { - return !!($scope.applinksAdd.accessRestriction.users.length || $scope.applinksAdd.accessRestriction.groups.length); - }, - - show: function () { - $scope.applinksAdd.error = {}; - $scope.applinksAdd.busy = false; - $scope.applinksAdd.upstreamUri = ''; - $scope.applinksAdd.label = ''; - $scope.applinksAdd.tags = ''; - - $scope.applinksAddForm.$setUntouched(); - $scope.applinksAddForm.$setPristine(); - - $('#applinksAddModal').modal('show'); - - return false; // prevent propagation and default - }, - - submit: function () { - if (!$scope.applinksAdd.upstreamUri) return; - - $scope.applinksAdd.busy = true; - - var accessRestriction = null; - if ($scope.applinksAdd.accessRestrictionOption === 'groups') { - accessRestriction = { users: [], groups: [] }; - accessRestriction.users = $scope.applinksAdd.accessRestriction.users.map(function (u) { return u.id; }); - accessRestriction.groups = $scope.applinksAdd.accessRestriction.groups.map(function (g) { return g.id; }); - } - - var data = { - upstreamUri: $scope.applinksAdd.upstreamUri, - label: $scope.applinksAdd.label, - accessRestriction: accessRestriction, - tags: $scope.applinksAdd.tags.split(' ').map(function (t) { return t.trim(); }).filter(function (t) { return !!t; }) - }; - - Client.addApplink(data, function (error) { - $scope.applinksAdd.busy = false; - - if (error) return console.error('Failed to add applink', error); - - Client.refreshInstalledApps(); - - $('#applinksAddModal').modal('hide'); - }); - } - }; - $scope.applinksEdit = { error: {}, busyEdit: false, diff --git a/src/views/appstore.html b/src/views/appstore.html index 447f312f7..7b323cba9 100644 --- a/src/views/appstore.html +++ b/src/views/appstore.html @@ -211,6 +211,68 @@
+ + +

@@ -287,36 +349,45 @@
-
-
- - - - - -
-
+
-
-
-
+
+
+ + + + + +
+ + +
+
+
+ +
+



@@ -324,7 +395,7 @@
{{ 'appstore.appMissing' | tr }}
-
+

{{ 'appstore.category.popular' | tr }}

@@ -345,7 +416,7 @@
-
+

{{ 'appstore.category.all' | tr }}

@@ -367,4 +438,5 @@
+
diff --git a/src/views/appstore.js b/src/views/appstore.js index 3cd59239a..890149d9b 100644 --- a/src/views/appstore.js +++ b/src/views/appstore.js @@ -601,6 +601,74 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$tran $location.path('/appstore/' + app.manifest.id, false).search({ version : app.manifest.version }); }; + $scope.openAppProxy = function () { + $location.path('/appstore/io.cloudron.builtin.appproxy', false).search({}); + }; + + $scope.applinksAdd = { + error: {}, + busy: false, + upstreamUri: '', + label: '', + tags: '', + accessRestrictionOption: 'any', + accessRestriction: { users: [], groups: [] }, + + isAccessRestrictionValid: function () { + return !!($scope.applinksAdd.accessRestriction.users.length || $scope.applinksAdd.accessRestriction.groups.length); + }, + + show: function () { + $scope.applinksAdd.error = {}; + $scope.applinksAdd.busy = false; + $scope.applinksAdd.upstreamUri = ''; + $scope.applinksAdd.label = ''; + $scope.applinksAdd.tags = ''; + + $scope.applinksAddForm.$setUntouched(); + $scope.applinksAddForm.$setPristine(); + + $('#applinksAddModal').modal('show'); + + return false; // prevent propagation and default + }, + + submit: function () { + if (!$scope.applinksAdd.upstreamUri) return; + + $scope.applinksAdd.busy = true; + + var accessRestriction = null; + if ($scope.applinksAdd.accessRestrictionOption === 'groups') { + accessRestriction = { users: [], groups: [] }; + accessRestriction.users = $scope.applinksAdd.accessRestriction.users.map(function (u) { return u.id; }); + accessRestriction.groups = $scope.applinksAdd.accessRestriction.groups.map(function (g) { return g.id; }); + } + + var data = { + upstreamUri: $scope.applinksAdd.upstreamUri, + label: $scope.applinksAdd.label, + accessRestriction: accessRestriction, + tags: $scope.applinksAdd.tags.split(' ').map(function (t) { return t.trim(); }).filter(function (t) { return !!t; }) + }; + + Client.addApplink(data, function (error) { + $scope.applinksAdd.busy = false; + + if (error) return console.error('Failed to add applink', error); + + // wait for dialog to be fully closed to avoid modal behavior breakage when moving to a different view already + $('#applinksAddModal').on('hidden.bs.modal', function () { + $scope.$apply(function () { + $location.path('/apps').search({ }); + }); + }); + + $('#applinksAddModal').modal('hide'); + }); + } + }; + function hashChangeListener() { // event listener is called from DOM not angular, need to use $apply $scope.$apply(function () {