From 9ff4b21616ac8640c7513c58a5313a60ebafdd9c Mon Sep 17 00:00:00 2001 From: Anthony Lapenna Date: Mon, 28 May 2018 16:40:59 +0200 Subject: [PATCH] feat(support): add support view (#1937) --- api/cmd/portainer/main.go | 1 - api/http/handler/settings.go | 4 -- api/portainer.go | 3 +- api/swagger.yaml | 12 ------ app/portainer/__module.js | 11 ++++++ app/portainer/components/header-title.js | 3 +- app/portainer/models/settings/settings.js | 1 - app/portainer/services/stateManager.js | 6 --- app/portainer/views/about/about.html | 8 ---- app/portainer/views/settings/settings.html | 10 ----- .../views/settings/settingsController.js | 4 -- app/portainer/views/support/support.html | 38 +++++++++++++++++++ 12 files changed, 52 insertions(+), 49 deletions(-) create mode 100644 app/portainer/views/support/support.html diff --git a/api/cmd/portainer/main.go b/api/cmd/portainer/main.go index 3c2dba7c6..2ed222d33 100644 --- a/api/cmd/portainer/main.go +++ b/api/cmd/portainer/main.go @@ -139,7 +139,6 @@ func initSettings(settingsService portainer.SettingsService, flags *portainer.CL if err == portainer.ErrSettingsNotFound { settings := &portainer.Settings{ LogoURL: *flags.Logo, - DisplayDonationHeader: true, DisplayExternalContributors: false, AuthenticationMethod: portainer.AuthenticationInternal, LDAPSettings: portainer.LDAPSettings{ diff --git a/api/http/handler/settings.go b/api/http/handler/settings.go index bef01db91..2df31b62e 100644 --- a/api/http/handler/settings.go +++ b/api/http/handler/settings.go @@ -46,7 +46,6 @@ func NewSettingsHandler(bouncer *security.RequestBouncer) *SettingsHandler { type ( publicSettingsResponse struct { LogoURL string `json:"LogoURL"` - DisplayDonationHeader bool `json:"DisplayDonationHeader"` DisplayExternalContributors bool `json:"DisplayExternalContributors"` AuthenticationMethod portainer.AuthenticationMethod `json:"AuthenticationMethod"` AllowBindMountsForRegularUsers bool `json:"AllowBindMountsForRegularUsers"` @@ -57,7 +56,6 @@ type ( TemplatesURL string `valid:"required"` LogoURL string `valid:""` BlackListedLabels []portainer.Pair `valid:""` - DisplayDonationHeader bool `valid:""` DisplayExternalContributors bool `valid:""` AuthenticationMethod int `valid:"required"` LDAPSettings portainer.LDAPSettings `valid:""` @@ -92,7 +90,6 @@ func (handler *SettingsHandler) handleGetPublicSettings(w http.ResponseWriter, r publicSettings := &publicSettingsResponse{ LogoURL: settings.LogoURL, - DisplayDonationHeader: settings.DisplayDonationHeader, DisplayExternalContributors: settings.DisplayExternalContributors, AuthenticationMethod: settings.AuthenticationMethod, AllowBindMountsForRegularUsers: settings.AllowBindMountsForRegularUsers, @@ -121,7 +118,6 @@ func (handler *SettingsHandler) handlePutSettings(w http.ResponseWriter, r *http TemplatesURL: req.TemplatesURL, LogoURL: req.LogoURL, BlackListedLabels: req.BlackListedLabels, - DisplayDonationHeader: req.DisplayDonationHeader, DisplayExternalContributors: req.DisplayExternalContributors, LDAPSettings: req.LDAPSettings, AllowBindMountsForRegularUsers: req.AllowBindMountsForRegularUsers, diff --git a/api/portainer.go b/api/portainer.go index 413b37d39..e064285fa 100644 --- a/api/portainer.go +++ b/api/portainer.go @@ -73,12 +73,13 @@ type ( TemplatesURL string `json:"TemplatesURL"` LogoURL string `json:"LogoURL"` BlackListedLabels []Pair `json:"BlackListedLabels"` - DisplayDonationHeader bool `json:"DisplayDonationHeader"` DisplayExternalContributors bool `json:"DisplayExternalContributors"` AuthenticationMethod AuthenticationMethod `json:"AuthenticationMethod"` LDAPSettings LDAPSettings `json:"LDAPSettings"` AllowBindMountsForRegularUsers bool `json:"AllowBindMountsForRegularUsers"` AllowPrivilegedModeForRegularUsers bool `json:"AllowPrivilegedModeForRegularUsers"` + // Deprecated fields + DisplayDonationHeader bool } // User represents a user account. diff --git a/api/swagger.yaml b/api/swagger.yaml index edacf59d7..481a99930 100644 --- a/api/swagger.yaml +++ b/api/swagger.yaml @@ -2187,10 +2187,6 @@ definitions: description: "URL to a logo that will be displayed on the login page as well\ \ as on top of the sidebar. Will use default Portainer logo when value is\ \ empty string" - DisplayDonationHeader: - type: "boolean" - example: true - description: "Whether to display or not the donation message in the header." DisplayExternalContributors: type: "boolean" example: false @@ -2294,10 +2290,6 @@ definitions: \ when querying containers" items: $ref: "#/definitions/Settings_BlackListedLabels" - DisplayDonationHeader: - type: "boolean" - example: true - description: "Whether to display or not the donation message in the header." DisplayExternalContributors: type: "boolean" example: false @@ -2688,10 +2680,6 @@ definitions: \ when querying containers" items: $ref: "#/definitions/Settings_BlackListedLabels" - DisplayDonationHeader: - type: "boolean" - example: true - description: "Whether to display or not the donation message in the header." DisplayExternalContributors: type: "boolean" example: false diff --git a/app/portainer/__module.js b/app/portainer/__module.js index 77caaa70c..2b017bb2b 100644 --- a/app/portainer/__module.js +++ b/app/portainer/__module.js @@ -253,6 +253,16 @@ angular.module('portainer.app', []) } }; + var support = { + name: 'portainer.support', + url: '/support', + views: { + 'content@': { + templateUrl: 'app/portainer/views/support/support.html' + } + } + }; + var users = { name: 'portainer.users', url: '/users', @@ -319,6 +329,7 @@ angular.module('portainer.app', []) $stateRegistryProvider.register(registryCreation); $stateRegistryProvider.register(settings); $stateRegistryProvider.register(settingsAuthentication); + $stateRegistryProvider.register(support); $stateRegistryProvider.register(users); $stateRegistryProvider.register(user); $stateRegistryProvider.register(teams); diff --git a/app/portainer/components/header-title.js b/app/portainer/components/header-title.js index 92a6e3d4c..e2eaa1945 100644 --- a/app/portainer/components/header-title.js +++ b/app/portainer/components/header-title.js @@ -7,10 +7,9 @@ angular.module('portainer.app') }, link: function (scope, iElement, iAttrs) { scope.username = Authentication.getUserDetails().username; - scope.displayDonationHeader = StateManager.getState().application.displayDonationHeader; }, transclude: true, - template: '
{{title}} {{username}} Help support portainer
', + template: '
{{title}} {{username}} Portainer support
', restrict: 'E' }; return directive; diff --git a/app/portainer/models/settings/settings.js b/app/portainer/models/settings/settings.js index 300de0733..4c130b052 100644 --- a/app/portainer/models/settings/settings.js +++ b/app/portainer/models/settings/settings.js @@ -2,7 +2,6 @@ function SettingsViewModel(data) { this.TemplatesURL = data.TemplatesURL; this.LogoURL = data.LogoURL; this.BlackListedLabels = data.BlackListedLabels; - this.DisplayDonationHeader = data.DisplayDonationHeader; this.DisplayExternalContributors = data.DisplayExternalContributors; this.AuthenticationMethod = data.AuthenticationMethod; this.LDAPSettings = data.LDAPSettings; diff --git a/app/portainer/services/stateManager.js b/app/portainer/services/stateManager.js index f50101a94..d27844e60 100644 --- a/app/portainer/services/stateManager.js +++ b/app/portainer/services/stateManager.js @@ -30,18 +30,12 @@ function StateManagerFactory($q, SystemService, InfoHelper, LocalStorage, Settin LocalStorage.storeApplicationState(state.application); }; - manager.updateDonationHeader = function(displayDonationHeader) { - state.application.displayDonationHeader = displayDonationHeader; - LocalStorage.storeApplicationState(state.application); - }; - function assignStateFromStatusAndSettings(status, settings) { state.application.authentication = status.Authentication; state.application.analytics = status.Analytics; state.application.endpointManagement = status.EndpointManagement; state.application.version = status.Version; state.application.logo = settings.LogoURL; - state.application.displayDonationHeader = settings.DisplayDonationHeader; state.application.displayExternalContributors = settings.DisplayExternalContributors; state.application.validity = moment().unix(); } diff --git a/app/portainer/views/about/about.html b/app/portainer/views/about/about.html index 6486ad264..96bca4322 100644 --- a/app/portainer/views/about/about.html +++ b/app/portainer/views/about/about.html @@ -25,14 +25,6 @@

It is a community effort to make Portainer as feature-rich as simple it is to deploy and use. We need all the help we can get!

-

- Fund our work -

-

Contribute