From 671fa445a59e2c58012bc4b13d466fbc9a9c4d0a Mon Sep 17 00:00:00 2001 From: Mike Lambert Date: Mon, 18 May 2020 18:29:14 +0000 Subject: [PATCH 1/7] Hide some of the more advanced features behind environment variables --- gui/ConfigModule.js | 14 +++++++ gui/Dockerfile | 5 +++ gui/dashboard/catalog/CatalogController.js | 6 ++- gui/dashboard/catalog/catalog.html | 4 +- .../dashboard/DashboardController.js | 8 +++- gui/dashboard/dashboard/dashboard.html | 41 ++++++++++--------- gui/entrypoint.sh | 11 +++++ gui/shared/navbar/NavbarController.js | 5 ++- gui/shared/navbar/navbar.html | 2 +- 9 files changed, 67 insertions(+), 29 deletions(-) diff --git a/gui/ConfigModule.js b/gui/ConfigModule.js index 07d84dac..b68af1c8 100644 --- a/gui/ConfigModule.js +++ b/gui/ConfigModule.js @@ -17,6 +17,20 @@ angular * Make lodash available for injection into controllers */ .constant('_', window._) + +/** + * Toggles for hiding the more advanced UI features + */ +.constant('AdvancedFeatures', { + showConsole: false, + showEditService: false, + showRemoveService: false, + showCreateSpec: false, + showImportSpec: false, + showFileManager: false, + showServiceHelpIcon: false, +}) + /** * The back-up (default) administrator e-mail to use for support, * in case the /api/contact endpoint is unavailable diff --git a/gui/Dockerfile b/gui/Dockerfile index 35b9bf40..81f997f4 100644 --- a/gui/Dockerfile +++ b/gui/Dockerfile @@ -30,6 +30,11 @@ ENV APISERVER_HOST="localhost" \ APISERVER_PATH="/api" \ APISERVER_SECURE="true" \ ANALYTICS_ACCOUNT="" \ + SHOW_CONSOLE="false" \ + SHOW_IMPORT_SPEC="false" \ + SHOW_CREATE_SPEC="false" \ + SHOW_FILE_MANAGER="false" \ + SHOW_EDIT_SERVICE="false" \ SUPPORT_EMAIL="ndslabs-support@nationaldataservice.org" # Expose port 3000 for ExpressJS diff --git a/gui/dashboard/catalog/CatalogController.js b/gui/dashboard/catalog/CatalogController.js index 5f277272..bd292778 100644 --- a/gui/dashboard/catalog/CatalogController.js +++ b/gui/dashboard/catalog/CatalogController.js @@ -23,10 +23,12 @@ angular * @see https://opensource.ncsa.illinois.edu/confluence/display/~lambert8/3.%29+Controllers%2C+Scopes%2C+and+Partial+Views */ .controller('CatalogController', [ '$scope', '$filter', '$interval', '$uibModal', '$location', '$log', '_', 'NdsLabsApi', 'Project', 'Stack', 'Stacks', - 'StackService', 'Specs', 'clipboard', 'Vocabulary', 'RandomPassword', 'AuthInfo', 'ProductName', 'ApiUri', 'DashboardAppPath', 'HomePathSuffix', - function($scope, $filter, $interval, $uibModal, $location, $log, _, NdsLabsApi, Project, Stack, Stacks, StackService, Specs, clipboard, Vocabulary, RandomPassword, AuthInfo, ProductName, ApiUri, DashboardAppPath, HomePathSuffix) { + 'StackService', 'Specs', 'clipboard', 'Vocabulary', 'RandomPassword', 'AuthInfo', 'ProductName', 'ApiUri', 'DashboardAppPath', 'HomePathSuffix', 'AdvancedFeatures', + function($scope, $filter, $interval, $uibModal, $location, $log, _, NdsLabsApi, Project, Stack, Stacks, StackService, Specs, clipboard, Vocabulary, RandomPassword, AuthInfo, ProductName, ApiUri, DashboardAppPath, HomePathSuffix, AdvancedFeatures) { "use strict"; + $scope.showCreateSpec = AdvancedFeatures.showCreateSpec; + $scope.showImportSpec = AdvancedFeatures.showImportSpec; $scope.productName = ProductName; $scope.tags = { all: [], selected: [] }; diff --git a/gui/dashboard/catalog/catalog.html b/gui/dashboard/catalog/catalog.html index dfc42d60..9f768523 100644 --- a/gui/dashboard/catalog/catalog.html +++ b/gui/dashboard/catalog/catalog.html @@ -34,11 +34,11 @@

Catalog

-
-
+
Create diff --git a/gui/dashboard/dashboard/DashboardController.js b/gui/dashboard/dashboard/DashboardController.js index a08946f6..554b249d 100755 --- a/gui/dashboard/dashboard/DashboardController.js +++ b/gui/dashboard/dashboard/DashboardController.js @@ -10,15 +10,19 @@ angular * @see https://opensource.ncsa.illinois.edu/confluence/display/~lambert8/3.%29+Controllers%2C+Scopes%2C+and+Partial+Views */ .controller('DashboardController', [ '$scope', 'Loading', '$log', '$routeParams', '$location', '$interval', '$q', '$window', '$filter', '$uibModal', '_', 'Project', 'RandomPassword', 'Stack', 'Stacks', 'Specs', 'AutoRefresh', 'AuthInfo', - 'StackService', 'NdsLabsApi', 'ProductName', 'FileManager', 'QuickStart', + 'StackService', 'NdsLabsApi', 'ProductName', 'FileManager', 'QuickStart', 'AdvancedFeatures', function($scope, Loading, $log, $routeParams, $location, $interval, $q, $window, $filter, $uibModal, _, Project, RandomPassword, Stack, Stacks, Specs, AutoRefresh, AuthInfo, StackService, NdsLabsApi, - ProductName, FileManager, QuickStart) { + ProductName, FileManager, QuickStart, AdvancedFeatures) { "use strict"; if ($routeParams.quickstart) { QuickStart.get($routeParams.quickstart).launch(); } + $scope.showRemoveService = AdvancedFeatures.showRemoveService; + $scope.showServiceHelpIcon = AdvancedFeatures.showServiceHelpIcon; + $scope.showEditService = AdvancedFeatures.showEditService; + $scope.showConsole = AdvancedFeatures.showConsole; $scope.fileManager = FileManager; $scope.productName = ProductName; diff --git a/gui/dashboard/dashboard/dashboard.html b/gui/dashboard/dashboard/dashboard.html index a3e7afe8..77d39867 100755 --- a/gui/dashboard/dashboard/dashboard.html +++ b/gui/dashboard/dashboard/dashboard.html @@ -83,18 +83,14 @@

Status - Name - ID - Console - - Config - Edit - - - Logs - Remove - - Help + Name + ID + Console + Edit + Config + Logs + Remove + Help @@ -130,22 +126,24 @@

{{ svc.id }} - + - - - + + - + + + + - + + + + diff --git a/gui/entrypoint.sh b/gui/entrypoint.sh index 40b1abd1..4b2daaf3 100755 --- a/gui/entrypoint.sh +++ b/gui/entrypoint.sh @@ -17,7 +17,9 @@ /bin/sed -i -e "s#^\.constant('GaAccount', .*)#.constant('GaAccount', '${ANALYTICS_ACCOUNT}')#" "$BASEDIR/ConfigModule.js" # In lieu of actual user management, some instance-wide flags to toggle the more advanced features -/bin/sed -i -e "s#^\showConsole: .*,#showConsole: ${SHOW_CONSOLE:-false},#" "$BASEDIR/ConfigModule.js" +/bin/sed -i -e "s#^\showConfig: .*,#showConfig: ${SHOW_CONFIG:-false},#" "$BASEDIR/ConfigModule.js" +/bin/sed -i -e "s#^\showLogs: .*,#showLogs: ${SHOW_LOGS:-false},#" "$BASEDIR/ConfigModule.js" +/bin/sed -i -e "s#^\showConsole: .*,#showConsole: ${SHOW_CONSOLE:-true},#" "$BASEDIR/ConfigModule.js" /bin/sed -i -e "s#^\showEditService: .*,#showEditService: ${SHOW_EDIT_SERVICE:-false},#" "$BASEDIR/ConfigModule.js" /bin/sed -i -e "s#^\showRemoveService: .*,#showRemoveService: ${SHOW_REMOVE_SERVICE:-false},#" "$BASEDIR/ConfigModule.js" /bin/sed -i -e "s#^\showServiceHelpIcon: .*,#showServiceHelpIcon: ${SHOW_SERVICE_HELP_ICON:-false},#" "$BASEDIR/ConfigModule.js" From 54eb0bb411fb24eb83498f43145d0f15ffd1cc73 Mon Sep 17 00:00:00 2001 From: Mike Lambert Date: Mon, 8 Jun 2020 17:08:38 -0500 Subject: [PATCH 5/7] Remove unused envvar --- gui/entrypoint.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/gui/entrypoint.sh b/gui/entrypoint.sh index 4b2daaf3..6b20d7e7 100755 --- a/gui/entrypoint.sh +++ b/gui/entrypoint.sh @@ -27,7 +27,5 @@ /bin/sed -i -e "s#^\showImportSpec: .*,#showImportSpec: ${SHOW_IMPORT_SPEC:-false},#" "$BASEDIR/ConfigModule.js" /bin/sed -i -e "s#^\showFileManager: .*,#showFileManager: ${SHOW_FILE_MANAGER:-false},#" "$BASEDIR/ConfigModule.js" -/bin/sed -i -e "s#^\.constant('AllowDuplicateApps', .*)#.constant('AllowDuplicateApps', ${ALLOW_DUPLICATE_APPS:-false})#" "$BASEDIR/ConfigModule.js" - # Start ExpressJS node server.js From d5e6df42ee4a960be60adcec52ed67dd42bfabe6 Mon Sep 17 00:00:00 2001 From: Mike Lambert Date: Wed, 10 Jun 2020 21:06:16 +0000 Subject: [PATCH 6/7] fix bad merge --- gui/dashboard/dashboard/DashboardController.js | 12 ++++++------ gui/dashboard/dashboard/dashboard.html | 13 +++++++------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/gui/dashboard/dashboard/DashboardController.js b/gui/dashboard/dashboard/DashboardController.js index b5aed298..4665398b 100755 --- a/gui/dashboard/dashboard/DashboardController.js +++ b/gui/dashboard/dashboard/DashboardController.js @@ -9,22 +9,22 @@ angular * @author lambert8 * @see https://opensource.ncsa.illinois.edu/confluence/display/~lambert8/3.%29+Controllers%2C+Scopes%2C+and+Partial+Views */ -.controller('DashboardController', [ '$scope', 'Loading', '$log', '$routeParams', '$location', '$interval', '$q', '$window', '$filter', '$uibModal', '_', 'Analytics', 'Project', 'RandomPassword', 'Stack', 'Stacks', 'Specs', 'AutoRefresh', 'AuthInfo', 'AdvancedFeatures', - 'StackService', 'NdsLabsApi', 'ProductName', 'FileManager', 'QuickStart', - function($scope, Loading, $log, $routeParams, $location, $interval, $q, $window, $filter, $uibModal, _, Analytics, Project, RandomPassword, Stack, Stacks, Specs, AutoRefresh, AuthInfo, StackService, NdsLabsApi, - ProductName, FileManager, QuickStart, AdvancedFeatures) { +.controller('DashboardController', [ '$scope', 'Loading', '$log', '$routeParams', '$location', '$interval', '$q', '$window', '$filter', '$uibModal', '_', 'Analytics', 'Project', 'RandomPassword', 'Stack', 'Stacks', 'Specs', 'AutoRefresh', 'AuthInfo', 'StackService', 'NdsLabsApi', 'ProductName', 'FileManager', 'QuickStart', 'AdvancedFeatures', + function($scope, Loading, $log, $routeParams, $location, $interval, $q, $window, $filter, $uibModal, _, Analytics, Project, RandomPassword, Stack, Stacks, Specs, AutoRefresh, AuthInfo, StackService, NdsLabsApi, ProductName, FileManager, QuickStart, AdvancedFeatures) { "use strict"; if ($routeParams.quickstart) { QuickStart.get($routeParams.quickstart).launch(); } + + $scope.AdvancedFeatures = AdvancedFeatures; $scope.showRemoveService = AdvancedFeatures.showRemoveService; $scope.showServiceHelpIcon = AdvancedFeatures.showServiceHelpIcon; $scope.showEditService = AdvancedFeatures.showEditService; $scope.showConsole = AdvancedFeatures.showConsole; - $scope.showConfig = AdvancedFeatures.showConfig; - $scope.showLogs = AdvancedFeatures.showLogs; + $scope.showConfigColumn = AdvancedFeatures.showConfig; + $scope.showLogsColumn = AdvancedFeatures.showLogs; $scope.fileManager = FileManager; $scope.productName = ProductName; diff --git a/gui/dashboard/dashboard/dashboard.html b/gui/dashboard/dashboard/dashboard.html index 68ce6bac..a2c995ab 100755 --- a/gui/dashboard/dashboard/dashboard.html +++ b/gui/dashboard/dashboard/dashboard.html @@ -79,6 +79,7 @@

+
@@ -89,8 +90,8 @@

- - + + @@ -112,8 +113,8 @@

-

- -
ID Console EditConfigLogsConfigLogs Remove Help
- {{ svc.service | specProperty:'label' }} + + {{ svc.service | specProperty:'label' }} + +