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

feat(ues-recycling): UES recycling mapping app #109

Merged
merged 37 commits into from May 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
f1faa1a
Added base angular and nest data api apps
Proantagonist Dec 16, 2020
3a0f379
Added ues recycling common entities lib
Proantagonist Dec 16, 2020
cb8cfa8
Added base recycling data-api and ngx libs
Proantagonist Dec 16, 2020
770700d
Populated api endpoints and services
Proantagonist Dec 17, 2020
bcc396e
Added angular data access module
Proantagonist Dec 21, 2020
6a0dce6
Generated ues-recycling-data-api-nest workspace def
Proantagonist Dec 22, 2020
86ace3d
Generated ues-recycling-angular app def
Proantagonist Dec 22, 2020
e0953a4
Added ues-recycling-common-entities lib def
Proantagonist Dec 22, 2020
4b8b3d7
Generated data api def
Proantagonist Dec 22, 2020
77b49fd
Added ues recycling ngx lib def
Proantagonist Dec 22, 2020
07ae517
Fixed API
Proantagonist Jan 5, 2021
6d88cd6
Added data entry initial views
Proantagonist Jan 5, 2021
bc8c4a6
Latest data view working
Proantagonist Jan 5, 2021
eb439c0
File upload view works
Proantagonist Jan 5, 2021
1d929a0
Visible recycling locations
Proantagonist Jan 5, 2021
dc008f8
Added total recycled cards and trend chart
Proantagonist Jan 7, 2021
0f97d03
Search and filtering working
Proantagonist Jan 9, 2021
d41d32b
Shows all data on startup
Proantagonist Jan 12, 2021
9c7066d
Added feature highlight
Proantagonist Jan 12, 2021
e895268
Added 3d visualizatio
Proantagonist Jan 12, 2021
d49ce7d
Delegating some map logic after view is available
Proantagonist Jan 12, 2021
9a82126
Added perspective toggle for 3d layer
Proantagonist Jan 12, 2021
e6ed38e
Added deployment package.json
Proantagonist Jan 13, 2021
261e82c
Added prod config
Proantagonist Jan 13, 2021
3db0428
Using SDE hosted service instead of AGOL service
Proantagonist Jan 13, 2021
aa1b1f5
Updated ues-recycling layer and legend sources
Proantagonist Mar 29, 2021
9aa3aa4
Added authentication for recycling endpoints
Proantagonist Apr 13, 2021
86dbee1
Update azure-pipelines.yml for Azure Pipelines
Proantagonist Apr 13, 2021
8062ca7
Added deployment ps scripts
Proantagonist Apr 13, 2021
1c7eaf1
Updated geojson utils dep
Proantagonist Apr 14, 2021
da8218c
Added global assets to build
Proantagonist Apr 14, 2021
da73db2
Added CORS allowed origins
Proantagonist Apr 14, 2021
be5e05c
Added iis rewrite clear ps scripts
Proantagonist Apr 14, 2021
19f9236
Skip nx cache
Proantagonist Apr 14, 2021
2b92d9a
Added authentication to locations routes
Proantagonist May 7, 2021
87bc57a
Re-implemented authentication with generalized auth implementation
Proantagonist May 11, 2021
4b0bb0b
Formatting pass
Proantagonist May 14, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
};