Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NDS-1127 / NDS-229: Globus Auth support for UI, refactor webui Docker build, remove Bower #243

Merged
merged 27 commits into from
May 16, 2018

Conversation

@bodom0015 bodom0015 changed the title NDS-1127 / NDS-229: Refactor Docker build, remove Bower NDS-1127 / NDS-229: Refactor webui Docker build, remove Bower Feb 28, 2018
@bodom0015 bodom0015 changed the title NDS-1127 / NDS-229: Refactor webui Docker build, remove Bower NDS-1127 / NDS-229: Globus Auth support for UI, refactor webui Docker build, remove Bower Mar 26, 2018
@@ -45,6 +45,9 @@ angular
.constant('AddSpecPathSuffix', '/store/add/')
.constant('EditSpecPathSuffix', '/store/edit/:specKey/')

// Navigate here when clicking "Sign In"
.constant('SigninUrl', 'https://www.local.ndslabs.org/oauth2/authorize')

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added to support Globus Auth

$cookies.remove('token', CookieOptions);
$cookies.remove('namespace', CookieOptions);

$log.debug("Routing to login...");
//window.location.href = LoginRoute;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleaning up some leftover junk


# Install app dependencies
RUN npm install && \
grunt swagger-js-codegen
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add frontend dependencies during image build instead of at container startup

RUN npm install -g bower grunt-cli && \
npm cache clean
# Install Grunt + Gulp
RUN npm install -g grunt-cli gulp-cli
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reworked base image:

  • Change base OS from Debian Jessie to Ubuntu Xenial
  • Update NodeJS from 6.x to 8.x (LTS)
  • Removed Bower from base image

