Skip to content
Snippets Groups Projects
Commit 65bd959c authored by Alexander Lovett's avatar Alexander Lovett
Browse files

[LGR-70] - Remove UI

parent 92e010aa
No related branches found
No related tags found
No related merge requests found
Showing
with 296 additions and 917 deletions
* 2.0.13
* [LGR-70](https://jira.software.geant.org/browse/LGR-70) - Pull UI out of jar
# 2.0.12 # 2.0.12
* [LGR-74](https://jira.software.geant.org/browse/LGR-74) - Creating too many threads * [LGR-74](https://jira.software.geant.org/browse/LGR-74) - Creating too many threads
* [LGR-69](https://jira.software.geant.org/browse/LGR-69) - Switch to Jenkins pipeline
# 2.0.11 # 2.0.11
* [LGR-71](https://jira.software.geant.org/browse/LGR-71) - SAML AssertionConsumerServiceURL not always correct * [LGR-71](https://jira.software.geant.org/browse/LGR-71) - SAML AssertionConsumerServiceURL not always correct
......
library 'JavaPipeline' library 'SWDPipeline'
JavaPipeline(); JavaPipeline();
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<modelVersion>4.0.0</modelVersion> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.geant</groupId> <groupId>org.geant</groupId>
<artifactId>looking-glass-service</artifactId> <artifactId>looking-glass-service</artifactId>
<version>2.0.12.RELEASE</version> <version>2.0.13-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>looking-glass-service</name> <name>looking-glass-service</name>
<description>Looking Glass Demo</description> <description>Looking Glass Demo</description>
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.5.RELEASE</version> <version>2.0.5.RELEASE</version>
<relativePath /> <!-- lookup parent from repository --> <relativePath/> <!-- lookup parent from repository -->
</parent> </parent>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version> <java.version>1.8</java.version>
</properties> </properties>
<scm> <scm>
<developerConnection>scm:git:https://gitlab.geant.net/live-projects/looking-glass-service.git</developerConnection> <developerConnection>scm:git:https://gitlab.geant.net/live-projects/looking-glass-service.git
<tag>HEAD</tag> </developerConnection>
</scm> <tag>HEAD</tag>
</scm>
<distributionManagement> <distributionManagement>
<repository> <repository>
<id>looking-glass-releases</id> <id>looking-glass-releases</id>
<name>GEANT Artifactory-releases</name> <name>GEANT Artifactory-releases</name>
<url>https://artifactory.geant.net:443/artifactory/lg-release-local</url> <url>https://artifactory.geant.net:443/artifactory/lg-release-local</url>
</repository> </repository>
<snapshotRepository> <snapshotRepository>
<id>looking-glass-snapshots</id> <id>looking-glass-snapshots</id>
<name>GEANT Artifactory-snapshots</name> <name>GEANT Artifactory-snapshots</name>
<url>https://artifactory.geant.net:443/artifactory/lg-snapshot-local</url> <url>https://artifactory.geant.net:443/artifactory/lg-snapshot-local</url>
</snapshotRepository> </snapshotRepository>
</distributionManagement> </distributionManagement>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId> <artifactId>spring-boot-starter</artifactId>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId> <artifactId>spring-boot-starter-logging</artifactId>
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId> <artifactId>spring-boot-starter-actuator</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId> <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>mysql</groupId> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId> <artifactId>spring-boot-starter-data-rest</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId> <artifactId>spring-boot-starter-log4j2</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>ch.ethz.ganymed</groupId> <groupId>ch.ethz.ganymed</groupId>
<artifactId>ganymed-ssh2</artifactId> <artifactId>ganymed-ssh2</artifactId>
<version>262</version> <version>262</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.security.extensions</groupId> <groupId>org.springframework.security.extensions</groupId>
<artifactId>spring-security-saml2-core</artifactId> <artifactId>spring-security-saml2-core</artifactId>
<version>1.0.3.RELEASE</version> <version>1.0.3.RELEASE</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.springfox</groupId> <groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId> <artifactId>springfox-swagger2</artifactId>
<version>2.7.0</version> <version>2.7.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.springfox</groupId> <groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId> <artifactId>springfox-swagger-ui</artifactId>
<version>2.7.0</version> <version>2.7.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.micrometer</groupId> <groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId> <artifactId>micrometer-registry-prometheus</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.micrometer</groupId> <groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-statsd</artifactId> <artifactId>micrometer-registry-statsd</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>ru.yaal.maven</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>write-text-files-maven-plugin</artifactId>
<configuration> <version>1.1</version>
<jvmArguments>-Xdebug <configuration>
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005</jvmArguments> <charset>UTF-8</charset>
<mainClass>org.geant.lgservice.LookingGlassServiceApplication</mainClass> <files>
</configuration> <file>
<executions> <path>${project.build.directory}/${artifactId}.service</path>
<execution> <lines>
<goals> <line>[Unit]</line>
<goal>repackage</goal> <line>Description=${artifactId}</line>
</goals> <line>After=syslog.target</line>
</execution> <line>[Service]</line>
<execution> <line>User=${artifactId}</line>
<id>build-info</id> <line>ExecStart=/opt/${artifactId}/latest/bin/${artifactId}.${project.packaging} --spring.config.location=file:/opt/${artifactId}/${version}/config/application.yml</line>
<goals> <line>StandardOutput=syslog</line>
<goal>build-info</goal> <line>StandardError=syslog</line>
</goals> <line>SuccessExitStatus=143</line>
</execution> <line>[Install]</line>
</executions> <line>WantedBy=multi-user.target</line>
</plugin> </lines>
<plugin> </file>
<groupId>com.github.eirslett</groupId> </files>
<artifactId>frontend-maven-plugin</artifactId> </configuration>
<version>1.3</version> <executions>
<configuration> <execution>
<nodeVersion>v10.17.0</nodeVersion> <id>generate-service-file</id>
<npmVersion>6.4.1</npmVersion> <phase>prepare-package</phase>
<workingDirectory>src/main/web/</workingDirectory> <goals>
</configuration> <goal>write-text-files</goal>
<executions> </goals>
<execution> </execution>
<id>install node and npm</id> </executions>
<goals> </plugin>
<goal>install-node-and-npm</goal> <plugin>
</goals> <groupId>org.springframework.boot</groupId>
</execution> <artifactId>spring-boot-maven-plugin</artifactId>
<execution> <configuration>
<id>npm install</id> <jvmArguments>-Xdebug
<goals> -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005
<goal>npm</goal> </jvmArguments>
</goals> <mainClass>org.geant.lgservice.LookingGlassServiceApplication</mainClass>
</execution> <executable>true</executable>
<execution> </configuration>
<id>rebuild node-sass</id> <executions>
<goals> <execution>
<goal>npm</goal> <goals>
</goals> <goal>repackage</goal>
<configuration> </goals>
<arguments>rebuild node-sass --force</arguments> </execution>
</configuration> <execution>
</execution> <id>build-info</id>
<execution> <goals>
<id>npm run build</id> <goal>build-info</goal>
<goals> </goals>
<goal>npm</goal> </execution>
</goals> </executions>
<configuration> </plugin>
<arguments>run build</arguments> <plugin>
</configuration> <groupId>org.jacoco</groupId>
</execution> <artifactId>jacoco-maven-plugin</artifactId>
</executions> <version>0.8.5</version>
</plugin> <executions>
<execution>
<plugin> <goals>
<artifactId>maven-resources-plugin</artifactId> <goal>prepare-agent</goal>
<executions> </goals>
<execution> </execution>
<id>copy-angular-resources</id> <execution>
<phase>prepare-package</phase> <id>report</id>
<goals> <phase>prepare-package</phase>
<goal>copy-resources</goal> <goals>
</goals> <goal>report</goal>
<configuration> </goals>
<outputDirectory>${project.build.directory}/classes/resources/</outputDirectory> </execution>
<resources> </executions>
<resource> </plugin>
<directory>${project.basedir}/src/main/web/dist/looking-glass-gui/</directory> <plugin>
</resource> <groupId>de.dentrassi.maven</groupId>
</resources> <artifactId>rpm</artifactId>
</configuration> <version>1.4.0</version>
</execution> <executions>
</executions> <execution>
</plugin> <goals>
<goal>rpm</goal>
</plugins> </goals>
</build> <configuration>
<skipSigning>true</skipSigning>
<beforeInstallation>
<script>getent passwd ${artifactId} || useradd -r -s /bin/false ${artifactId}</script>
</beforeInstallation>
<rulesets>
<ruleset>
<id>default</id>
<rules>
<rule>
<user>${artifactId}</user>
<group>${artifactId}</group>
<mode>755</mode>
<when>
<type>directory</type>
</when>
</rule>
<rule>
<user>${artifactId}</user>
<group>${artifactId}</group>
<mode>744</mode>
<when>
<type>file</type>
</when>
</rule>
<rule>
<user>${artifactId}</user>
<group>${artifactId}</group>
<mode>755</mode>
<when>
<type>link</type>
</when>
</rule>
<rule>
<user>root</user>
<group>root</group>
<mode>0644</mode>
<when>
<prefix>/etc/systemd/system/</prefix>
<type>file</type>
</when>
</rule>
</rules>
</ruleset>
</rulesets>
<entries>
<entry>
<name>/opt/${artifactId}</name>
<directory>true</directory>
<ruleset>default</ruleset>
</entry>
<entry>
<name>/opt/${artifactId}/${version}</name>
<directory>true</directory>
<ruleset>default</ruleset>
</entry>
<entry>
<name>/opt/${artifactId}/${version}/bin</name>
<directory>true</directory>
<ruleset>default</ruleset>
</entry>
<entry>
<name>/opt/${artifactId}/${version}/config</name>
<directory>true</directory>
<ruleset>default</ruleset>
</entry>
<entry>
<name>/opt/${artifactId}/${version}/bin/${project.build.finalName}.${project.packaging}</name>
<file>${project.build.directory}/${project.build.finalName}.${project.packaging}</file>
<ruleset>default</ruleset>
</entry>
<entry>
<name>/opt/${artifactId}/latest</name>
<linkTo>/opt/${artifactId}/${version}</linkTo>
<ruleset>default</ruleset>
</entry>
<entry>
<name>/opt/${artifactId}/${version}/bin/${artifactId}.${project.packaging}</name>
<linkTo>/opt/${artifactId}/${version}/bin/${project.build.finalName}.${project.packaging}</linkTo>
<ruleset>default</ruleset>
</entry>
<entry>
<name>/etc/systemd/system/${artifactId}.service</name>
<file>${project.build.directory}/${artifactId}.service</file>
<ruleset>default</ruleset>
</entry>
</entries>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project> </project>
# looking-glass-gui
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.2.5.
## Development server
Run `ng serve --configuration=development` for a dev server. Navigate to `http://localhost:4200/`. Any backing sources are mocked, permitting development without the need to run the java backend.
## Integration server
Run `ng serve --configuration=integration` This will make http calls out to the api. Note you might have to fudge the implementation classes to add the correct port, configuring this should be present in later versions
## Code scaffolding
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
## Build
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
## Running unit tests
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Running end-to-end tests
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
## Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"looking-glass-gui": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {
"@schematics/angular:component": {
"styleext": "scss"
}
},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/looking-glass-gui",
"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.scss",
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"node_modules/animate.css/animate.min.css",
"node_modules/font-awesome/css/font-awesome.min.css",
"node_modules/leaflet/dist/leaflet.css",
"node_modules/leaflet-defaulticon-compatibility/dist/leaflet-defaulticon-compatibility.webpack.css",
"node_modules/ionicons/dist/css/ionicons.css",
"node_modules/leaflet.awesome-markers/dist/leaflet.awesome-markers.css"
],
"scripts": [
"node_modules/jquery/dist/jquery.min.js",
"node_modules/bootstrap/dist/js/bootstrap.min.js",
"node_modules/leaflet/dist/leaflet.js",
"node_modules/leaflet.awesome-markers/dist/leaflet.awesome-markers.min.js"
]
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true
},
"development": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.development.ts"
}
]
},
"integration": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.integration.ts"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "looking-glass-gui:build"
},
"configurations": {
"production": {
"browserTarget": "looking-glass-gui:build:production"
},
"development": {
"browserTarget": "looking-glass-gui:build:development"
},
"integration": {
"browserTarget": "looking-glass-gui:build:integration"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "looking-glass-gui:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"src/styles.scss"
],
"scripts": [],
"assets": [
"src/favicon.ico",
"src/assets"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"looking-glass-gui-e2e": {
"root": "e2e/",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "looking-glass-gui:serve"
},
"configurations": {
"production": {
"devServerTarget": "looking-glass-gui:serve:production"
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "looking-glass-gui"
}
{
"name": "looking-glass-gui",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"prebuild": "npm install",
"build": "ng build --aot --prod --build-optimizer=true --vendor-chunk=true --extract-css"
},
"private": true,
"dependencies": {
"@angular/animations": "^6.1.10",
"@angular/common": "^6.1.0",
"@angular/compiler": "^6.1.0",
"@angular/core": "^6.1.0",
"@angular/forms": "^6.1.0",
"@angular/http": "^6.1.0",
"@angular/platform-browser": "^6.1.0",
"@angular/platform-browser-dynamic": "^6.1.0",
"@angular/router": "^6.1.0",
"@angular/material": "^6.1.0",
"@angular/cdk": "^6.1.0",
"@asymmetrik/ngx-leaflet-markercluster": "^3.0.0",
"animate.css": "^3.7.0",
"bootstrap": "^4.1.3",
"core-js": "^2.5.4",
"font-awesome": "^4.7.0",
"ionicons": "^4.4.6",
"jquery": "^3.3.1",
"leaflet": "1.3.1",
"leaflet-defaulticon-compatibility": "^0.1.1",
"leaflet.awesome-markers": "^2.0.4",
"leaflet.markercluster": "1.4.1",
"ng2-completer": "^2.0.8",
"ngx-pipes": "^2.3.6",
"rxjs": "^6.2.2",
"rxjs-compat": "^6.3.3",
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.8.0",
"@angular/cli": "^6.2.9",
"@angular/compiler-cli": "^6.1.0",
"@angular/language-service": "^6.1.0",
"@types/es6-shim": "^0.31.39",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"babel-core": "^6.26.3",
"babel-preset-es2015": "^6.24.1",
"babelify": "^10.0.0",
"browserify": "^16.2.3",
"codelyzer": "~4.3.0",
"gulp": "^4.0.0",
"gulp-clean": "^0.4.0",
"gulp-concat": "^2.6.1",
"gulp-count": "^1.0.0",
"gulp-sass": "^4.0.2",
"gulp-sourcemaps": "^2.6.4",
"gulp-typescript": "^5.0.0",
"gulp-uglify": "^3.0.1",
"gulp-util": "^3.0.8",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tsify": "^4.0.1",
"tslint": "~5.11.0",
"typescript": "^2.9.2",
"vinyl-buffer": "^1.0.1",
"vinyl-source-stream": "^2.0.0",
"watchify": "^3.11.0"
}
}
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ResultsComponent } from './interfaces/components/results/results.component';
import { HomeComponent } from './interfaces/components/home/home.component';
import { ErrorComponent } from './interfaces/components/error/error.component';
import { AdminComponent } from './interfaces/components/admin/admin.component';
import { NetworkRouterResolver } from './interfaces/resolvers/network-router-resolver';
import { UserResolver } from './interfaces/resolvers/user-resolver';
import { CommandResolver } from './interfaces/resolvers/command-resolver';
const routes: Routes = [
{
path: '',
component: HomeComponent,
resolve: {
networkRouters: NetworkRouterResolver,
user: UserResolver,
commandGroups: CommandResolver
}
},
{
path: 'results',
component: ResultsComponent
},
{
path: 'admin',
component: AdminComponent
},
{
path: 'authenticate',
component: HomeComponent
},
{
path: 'logout',
component: HomeComponent
},
{
path: 'error',
component: ErrorComponent
}
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule],
providers: [
NetworkRouterResolver,
UserResolver,
CommandResolver
]
})
export class AppRoutingModule { }
<div>
<app-navbar></app-navbar>
<div id="content">
<router-outlet></router-outlet>
</div>
<app-footer></app-footer>
</div>
import { TestBed, async } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
RouterTestingModule
],
declarations: [
AppComponent
],
}).compileComponents();
}));
// it('should create the app', () => {
// const fixture = TestBed.createComponent(AppComponent);
// const app = fixture.debugElement.componentInstance;
// expect(app).toBeTruthy();
// });
// it(`should have as title 'Looking Glass'`, () => {
// const fixture = TestBed.createComponent(AppComponent);
// const app = fixture.debugElement.componentInstance;
// expect(app.title).toEqual('Looking Glass');
// });
// it('should render title in a h1 tag', () => {
// const fixture = TestBed.createComponent(AppComponent);
// fixture.detectChanges();
// const compiled = fixture.debugElement.nativeElement;
// expect(compiled.querySelector('h1').textContent).toContain('Welcome to Looking Glass!');
// });
});
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
title = 'Looking Glass';
}
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { NavbarComponent } from './interfaces/components/navbar/navbar.component';
import { HomeComponent } from './interfaces/components/home/home.component';
import { ResultsComponent } from './interfaces/components/results/results.component';
import { HttpClientModule } from '@angular/common/http';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { FormsModule } from '@angular/forms';
import { NgPipesModule } from 'ngx-pipes';
import { FooterComponent } from './interfaces/components/footer/footer.component';
import { AdminComponent } from './interfaces/components/admin/admin.component';
import { ErrorComponent } from './interfaces/components/error/error.component';
import { environment } from 'src/environments/environment';
import { NetworkRouterViewCacheService } from './interfaces/views/cache/network-router-view-cache.service';
import { InfrastructureBackedNetworkRouterViewService } from './interfaces/views/infrastruture/infrastructure-backed-network-router-view.service';
import { SelectedOptionsCacheService } from './infrastructure/InMemory/selected-options-cache.service';
import { InfrastructureBackedCommandViewService } from './interfaces/views/infrastruture/infrastructure-backed-command-view.service';
import { CacheCommandViewService } from './interfaces/views/cache/cache-command-view.service';
@NgModule({
declarations: [
AppComponent,
NavbarComponent,
HomeComponent,
ResultsComponent,
FooterComponent,
AdminComponent,
ErrorComponent
],
imports: [
BrowserModule,
AppRoutingModule,
HttpClientModule,
BrowserAnimationsModule,
FormsModule,
NgPipesModule,
],
providers: [
{ provide: 'masterNetworkRouterViewService', useClass: InfrastructureBackedNetworkRouterViewService },
{ provide: 'networkRouterViewService', useClass: NetworkRouterViewCacheService },
{ provide: 'masterCommandViewService', useClass: InfrastructureBackedCommandViewService },
{ provide: 'commandViewService', useClass: CacheCommandViewService },
{ provide: 'networkRouterService', useClass: environment.providers.networkRouterService },
{ provide: 'userService', useClass: environment.providers.userService },
{ provide: 'commandService', useClass: environment.providers.commandService },
{ provide: 'selectedOptionsCache', useClass: SelectedOptionsCacheService }
],
bootstrap: [AppComponent]
})
export class AppModule { }
import { Command } from "./command";
import { Observable, from } from "rxjs";
export interface CommandService {
getCommands(): Observable<CommandService.Group>;
execute(request: CommandService.Request): Observable<CommandService.CommandResult>;
}
export namespace CommandService {
export class Group {
private name: string;
private commands: Command[];
constructor(name: string, commands: Command[]) {
this.name = name;
this.commands = commands;
}
public getName(): string {
return this.name;
}
public getCommands(): Command[] {
return this.commands;
}
}
export class Request {
private host: string;
private command: string;
constructor(host: string, command: string) {
this.host = host;
this.command = command;
}
static builder(): Request.Builder {
return new Request.Builder();
}
public getHost(): string {
return this.host;
}
public getCommand(): string {
return this.command;
}
}
export namespace Request {
export class Builder {
private host: string;
private command: string;
private argument: string;
private displayAsXml: boolean = false;
public withHost(host: string): Builder {
this.host = host;
return this;
}
public withCommand(command: string): Builder {
this.command = command;
return this;
}
public withArguments(argument: string): Builder {
this.argument = argument;
return this;
}
public asXml(asXml: boolean): Builder {
this.displayAsXml = asXml;
return this;
}
public build(): Request {
if (!this.command || this.command.trim().length < 1) {
throw new Error('Invalid command');
}
var command = this.command.trim();
if (this.argument && this.argument.trim().length > 0) {
command = `${command} ${this.argument}`
}
if (this.displayAsXml) {
command = `${command} | display xml`
}
return new Request(
this.host,
command
);
}
}
}
export class CommandResult {
private host: string;
private output: string;
private duration: number;
constructor(
host: string,
output: string,
duration: number) {
this.host = host;
this.output = output;
this.duration = duration;
}
public getHost(): string {
return this.host;
}
public getOutput(): string {
return this.output;
}
public getDuration(): number {
return this.duration;
}
}
}
\ No newline at end of file
export class Command {
private name: string;
private value: string;
private description: string;
private parametersRequired: boolean;
constructor(
name: string,
value: string,
description: string,
parametersRequired: boolean
) {
this.name = name;
this.value = value;
this.description = description;
this.parametersRequired = parametersRequired;
}
public getName(): string {
return this.name;
}
public getValue(): string {
return this.value;
}
public getDescription(): string {
return this.description;
}
public areParametersRequired(): boolean {
return this.parametersRequired;
}
}
export class Coordinates {
private latitude: string;
private longitude: string;
constructor(longitude: string, latitude: string) {
this.latitude = latitude;
this.longitude = longitude;
}
public getLatitude() : string {
return this.latitude;
}
public getLongitude(): string {
return this.longitude;
}
}
import { Observable } from 'rxjs';
import { NetworkRouter } from './network-router';
export interface NetworkRouterService {
getRouters(): Observable<NetworkRouter>;
}
import { Coordinates } from './coordinates'
export class NetworkRouter {
constructor(
private id: string,
private coordinates: Coordinates,
private countryCode: string,
private cityCode: string) {};
public getId(): string {
return this.id;
}
public getCoordinates(): Coordinates {
return this.coordinates;
}
public getCountryCode(): string {
return this.countryCode;
}
public getCityCode(): string {
return this.cityCode;
}
}
import { Observable } from "rxjs";
import { User } from "./user";
export interface UserService {
getUser(): Observable<User>;
}
export class User {
private givenName: string;
private surname: string;
constructor(givenName: string, surname: string) {
this.givenName = givenName;
this.surname = surname;
}
public getGivenName(): string {
return this.givenName;
}
public getSurname(): string {
return this.surname;
}
}
import { Injectable } from '@angular/core';
import { CommandService } from 'src/app/domain/command.service';
import { Command } from 'src/app/domain/command';
import { Observable, from, of } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class InMemoryCommandServiceService implements CommandService {
private commandGroups: CommandService.Group[] = [
new CommandService.Group(
"stubgroup",
[
new Command(
'stub',
'stub_command',
'a_stub_command',
false
),
new Command(
'stubWithArgs',
'stub_command_with_args',
'a_stub_command_with_args',
true
)
]
)
];
getCommands(): Observable<CommandService.Group> {
return from(this.commandGroups);
}
execute(request: CommandService.Request): Observable<CommandService.CommandResult> {
return of(request.getHost())
.map(host => new CommandService.CommandResult(
host,
`${host} ${request.getCommand()}`,
1
)
);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment