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

1226 create showcase app #217

Merged
merged 18 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
f316034
1226: Created showcase directory with generic angular application
Jordanafoster6 Sep 9, 2024
30146a4
1226: Update showcase port and import arcgis components
Jordanafoster6 Sep 9, 2024
8e995c6
clean up HTML of showcase app and separate the components
Jordanafoster6 Sep 23, 2024
241785f
fix html mistake in showcase component
Jordanafoster6 Sep 23, 2024
9dafb8d
added mock service file to arcgis plugin and mock data for event results
Jordanafoster6 Sep 23, 2024
112b394
setup mock service providers in showcase app module
Jordanafoster6 Sep 23, 2024
fff4f10
add type definition for arc service and mock arc service
Jordanafoster6 Sep 23, 2024
f9ee532
add material theme styles to showcase app
Jordanafoster6 Sep 24, 2024
a4c4f9b
add root injection to mock service
Jordanafoster6 Sep 24, 2024
8393ced
added BrowserAnimationsModule to showcase module to fix dialog issues
Jordanafoster6 Sep 25, 2024
68c09d2
added error handling for component initialization and subscription
Jordanafoster6 Sep 25, 2024
001c5ff
pulled in changes from develop so branch can be merged without conflicts
Jordanafoster6 Sep 29, 2024
34d935f
moved mock service and mock EventResult object to the showcase app an…
Jordanafoster6 Sep 30, 2024
ab4020f
remove arc-layer and arc-event imports from showcase because theyre a…
Jordanafoster6 Sep 30, 2024
da24454
remove title property from app.component.ts file
Jordanafoster6 Sep 30, 2024
6cdaad1
remove component stylesheet imports and use of showcase stylesheet
Jordanafoster6 Sep 30, 2024
3273549
remove comment left over from changes made to the configChangedNotifi…
Jordanafoster6 Oct 1, 2024
dba660f
remove showcase title from showcase page component
Jordanafoster6 Oct 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions plugins/arcgis/web-app/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,114 @@
}
}
}
},
"showcase": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
},
"root": "projects/showcase",
"sourceRoot": "projects/showcase/src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/showcase",
"index": "projects/showcase/src/index.html",
"main": "projects/showcase/src/main.ts",
"polyfills": "projects/showcase/src/polyfills.ts",
"tsConfig": "projects/showcase/tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": [
"projects/showcase/src/favicon.ico",
"projects/showcase/src/assets"
],
"styles": [
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
"projects/showcase/src/styles.scss"
],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
"fileReplacements": [
{
"replace": "projects/showcase/src/environments/environment.ts",
"with": "projects/showcase/src/environments/environment.prod.ts"
}
],
"outputHashing": "all"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"port": 4201
},
"configurations": {
"production": {
"browserTarget": "showcase:build:production"
},
"development": {
"browserTarget": "showcase:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "showcase:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/showcase/src/test.ts",
"polyfills": "projects/showcase/src/polyfills.ts",
"tsConfig": "projects/showcase/tsconfig.spec.json",
"karmaConfig": "projects/showcase/karma.conf.js",
"inlineStyleLanguage": "scss",
"assets": [
"projects/showcase/src/favicon.ico",
"projects/showcase/src/assets"
],
"styles": [
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
"projects/showcase/src/styles.scss"
],
"scripts": []
}
}
}
}
},
"cli": {
"analytics": false
}
}
2 changes: 1 addition & 1 deletion plugins/arcgis/web-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@
"tslint": "~6.1.0",
"typescript": "~4.6.4"
}
}
}
Jordanafoster6 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ export class FormResult {

export class FieldResult {
title: string;
}
}
Jordanafoster6 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class ArcEventComponent implements OnInit, OnChanges {

private eventsSubscription: Subscription;

@Input('config') config: ArcGISPluginConfig;
@Input('config') config: ArcGISPluginConfig = defaultArcGISPluginConfig;
private configSet = false;

@Input() configChangedNotifier: Observable<void>;
Expand Down
12 changes: 11 additions & 1 deletion plugins/arcgis/web-app/projects/main/src/lib/arc.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ import { EventResult } from './EventsResult'
export const baseUrl = '/plugins/@ngageoint/mage.arcgis.service'
export const apiBaseUrl = '/api'

export interface ArcServiceInterface {
fetchArcConfig(): Observable<ArcGISPluginConfig>;
fetchArcLayers(featureUrl: string): Observable<FeatureServiceResult>;
fetchEvents(): Observable<EventResult[]>;
fetchPopulatedEvents(): Observable<EventResult[]>;
putArcConfig(config: ArcGISPluginConfig): void;
removeUserTrack(userTrackId: string): Observable<ArcGISPluginConfig>;
removeOperation(operationId: string): Observable<ArcGISPluginConfig>;
}

@Injectable({
providedIn: 'root'
/*
Expand All @@ -17,7 +27,7 @@ export const apiBaseUrl = '/api'
providedIn: MageArcServicesModule
*/
})
export class ArcService {
export class ArcService implements ArcServiceInterface {

constructor(private http: HttpClient) {
}
Expand Down
16 changes: 16 additions & 0 deletions plugins/arcgis/web-app/projects/showcase/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 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
44 changes: 44 additions & 0 deletions plugins/arcgis/web-app/projects/showcase/karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html

module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
jasmine: {
// you can add configuration options for Jasmine here
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
// for example, you can disable the random execution with `random: false`
// or set a specific seed with `seed: 4321`
},
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces
},
coverageReporter: {
dir: require('path').join(__dirname, '../../coverage/showcase'),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'text-summary' }
]
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';

const routes: Routes = [];

@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
Jordanafoster6 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<!-- Showcase Content -->
<div>
<arc-admin class="arc-admin"></arc-admin>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';

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 'showcase'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('showcase');
});

it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('.content span')?.textContent).toContain('showcase app is running!');
});
});
Jordanafoster6 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Component } from '@angular/core';

@Component({
selector: 'app-root',
templateUrl: './app.component.html'
})
export class AppComponent {}
30 changes: 30 additions & 0 deletions plugins/arcgis/web-app/projects/showcase/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { MageArcModule } from 'projects/main/src/public-api';

import { ArcService } from 'projects/main/src/lib/arc.service';
import { MockArcService } from './arc.service.mock';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

@NgModule({
declarations: [
AppComponent
],
imports: [
MageArcModule,
BrowserModule,
BrowserAnimationsModule, // ENABLES ANIMATIONS
AppRoutingModule
],
providers: [
{
provide: ArcService,
useClass: MockArcService
}
],
bootstrap: [AppComponent]
})
export class AppModule { }
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { Observable, of } from "rxjs";
import { Injectable } from '@angular/core'
import { ArcServiceInterface } from "../../../main/src/lib/arc.service";
import { EventResult } from '../../../main/src/lib/EventsResult';
import { ArcGISPluginConfig, defaultArcGISPluginConfig } from '../../../main/src/lib/ArcGISPluginConfig';

export const mockArcGISEventResult = Object.freeze<EventResult>({
id: 0,
name: 'test event result name',
forms: [{
id: 1,
name: 'test form result name',
fields: [{
title: 'test field'
}]
}]
})

@Injectable({
providedIn: 'root'
})
export class MockArcService implements ArcServiceInterface {
fetchArcConfig(): Observable<ArcGISPluginConfig> {
return of(defaultArcGISPluginConfig)
}

fetchArcLayers(featureUrl: string) {
return of({
layers: [
{
id: 0,
name: 'mage_sync',
geometryType: 'esriGeometryPoint'
},
]
}
)
}

fetchEvents() {
return of([mockArcGISEventResult])
}

fetchPopulatedEvents() {
return of([mockArcGISEventResult])
}

putArcConfig(config: ArcGISPluginConfig) {}

removeUserTrack(userTrackId: string): Observable<ArcGISPluginConfig> {
return of(
defaultArcGISPluginConfig
)
}

removeOperation(operationId: string): Observable<ArcGISPluginConfig> {
return of(
defaultArcGISPluginConfig
)
}
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const environment = {
production: true
};
Loading
Loading