Skip to content

Commit

Permalink
feat(ues-recycling): UES recycling mapping app (#109)
Browse files Browse the repository at this point in the history
* Added base angular and nest data api apps

* Added ues recycling common entities lib

* Added base recycling data-api and ngx libs

* Populated api endpoints and services

* Added angular data access module

* Generated ues-recycling-data-api-nest workspace def

* Generated ues-recycling-angular app def

* Added ues-recycling-common-entities lib def

* Generated data api def

* Added ues recycling ngx lib def

* Fixed API

* Added data entry initial views

* Latest data view working

View responsible for displaying latest recycling data is working. Next  step is working on upload view.

* File upload view works

* Visible recycling locations

* Added total recycled cards and trend chart

* Search and filtering working

* Shows all data on startup

* Added feature highlight

- Highlight features on map selection/search suggestion selection
- Clear highlight when cleared through search

* Added 3d visualizatio

* Delegating some map logic after view is available

* Added perspective toggle for 3d layer

* Added deployment package.json

* Added prod config

* Using SDE hosted service instead of AGOL service

- Using common application definitions for both development and production.
- Updated recycling metadata schema for SDE hosted service
- Filtering map recycling locations by public view only

* Updated ues-recycling layer and legend sources

Removed some deprecated options and switched to using dynamic legend rendering instead of static legend infos.

* Added authentication for recycling endpoints

* Update azure-pipelines.yml for Azure Pipelines

* Added deployment ps scripts

* Updated geojson utils dep

* Added global assets to build

* Added CORS allowed origins

* Added iis rewrite clear ps scripts

* Skip nx cache

* Added authentication to locations routes

* Re-implemented authentication with generalized auth implementation

* Formatting pass
  • Loading branch information
Proantagonist authored and IsaiahV98 committed May 21, 2021
1 parent 0797740 commit 21f1654
Show file tree
Hide file tree
Showing 154 changed files with 4,948 additions and 82 deletions.
12 changes: 12 additions & 0 deletions apps/ues-recycling-angular-e2e/cypress.json
@@ -0,0 +1,12 @@
{
"fileServerFolder": ".",
"fixturesFolder": "./src/fixtures",
"integrationFolder": "./src/integration",
"modifyObstructiveCode": false,
"pluginsFile": "./src/plugins/index",
"supportFile": "./src/support/index.ts",
"video": true,
"videosFolder": "../../dist/cypress/apps/ues-recycling-angular-e2e/videos",
"screenshotsFolder": "../../dist/cypress/apps/ues-recycling-angular-e2e/screenshots",
"chromeWebSecurity": false
}
4 changes: 4 additions & 0 deletions apps/ues-recycling-angular-e2e/src/fixtures/example.json
@@ -0,0 +1,4 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io"
}
13 changes: 13 additions & 0 deletions apps/ues-recycling-angular-e2e/src/integration/app.spec.ts
@@ -0,0 +1,13 @@
import { getGreeting } from '../support/app.po';

describe('ues-recycling-angular', () => {
beforeEach(() => cy.visit('/'));

it('should display welcome message', () => {
// Custom command example, see `../support/commands.ts` file
cy.login('my-email@something.com', 'myPassword');

// Function helper example, see `../support/app.po.ts` file
getGreeting().contains('Welcome to ues-recycling-angular!');
});
});
22 changes: 22 additions & 0 deletions apps/ues-recycling-angular-e2e/src/plugins/index.js
@@ -0,0 +1,22 @@
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************

// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)

const { preprocessTypescript } = require('@nrwl/cypress/plugins/preprocessor');

module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config

// Preprocess Typescript file using Nx helper
on('file:preprocessor', preprocessTypescript(config));
};
1 change: 1 addition & 0 deletions apps/ues-recycling-angular-e2e/src/support/app.po.ts
@@ -0,0 +1 @@
export const getGreeting = () => cy.get('h1');
31 changes: 31 additions & 0 deletions apps/ues-recycling-angular-e2e/src/support/commands.ts
@@ -0,0 +1,31 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************

declare namespace Cypress {
interface Chainable<Subject> {
login(email: string, password: string): void;
}
}
//
// -- This is a parent command --
Cypress.Commands.add('login', (email, password) => {
console.log('Custom command example: Login', email, password);
});
//
// -- This is a child command --
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
17 changes: 17 additions & 0 deletions apps/ues-recycling-angular-e2e/src/support/index.ts
@@ -0,0 +1,17 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands';
10 changes: 10 additions & 0 deletions apps/ues-recycling-angular-e2e/tsconfig.e2e.json
@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"sourceMap": false,
"outDir": "../../dist/out-tsc",
"allowJs": true,
"types": ["cypress", "node"]
},
"include": ["src/**/*.ts", "src/**/*.js"]
}
10 changes: 10 additions & 0 deletions apps/ues-recycling-angular-e2e/tsconfig.json
@@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.base.json",
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.e2e.json"
}
]
}
1 change: 1 addition & 0 deletions apps/ues-recycling-angular-e2e/tslint.json
@@ -0,0 +1 @@
{ "extends": "../../tslint.json", "linterOptions": { "exclude": ["!**/*"] }, "rules": {} }
17 changes: 17 additions & 0 deletions apps/ues-recycling-angular/.browserslistrc
@@ -0,0 +1,17 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries

# For the full list of supported browsers by the Angular framework, please see:
# https://angular.io/guide/browser-support

# You can see what browsers were selected by your queries by running:
# npx browserslist

last 1 Chrome version
last 1 Firefox version
last 2 Edge major versions
last 2 Safari major versions
last 2 iOS major versions
Firefox ESR
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.
20 changes: 20 additions & 0 deletions apps/ues-recycling-angular/jest.config.js
@@ -0,0 +1,20 @@
module.exports = {
displayName: 'ues-recycling-angular',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
globals: {
'ts-jest': {
tsConfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
astTransformers: {
before: ['jest-preset-angular/build/InlineFilesTransformer', 'jest-preset-angular/build/StripStylesTransformer']
}
}
},
coverageDirectory: '../../coverage/apps/ues-recycling-angular',
snapshotSerializers: [
'jest-preset-angular/build/AngularNoNgAttributesSnapshotSerializer.js',
'jest-preset-angular/build/AngularSnapshotSerializer.js',
'jest-preset-angular/build/HTMLCommentSerializer.js'
]
};
1 change: 1 addition & 0 deletions apps/ues-recycling-angular/src/app/app.component.html
@@ -0,0 +1 @@
<router-outlet></router-outlet>
Empty file.
31 changes: 31 additions & 0 deletions apps/ues-recycling-angular/src/app/app.component.spec.ts
@@ -0,0 +1,31 @@
import { TestBed } from '@angular/core/testing';
import { AppComponent } from './app.component';
import { RouterTestingModule } from '@angular/router/testing';

describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [RouterTestingModule],
declarations: [AppComponent]
}).compileComponents();
});

it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});

it(`should have as title 'ues-recycling-angular'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('ues-recycling-angular');
});

it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain('Welcome to ues-recycling-angular!');
});
});
8 changes: 8 additions & 0 deletions apps/ues-recycling-angular/src/app/app.component.ts
@@ -0,0 +1,8 @@
import { Component } from '@angular/core';

@Component({
selector: 'tamu-gisc-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {}
53 changes: 53 additions & 0 deletions apps/ues-recycling-angular/src/app/app.module.ts
@@ -0,0 +1,53 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';
import { RouterModule } from '@angular/router';

import * as WebFont from 'webfontloader';
import { env, EnvironmentService } from '@tamu-gisc/common/ngx/environment';
import { AuthGuard, AuthProvider } from '@tamu-gisc/common/ngx/auth';

import * as environment from '../environments/environment';
import { AppComponent } from './app.component';

WebFont.load({
google: {
families: ['Material Icons']
},
custom: {
families: ['Moriston', 'Tungsten'],
urls: ['assets/fonts/moriston_pro/moriston_pro.css', 'assets/fonts/tungsten/tungsten.css']
}
});

@NgModule({
declarations: [AppComponent],
imports: [
BrowserModule,
HttpClientModule,
RouterModule.forRoot(
[
{
path: 'data',
loadChildren: () => import('@tamu-gisc/ues/recycling/ngx').then((m) => m.DataModule),
canActivate: [AuthGuard]
},
{
path: '',
loadChildren: () => import('@tamu-gisc/ues/recycling/ngx').then((m) => m.MapModule)
}
],
{ initialNavigation: 'enabled' }
)
],
providers: [
EnvironmentService,
{
provide: env,
useValue: environment
},
AuthProvider
],
bootstrap: [AppComponent]
})
export class AppModule {}
Empty file.
100 changes: 100 additions & 0 deletions apps/ues-recycling-angular/src/environments/definitions.ts
@@ -0,0 +1,100 @@
import { SearchSource, SearchSourceQueryParamsProperties } from '@tamu-gisc/search';
import { LayerSource, LegendItem } from '@tamu-gisc/common/types';

import esri = __esri;

export const Connections = {
basemapUrl: 'https://gis.tamu.edu/arcgis/rest/services/FCOR/TAMU_BaseMap/MapServer',
inforUrl: 'https://gis.tamu.edu/arcgis/rest/services/FCOR/MapInfo_20190529/MapServer',
accessibleUrl: 'https://fc-gis.tamu.edu/arcgis/rest/services/FCOR/ADA_120717/MapServer/0',
constructionUrl: 'https://gis.tamu.edu/arcgis/rest/services/FCOR/Construction_2018/MapServer',
recyclingPointsUrl: 'https://ues-arc.tamu.edu/arcgis/rest/services/Recycling/Utilities_Recycilng_WebMap/MapServer/0'
};

export const Definitions = {
BUILDINGS: {
id: 'buildings',
layerId: 'buildings-layer',
name: 'Buildings',
url: `${Connections.basemapUrl}/1`
},
RECYCLING: {
id: 'recycling',
layerId: 'recycling-layer',
name: 'Recycling Centers',
url: `${Connections.recyclingPointsUrl}`
}
};

const commonLayerProps = {
outFields: ['*'],
minScale: 100000,
maxScale: 0,
elevationInfo: { mode: 'relative-to-ground', offset: 1 } as esri.FeatureLayerElevationInfo,
popupEnabled: false
};

// Persistent layer definitions that will be processed by a factory and added to the map.
export const LayerSources: LayerSource[] = [
{
type: 'feature',
id: Definitions.RECYCLING.layerId,
title: Definitions.RECYCLING.name,
url: Definitions.RECYCLING.url,
listMode: 'hide',
visible: true,
layerIndex: 2,
native: {
...commonLayerProps,
definitionExpression: "public_view LIKE 'Yes'"
}
},
{
type: 'graphic',
id: 'selection-layer',
title: 'Selected Buildings',
category: 'Infrastructure',
listMode: 'hide',
visible: true
}
];

const commonQueryParams: Partial<SearchSourceQueryParamsProperties> = {
f: 'json',
resultRecordCount: 5,
outFields: '*',
outSR: 4326,
returnGeometry: true,
spatialRel: 'esriSpatialRelIntersects'
};

// Search sources used for querying features.
export const SearchSources: SearchSource[] = [];

export const SelectionSymbols = {
polygon: {
type: 'simple-fill',
style: 'solid',
color: [252, 227, 0, 0.55],
outline: {
color: [252, 227, 0, 0.8],
width: '2px'
}
},
point: {
type: 'simple-marker',
style: 'circle',
size: 8,
outline: {
width: 2
}
},
multipoint: {
type: 'simple-marker',
style: 'circle',
size: 8,
outline: {
width: 2
}
}
};
13 changes: 13 additions & 0 deletions apps/ues-recycling-angular/src/environments/environment.prod.ts
@@ -0,0 +1,13 @@
import { AuthOptions } from '@tamu-gisc/oidc/client';

export const environment = {
production: true
};

export * from './definitions';

export const apiUrl = 'https://nodes.geoservices.tamu.edu/api/ues/recycling/';
export const auth_options: AuthOptions = {
url: `https://nodes.geoservices.tamu.edu/api/ues/recycling`,
attach_href: true
};

0 comments on commit 21f1654

Please sign in to comment.