```

An example of a typical set of UI customizations for http://www.terraref.ndslabs.org/#/ can be seen [here](https://github.com/nds-org/ndslabs/compare/terra).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed stale docs

"angular-animate": "~1.5.0",
"lodash": "4.5.1"
}
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bower.json goes away and all of these dependencies move to package.json instead

@@ -123,7 +123,7 @@ angular.module('ndslabs', [ 'navbar', 'footer', 'ndslabs-services', 'ndslabs-fil
}
}

window.location.href = LoginAppPath;
window.location.href = '/landing/';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logout now routes you to the LandingPage

<button id="toggleAuthBtn" class="btn btn-sm btn-default" ng-click="toggleSecure(stack)" ng-disabled="stack.status !== 'stopped' || starting[stack.id] || ((stack.key | specProperty:'authRequired') === true) || ((stack.key | specProperty:'catalog') === 'user')">
<i class="fa fa-fw" ng-class="{ 'fa-lock': stack.secure, 'fa-unlock': !stack.secure }"></i> <small ng-class="{ 'text-success': stack.secure, 'text-danger': !stack.secure }">HTTP Basic Authentication {{ stack.secure === true ? 'Enabled' : 'Disabled' }}</small>
<i class="fa fa-fw" ng-class="{ 'fa-lock': stack.secure, 'fa-unlock': !stack.secure }"></i> <small ng-class="{ 'text-success': stack.secure, 'text-danger': !stack.secure }">Authentication {{ stack.secure === true ? 'Enabled' : 'Disabled' }}</small>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated button text to remove "HTTP Basic"

bower install --allow-root --config.interactive=false && \
grunt
# Start ExpressJS
node server.js
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reworked entrypoint.sh:

  • Removed support for GIT_DROPIN
  • Removed npm/bower/grunt calls (this now happens in the Dockerfile)
  • Added a line to read SIGNIN_URL from the new envvar


<!-- Shared Dependencies -->
<script src="../bower_components/angular-grid/angular-grid.js"></script>
<script src="../node_modules/angular-grid/angular-grid.js"></script>
<script src="../shared/ndslabs-api.js"></script>
<script src="../shared/services.js"></script>
<script src="../shared/filters.js"></script>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

../bower_components/ -> ../node_modules/

<script src="../node_modules/js-yaml/dist/js-yaml.min.js"></script>
<script src="../node_modules/angular-swagger-ui/dist/scripts/swagger-ui.min.js"></script>
<script src="../node_modules/angular-swagger-ui/dist/scripts/modules/swagger-yaml-parser.min.js"></script>
<link rel="stylesheet" href="../node_modules/angular-swagger-ui/dist/css/swagger-ui.min.css">

<!-- Shared Dependencies -->
<script src="../shared/ndslabs-api.js"></script>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

../bower_components/ -> ../node_modules/

@@ -44,7 +44,7 @@ <h3 class="panel-title">Already have an account?</h3>
</div>
<div class="panel-body">
<p>Start using {{ productName }}!</p>
<a id="signInBtn" class="btn btn-default" ng-href="/login/{{ rd ? '?rd=' + rd : '' }}">Sign in here <i class="fa fa-fw fa-caret-right"></i></a>
<a id="signInBtn" class="btn btn-default" ng-href="{{ signinLink }}">Sign in here <i class="fa fa-fw fa-caret-right"></i></a>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hide the "Sign Up" button if OAuth is enabled, set "Sign In" target based on SIGNIN_URL envvar

@@ -13,7 +13,7 @@ <h3><i class="fa fa-fw fa-server"></i> API Reference</h3>

<div class="row">
<div class="col-sm-12">
<div swagger-ui parser="yaml" trusted-sources="true" input-type="json" input="swaggerSpec" api-explorer="true"></div>
<div id="swaggerUi" swagger-ui parser="yaml" trusted-sources="true" url="'/swagger.yaml'" api-explorer="true"></div>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed broken Swagger UI (again), added an id for the new test case

<script src="../bower_components/angular-google-analytics/dist/angular-google-analytics.js"></script>
<script src="../bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js"></script>
<script src="../node_modules/angular-google-analytics/dist/angular-google-analytics.js"></script>
<script src="../node_modules/angular-ui-bootstrap/dist/ui-bootstrap-tpls.js"></script>

<!-- Shared Dependencies -->
<script src="../shared/ndslabs-api.js"></script>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

../bower_components/ -> ../node_modules/

if ($scope.enableOAuth) { return false; }
$window.location.href = '/login/recover' + ($rootScope.rd ? '?rd=' + $rootScope.rd : '')
};

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Detect OAuth configuration in LoginPage... Redirect if odd state encountered, disable page in case redirect doesn't work.

$window.location.href = $scope.signinLink;
return;
};

// To handle special characters in passwords, we must escape them in the validation regex pattern
// See https://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript/3561711#3561711
$scope.escapeRegex = function(pattern) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Detect OAuth configuration in SignUpPage... Redirect if odd state encountered, disable page in case redirect doesn't work.

"test": "npm run unit && npm run e2e",
"unit": "grunt karma",
"e2e": "grunt protractor-xvfb",
"ship": "grunt ship"
"ship": "grunt ship",
"start": "node server.js"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added all dependencies from bower.json

@@ -51,7 +51,7 @@ app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());

// AngularJS app dependencies
app.use('/bower_components', express.static('bower_components'));
app.use('/node_modules', express.static('node_modules'));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Server needed a rule update to serve node_modules instead of bower_components

@@ -76,7 +78,7 @@ angular
$cookies.remove('namespace', CookieOptions);

// TODO: Can we avoid hard-coding this URL?
$window.location.href = '/login/';
$window.location.href = '/landing/';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logout now routes to LandingPage, and detect OAuth support to hide the SignUp button, as well as change the target of the SignIn button


// Enter the port number
addSpecPage.newDockerTagNameField.sendKeys(TEST_DOCKER_IMAGE_TAG);

// Click the Add button
var addBtn = addSpecPage.addDockerTagBtn;
helpers.scrollIntoView(addBtn);
//helpers.scrollIntoView(addBtn);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why this test case was broken, but I'll need to revisit it if we find that it breaks again

var TEXT_BASIC_AUTH_ENABLED = 'HTTP Basic Authentication Enabled';
var TEXT_BASIC_AUTH_DISABLED = 'HTTP Basic Authentication Disabled';
var TEXT_BASIC_AUTH_ENABLED = 'Authentication Enabled';
var TEXT_BASIC_AUTH_DISABLED = 'Authentication Disabled';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adjusting test case to account for new button text

helpers.expectNewTabOpen(PAGE_ROUTE, true);
browser.waitForAngular();
self.verify();
});
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Properly handling this asynchronously - previous pattern had a race condition

@@ -22,6 +22,8 @@ var SwaggerUiPage = function() {
/**
* Insert public Getters here for page elements
*/
this.swaggerUi = element(by.css('.swagger-ui'));
this.apiTitle = element(by.binding('ui.infos.title'));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a couple of new ids for new test case

it('should offer a Workbench API reference', function() {
expect(swaggerUiPage.apiTitle.isPresent()).toBe(true);
expect(swaggerUiPage.apiTitle.isDisplayed()).toBe(true);
expect(swaggerUiPage.apiTitle.getText()).toBe(EXPECTED_API_TITLE);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EXPECTED_API_TITLE is effectively read from the name/description swagger.yml spec, so this seems to be a reasonable test of whether or not the SwaggerUI view is actually functioning

@craig-willis craig-willis merged commit eb4d003 into nds-org:master May 16, 2018
bodom0015 added a commit to cheese-hub/ndslabs that referenced this pull request Oct 8, 2020
* Add version 2.0 of client-go

* Stub pod and RC watching

* Add kubernetes go client to KubeHelper

* Get clean healthz result

* Migrate more operations over to go client

* Migrate GetLog to go client

* Mostly complete conversion to go client

* Initial fixes

* Just a reformat

* Removed unused PutDataset endpoint

* Changed Kubernetes version to 1.5

* Reverted change to Stream() call

* Migrate to mockable kubernetes Interface

* Updated event handling to use go client approach

* Added instructions to run apiserver out of cluster

* Added support for in-cluster configuration

* NDS-1172: Add -p flag to ndsctl to allow specification of password (nds-org#242)

* Roll versions forward to 1.0.14

* NDS-1172: Add -p flag to ndsctl to allow specification of password

* NDS-1177: Delete ingress rule before recreating it during stack modification

* NDS-1219: If stack is starting, StartStack should simply return 202 again

* NDS-1116: Adds oauth endpoint to apiserver (nds-org#246)

* Added admin port

* Added admin port

* Added oauth registration method

* Parameterized auth urls

* NDS-1127 / NDS-229: Globus Auth support for UI, refactor webui Docker build, remove Bower (nds-org#243)

* Roll versions forward to 1.0.14

* Sync.. starting to refactor webui Dockerfile(s)

* NDS-1127 / NDS-229: Rework Docker/Grunt build process, migrate away from using Bower

* Removed bower from package.json

* Removed Bower from base image

* Replace static file server rule for '/bower_components' with '/node_modules'

* Fix last few dependency issues from migration

* Fixed SwaggerUI view (again) and added a test case

* Removed the 'HTTP Basic' from 'HTTP Basic Authentication' on the dashboard

* Made the SwaggerUI test case actually useful

* Fixed an issue scrolling Docker image tags into view (addSpec)

* Fixed race condition in consolePage.get()

* Fixed erroneous comments

* Removed documentation about GIT_DROPIN feature

* Remove debian backports apt repo from Dockerfile

* Adjusted Docker image to read in SIGNIN_URL

* Adjusted Signin/Signout paths on LandingPage/Navbar

* Added banner / redirect to LoginPage / SignUpPage when OAuth is enabled

* Update README.md

* Create simple travis script to verify basics (nds-org#247)

* Update glide repos to fix sirupsen repo name change

* Changed default NDSLABS_APISERVER_SERVICE_PORT

to 30001

* Updated dependencies and imports

* Added better defaults for debugging

* Updated README to reflect current dev practices

* Added insecure postman collection

* Addressed review feedack

* Allow user to configure nodeSelector in Workbench apiserver

* Update entrypoint.sh to include new config values

nodeSelectorName / nodeSelectorValue

* Added new config for pvcStorageClass, new functions for Creating/Deleting PVCs in kube.go

* Create 'home' PVC when namespace is created, create vol/user PVCs when stack starts

* Removed references to glusterfs / HomeVolume, replaced with HomePvcSuffix

* Added a test case for a stack mounting a PVC

* Fixed HTTPS simple stack chaining/test case

* Added helpers to Create/Delete NetworkPolicy resources and check for their existence

* Improve NetworkPolicy error-handling slightly

* Updated PVC support to use SubPath from home PVC, instead of creating a new PVC every time

* Added new config for pvcStorageClass, new functions for Creating/Deleting PVCs in kube.go

* Create 'home' PVC when namespace is created, create vol/user PVCs when stack starts

* Removed references to glusterfs / HomeVolume, replaced with HomePvcSuffix

* Added a test case for a stack mounting a PVC

* Fixed HTTPS simple stack chaining/test case

* Updated PVC support to use SubPath from home PVC, instead of creating a new PVC every time

* Removed VOLUME_* variables and added HOME_PVC_SUFFIX

* Removed unused VolumeType

* Added default nfs storage class in entrypoint

* Added nginx ingress class for GKE

* Added Sphinx config

* Basic install instructions

* Added the volume.beta.kubernetes.io/nfs-mount-path annotation to the PersistentVolumeClaim

* Updated the base containers to Debian Stretch due to 404 errors when running apt-get on golang:1.8-jessie

* Check for error instead of nil

* Add support for more fine-grained container security capabilities

* Expand full.json example to show securityContext

* Fix merge conflict, further expand error-handling in StartStack

* Read subdomain_prefix from env instead of 'www'

* Removed last references to Privileged

* Don't re-pull dependencies if the --cache flag is passed

* Moved networkpolicy creation to stack (not service) level

* Gofmt

* Add check for existing network policy

* Added collocate spec option to support pod affinity on host

* Changed network policy pod selector to support access by ILB

* Disabled network policies

* Temporary fix to ensure spdy installed

* Implemented exec using go client

* Added QPS and Burst overrides

* Analytics event tracking (nds-org#296)

* Low-barrier platform instrumentation/tracking using Google Analytics events

* Fixed logs/console/edit/help/config event tracking

* Use Catalog as default page when first logging in (nds-org#313)

* Update Dashboard/Applications page names throughout, highlight current page in navbar (nds-org#314)

* Catalog: Remove help icon, revise text in help link on dropdown (nds-org#315)

* Catalog: Hide 'Add' button after installing once, highlight the 'View' button (nds-org#316)

* Added description to Dashboard page, changed red panels to grey (nds-org#317)

* Applications: Added tooltips to all buttons and columns (nds-org#318)

* Replace link icon with text, add margin (nds-org#319)

* Replace link icon with text, add margin

* Replace link icon with text, add margin

* Hide advanced features behind config flags (nds-org#320)

* Hide some of the more advanced features behind environment variables

* Fix default login path

* Show Console by default

* Added showLogs and showConfig flags

* Remove unused envvar

* fix bad merge

* Remove debug variable

* Update gui/README.md to correct Swagger codegen

Fixes nds-org#312

* Hide Terms&Conditions link on signup if no 'Acceptable Use Policy' link is provided (nds-org#321)

* Address SGCI Phase 2 Feedback (nds-org#324)

* Hide purple boxes on landing, consistent naming for signUp

* Move "See Also" from Landing to the "Help" dropdown on the navbar

* Adjust hint text, make list / card buttons slightly more obvious

* Highlight "Add" button, show popup when copying to clipboard, hide source when not needed

* Hide "Add Application" button on Dashboard view

* Increase size of Loading/Refresh icon

* Upgrade AngularJS to 1.8.0 (nds-org#322)

* Roll AngularJS forward to 1.7.9, update return signature for all uses of .then()

* Roll AngularJS forward to 1.8.0

* Bump lodash from 4.5.1 to 4.17.19 in /gui (nds-org#325)

Bumps [lodash](https://github.com/lodash/lodash) from 4.5.1 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](lodash/lodash@4.5.1...4.17.19)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Co-authored-by: BenGalewsky <ben@peartreestudio.net>
Co-authored-by: Craig Willis <willis8@illinois.edu>
Co-authored-by: BenGalewsky <BenGalewsky@users.noreply.github.com>
Co-authored-by: Ben Galewsky <bengal1@illinois.ed>
Co-authored-by: Kevin Coakley <kcoakley@sdsc.edu>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
bodom0015 added a commit that referenced this pull request Apr 21, 2021
… build, remove Bower (#243)

* Roll versions forward to 1.0.14

* Sync.. starting to refactor webui Dockerfile(s)

* NDS-1127 / NDS-229: Rework Docker/Grunt build process, migrate away from using Bower

* Removed bower from package.json

* Removed Bower from base image

* Replace static file server rule for '/bower_components' with '/node_modules'

* Fix last few dependency issues from migration

* Fixed SwaggerUI view (again) and added a test case

* Removed the 'HTTP Basic' from 'HTTP Basic Authentication' on the dashboard

* Made the SwaggerUI test case actually useful

* Fixed an issue scrolling Docker image tags into view (addSpec)

* Fixed race condition in consolePage.get()

* Fixed erroneous comments

* Removed documentation about GIT_DROPIN feature

* Remove debian backports apt repo from Dockerfile

* Adjusted Docker image to read in SIGNIN_URL

* Adjusted Signin/Signout paths on LandingPage/Navbar

* Added banner / redirect to LoginPage / SignUpPage when OAuth is enabled
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants