Skip to content

Commit

Permalink
Merge branch 'integration' of /home/rlp3/NIST/ODI/OAR/dev/oar-sdp-red…
Browse files Browse the repository at this point in the history
…esign into redesign
  • Loading branch information
RayPlante committed Aug 16, 2024
2 parents 9ee317a + 30778dc commit 6e2b475
Show file tree
Hide file tree
Showing 520 changed files with 79,437 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This file is currently used by autoprefixer to adjust CSS to support the below specified browsers
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
#
# For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed

> 0.5%
last 2 versions
Firefox ESR
not dead
not IE 9-11
73 changes: 73 additions & 0 deletions angular/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# SDP Frontend Service

This directory provides the `sdp` software product, an [Angular](https://angular.io) which provides a browser-based interface for searching and browsing NIST data products.

This software is built on the Angular framework using Angular CLI and implemented primarily in Typescript. It is currently built on Angular 6.

## Prerequisites

- [node](https://nodejs.org/en/download/) version 8.9.4 or higher (10.9 is recommended). This provides the `npm` build tool.

All other required modules can be installed automatically via the `npm` tool (by typing `npm install` in this directory).

You may be interested these related links:
- [Get VS Code](https://code.visualstudio.com/download) (an IDE)
- [Angular CLI](https://github.com/angular/angular-cli) version 1.6.8.

## Building the app from scratch

### Downloading this repository

```bash
# clone the repo
git clone https://github.com/usnistgov/oar-sdp.git

# change directory to repo
cd oar-sdp
cd angular
```

### Building the application

The `npm` tool is used to build, test, and run the Angular application.
To install the Typescript compiler and all required Javascript modules, type:

```bash
npm install
```
This only needs to be done once, unless dependencies (recorded in the `package.json` file) change.
To build the application, type
```bash
npm run build
```
## Running the tests

To run the unit tests and the integration tests (also refered to as _e2e tests_), type, respectively:
```bash
npm test
npm e2e
```
## Running the service

_Editor's note: Need some instruction on configuring the service._

This application can run via the following command:
```bash
npm start
```
This will serve the application via a local web server; one can use a browser to interact with it by accessing URLs based at `http://localhost:5555`.

## Further information

### Libraries

- [bootstrap](https://github.com/twbs/bootstrap) - The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.
- [ng-bootstrap](https://ng-bootstrap.github.io) - Angular powered Bootstrap
- [font-awesome 5.x](https://github.com/FortAwesome/Font-Awesome) - Get vector icons and social logos on your website with Font Awesome, the web’s most popular icon set and toolkit.

## Developing

### Code scaffolding

Run ng `generate component component-name` to generate a new component. You can also use `ng generate directive/pipe/service/class/module`.

128 changes: 128 additions & 0 deletions angular/angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"angular": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/angular",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": ["src/favicon.ico", "src/assets"],
"styles": [
"src/styles/font-awesome/css/font-awesome.min.css",
"node_modules/primeicons/primeicons.css",
"node_modules/primeng/resources/themes/lara-dark-blue/theme.css",
"node_modules/primeng/resources/primeng.min.css",
"node_modules/primeflex/primeflex.css"
],
"scripts": ["node_modules/primeui/primeui-ng-all.min.js"],
"vendorChunk": true,
"extractLicenses": false,
"buildOptimizer": false,
"sourceMap": true,
"optimization": false,
"namedChunks": true
},
"configurations": {
"production": {
"budgets": [
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
],
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"baseHref": "/sdp/"
},
"mock": {
"budgets": [
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
],
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.mock.ts"
}
]
}
},
"defaultConfiguration": ""
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "angular:build"
},
"configurations": {
"production": {
"browserTarget": "angular:build:production"
},
"mock": {
"browserTarget": "angular:build:mock"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "angular:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:jest",
"options": {
"polyfills": ["zone.js", "zone.js/testing"],
"tsConfig": "tsconfig.spec.json"
}
}
}
},
"angular-e2e": {
"root": "e2e/",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "angular:serve:mock"
},
"configurations": {
"production": {
"devServerTarget": "angular:serve:mock"
}
}
}
}
}
},
"cli": {
"analytics": false
}
}
32 changes: 32 additions & 0 deletions angular/e2e/protractor.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts

const { SpecReporter } = require('jasmine-spec-reporter');

exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome',
chromeOptions: {
// args: [ "--disable-gpu", "--window-size=800x600", "--disable-web-security" ]
args: [ "--headless", "--disable-gpu", "--window-size=800x600", "--disable-web-security" ]
}
},
directConnect: true,
baseUrl: 'http://localhost:5555/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.e2e.json')
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};
60 changes: 60 additions & 0 deletions angular/e2e/src/app.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import {Injectable, Injector} from '@angular/core';
import { AppPage } from './app.po';
import { browser, element, by } from 'protractor';
import {async, fakeAsync, tick} from '@angular/core/testing';
import {BaseRequestOptions, ConnectionBackend, Http, RequestOptions} from '@angular/http';
import {Response, ResponseOptions} from '@angular/http';
import {MockBackend, MockConnection} from '@angular/http/testing';

describe('workspace-project App', () => {
let page: AppPage;

beforeEach(() => {
page = new AppPage();

});

it('Home page should have a title and title should be NIST Data Discovery', async () => {
page.navigateTo('/');
browser.sleep(5000);
browser.ignoreSynchronization = true;
expect<any>(browser.getTitle()).toEqual('NIST Data Repository Page');
expect<any>(page.getParagraphText()).toEqual('NIST Data Discovery');
expect<any>(element(by.id('feature')).getText()).toEqual('FEATURED DATA DOMAINS');
});

it('About page should display title of about page', () => {
page.navigateTo('/#/about');
browser.sleep(5000);
browser.ignoreSynchronization = true;
expect<any>(element(by.id('title')).getText()).toEqual('About NIST Data');
});

it('Advanced search page should display title of Advanced Search Builder', () => {
page.navigateTo('/#/advanced');
browser.sleep(5000);
browser.ignoreSynchronization = true;
expect<any>(element(by.id('title')).getText()).toEqual('Advanced Search Builder');
});

it('Policy page should display title of policy', () => {
page.navigateTo('/#/policy');
browser.sleep(5000);
browser.ignoreSynchronization = true;
expect<any>(element(by.id('title')).getText()).toEqual('Policy');
});

it('Help page should display title of help', () => {
page.navigateTo('/#/help');
browser.sleep(5000);
browser.ignoreSynchronization = true;
expect<any>(element(by.id('title')).getText()).toEqual('Help');
});

it('Api page should display title of api page', () => {
page.navigateTo('/#/api');
browser.sleep(5000);
browser.ignoreSynchronization = true;
expect<any>(element(by.id('title')).getText()).toEqual('APIs');
});
});
25 changes: 25 additions & 0 deletions angular/e2e/src/app.po.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { browser, by, element } from 'protractor';

export class AppPage {
navigateTo(pageRoute) {
return browser.get(pageRoute);
}

getParagraphText() {
browser.sleep(5000);
browser.ignoreSynchronization = true;
return element(by.className('title')).getText();
}

getSearchExampleLink() {
return element(by.id('srd101'));
}

getSearchButton() {
return element(by.className('bigSearchButton'));
}

showExampleLink() {
return element(by.id('example'));
}
}
13 changes: 13 additions & 0 deletions angular/e2e/tsconfig.e2e.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"module": "commonjs",
"target": "es5",
"types": [
"jasmine",
"jasminewd2",
"node"
]
}
}
8 changes: 8 additions & 0 deletions angular/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
preset: 'jest-preset-angular',
setupFilesAfterEnv: ['./setup-jest.ts'],
moduleNameMapper: {
"^lodash-es$": "lodash"
},
globalSetup: 'jest-preset-angular/global-setup'
};
Loading

0 comments on commit 6e2b475

Please sign in to comment.