Commit 22c3ff77 by Tuomas Riihimäki

Merge branch 'angular2pages' into 'master'

Angular2pages

See merge request !393
2 parents 341df336 41a44f19
Showing with 4664 additions and 1795 deletions
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "angular6testi"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.scss"
],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"project": "src/tsconfig.app.json",
"exclude": "**/node_modules/**"
},
{
"project": "src/tsconfig.spec.json",
"exclude": "**/node_modules/**"
},
{
"project": "e2e/tsconfig.e2e.json",
"exclude": "**/node_modules/**"
}
],
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "css",
"component": {}
}
}
# Editor configuration, see http://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
max_line_length = off
trim_trailing_whitespace = false
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
# dependencies
/node_modules
/node
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
# misc
/.sass-cache
/connect.lock
/coverage/*
/libpeerconnection.log
npm-debug.log
testem.log
/typings
package-lock.json
# e2e
/e2e/*.js
/e2e/*.map
#System Files
.DS_Store
Thumbs.db
# devausnoteja (tmp ohjeet)
## Devaus
### devaus workflow
Kehittäminen on nopeampaa jos saa muutokset suoraan käyttöön, tämän takia kannattaa käynnistää lasikala ja webback-palvelin erikseen, ja proxyttää webbakista moya-jutut lasikalaan.
ng-palvelimessa on bugi, ja se ei osaa jakaa tavaraa muusta hakemistosta kuin /.
moyaproxy.conf.json sisältää proxyasetukset porttiin 8080.
Käyttö:
`ng serve --preserve-symlinks --proxy-config=moyaproxy.conf.json --base-href=/`
Tämän jälkeen kirjaa selaimesi sisään moyaan: http://localhost:4200/MoyaWeb/ ja surffata softaan: http://localhost:4200/
### HMR
HMR -asetukset löytyy, niistä ei nykyisellään ole mitään hyötyä. Saa poistaa.
## Koodijuttuja
### moya-rest
Oma moduulinsa, joka tullaan jossain vaiheessa eriyttämään ja käyttämään myös mahdollisessa nativescript-kännyappiksessa. Eli sen alle tulee vain servisejä, ei komponentteja.
### Muuta
Jos tulee muita järkeviä kokonaisuuksia, joita voi käyttää muualla, jaa omaan moduuliinsa.
## Hakemistohierarkia
* app
* pages `tämän alla on käytännössä "älykkäät" komponentit (stateful), eli componentit jotka tietää mitä dataa haetaan ja mistä. Käytännössä route -targetit`
* user `Loppukäyttäjälle näkyvät jutut, ohjleman ns. main moduuli`
* pizzatilaus
* listOpen.component.ts `avoimet pizzatilaukset joista voi tilata`
* own_orders.component.ts
* testit yms.
* admin `moya asetukset, esim. tuotteet, korttipohjat, oma moduulinsa joka lazyloadataan`
* admin.module.ts
* pizzatilaus
* pizzaedit.component.ts `hallitse mitä pizzoja voi tilata ylipäätänsä`
* info `tapahtumanaikana "infolaisen" toimesta tehtävät jutut, sisäänotto, käyttäjänhallinta jne. Oma moduulinsa joka lazyloadataan`
* info.module.ts
* viplist
* viplist.component.ts,html,jne
* viplist.service.ts
* pizzatilaus
* list.component.ts `listaa kaikki, ja lisää uusi pizzailaus`
* old-moya `Monessa paikassa käytettävät target -componentit tulevat omiksi kokonaisuudiksiin`
* old-moya.component.ts
* pizzatilaus `Jos halutaan lazyloadata jokin osa moyasta, tehdään siitä uusi päätason komponentti. Joka sitten laitetetaan user / admin yms. puolille route -targetiksi`
* pizzatilaus-route.module.ts
* pizza-user-order.component.ts
* menu `menu on täällä`
* shared `geneeriset, mihinkään osaan kuulumattomat jaetut modellit ja servicet tulevat tänne`
* models
* user.model.ts
* services
* moya-rest.service.ts
* session.service.ts
* widgets `tyhmät componponentit tulevat tänne`
* button
* html
* ts
* scss
* components `servicet sekä componenttien geneeriset tyhmät osat tulevat tämän hakemiston alle `
* viplist
* list.component.ts
* add.component.ts
* modules `Kokonaiset, monessa paikassa olevt kokonaisuuksien tyhmät osat tulevat tänne. Sen verta isot että ne kannattaa tehdä moduuleiksi`
* pizzatilaus
* anna-pizza.component.ts
* list-pizzat.component.ts,html,jne
* listItem.component.ts
* edit.component.ts
* pizzatilaus.service.ts
* pizza-tilaus.module.ts
## TODO
Tekemistä jota voi esim kämpissä säätää
### I18N
I18N loaderi webpackkiin. Esim. muuntaa properties-filun taulukoksi ja siihen joku localisointikirjasto, tai jotain.
### Paketointi
Miten paketoidaan moya niin että mukaan kääntyy myös angular -jutukkeet?
### Lazy loading
Lazy loading niin että se toimii vielä moyan kanssa, vaatinnee säätöä.
### Travis yms. autotestit
oma travis-palvelin, ja siihen autotestit
Ehkä greenkeeper, jos sitä voi hostata ite
### Testit
Integraatio jne. testit, aloitteliat ei riko asioita niin todennäköisesti.
### WebPack ja buildin minimointi
aot-kääntäminen ja siihen comperssointia jne.
# MoyaAngular, generoidut ohjeet
This project was generated with [angular-cli](https://github.com/angular/angular-cli) version 1.0.0-beta.24.
## Development server
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
## Code scaffolding
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive/pipe/service/class/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/).
Before running the tests make sure you are serving the app via `ng serve`.
## Deploying to Github Pages
Run `ng github-pages:deploy` to deploy to Github Pages.
## 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).
<pretty-config xmlns="http://ocpsoft.org/schema/rewrite-config-prettyfaces"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ocpsoft.org/schema/rewrite-config-prettyfaces
http://ocpsoft.org/xml/ns/prettyfaces/rewrite-config-prettyfaces.xsd">
<rewrite match="^(?!.*\.(js|css|jpg|gif|png|ico|html|svg)$).*$" substitute="/index.html" redirect="chain" />
</pretty-config>
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:web="http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<display-name>MoyaAngularWeb</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
import { MoyaAngularPage } from './app.po';
describe('moya-angular App', function() {
let page: MoyaAngularPage;
beforeEach(() => {
page = new MoyaAngularPage();
});
it('should display message saying app works', () => {
page.navigateTo();
expect(page.getParagraphText()).toEqual('app works!');
});
});
import { browser, element, by } from 'protractor';
export class MoyaAngularPage {
navigateTo() {
return browser.get('/');
}
getParagraphText() {
return element(by.css('app-root h1')).getText();
}
}
{
"compileOnSave": false,
"compilerOptions": {
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",
"outDir": "../dist/out-tsc-e2e",
"sourceMap": true,
"target": "es5",
"typeRoots": [
"../node_modules/@types"
]
}
}
// Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', 'angular-cli'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-remap-istanbul'),
require('angular-cli/plugins/karma')
],
files: [
{ pattern: './src/test.ts', watched: false }
],
preprocessors: {
'./src/test.ts': ['angular-cli']
},
mime: {
'text/x-typescript': ['ts','tsx']
},
remapIstanbulReporter: {
reports: {
html: 'coverage',
lcovonly: './coverage/coverage.lcov'
}
},
angularCli: {
config: './angular-cli.json',
environment: 'dev'
},
reporters: config.angularCli && config.angularCli.codeCoverage
? ['progress', 'karma-remap-istanbul']
: ['progress'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
});
};
{
"/MoyaWeb": {
"target": "http://localhost:8080",
"secure": false
}
}
{
"name": "moya-angular",
"version": "0.0.0",
"license": "UNLICENSED",
"angular-cli": {},
"scripts": {
"ng": "ng",
"start": "ng serve --proxy-config=moyaproxy.conf.json --base-href=/",
"build": "ng build",
"aot": "ng build --aot",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"version": "ng version"
},
"private": true,
"dependencies": {
"@angular/animations": "^5.2.9",
"@angular/common": "^5.2.9",
"@angular/compiler": "^5.2.9",
"@angular/core": "^5.2.9",
"@angular/forms": "^5.2.9",
"@angular/http": "^5.2.9",
"@angular/material": "^5.2.4",
"@angular/platform-browser": "^5.2.9",
"@angular/platform-browser-dynamic": "^5.2.9",
"@angular/router": "^5.2.9",
"bootstrap": "^4.0.0",
"core-js": "^2.5.1",
"ngx-bootstrap": "^2.0.2",
"rxjs": "^5.5.0",
"ts-helpers": "^1.1.1",
"zone.js": "^0.8.19"
},
"devDependencies": {
"@angular/cdk": "^5.2.4",
"@angular/cli": "^1.7.3",
"@angular/compiler-cli": "^5.2.9",
"@angular/language-service": "^5.2.9",
"@types/jasmine": "~2.8.3",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~9.4.6",
"codelyzer": "^4.0.1",
"jasmine-core": "~3.1.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~2.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.3.0",
"ts-node": "~5.0.0",
"tslint": "~5.9.1",
"typescript": "~2.5.3"
}
}
<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">
<modelVersion>4.0.0</modelVersion>
<artifactId>moya-angular</artifactId>
<packaging>war</packaging>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>${war-plugin-version}</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
<packagingExcludes>%regex[WEB-INF/lib/(?!rewrite-.*\.jar)(?!moya-restpojo.*\.jar).*]</packagingExcludes>
<webResources>
<resource>
<directory>./dist/</directory>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>${eirslett.frontend.version}</version>
<executions>
<execution>
<!-- optional: you don't really need execution ids,
but it looks nice in your build log. -->
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<configuration>
<nodeVersion>${js.node.version}</nodeVersion>
<npmVersion>${js.npm.version}</npmVersion>
</configuration>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
</execution>
<execution>
<id>npm run build</id>
<goals>
<goal>npm</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<arguments>run build</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.ocpsoft.rewrite</groupId>
<artifactId>rewrite-servlet</artifactId>
<version>${rewriteservlet.version}</version>
</dependency>
<dependency>
<groupId>org.ocpsoft.rewrite</groupId>
<artifactId>rewrite-config-prettyfaces</artifactId>
<version>${rewriteservlet.version}</version>
</dependency>
</dependencies>
<parent>
<groupId>fi.codecrew.moya</groupId>
<artifactId>moya-parent</artifactId>
<version>1.2-SNAPSHOT</version>
<relativePath>../moya-parent/pom.xml</relativePath>
</parent>
</project>
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
/*global jasmine */
var SpecReporter = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./e2e/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
useAllAngular2AppRoots: true,
beforeLaunch: function() {
require('ts-node').register({
project: 'e2e'
});
},
onPrepare: function() {
jasmine.getEnv().addReporter(new SpecReporter());
}
};
<div id="top-container">
<div id="left-menu">
<router-outlet name="left-menu"></router-outlet>
</div>
<div id="contentarea">
<div id="topbar">
<top-menu></top-menu>
</div>
<div id="content">
<router-outlet></router-outlet>
</div>
</div>
</div>
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var core_1 = require('@angular/core');
var AppComponent = (function () {
function AppComponent(router, zone) {
this.router = router;
this.zone = zone;
this.counter = 4;
this.title = 'app works!';
window.angularRoute = (function (url) {
zone.run(function () {
router.navigateByUrl(url);
});
});
// Enable change detection sometimes to see that it's not overflooded.
// bcause it takes time
//zone.onMicrotaskEmpty.subscribe(() => {console.log(".");}); // <-- Print "." everytime change detection is possibly
}
AppComponent = __decorate([
core_1.Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
], AppComponent);
return AppComponent;
}());
exports.AppComponent = AppComponent;
#top-container {
width: 100%;
display: flex;
min-height: 100%;
}
#left-menu {
}
#contentarea {
flex-grow: 1;
display: flex;
flex-direction: column;
}
#topbar {
margin-bottom: 30px;
}
#content {
display: flex;
flex-direction: row;
background-color: white;
margin-left: 30px;
padding: 20px;
flex-grow: 1;
}
/* tslint:disable:no-unused-variable */
import { TestBed, async } from '@angular/core/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [
AppComponent
],
});
TestBed.compileComponents();
});
it('should create the app', async(() => {
let fixture = TestBed.createComponent(AppComponent);
let app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
it(`should have as title 'app works!'`, async(() => {
let fixture = TestBed.createComponent(AppComponent);
let app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('app works!');
}));
it('should render title in a h1 tag', async(() => {
let fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
let compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain('app works!');
}));
});
import {Component, NgZone} from '@angular/core';
import {Router} from '@angular/router';
declare var window: any;
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
constructor(private router: Router, private zone: NgZone) {
window.angularRoute = (url => {
zone.run(() => {
router.navigateByUrl(url);
});
});
}
}
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var platform_browser_1 = require('@angular/platform-browser');
var core_1 = require('@angular/core');
var forms_1 = require('@angular/forms');
var http_1 = require('@angular/http');
var app_component_1 = require('./app.component');
var viplist_component_1 = require('./viplist/viplist.component');
var ng2_bootstrap_1 = require("ng2-bootstrap");
var moya_angular_common_1 = require("moya-angular-common");
var router_1 = require('@angular/router');
var test_component_1 = require("./test/test.component");
var old_moya_component_1 = require('./old-moya/old-moya.component');
var safe_pipe_1 = require('./safe.pipe');
var appRoutes = [
{ path: 'vip/viplist', component: viplist_component_1.ViplistComponent },
{ path: 'test', component: test_component_1.TestComponent },
{ path: 'old', component: old_moya_component_1.OldMoyaComponent }
];
var AppModule = (function () {
function AppModule() {
}
AppModule = __decorate([
core_1.NgModule({
declarations: [
app_component_1.AppComponent,
viplist_component_1.ViplistComponent,
test_component_1.TestComponent,
old_moya_component_1.OldMoyaComponent,
safe_pipe_1.SafePipe,
],
imports: [
platform_browser_1.BrowserModule,
forms_1.FormsModule,
http_1.HttpModule,
ng2_bootstrap_1.AlertModule.forRoot(),
moya_angular_common_1.MoyaRestModule.forRoot(),
router_1.RouterModule.forRoot(appRoutes)
],
providers: [],
bootstrap: [app_component_1.AppComponent]
})
], AppModule);
return AppModule;
}());
exports.AppModule = AppModule;
import {BrowserModule} from '@angular/platform-browser';
import {Injector, NgModule, ReflectiveInjector} from '@angular/core';
import {FormsModule} from '@angular/forms';
import {AppComponent} from './app.component';
import {ViplistComponent} from './viplist/viplist.component';
import {AlertModule} from 'ngx-bootstrap';
import {RouterModule, Routes} from '@angular/router';
import {OldMoyaComponent} from './pages/old-moya/old-moya.component';
import {TestComponent} from './test/test.component';
import {AdminMenuComponent} from './menu/admin-menu/admin-menu.component';
import {TopMenuComponent} from './menu/top-menu/top-menu.component';
import {LeftMenuComponent} from './menu/left-menu/left-menu.component';
import {InfoMenuComponent} from './menu/info-menu/info-menu.component';
import {UserMenuComponent} from './menu/user-menu/user-menu.component';
import {UserComponent} from './pages/user/user.component';
import {InfoComponent} from './pages/info/info.component';
import {AdminComponent} from './pages/admin/admin.component';
import {HttpClientModule, HttpHandler } from '@angular/common/http';
import { HttpModule } from '@angular/http';
import {StaticInjector} from "@angular/core/src/di/injector";
import {CommonModule} from "@angular/common";
import {CacheService} from "./shared/services/cache.service";
import {MoyaRestModule} from "./moya-rest";
import {SafePipe} from "./shared/pipes/safe.pipe";
const appRoutes: Routes = [
{
path: 'user',
children: [
{path: '', component: UserMenuComponent, outlet: 'left-menu'},
{path: '', pathMatch: 'full', component: UserComponent},
{path: 'old', component: OldMoyaComponent},
]
},
{
path: 'info',
children: [
{path: '', component: InfoMenuComponent, outlet: 'left-menu'},
{path: '', pathMatch: 'full', component: OldMoyaComponent},
{path: 'old', component: OldMoyaComponent},
{path: 'viplist', component: ViplistComponent},
]
},
{
path: 'admin',
children: [
{path: '', component: AdminMenuComponent, outlet: 'left-menu'},
{path: '', pathMatch: 'full', component: AdminComponent},
{path: 'old', component: OldMoyaComponent},
]
},
{path: 'old', pathMatch: 'prefix', component: OldMoyaComponent},
];
@NgModule({
declarations: [
AppComponent,
ViplistComponent,
OldMoyaComponent,
TestComponent,
TopMenuComponent,
LeftMenuComponent,
AdminMenuComponent,
InfoMenuComponent,
UserMenuComponent,
UserComponent,
InfoComponent,
AdminComponent,
SafePipe
],
imports: [
CommonModule,
BrowserModule,
FormsModule,
HttpClientModule,
AlertModule.forRoot(),
MoyaRestModule,
//MoyaRestModule.forRoot(),
RouterModule.forRoot(appRoutes)
],
providers: [CacheService],
bootstrap: [AppComponent]
})
export class AppModule {
}
<left-menu [menu]="menu" styleClass="adminMenu"></left-menu>
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { AdminMenuComponent } from './admin-menu.component';
describe('AdminMenuComponent', () => {
let component: AdminMenuComponent;
let fixture: ComponentFixture<AdminMenuComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AdminMenuComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(AdminMenuComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should be created', () => {
expect(component).toBeTruthy();
});
});
import {Component} from '@angular/core';
import {MenuGroup} from '../models/menu-group.model';
import {MENU} from '../defines/menu';
@Component({
selector: 'app-admin-menu',
templateUrl: './admin-menu.component.html',
styleUrls: ['./admin-menu.component.scss']
})
export class AdminMenuComponent {
menu: MenuGroup[] = MENU.ADMIN;
}
import {MenuGroup} from '../models/menu-group.model';
/**
* Created by tuukka on 13/05/17.
*/
export class MENU {
static ADMIN: MenuGroup[]= [
{
'name': 'Kauppa',
'items': [
{ 'path': '/admin/old', 'name': 'Products', 'params': {p: 'product/list.jsf'} }
]}
];
static INFO: MenuGroup[] = [
{
'name': 'Users',
'items': [
{ 'path': '/info/old', 'name': 'List users', 'params': {p: 'useradmin/list.jsf'} },
{ 'path': '/info/viplist', 'name': 'VipList'}
]}
];
static USER: MenuGroup[] = [
{
'name': 'Event',
'items': [
{ 'path': '/user/old', 'name': 'Poll', 'params': {p: 'poll/index.jsf'} },
{ 'path': '/user/old', 'name': 'Invite friends', 'params': {p: 'user/invite.jsf'} },
]},
{
'name': 'Shop',
'items': [
{ 'path': '/user/old', 'name': 'Buy Tickets', 'params': {p: 'shop/createBill.jsf'} },
{ 'path': '/user/old', 'name': 'Reserve Places', 'params': {p: 'neomap/reserve.jsf'} },
{ 'path': '/user/old', 'name': 'Change Places', 'params': {p: 'neomap/moveplaces.jsf'} },
{ 'path': '/user/old', 'name': 'Food Orders', 'params': {p: 'foodwave/list.jsf'} },
{ 'path': '/user/old', 'name': 'Own Orders', 'params': {p: 'bill/list.jsf'} },
{ 'path': '/user/old', 'name': 'Account Events', 'params': {p: 'user/accountEvents.jsf'} },
]},
{
'name': 'Computerplaces',
'items': [
{ 'path': '/user/old', 'name': 'Own Places', 'params': {p: 'place/myGroups.jsf'} },
{ 'path': '/user/old', 'name': 'Placemap', 'params': {p: 'neomap/view.jsf'} },
]},
{
'name': 'Competitions',
'items': [
{ 'path': '/user/old', 'name': 'Compos', 'params': {p: 'voting/compolist.jsf'} },
{ 'path': '/user/old', 'name': 'My entries', 'params': {p: 'voting/myEntries.jsf'} },
]},
{
'name': 'Profile',
'items': [
{ 'path': '/user/old', 'name': 'My Information', 'params': {p: 'user/edit.jsf'} },
{ 'path': '/user/old', 'name': 'Request Role', 'params': {p: 'orgrole/requestRole.jsf'} },
{ 'path': '/user/old', 'name': 'Change password', 'params': {p: 'user/changePassword.jsf'} },
{ 'path': '/user/old', 'name': 'Set GameIDs', 'params': {p: 'user/gameids.jsf'} },
]},
{
'name': 'Tournaments',
'items': [
{ 'path': '/user/old', 'name': 'Tournaments List', 'params': {p: 'tournaments/index.jsf'} },
{ 'path': '/user/old', 'name': 'My Participations', 'params': {p: 'tournaments/myparticipations.jsf'} },
]},
{
'name': 'Lectures and Courses',
'items': [
{ 'path': '/user/old', 'name': 'Participate', 'params': {p: 'lectures/viewLectures.jsf'} },
]},
];
}
<left-menu [menu]="menu" styleClass="infoMenu"></left-menu>
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { InfoMenuComponent } from './info-menu.component';
describe('InfoMenuComponent', () => {
let component: InfoMenuComponent;
let fixture: ComponentFixture<InfoMenuComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ InfoMenuComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(InfoMenuComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should be created', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
import {MenuGroup} from '../models/menu-group.model';
import {MENU} from '../defines/menu';
@Component({
selector: 'app-info-menu',
templateUrl: './info-menu.component.html',
styleUrls: ['./info-menu.component.scss']
})
export class InfoMenuComponent implements OnInit {
menu: MenuGroup[]= MENU.INFO;
constructor() { }
ngOnInit() {
}
}
<div id="leftNavTop" [class]="styleClass">
<nav id="leftNav">
<div *ngFor="let group of menu" class="leftNavGroup">
<span class="menuHeader">{{group.name}}</span>
<a *ngFor="let item of group.items" class="leftNavItem" [routerLink]="item.path" routerLinkActive="active" [queryParams]="item.params" >{{item.name}}</a>
</div>
</nav>
<a href="http://codecrew.fi" alt="Codecrew homepage" target="_blank"><img id="moya-logo" src="assets/moya-logo.svg" /></a>
</div>
@import "../../scss/main.scss";
#leftNavTop {
min-height: 100vh;
width: 255px;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
}
#moya-logo {
width: 130px;
margin-bottom: 20px;
}
#leftNav {
display: flex;
flex-direction: column;
width: inherit;
}
.leftNavItem {
font-family: Roboto;
font-size: 14px;
color: #FFFFFF;
text-align: center;
padding-bottom: 12px;
padding-top: 12px;
border-left: 3px solid transparent;
left: 0px;
right: 0px;
width: auto;
}
.leftNavItem.active {
background-image: linear-gradient(90deg, rgba(126, 142, 218,0.13) 0%, rgba(255,255,255,0.00) 92%);
border-left: 3px solid #69B1A1;
text-decoration: none;
}
.leftNavItem:hover {
//background-image: linear-gradient(90deg, rgba(126, 142, 218,0.13) 0%, rgba(255,255,255,0.00) 92%);
border-left: 3px solid #69B1A1;
text-decoration: none;
}
.leftNavGroup {
display: flex;
flex-direction: column;
font-family: Roboto;
font-weight: 500;
font-size: 15px;
color: #E49436;
letter-spacing: 1.17px;
margin-top: 30px;
text-align: center;
padding-bottom: 12px;
padding-top: 12px;
}
.adminMenu .leftNavGroup {
color: $user-color;
}
.userMenu {
// background-color: $user-color;
background-image: linear-gradient(0deg, #485173 0%, #141721 100%);
}
.adminMenu {
// background-color: $info-color;
background-image: linear-gradient(0deg, #fad9b1 0%, #de821f 100%);
}
.infoMenu{
// background-color: $admin-color;
background-image: linear-gradient(0deg, #569f8e 0%, #11141b 100%);
}
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { LeftMenuComponent } from './left-menu.component';
describe('LeftMenuComponent', () => {
let component: LeftMenuComponent;
let fixture: ComponentFixture<LeftMenuComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LeftMenuComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(LeftMenuComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should be created', () => {
expect(component).toBeTruthy();
});
});
import {Component, OnInit, Input} from '@angular/core';
import {MenuGroup} from '../models/menu-group.model';
@Component({
selector: 'left-menu',
templateUrl: './left-menu.component.html',
styleUrls: ['./left-menu.component.scss']
})
export class LeftMenuComponent implements OnInit {
@Input()
menu: MenuGroup[];
@Input()
styleClass: string;
constructor() {
}
ngOnInit() {
}
}
import {MenuItem} from './menu-item.model';
export interface MenuGroup {
name: string;
items: MenuItem[];
}
export interface MenuItem {
path: string;
name: string;
params?: any;
}
<nav id="topNav">
<a class="topNavItem" id="userTopNav" routerLink="/user" routerLinkActive="active" i18n>Kävijänäkymä</a>
<a class="topNavItem" id="infoTopNav" routerLink="/info" routerLinkActive="active" [queryParams]="{p: 'useradmin/list.jsf'}" i18n>Infonäkymä</a>
<a class="topNavItem" id="adminTopNav" routerLink="/admin" routerLinkActive="active" i18n>Ylläpitonäkymä</a>
</nav>
@import "../../scss/main.scss";
#topNav {
padding: 10px 10px 10px 30px;
display: flex;
background-color: white;
}
.topNavItem {
display: inline-block;
padding: 10px 20px 10px 20px;
margin-right: 10px;
font-family: Roboto;
font-size: 14px;
color: #FFFFFF;
letter-spacing: 0;
opacity: 0.5;
min-width: 100px;
text-align: center;
}
.topNavItem.active {
opacity: 1.0;
}
#userTopNav {
background: $user-color;
}
#infoTopNav {
background: $info-color;
}
#adminTopNav {
background: $admin-color;
}
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { TopMenuComponent } from './top-menu.component';
describe('TopMenuComponent', () => {
let component: TopMenuComponent;
let fixture: ComponentFixture<TopMenuComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ TopMenuComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(TopMenuComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should be created', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'top-menu',
templateUrl: './top-menu.component.html',
styleUrls: ['./top-menu.component.scss']
})
export class TopMenuComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
<left-menu [menu]="menu" styleClass="userMenu"></left-menu>
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { UserMenuComponent } from './user-menu.component';
describe('UserMenuComponent', () => {
let component: UserMenuComponent;
let fixture: ComponentFixture<UserMenuComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ UserMenuComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(UserMenuComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should be created', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
import {MenuGroup} from '../models/menu-group.model';
import {MENU} from '../defines/menu';
@Component({
selector: 'app-user-menu',
templateUrl: './user-menu.component.html',
styleUrls: ['./user-menu.component.scss']
})
export class UserMenuComponent implements OnInit {
menu: MenuGroup[]= MENU.USER;
constructor() { }
ngOnInit() {
}
}
export * from "./moya-rest.module"
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var core_1 = require('@angular/core');
var common_1 = require('@angular/common');
var http_1 = require("@angular/http");
var moya_rest_service_1 = require("../shared/services/moya-rest.service");
var viplist_service_1 = require("../shared/services/viplist.service");
var cache_service_1 = require("../shared/services/cache.service");
var user_service_1 = require("../shared/services/user.service");
var MoyaRestModule = (function () {
function MoyaRestModule() {
}
MoyaRestModule.forRoot = function () {
return {
ngModule: MoyaRestModule,
providers: [
moya_rest_service_1.MoyaRestService,
viplist_service_1.ViplistService,
cache_service_1.CacheService,
user_service_1.UserService
]
};
};
MoyaRestModule = __decorate([
core_1.NgModule({
imports: [
common_1.CommonModule,
http_1.HttpModule
],
declarations: []
})
], MoyaRestModule);
return MoyaRestModule;
}());
exports.MoyaRestModule = MoyaRestModule;
import {NgModule, ModuleWithProviders, NgZone, Injector} from '@angular/core';
import { CommonModule } from '@angular/common';
import {MoyaRestService} from "../shared/services/moya-rest.service";
import {ViplistService} from "../shared/services/viplist.service";
import {CacheService} from "../shared/services/cache.service";
import {UserService} from "../shared/services/user.service";
import {HttpClientModule} from "@angular/common/http";
import {HttpModule} from "@angular/http";
export * from "../shared/services/moya-rest.service";
export * from "../shared/services/viplist.service";
export * from "../shared/services/cache.service";
export * from "../shared/services/user.service";
export * from "../shared/models/user.model";
export * from "../shared/models/vip.model";
export * from "../shared/models/vip-product.model";
export * from "../shared/models/vip-product-delivery.model";
@NgModule({
imports: [
CommonModule,
HttpClientModule
],
declarations: [ ],
providers: [
MoyaRestService,
ViplistService,
CacheService,
UserService,
HttpClientModule
/*{ provide: NgZone, useFactory: () => new NgZone({}) },
{ provide: Injector, useFactory: () => Injector.create({providers: []}) } */
],
exports: [
],
})
export class MoyaRestModule {
/*
static forRoot(): ModuleWithProviders {
return {
ngModule: MoyaRestModule,
providers: [
MoyaRestService,
ViplistService,
CacheService,
UserService,
HttpClientModule
/*{ provide: NgZone, useFactory: () => new NgZone({}) },
{ provide: Injector, useFactory: () => Injector.create({providers: []}) }
]
};
}*/
}
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { AdminComponent } from './admin.component';
describe('AdminComponent', () => {
let component: AdminComponent;
let fixture: ComponentFixture<AdminComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AdminComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(AdminComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should be created', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-admin',
templateUrl: './admin.component.html',
styleUrls: ['./admin.component.scss']
})
export class AdminComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { InfoComponent } from './info.component';
describe('InfoComponent', () => {
let component: InfoComponent;
let fixture: ComponentFixture<InfoComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ InfoComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(InfoComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should be created', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-info',
templateUrl: './info.component.html',
styleUrls: ['./info.component.scss']
})
export class InfoComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
<iframe id="oldMoyaFrame" [src]="frameUrl | safe" [height]="height" #iframe (load)="changeUrl()" frameborder="0"></iframe>
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var core_1 = require('@angular/core');
var common_1 = require("@angular/common");
var OldMoyaComponent = (function () {
function OldMoyaComponent(location) {
this.location = location;
this.frameUrl = "/MoyaWeb/";
}
OldMoyaComponent.prototype.ngOnInit = function () {
};
OldMoyaComponent.prototype.logIt = function () {
console.log(this.frameUrl);
console.log(this.frametus.nativeElement.contentWindow.location.href);
console.log(location.path(true));
};
__decorate([
core_1.ViewChild('frametus')
], OldMoyaComponent.prototype, "frametus", void 0);
OldMoyaComponent = __decorate([
core_1.Component({
selector: 'app-old-moya',
providers: [common_1.Location, { provide: common_1.LocationStrategy, useClass: common_1.PathLocationStrategy }],
templateUrl: './old-moya.component.html',
styleUrls: ['./old-moya.component.css']
})
], OldMoyaComponent);
return OldMoyaComponent;
}());
exports.OldMoyaComponent = OldMoyaComponent;
:host {
display: flex;
flex-grow: 1;
}
#oldMoyaFrame {
flex-grow: 1;
}
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { OldMoyaComponent } from './old-moya.component';
describe('OldMoyaComponent', () => {
let component: OldMoyaComponent;
let fixture: ComponentFixture<OldMoyaComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ OldMoyaComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(OldMoyaComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should be created', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit, ViewChild, ElementRef } from '@angular/core';
import {Location, LocationStrategy, HashLocationStrategy, PathLocationStrategy} from '@angular/common';
import {NavigationExtras, ActivatedRoute, Router} from '@angular/router';
@Component({
selector: 'old-moya',
providers: [Location, {provide: LocationStrategy, useClass: PathLocationStrategy}],
templateUrl: './old-moya.component.html',
styleUrls: ['./old-moya.component.scss']
})
export class OldMoyaComponent implements OnInit {
frameUrl: String = '/MoyaWeb/';
@ViewChild('iframe') iframe: any;
height = '700px';
constructor(private location: Location, private route: ActivatedRoute) {
route.queryParamMap.map(a => a.get('p')).subscribe(x => {
console.log(x);
if (x) {
this.frameUrl = '/MoyaWeb/' + x.replace("::", "?");
}
});
}
ngOnInit() { }
changeUrl() {
let tmpFrameUrl = this.iframe.nativeElement.contentWindow.location.href.split('/MoyaWeb/', 2);
if (tmpFrameUrl.length > 1) {
this.location.replaceState(this.location.path(false).split('?', 1)[0] + '?p=' + tmpFrameUrl[1].replace("?", "::") );
}
console.log(this.iframe.nativeElement.contentWindow.document.body.height);
this.height = (this.iframe.nativeElement.contentWindow.document.body.scrollHeight + 50) + 'px';
}
}
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { UserComponent } from './user.component';
describe('UserComponent', () => {
let component: UserComponent;
let fixture: ComponentFixture<UserComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ UserComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(UserComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should be created', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-user',
templateUrl: './user.component.html',
styleUrls: ['./user.component.scss']
})
export class UserComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
$user-color: #2b2c3a;
$admin-color: #de821f;
$info-color: #69B1A1;
/**
* Created by tuukka on 15/02/17.
*/
"use strict";
// vim magic: %s/^\s*\w\+\s\+\(\w\+\)\s\+\(\w\+\)\s*.*;$/ \2: \L\1;/
(function (UserGender) {
UserGender[UserGender["MALE"] = 0] = "MALE";
UserGender[UserGender["FEMALE"] = 1] = "FEMALE";
UserGender[UserGender["UNSPECIFIED"] = 2] = "UNSPECIFIED";
})(exports.UserGender || (exports.UserGender = {}));
var UserGender = exports.UserGender;
var User = (function () {
function User() {
}
return User;
}());
exports.User = User;
/**
* Created by tuukka on 15/02/17.
*/
// vim magic: %s/^\s*\w\+\s\+\(\w\+\)\s\+\(\w\+\)\s*.*;$/ \2: \L\1;/
export enum UserGender {
MALE,
FEMALE,
UNSPECIFIED
}
export class User {
nick: string;
login: string;
eventuserId: number;
userId: number;
firstname: string;
lastname: string;
password: string;
birthday: Date;
gender: UserGender;
phoneNumber: string;
email: string;
streetAddress: string;
zipCode: string;
postOffice: string;
constructor() { }
}
/**
* Created by tuukka on 04/02/17.
*/
"use strict";
var VipProductDelivery = (function () {
function VipProductDelivery() {
}
return VipProductDelivery;
}());
exports.VipProductDelivery = VipProductDelivery;
/**
* Created by tuukka on 04/02/17.
*/
export class VipProductDelivery {
/*
public Integer id;
public Integer delivererId;
public BigDecimal quantity;
public Date deliveryTime;
public String notes;
*/
id: number;
delivererId: number;
quantity: number;
deliveryTime: Date;
notes: string;
constructor() {}
}
"use strict";
/**
* Created by tuukka on 04/02/17.
*/
var VipProduct = (function () {
function VipProduct() {
}
return VipProduct;
}());
exports.VipProduct = VipProduct;
import {VipProductDelivery} from "./vip-product-delivery.model";
/**
* Created by tuukka on 04/02/17.
*/
export class VipProduct {
/*
public Integer id;
public String name;
public Integer productId;
public String notes;
public BigDecimal quantity;
public BigDecimal delivered;
public List<VipProductDeliveryPojo> deliveries = new ArrayList<>();
*/
id: number;
name: string;
productId: number;
notes: string;
quantity: number;
delivered: number;
deliveries : VipProductDelivery[];
constructor() {}
}
"use strict";
/**
* Created by tuukka on 04/02/17.
*/
var Vip = (function () {
function Vip() {
}
return Vip;
}());
exports.Vip = Vip;
import {VipProduct} from "./vip-product.model";
import {User} from "./user.model";
/**
* Created by tuukka on 04/02/17.
*/
export class Vip {
/*
public Integer id;
public String description;
public String shortdescr;
public Date created;
public Integer eventuserId;
public Integer creatorId;
public Integer hostId;
public List<VipProductPojo> products = new ArrayList<>();
*/
id: number;
description: string;
shortdescr: string;
created: Date;
eventuserId: number;
creatorId: number;
host: User;
products: VipProduct[];
constructor() {
}
}
import { Pipe, PipeTransform } from '@angular/core';
import { DomSanitizer} from '@angular/platform-browser';
@Pipe({
name: 'safe'
})
export class SafePipe implements PipeTransform {
constructor(private sanitizer: DomSanitizer) {}
transform(url) {
return this.sanitizer.bypassSecurityTrustResourceUrl(url);
}
}
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var core_1 = require("@angular/core");
var rxjs_1 = require("rxjs");
var DEFAULT_EXPIRE_MS = 300000; // 5min
var CachedItem = (function () {
function CachedItem(moduleName, path, value, isObservable) {
this.moduleName = moduleName;
this.path = path;
this.value = value;
this.expires = new Date();
this.expires.setTime(Date.now() + DEFAULT_EXPIRE_MS);
this.isObservable = isObservable;
}
CachedItem.prototype.isExpired = function () {
return this.expires.getTime() < Date.now();
};
return CachedItem;
}());
/**
* Basic cacheService.
*
* First this was part of moyaRestService, but I thinked that if cache is too easy to use, someone will kill this application with it.
* So let's make it litlebit harder
*/
var CacheService = (function () {
// TODO: timed clearup for cache to save memory
function CacheService(zone) {
this.zone = zone;
this.cache = new Map();
this.timerObservable = rxjs_1.Observable.timer(30000, 30000); // afther 0.5min, every 0.5min.
}
/**
* This will return observable with value from cache, or cache value from your observable and return it in observable.
*
* example: return cacheService.cacheObservable("mymodule",<url>, http.get(<url>).map(v => v.json()));
*
* @param moduleName
* @param cachePath
* @param source: {Observable<any>} Observable where the values, which are cached, is coming from
* @return {Observable<any>}: if value is in cache, this is observable made from this value. Otherwise this is source observable.
*/
CacheService.prototype.cacheObservable = function (moduleName, cachePath, source) {
var _this = this;
var cacheName = this.generateCachename(moduleName, cachePath);
if (this.cache.has(cacheName) && this.cache.get(cacheName).expires.getTime() < Date.now()) {
console.log(cacheName, " Expired version in cache");
this.cache.delete(cacheName);
}
if (!this.cache.has(cacheName)) {
/*
not in cache, let's change source to hot -observable, and return one instance from it
problem is, that before this observable is runned, there can be queries for this value from cache.
So, let's change this to hot-observable, and put that hot-observable into the cache.
And in first run, we change this hot observable to it's value.
Javascript is asynchronous, so there is no need to worry some weird things that could happen in multithreaded languages.
*/
console.log(cacheName, " not in cache");
var hotSource = source
.do(function (val) { return _this.cache.set(cacheName, new CachedItem(moduleName, cachePath, val)); })
.publishLast().refCount();
this.cache.set(cacheName, new CachedItem(moduleName, cachePath, hotSource, true));
this.checkCleanTimer();
return hotSource;
}
var cacheItem = this.cache.get(cacheName);
// if value is hotObservable, return it, otherwise create observable from value
if (cacheItem.isObservable) {
console.log(cacheName, " hot observable in cache ");
return cacheItem.value;
}
console.log(cacheName, " value in cache");
this.checkCleanTimer();
return rxjs_1.Observable.of(cacheItem.value);
};
CacheService.prototype.clean = function () {
this.cache.clear();
this.checkCleanTimer();
};
CacheService.prototype.cleanExpired = function () {
var _this = this;
this.cache.forEach(function (v, k) {
if (v.isExpired()) {
console.log(k, " Cache expired");
_this.cache.delete(k);
}
});
this.checkCleanTimer();
};
CacheService.prototype.checkCleanTimer = function () {
var _this = this;
if (this.cache.size > 0) {
if (!this.timerSubscription) {
console.log("adding clearing timer");
this.zone.runOutsideAngular(function () {
_this.timerSubscription = _this.timerObservable.subscribe(function (v) {
_this.cleanExpired();
});
});
}
}
else {
if (this.timerSubscription) {
console.log("removing clearing timer");
this.timerSubscription.unsubscribe();
}
}
};
/**
*
* @param moduleName
* @param cachePath
* @param value
*/
CacheService.prototype.set = function (moduleName, cachePath, value) {
var cacheName = this.generateCachename(moduleName, cachePath);
this.cache.set(cacheName, new CachedItem(moduleName, cachePath, value));
};
/**
* Get one value from cache.
*
* Now when there is this observablethingy. Make public afther rethinking this.
*
* @param moduleName
* @param cachePath
* @return {any|null} Null if nothing is in cache.
*/
CacheService.prototype.get = function (moduleName, cachePath) {
var cacheName = this.generateCachename(moduleName, cachePath);
if (this.cache.has(cacheName) && this.cache.get(cacheName).expires.getTime() < Date.now()) {
this.cache.delete(cacheName);
}
if (this.cache.has(cacheName)) {
return this.cache.get(cacheName);
}
return null;
};
CacheService.prototype.generateCachename = function (moduleName, cachePath) {
return moduleName + "::" + cachePath;
};
CacheService = __decorate([
core_1.Injectable()
], CacheService);
return CacheService;
}());
exports.CacheService = CacheService;
/* tslint:disable:no-unused-variable */
import { TestBed, async, inject } from '@angular/core/testing';
import { CacheService } from './cache.service';
describe('CacheService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [CacheService]
});
});
it('should ...', inject([CacheService], (service: CacheService) => {
expect(service).toBeTruthy();
}));
});
import {Injectable, NgZone} from "@angular/core";
import {Observable} from "rxjs/Observable";
import 'rxjs/add/observable/timer';
import {forkJoin} from "rxjs/observable/forkJoin";
import "rxjs/add/operator/do";
import "rxjs/add/operator/publishLast";
import "rxjs/add/observable/of";
import {Subscription} from "rxjs/Subscription";
const DEFAULT_EXPIRE_MS = 300000; // 5min
class CachedItem {
moduleName: string;
path: string;
value: any;
expires: Date;
isObservable: boolean;
constructor(moduleName: string, path: string, value: any, isObservable? : boolean) {
this.moduleName = moduleName;
this.path = path;
this.value = value;
this.expires = new Date();
this.expires.setTime(Date.now() + DEFAULT_EXPIRE_MS);
this.isObservable = isObservable;
}
public isExpired(): boolean {
return this.expires.getTime() < Date.now();
}
}
/**
* Basic cacheService.
*
* First this was part of moyaRestService, but I thinked that if cache is too easy to use, someone will kill this application with it.
* So let's make it litlebit harder
*/
@Injectable()
export class CacheService {
private timerSubscription : Subscription;
private timerObservable: Observable<any>;
private cache: Map<string, CachedItem>;
// TODO: timed clearup for cache to save memory
constructor(private zone : NgZone) {
this.cache = new Map<string, CachedItem>();
this.timerObservable = Observable.timer(30000, 30000); // afther 0.5min, every 0.5min.
}
/**
* This will return observable with value from cache, or cache value from your observable and return it in observable.
*
* example: return cacheService.cacheObservable("mymodule",<url>, http.get(<url>).map(v => v.json()));
*
* @param moduleName
* @param cachePath
* @param source: {Observable<any>} Observable where the values, which are cached, is coming from
* @return {Observable<any>}: if value is in cache, this is observable made from this value. Otherwise this is source observable.
*/
public cacheObservable(moduleName: string, cachePath: string, source: Observable<any>): Observable<any> {
let cacheName = this.generateCachename(moduleName, cachePath);
if(this.cache.has(cacheName) && this.cache.get(cacheName).expires.getTime() < Date.now()) {
console.log(cacheName, " Expired version in cache");
this.cache.delete(cacheName);
}
if(!this.cache.has(cacheName)) {
/*
not in cache, let's change source to hot -observable, and return one instance from it
problem is, that before this observable is runned, there can be queries for this value from cache.
So, let's change this to hot-observable, and put that hot-observable into the cache.
And in first run, we change this hot observable to it's value.
Javascript is asynchronous, so there is no need to worry some weird things that could happen in multithreaded languages.
*/
console.log(cacheName," not in cache");
let hotSource = source
.do(val => this.cache.set(cacheName, new CachedItem(moduleName,cachePath, val)))
.publishLast().refCount();
this.cache.set(cacheName, new CachedItem(moduleName,cachePath, hotSource, true));
this.checkCleanTimer();
return hotSource;
}
let cacheItem = this.cache.get(cacheName);
// if value is hotObservable, return it, otherwise create observable from value
if(cacheItem.isObservable) {
console.log(cacheName, " hot observable in cache ");
return cacheItem.value;
}
console.log(cacheName, " value in cache");
this.checkCleanTimer();
return Observable.of(cacheItem.value);
}
public clean(): void {
this.cache.clear();
this.checkCleanTimer();
}
public cleanExpired(): void {
this.cache.forEach((v,k) => {
if(v.isExpired()) {
console.log(k, " Cache expired");
this.cache.delete(k);
}});
this.checkCleanTimer();
}
private checkCleanTimer() {
if(this.cache.size > 0) {
if(!this.timerSubscription) {
console.log("adding clearing timer");
this.zone.runOutsideAngular(() => {
this.timerSubscription = this.timerObservable.subscribe(v => {
this.cleanExpired();
});
});
}
} else {
if(this.timerSubscription) {
console.log("removing clearing timer");
this.timerSubscription.unsubscribe();
}
}
}
/**
*
* @param moduleName
* @param cachePath
* @param value
*/
private set(moduleName: string, cachePath: string, value: any): void {
let cacheName = this.generateCachename(moduleName, cachePath);
this.cache.set(cacheName, new CachedItem(moduleName,cachePath, value));
}
/**
* Get one value from cache.
*
* Now when there is this observablethingy. Make public afther rethinking this.
*
* @param moduleName
* @param cachePath
* @return {any|null} Null if nothing is in cache.
*/
private get(moduleName: string, cachePath: string): CachedItem {
let cacheName = this.generateCachename(moduleName, cachePath);
if(this.cache.has(cacheName) && this.cache.get(cacheName).expires.getTime() < Date.now()) {
this.cache.delete(cacheName);
}
if(this.cache.has(cacheName)) {
return this.cache.get(cacheName);
}
return null;
}
private generateCachename(moduleName: string, cachePath: string): string {
return moduleName + "::" + cachePath;
}
}
/* tslint:disable:no-unused-variable */
import { TestBed, async, inject } from '@angular/core/testing';
import { MoyaRestService } from './moya-rest.service';
describe('MoyaRestService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [MoyaRestService]
});
});
it('should ...', inject([MoyaRestService], (service: MoyaRestService) => {
expect(service).toBeTruthy();
}));
});
import { Injectable } from '@angular/core';
import {Observable} from "rxjs/Observable";
import {HttpClient, HttpResponse} from "@angular/common/http";
import "rxjs/add/operator/catch";
import "rxjs/add/observable/throw";
@Injectable()
export class MoyaRestService {
constructor(private http: HttpClient) { }
post(subUrl: string, body: any, pathParameters?: Map<string, string>): Observable<any> {
return this.http.post(this.genUrl(subUrl, pathParameters), body)
.catch(this.handleException);
}
put(subUrl: string, body: any, pathParameters?: Map<string, string>): Observable<any> {
return this.http.put(this.genUrl(subUrl, pathParameters), body)
.catch(this.handleException);
}
delete(subUrl: string, pathParameters?: Map<string, string>): Observable<any> {
return this.http.delete(this.genUrl(subUrl, pathParameters))
.catch(this.handleException);
}
get(subUrl: string, pathParameters?: Map<string, string>): Observable<any> {
return this.http.get(this.genUrl(subUrl, pathParameters))
.catch(this.handleException);
}
private genUrl(subUrl: string, urlParams?: Map<string, string>): string {
let suffix = "";
if(urlParams) {
urlParams.forEach(function(value: string, key: string) {
if(suffix.length <= 0) {
suffix = "?";
} else {
suffix += "&";
}
suffix += key + "=" + value;
});
}
return "/MoyaWeb/rest/" + subUrl + suffix; // <-- TODO: kauneista
}
/*
private handleResponse(res: HttpResponse<any>) {
console.log(res);
// basicly, 200 statuscodes means success
if(!(res.status >= 200 && res.status <= 299 )) {
console.log("statuscode not between 200 and 299", res.status);
// next stop: handlerException
throw res;
}
return res;
}*/
private handleException(error: HttpResponse<any> | any) {
console.log("error on jira rest connection", error);
// TODO: add handlers to 403's and other "not logged in" or "invalid permissions"
// -statuscodes, and route them using some nice global parameter
return Observable.throw(error);
}
}
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var core_1 = require("@angular/core");
var rxjs_1 = require("rxjs");
var UserService = (function () {
function UserService(moyaRest, cacheService) {
this.moyaRest = moyaRest;
this.cacheService = cacheService;
}
UserService.prototype.get = function (id) {
if (!id || id < 0) {
return rxjs_1.Observable.throw("There should be userid");
}
var path = "v2/user/" + id;
return this.cacheService.cacheObservable("moya:UserService", path, this.moyaRest.get(path)
.do(function (v) { console.log("getting user outside of cache", path); })
.map(function (res) { return (res.json()); }));
};
UserService = __decorate([
core_1.Injectable()
], UserService);
return UserService;
}());
exports.UserService = UserService;
/* tslint:disable:no-unused-variable */
import { TestBed, async, inject } from '@angular/core/testing';
import { UserService } from './user.service';
describe('UserService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [UserService]
});
});
it('should ...', inject([UserService], (service: UserService) => {
expect(service).toBeTruthy();
}));
});
import {Injectable} from "@angular/core";
import {User} from "../models/user.model";
import {MoyaRestService} from "./moya-rest.service";
import {CacheService} from "./cache.service";
import {Observable} from "rxjs/Observable";
@Injectable()
export class UserService {
constructor(private moyaRest : MoyaRestService, private cacheService : CacheService) { }
public get(id: number): Observable<User> {
if(!id || id < 0) {
return Observable.throw("There should be userid");
}
let path = "v2/user/" + id;
return this.cacheService.cacheObservable("moya:UserService", path,
this.moyaRest.get(path)
.do(v => {console.log("getting user outside of cache", path)})
.map(res => (<User> res.body)));
}
}
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments)).next());
});
};
var core_1 = require('@angular/core');
var rxjs_1 = require("rxjs");
var ViplistService = (function () {
function ViplistService(moyaRestService, userService) {
this.moyaRestService = moyaRestService;
this.userService = userService;
}
/**
* get vips
* @param searchString: searchString, skip to return all vips
*/
ViplistService.prototype.get = function (searchString) {
var _this = this;
if (!searchString) {
return this.moyaRestService.get("v3/vip/all")
.switchMap(function (res) { return rxjs_1.Observable.forkJoin.apply(rxjs_1.Observable, res.json().map(function (apiRow) { return _this.hostPopulator(apiRow); })); });
}
return this.moyaRestService.get("v3/vip/search/" + searchString)
.switchMap(function (v) { return rxjs_1.Observable.forkJoin.apply(rxjs_1.Observable, v.json().map(function (x) { return _this.hostPopulator(x); })); });
};
/**
* Delete vip.
*
* @param vip
* @return Observable
*/
ViplistService.prototype.delete = function (vip) {
return __awaiter(this, void 0, Promise, function* () {
if (!vip.id)
throw new Error("TODO: errori, tyhmä vippi");
var res = yield this.moyaRestService.delete("v3/vip/" + vip.id)
.first()
.toPromise();
return res.ok;
});
};
/*
public deleteProm(vip: Vip): Promise<boolean> {
if (!vip.id)
throw new Error("TODO: errori, tyhmä vippi");
return this.moyaRestService.delete("v3/vip/" + vip.id)
.first()
.toPromise()
.then(r => r.ok);
}
*/
ViplistService.prototype.getWithId = function (id) {
return this.moyaRestService.get("v3/vip/" + id)
.map(function (v) { return v.json(); });
};
ViplistService.prototype.create = function (vip) {
return this.moyaRestService.post("v3/vip/create", vip)
.map(function (v) { return v.json(); });
};
ViplistService.prototype.hostPopulator = function (rawVip) {
return this.userService.get(rawVip.hostId)
.map(function (u) { rawVip.host = u; return rawVip; });
};
ViplistService = __decorate([
core_1.Injectable()
], ViplistService);
return ViplistService;
}());
exports.ViplistService = ViplistService;
/* tslint:disable:no-unused-variable */
import { TestBed, async, inject } from '@angular/core/testing';
import { ViplistService } from './viplist.service';
describe('ViplistService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [ViplistService]
});
});
it('should ...', inject([ViplistService], (service: ViplistService) => {
expect(service).toBeTruthy();
}));
});
import {Injectable} from '@angular/core';
import {MoyaRestService} from "./moya-rest.service";
import {Vip} from "../models/vip.model";
import {Response} from "@angular/http";
import {User} from "../models/user.model";
import {UserService} from "./user.service";
import {Observable} from "rxjs/Observable";
import "rxjs/add/operator/map";
import "rxjs/add/operator/switchMap";
import "rxjs/add/observable/forkJoin";
import "rxjs/add/operator/first";
import {HttpResponse} from "@angular/common/http";
@Injectable()
export class ViplistService {
constructor(private moyaRestService: MoyaRestService, private userService : UserService) {
}
/**
* get vips
* @param searchString: searchString, skip to return all vips
*/
public get(searchString?: string): Observable<Array<Vip>> {
if (!searchString) {
return this.moyaRestService.get("v3/vip/all")
.switchMap(res => Observable.forkJoin(...res.map(apiRow => this.hostPopulator(apiRow))));
}
return this.moyaRestService.get("v3/vip/search/" + searchString)
.switchMap(v => Observable.forkJoin(...v.map(x => this.hostPopulator(x))));
}
/**
* Delete vip.
*
* @param vip
* @return Promise
*/
public async delete(vip: Vip): Promise<boolean> {
if (!vip.id)
throw new Error("TODO: errori, tyhmä vippi");
let res: HttpResponse<any> = await this.moyaRestService.delete("v3/vip/" + vip.id)
.first()
.toPromise();
return res.ok;
}
public getWithId(id: number): Observable<Vip> {
return this.moyaRestService.get("v3/vip/" + id)
}
public create(vip: Vip): Observable<Vip> {
return this.moyaRestService.post("v3/vip/create", vip)
}
private hostPopulator(rawVip : any): Observable<Vip> {
return this.userService.get(rawVip.hostId)
.map((u: User) => {rawVip.host = u; return <Vip> rawVip });
}
}
<span i18n>This is testfile</span>
<br />
<br />
<br />
<h1 i18n>Counter value</h1>
{{counter}}
<p i18n>{counter, plural, =0 {not pressed} =1 {pressed once} other {pressed many times}} </p>
<button (click)="addOne()" i18n>ADD ONE</button>
<span i18n>This is testfile</span>
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var core_1 = require('@angular/core');
var TestComponent = (function () {
function TestComponent() {
this.counter = 0;
}
TestComponent.prototype.ngOnInit = function () {
};
TestComponent.prototype.addOne = function () {
this.counter++;
};
__decorate([
core_1.Input()
], TestComponent.prototype, "counter", void 0);
TestComponent = __decorate([
core_1.Component({
selector: 'app-test',
templateUrl: './test.component.html',
styleUrls: ['./test.component.css']
})
], TestComponent);
return TestComponent;
}());
exports.TestComponent = TestComponent;
/* tslint:disable:no-unused-variable */
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { TestComponent } from './test.component';
describe('TestComponent', () => {
let component: TestComponent;
let fixture: ComponentFixture<TestComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ TestComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(TestComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import {Component, OnInit, Input} from '@angular/core';
@Component({
selector: 'app-test',
templateUrl: './test.component.html',
styleUrls: ['./test.component.scss']
})
export class TestComponent implements OnInit {
@Input() counter: number;
constructor() {
this.counter = 0;
}
ngOnInit() {
}
addOne() {
this.counter++;
}
}
<div class="container-fluid">
<div class="row bg-primary text-white titlerow">
<div class="col">Isäntä</div>
<div class="col-3">Nimi</div>
<div class="col">Kuvaus</div>
<div class="col-4">Tuotteet</div>
<div class="col">Muokkaa</div>
</div>
<div *ngFor="let vip of vips | async" class="row contentrow">
<div class="col">{{vip.host.firstname}}</div>
<div class="col-3"><b>{{vip.shortdescr}}</b></div>
<div class="col">{{vip.description}}</div>
<div class="col-4">
<div *ngFor="let p of vip.products" class="row">
<div style="display: inline-block;">{{p.name}}</div>
<div style="display: inline-block;">{{p.quantity}}</div>
<div style="display: inline-block; flex: 1;"> </div>
<div style="display: inline-block;"><button type="button" class="btn btn-default">Toimita</button></div>
</div>
</div>
<div class="col">todo</div>
</div>
<div *ngFor="let vip of vips | async" class="row contentrow">
<div class="col">{{vip.host.firstname}}</div>
<div class="col-3"><b>{{vip.shortdescr}}</b></div>
<div class="col">{{vip.description}}</div>
<div class="col-4">
<div *ngFor="let p of vip.products" class="row">
<div style="display: inline-block;">{{p.name}}</div>
<div style="display: inline-block;">{{p.quantity}}</div>
<div style="display: inline-block; flex: 1;"> </div>
<div style="display: inline-block;"><button type="button" class="btn btn-default">Toimita</button></div>
</div>
</div>
<div class="col">todo</div>
</div>
</div>
<br /><br />
<br /><br />
<br /><br />
<!--
<table class="table table-striped">
<thead>
<tr class="bg-primary text-white">
<th>Isäntä</th>
<th>Nimi</th>
<th>Kuvaus</th>
<th>Tuotteet</th>
<th>Muokkaa</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let vip of vips | async" >
<td class="">Kekkonen kekkonen</td>
<td class=""><b>{{vip.shortdescr}}</b></td>
<td class="">{{vip.description}}</td>
<td class="">
<div *ngFor="let p of vip.products" class="productsRow">
<div>{{p.name}}</div>
<div>{{p.quantity}}</div>
<div style="flex: 1;"> </div>
<div><button type="button" class="btn btn-default">Toimita</button></div>
</div>
</td>
<td class="">todo</td>
</tr>
</tbody>
</table>
-->
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var core_1 = require('@angular/core');
var ViplistComponent = (function () {
function ViplistComponent(viplistService) {
this.viplistService = viplistService;
}
ViplistComponent.prototype.ngOnInit = function () {
this.vips = this.viplistService.get();
};
ViplistComponent = __decorate([
core_1.Component({
selector: 'moya-viplist',
templateUrl: './viplist.component.html',
styleUrls: ['./viplist.component.css']
})
], ViplistComponent);
return ViplistComponent;
}());
exports.ViplistComponent = ViplistComponent;
.row {
display: flex;
flex-direction: row;
}
.productsRow {
display: flex;
flex-direction: row;
}
.productsRow:not(:last-child) {
margin-bottom: 3px;
border-bottom: 1px solid darkgray;
padding-bottom: 3px;
}
.kissa:nth-child(even) {
background-color: grey;
}
/* tslint:disable:no-unused-variable */
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { ViplistComponent } from './viplist.component';
describe('ViplistComponent', () => {
let component: ViplistComponent;
let fixture: ComponentFixture<ViplistComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ViplistComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ViplistComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import {Component, NgZone, OnInit} from '@angular/core';
import {Observable} from "rxjs/Observable";
import {Vip} from "../shared/models/vip.model";
import {ViplistService} from "../shared/services/viplist.service";
@Component({
selector: 'moya-viplist',
templateUrl: './viplist.component.html',
styleUrls: ['./viplist.component.scss']
})
export class ViplistComponent implements OnInit {
vips: Observable<Array<Vip>>;
constructor(private viplistService: ViplistService) {
}
ngOnInit() {
this.vips = this.viplistService.get();
}
}
<?xml version="1.0" encoding="UTF-8"?>
<svg width="695px" height="695px" viewBox="0 0 695 695" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 43.2 (39069) - http://www.bohemiancoding.com/sketch -->
<title>Moya-logo</title>
<desc>Created with Sketch.</desc>
<defs>
<circle id="path-1" cx="347.5" cy="347.5" r="347.5"></circle>
</defs>
<g id="Exportjutut" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Moya-logo">
<mask id="mask-2" fill="white">
<use xlink:href="#path-1"></use>
</mask>
<use id="bg" fill="#FFFFFF" xlink:href="#path-1"></use>
<g id="M" mask="url(#mask-2)">
<g transform="translate(83.548905, 190.045179)">
<polygon id="Path-3" fill="#4B4C53" points="449.867332 270.902613 517.324914 270.902613 406.84118 53.2464587 371.719459 117.206946"></polygon>
<polygon id="Path-3-Copy-2" fill="#4B4C53" points="223.003097 270.974179 289.369783 270.974179 178.108226 54.5480655 145.166718 118.284879"></polygon>
<polygon id="Path-4" fill="#69B1A1" points="289.323585 270.910137 406.906864 53.2748731 377.342132 0.153414611 370.090013 0.153414611 258.195348 210.246315"></polygon>
<polygon id="Path-4-Copy" fill="#69B1A1" points="64.9703444 270.836635 90.5241976 222.417957 58.5326149 161.068771 0.713589374 270.836635"></polygon>
<polygon id="Path-4-Copy-2" fill="#69B1A1" points="123.667349 159.935465 178.141888 54.53719 150.541837 0.0852033358 143.317376 0.0852033358 90.7363389 99.801993"></polygon>
<polygon id="Path-3-Copy" fill="#4B4C53" points="341.497382 270.837809 406.048634 270.837809 267.612338 0.141904677 260.333163 0.141904677 229.691259 51.3758733"></polygon>
</g>
</g>
</g>
</g>
</svg>
\ No newline at end of file
export const environment = {
production: false,
hmr: true
};
export const environment = {
production: true,
hmr: false
};
// The file contents for the current environment will overwrite these during build.
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
// The list of which env maps to which file can be found in `angular-cli.json`.
export const environment = {
production: false,
hmr: false
};
No preview for this file type
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>MoyaAngular</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<base href="/MoyaNG/">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root>Welcome to new MOYA</app-root>
</body>
</html>
import './polyfills.ts';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { environment } from './environments/environment';
import { AppModule } from './app/app.module';
if (environment.production) {
enableProdMode();
}
const bootstrap = () => {
return platformBrowserDynamic().bootstrapModule(AppModule);
};
bootstrap();
// This file includes polyfills needed by Angular 2 and is loaded before
// the app. You can add your own extra polyfills to this file.
import 'core-js/es6/symbol';
import 'core-js/es6/object';
import 'core-js/es6/function';
import 'core-js/es6/parse-int';
import 'core-js/es6/parse-float';
import 'core-js/es6/number';
import 'core-js/es6/math';
import 'core-js/es6/string';
import 'core-js/es6/date';
import 'core-js/es6/array';
import 'core-js/es6/regexp';
import 'core-js/es6/map';
import 'core-js/es6/set';
import 'core-js/es6/reflect';
import 'core-js/es7/reflect';
import 'zone.js/dist/zone';
/* You can add global styles to this file, and also import other style files */
@import url('https://fonts.googleapis.com/css?family=Roboto');
@import '~@angular/material/prebuilt-themes/indigo-pink.css';
body {
background-color: #f2f3f9;
}
html, body {
height: 100%;
}
import './polyfills.ts';
import 'zone.js/dist/long-stack-trace-zone';
import 'zone.js/dist/proxy.js';
import 'zone.js/dist/sync-test';
import 'zone.js/dist/jasmine-patch';
import 'zone.js/dist/async-test';
import 'zone.js/dist/fake-async-test';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
declare var __karma__: any;
declare var require: any;
// Prevent Karma from running prematurely.
__karma__.loaded = function () {};
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
// Then we find all the tests.
let context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);
// Finally, start Karma to run the tests.
__karma__.start();
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"baseUrl": "./",
"module": "es2015",
"types": []
},
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/spec",
"baseUrl": "./",
"module": "commonjs",
"types": [
"jasmine",
"node"
]
},
"files": [
"test.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}
/* SystemJS module definition */
declare var module: NodeModule;
interface NodeModule {
id: string;
}
console.log("foo");
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
}
}
{
"rulesDirectory": [
"node_modules/codelyzer"
],
"rules": {
"class-name": true,
"comment-format": [
true,
"check-space"
],
"curly": true,
"eofline": true,
"forin": true,
"indent": [
true,
"spaces"
],
"label-position": true,
"max-line-length": [
true,
140
],
"member-access": false,
"member-ordering": [
true,
"static-before-instance",
"variables-before-functions"
],
"no-arg": true,
"no-bitwise": true,
"no-console": [
true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-construct": true,
"no-debugger": true,
"no-duplicate-variable": true,
"no-empty": false,
"no-eval": true,
"no-inferrable-types": true,
"no-shadowed-variable": true,
"no-string-literal": false,
"no-switch-case-fall-through": true,
"no-trailing-whitespace": true,
"no-unused-expression": true,
"no-use-before-declare": true,
"no-var-keyword": true,
"object-literal-sort-keys": false,
"one-line": [
true,
"check-open-brace",
"check-catch",
"check-else",
"check-whitespace"
],
"quotemark": [
true,
"single"
],
"radix": true,
"semicolon": [
"always"
],
"triple-equals": [
true,
"allow-null-check"
],
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
}
],
"variable-name": false,
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type"
],
"directive-selector": [true, "attribute", "", "camelCase"],
"component-selector": [true, "element", "", "kebab-case"],
"use-input-property-decorator": true,
"use-output-property-decorator": true,
"use-host-property-decorator": true,
"no-input-rename": true,
"no-output-rename": true,
"use-life-cycle-interface": true,
"use-pipe-transform-interface": true,
"component-class-suffix": true,
"directive-class-suffix": true,
"no-access-missing-member": true,
"templates-use-public": true,
"invoke-injectable": true
}
}
{
"/MoyaWeb": {
"target": "https://kauppa.insomnia.fi",
"secure": true
}
}
...@@ -441,8 +441,8 @@ public class BootstrapBean implements BootstrapBeanLocal { ...@@ -441,8 +441,8 @@ public class BootstrapBean implements BootstrapBeanLocal {
dbUpdates.add(new String[]{ dbUpdates.add(new String[]{
"ALTER TABLE account_events DROP COLUMN delivered_count;" "ALTER TABLE account_events DROP COLUMN delivered_count;"
}); });
} }
public BootstrapBean() { public BootstrapBean() {
} }
...@@ -518,16 +518,6 @@ public class BootstrapBean implements BootstrapBeanLocal { ...@@ -518,16 +518,6 @@ public class BootstrapBean implements BootstrapBeanLocal {
dbModelFacade.create(dBm); dbModelFacade.create(dBm);
} }
} }
// We will never run this again with empty database
// public void saneDefaults() {
// User adminUser = userFacade.findByLogin("admin");
// if (adminUser == null) {
// adminUser = new User();
// adminUser.setLogin("admin");
// // adminUser.setSuperadmin(true);
// adminUser.resetPassword("admin");
// userFacade.create(adminUser);
// }
// }
} }
...@@ -48,7 +48,6 @@ import fi.codecrew.moya.model.ApplicationPermission; ...@@ -48,7 +48,6 @@ import fi.codecrew.moya.model.ApplicationPermission;
import fi.codecrew.moya.model.EventUser; import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.LanEvent; import fi.codecrew.moya.model.LanEvent;
import fi.codecrew.moya.model.Role; import fi.codecrew.moya.model.Role;
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
/** /**
* Session Bean implementation class SessionHandlerBean * Session Bean implementation class SessionHandlerBean
......
...@@ -113,6 +113,7 @@ public class MenuBean implements MenuBeanLocal { ...@@ -113,6 +113,7 @@ public class MenuBean implements MenuBeanLocal {
usermenu.addPage(menuitemfacade.findOrCreate("/frontpage"), UserPermission.ANYUSER); usermenu.addPage(menuitemfacade.findOrCreate("/frontpage"), UserPermission.ANYUSER);
usermenu.addPage(menuitemfacade.findOrCreate("/checkout/return"), null).setVisible(false); usermenu.addPage(menuitemfacade.findOrCreate("/checkout/return"), null).setVisible(false);
usermenu.addPage(menuitemfacade.findOrCreate("/checkout/delayed"), null).setVisible(false); usermenu.addPage(menuitemfacade.findOrCreate("/checkout/delayed"), null).setVisible(false);
usermenu.addPage(menuitemfacade.findOrCreate("/checkout/reject"), null).setVisible(false); usermenu.addPage(menuitemfacade.findOrCreate("/checkout/reject"), null).setVisible(false);
usermenu.addPage(menuitemfacade.findOrCreate("/checkout/cancel"), null).setVisible(false); usermenu.addPage(menuitemfacade.findOrCreate("/checkout/cancel"), null).setVisible(false);
...@@ -260,6 +261,7 @@ public class MenuBean implements MenuBeanLocal { ...@@ -260,6 +261,7 @@ public class MenuBean implements MenuBeanLocal {
vips.addPage(menuitemfacade.findOrCreate("/vip/multiadd"), VipPermission.EDIT); vips.addPage(menuitemfacade.findOrCreate("/vip/multiadd"), VipPermission.EDIT);
vips.addPage(menuitemfacade.findOrCreate("/vip/deliver"), VipPermission.VIEW).setVisible(false); vips.addPage(menuitemfacade.findOrCreate("/vip/deliver"), VipPermission.VIEW).setVisible(false);
vips.addPage(menuitemfacade.findOrCreate("/vip/edit"), VipPermission.VIEW).setVisible(false); vips.addPage(menuitemfacade.findOrCreate("/vip/edit"), VipPermission.VIEW).setVisible(false);
//adminuser.addPage(menuitemfacade.findOrCreate("/angular/vip/viplist", true), null);
MenuNavigation adminAssociation = adminmenu.addPage(null, null); MenuNavigation adminAssociation = adminmenu.addPage(null, null);
adminAssociation.setKey("topnavi.adminassoc"); adminAssociation.setKey("topnavi.adminassoc");
......
...@@ -41,28 +41,9 @@ public class MenuitemFacade extends IntegerPkGenericFacade<Menuitem> { ...@@ -41,28 +41,9 @@ public class MenuitemFacade extends IntegerPkGenericFacade<Menuitem> {
super(Menuitem.class); super(Menuitem.class);
} }
public Menuitem findOrCreate(String url) {
if (url == null || url.isEmpty()) {
return null;
}
try { public Menuitem findOrCreate(String url) {
CriteriaBuilder cb = getEm().getCriteriaBuilder(); return findOrCreate(url);
CriteriaQuery<Menuitem> cq = cb.createQuery(Menuitem.class);
Root<Menuitem> root = cq.from(Menuitem.class);
cq.where(cb.equal(root.get(Menuitem_.url), url));
Menuitem ret = super.getSingleNullableResult(getEm()
.createQuery(cq));
if (ret == null) {
ret = new Menuitem();
ret.setUrl(url);
create(ret);
}
return ret;
} catch (Exception e) {
logger.warn("Exception menussa" + url, e);
}
return null;
} }
} }
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<plugins> <plugins>
<plugin> <plugin>
<artifactId>maven-ejb-plugin</artifactId> <artifactId>maven-ejb-plugin</artifactId>
<version>2.4</version> <version>${ejb-plugin-version}</version>
<configuration> <configuration>
<ejbVersion>3.2</ejbVersion> <ejbVersion>3.2</ejbVersion>
</configuration> </configuration>
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId> <artifactId>build-helper-maven-plugin</artifactId>
<version>1.9.1</version> <version>3.0.0</version>
<executions> <executions>
<execution> <execution>
<id>add-source</id> <id>add-source</id>
......
...@@ -68,5 +68,4 @@ public class Menuitem extends GenericEntity { ...@@ -68,5 +68,4 @@ public class Menuitem extends GenericEntity {
public void setNavigations(List<MenuNavigation> navigations) { public void setNavigations(List<MenuNavigation> navigations) {
this.navigations = navigations; this.navigations = navigations;
} }
} }
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<plugins> <plugins>
<plugin> <plugin>
<artifactId>maven-ear-plugin</artifactId> <artifactId>maven-ear-plugin</artifactId>
<version>2.9.1</version> <version>2.10.1</version>
<configuration> <configuration>
<applicationName>Moya</applicationName> <applicationName>Moya</applicationName>
<earSourceDirectory>EarContent</earSourceDirectory> <earSourceDirectory>EarContent</earSourceDirectory>
...@@ -16,16 +16,7 @@ ...@@ -16,16 +16,7 @@
<version>7</version> <version>7</version>
<defaultLibBundleDir>lib</defaultLibBundleDir> <defaultLibBundleDir>lib</defaultLibBundleDir>
<modules> <modules>
<jarModule>
<groupId>net.bull.javamelody</groupId>
<artifactId>javamelody-core</artifactId>
<includeInApplicationXml>true</includeInApplicationXml>
</jarModule>
<jarModule>
<groupId>org.jrobin</groupId>
<artifactId>jrobin</artifactId>
<includeInApplicationXml>true</includeInApplicationXml>
</jarModule>
<ejbModule> <ejbModule>
<groupId>fi.codecrew.moya</groupId> <groupId>fi.codecrew.moya</groupId>
...@@ -38,11 +29,16 @@ ...@@ -38,11 +29,16 @@
</webModule> </webModule>
<webModule> <webModule>
<groupId>fi.codecrew.moya</groupId> <groupId>fi.codecrew.moya</groupId>
<artifactId>moya-mgmt-web</artifactId> <artifactId>moya-mgmt</artifactId>
<contextRoot>/mgmt</contextRoot> <contextRoot>/mgmt</contextRoot>
</webModule> </webModule>
<webModule> <webModule>
<groupId>fi.codecrew.moya</groupId> <groupId>fi.codecrew.moya</groupId>
<artifactId>moya-angular</artifactId>
<contextRoot>/MoyaNG</contextRoot>
</webModule>
<webModule>
<groupId>fi.codecrew.moya</groupId>
<artifactId>moya-terminal-web</artifactId> <artifactId>moya-terminal-web</artifactId>
<contextRoot>/terminal</contextRoot> <contextRoot>/terminal</contextRoot>
</webModule> </webModule>
...@@ -53,11 +49,7 @@ ...@@ -53,11 +49,7 @@
</build> </build>
<dependencies> <dependencies>
<dependency>
<groupId>net.bull.javamelody</groupId>
<artifactId>javamelody-core</artifactId>
<version>${javamelody.version}</version>
</dependency>
<dependency> <dependency>
<groupId>fi.codecrew.moya</groupId> <groupId>fi.codecrew.moya</groupId>
<artifactId>moya-beans</artifactId> <artifactId>moya-beans</artifactId>
...@@ -72,7 +64,14 @@ ...@@ -72,7 +64,14 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>fi.codecrew.moya</groupId> <groupId>fi.codecrew.moya</groupId>
<artifactId>moya-mgmt-web</artifactId> <artifactId>moya-mgmt</artifactId>
<version>1.2-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>fi.codecrew.moya</groupId>
<artifactId>moya-angular</artifactId>
<version>1.2-SNAPSHOT</version> <version>1.2-SNAPSHOT</version>
<type>war</type> <type>war</type>
</dependency> </dependency>
...@@ -102,7 +101,7 @@ ...@@ -102,7 +101,7 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId> <artifactId>maven-ear-plugin</artifactId>
<configuration> <configuration>
<unpackTypes>war,ejb,jar</unpackTypes> <unpackTypes>war,ejb</unpackTypes>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
......
<?xml version="1.0" encoding="UTF-8"?>
<faces-config xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"
version="2.2">
<application>
<resource-bundle>
<base-name>fi.codecrew.moyamgmt.resources.i18n</base-name>
<var>i18n</var>
</resource-bundle>
<message-bundle>fi.codecrew.moyamgmt.resources.i18n</message-bundle>
<locale-config>
<default-locale>fi</default-locale>
<supported-locale>en</supported-locale>
</locale-config>
</application>
<factory>
<exception-handler-factory>fi.codecrew.moyamgmt.exceptions.BortalExceptionHandlerFactory</exception-handler-factory>
</factory>
</faces-config>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN"
"http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
<resource-ref>
<res-ref-name>jsf/ProjectStage</res-ref-name>
<jndi-name>javax.faces.PROJECT_STAGE</jndi-name>
</resource-ref>
<class-loader delegate="true" />
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class java code.</description>
</property>
</jsp-config>
<parameter-encoding default-charset="UTF-8" />
</glassfish-web-app>
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<display-name>MoyaEventMgmtWeb</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.jsf</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.wtf</welcome-file>
</welcome-file-list>
<context-param>
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
<!-- Asetetaan PROJwECT_STAGE JNDI:llä, ja fallbackataan arvoon Development -->
<resource-ref>
<res-ref-name>jsf/ProjectStage</res-ref-name>
<res-type>java.lang.String</res-type>
</resource-ref>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<!-- Java melody monitoring -->
<filter>
<filter-name>javamelody</filter-name>
<filter-class>net.bull.javamelody.MonitoringFilter</filter-class>
<async-supported>true</async-supported>
</filter>
<filter-mapping>
<filter-name>javamelody</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>net.bull.javamelody.SessionListener</listener-class>
</listener>
<filter>
<display-name>PrimefacesFileupload</display-name>
<filter-name>PrimefacesFileupload</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
</filter>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/error.jsf</location>
</error-page>
<security-constraint>
<display-name>Forbidden resource</display-name>
<web-resource-collection>
<web-resource-name>Forbidden</web-resource-name>
<url-pattern>*.xhtml</url-pattern>
<url-pattern>/layout/*</url-pattern>
<url-pattern>/resources/tools/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<description>Thou shall not read the sources or use utils directly
</description>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>moyaRealm</realm-name>
<form-login-config>
<form-login-page>/auth/login.jsf</form-login-page>
<form-error-page>/auth/loginError.jsf</form-error-page>
</form-login-config>
</login-config>
<filter-mapping>
<filter-name>PrimefacesFileupload</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
</web-app>
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<title></title>
</h:head>
<h:body>
<ui:composition template="#{mgmtSessionHandler.template}">
<f:metadata>
<f:event type="preRenderView" listener="#{frontpageView.initIndexView}" />
</f:metadata>
<ui:define name="content">
<h:outputLabel rendered="#{mgmtSessionHandler.isInDevelopmentMode()}">
Development-tilassa.
Täällä voit huoletta rikkoa.
</h:outputLabel>
Hurrdurr. #{frontpageView.content}
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<meta http-equiv="refresh" content="1;url=#{request.contextPath}/frontpage.jsf" />
<script type="text/javascript">
window.location.href = "#{request.contextPath}/frontpage.jsf"
</script>
<title></title>
</h:head>
<h:body>
Redirecting to <a href="#{request.contextPath}/frontpage.jsf">Frontpage</a>
</h:body>
</html>
\ No newline at end of file
/* General css, use for non-layout purposes for general elements */
/* userlistview popup */
.userdata_popup {
position: absolute;
border: 1px solid black;
background: white;
border-radius: 3px;
display: none;
width: 300px;
height: 150px;
}
/* general class for hoverable usage */
.hoverable {
}
.hidden {
display: none;
}
#webcamcontainer {
}
#shopItems {
}
.ui-panel-title {
text-overflow: clip;
}
.shopItem {
float: left;
width: 72px;
height: 72px;
background: burlywood;
border: 1px solid black;
margin: 2px;
}
a.shopItem {
color: black !important;
}
a.shopItem div {
position: absolute;
height: 72px;
width: 72px;
text-align: center;
/* Firefox */
display: -moz-box;
-moz-box-orient: horizontal;
-moz-box-pack: center;
-moz-box-align: center;
/* Safari and Chrome */
display: -webkit-box;
-webkit-box-orient: horizontal;
-webkit-box-pack: center;
-webkit-box-align: center;
/* W3C */
display: box;
box-orient: horizontal;
box-pack: center;
box-align: center;
clip: rect(0, 72px, 72px, 0);
}
}
a.shopItem:hover {
background: darkgoldenrod;
}
a.shopItem:active {
background: red;
}
.prime-menu-selected div
{
display:block;
}
\ No newline at end of file
/* ==========================================================================
HTML5 Boilerplate styles - h5bp.com (generated via initializr.com)
========================================================================== */
html,
button,
input,
select,
textarea {
color: #222;
}
body {
font-size: 1em;
line-height: 1.4;
}
::-moz-selection {
background: #b3d4fc;
text-shadow: none;
}
::selection {
background: #b3d4fc;
text-shadow: none;
}
hr {
display: block;
height: 1px;
border: 0;
border-top: 1px solid #ccc;
margin: 1em 0;
padding: 0;
}
img {
vertical-align: middle;
}
fieldset {
border: 0;
margin: 0;
padding: 0;
}
textarea {
resize: vertical;
}
.chromeframe {
margin: 0.2em 0;
background: #ccc;
color: #000;
padding: 0.2em 0;
}
/* ==========================================================================
Author's custom styles
========================================================================== */
/* ==========================================================================
Media Queries
========================================================================== */
@media only screen and (min-width: 35em) {
}
@media print,
(-o-min-device-pixel-ratio: 5/4),
(-webkit-min-device-pixel-ratio: 1.25),
(min-resolution: 120dpi) {
}
/* ==========================================================================
Helper classes
========================================================================== */
.ir {
background-color: transparent;
border: 0;
overflow: hidden;
*text-indent: -9999px;
}
.ir:before {
content: "";
display: block;
width: 0;
height: 150%;
}
.hidden {
display: none !important;
visibility: hidden;
}
.visuallyhidden {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
.visuallyhidden.focusable:active,
.visuallyhidden.focusable:focus {
clip: auto;
height: auto;
margin: 0;
overflow: visible;
position: static;
width: auto;
}
.invisible {
visibility: hidden;
}
.clearfix:before,
.clearfix:after {
content: " ";
display: table;
}
.clearfix:after {
clear: both;
}
.clearfix {
*zoom: 1;
}
/* ==========================================================================
Print styles
========================================================================== */
@media print {
* {
background: transparent !important;
color: #000 !important; /* Black prints faster: h5bp.com/s */
box-shadow: none !important;
text-shadow: none !important;
}
a,
a:visited {
text-decoration: underline;
}
a[href]:after {
content: " (" attr(href) ")";
}
abbr[title]:after {
content: " (" attr(title) ")";
}
/*
* Don't show links for images, or javascript/internal links
*/
.ir a:after,
a[href^="javascript:"]:after,
a[href^="#"]:after {
content: "";
}
pre,
blockquote {
border: 1px solid #999;
page-break-inside: avoid;
}
thead {
display: table-header-group; /* h5bp.com/t */
}
tr,
img {
page-break-inside: avoid;
}
img {
max-width: 100% !important;
}
@page {
margin: 0.5cm;
}
p,
h2,
h3 {
orphans: 3;
widows: 3;
}
h2,
h3 {
page-break-after: avoid;
}
}
\ No newline at end of file
/*! normalize.css v1.1.2 | MIT License | git.io/normalize */article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,video{display:inline-block;*display:inline;*zoom:1}audio:not([controls]){display:none;height:0}[hidden]{display:none}html{font-size:100%;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}html,button,input,select,textarea{font-family:sans-serif}body{margin:0}a:focus{outline:thin dotted}a:active,a:hover{outline:0}h1{font-size:2em;margin:.67em 0}h2{font-size:1.5em;margin:.83em 0}h3{font-size:1.17em;margin:1em 0}h4{font-size:1em;margin:1.33em 0}h5{font-size:.83em;margin:1.67em 0}h6{font-size:.67em;margin:2.33em 0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}blockquote{margin:1em 40px}dfn{font-style:italic}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}mark{background:#ff0;color:#000}p,pre{margin:1em 0}code,kbd,pre,samp{font-family:monospace,serif;_font-family:'courier new',monospace;font-size:1em}pre{white-space:pre;white-space:pre-wrap;word-wrap:break-word}q{quotes:none}q:before,q:after{content:'';content:none}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}dl,menu,ol,ul{margin:1em 0}dd{margin:0 0 0 40px}menu,ol,ul{padding:0 0 0 40px}nav ul,nav ol{list-style:none;list-style-image:none}img{border:0;-ms-interpolation-mode:bicubic}svg:not(:root){overflow:hidden}figure{margin:0}form{margin:0}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0;white-space:normal;*margin-left:-7px}button,input,select,textarea{font-size:100%;margin:0;vertical-align:baseline;*vertical-align:middle}button,input{line-height:normal}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer;*overflow:visible}button[disabled],html input[disabled]{cursor:default}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0;*height:13px;*width:13px}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top}table{border-collapse:collapse;border-spacing:0}
\ No newline at end of file
.ui-widget,.ui-widget .ui-widget,.ui-button-text,.ui-wizard-step-title {
font-size: 90% !important;
}
.ui-panelmenu-header {
font-size: 80% !important;
}
#menu {
padding: 1em;
}
#aside {
margin: 1em;
width: 200px;
}
#main h1 {
font-family: Oxygen, Calibri;
font-size: 14pt;
border-bottom: 1px solid #B1B7AF;
color: #101D27;
font-weight: lighter;
padding-left: 0.5em;
}
#main h2 {
font-family: Oxygen, Calibri;
font-size: 12pt;
border-bottom: 1px solid #B1B7AF;
color: #101D27;
font-weight: lighter;
padding-left: 0.5em;
}
#main h3 {
font-family: Oxygen, Calibri;
font-size: 11pt;
color: #101D27;
font-weight: lighter;
}
#main {
font-family: Oxygen, Calibri;
font-size: 10pt;
padding-right: 1em;
}
#main p {
padding-left: 5em;
}
aside {
font-family: Oxygen !important;
font-weight: 100;
font-size: 10pt;
}
#main form label {
}
#main form input {
}
label {
color: #000;
font-weight: 100;
font-family: Oxygen;
font-size: 10pt;
padding-left: 10px;
}
input,textarea {
padding: 3px;
border: solid 1px #E5E5E5;
outline: 0;
font: normal 13px/100% Verdana, Tahoma, sans-serif;
margin: 0.25em 0;
background: -webkit-gradient(linear, left top, left 25, from(#FFFFFF),
color-stop(4%, #EEEEEE), to(#FFFFFF));
background: -moz-linear-gradient(top, #FFFFFF, #EEEEEE 1px, #FFFFFF 25px);
box-shadow: rgba(0, 0, 0, 0.1) 0px 0px 8px;
-moz-box-shadow: rgba(0, 0, 0, 0.1) 0px 0px 8px;
-webkit-box-shadow: rgba(0, 0, 0, 0.1) 0px 0px 8px;
}
textarea {
width: 400px;
max-width: 400px;
height: 150px;
line-height: 150%;
}
input:hover,textarea:hover,input:focus,textarea:focus {
border-color: #C9C9C9;
-webkit-box-shadow: rgba(0, 0, 0, 0.15) 0px 0px 8px;
}
@font-face {
font-family: Oxygen;
src: url('Oxygen-Regular.ttf');
}
body,html {
margin: 0;
padding: 0;
background: url("../img/bg.png");
}
h1 {
font-family: Oxygen, Calibri;
font-size: 18pt;
}
.box {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
}
#header_left {
width: 300px;
}
.flex1 {
-webkit-box-flex: 1; /* OLD - iOS 6-, Safari 3.1-6 */
-moz-box-flex: 1; /* OLD - Firefox 19- */
width: 20%; /* For old syntax, otherwise collapses. */
-webkit-flex: 1; /* Chrome */
-ms-flex: 1; /* IE 10 */
flex: 1; /* NEW, Spec - Opera 12.1, Firefox 20+ */
}
.flex2 {
-webkit-box-flex: 3; /* OLD - iOS 6-, Safari 3.1-6 */
-moz-box-flex: 3; /* OLD - Firefox 19- */
width: 20%; /* For old syntax, otherwise collapses. */
-webkit-flex: 3; /* Chrome */
-ms-flex: 3; /* IE 10 */
flex: 3; /* NEW, Spec - Opera 12.1, Firefox 20+ */
}
#header_right {
width: 200px;
}
nav {
min-width: 200px;
background: white;
min-height: 400px;
border-bottom: 1px solid #aaa;
}
#main {
min-width: 810px;
min-height: 400px; background : white;
margin-right: 1em;
border-right: 1px solid #aaa;
border-bottom: 1px solid #aaa;
background: white;
}
aside {
min-width: 250px;
}
#side {
width: 175px;
}
#main h1 {
color: black;
}
#main a {
color: #2694e8;
}
#header a {
color: white;
text-decoration: none;
}
#header_right {
text-align: right;
}
th, td {
padding: 5px;
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html class="no-js" xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:login="http://java.sun.com/jsf/composite/tools/login"
xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:p="http://primefaces.org/ui">
<f:view contentType="text/html" locale="#{sessionHandler.locale}">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title><h:outputText value="#{layoutView.getHeader()}" /></title>
<meta name="description" content="Lippukauppa" />
<meta name="author" content="CodeCrew ry" />
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Language" content="#{sessionHandler.locale}" />
<link rel="icon" href="#{request.contextPath}/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="#{request.contextPath}/resources/templates/template1/css/normalize.min.css" />
<link rel="stylesheet" href="#{request.contextPath}/resources/templates/template1/css//main.css" />
<link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/templates/template1/css/style.css" />
<link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/templates/template1/css/general.css" />
<script src="#{request.contextPath}/resources/templates/template1/js/modernizr-2.6.2.min.js"></script>
<h:outputStylesheet>
.bgColor1 {
background-color: #{layoutView.getLayoutProperty1('#68A3C2')};
}
</h:outputStylesheet>
<ui:insert name="headerdata" />
</h:head>
<h:body>
<!--[if lt IE 7]>
<p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
<![endif]-->
<header class="bgColor1 box">
<div id="header_left">
<h:link outcome="/index">
<c:choose>
<c:when test="#{sessionHandler.isInDevelopmentMode()}">
<img src="#{request.contextPath}/resources/templates/insomnia2/img/devel_logo.png" />
</c:when>
<c:otherwise>
<p:graphicImage rendered="#{!empty layoutView.headerimage}" value="#{layoutView.headerimage}" />
<ui:fragment rendered="#{empty layoutView.headerimage}">
<h1>
<h:outputText value="#{layoutView.headertext}" />
</h1>
</ui:fragment>
</c:otherwise>
</c:choose>
</h:link>
</div>
<div id="header_center" class="flex1"></div>
<div id="header_right">
<a href="http://www.codecrew.fi"><img src="#{request.contextPath}/resources/templates/template1/img/moya_logo.png" />
</a>
</div>
</header>
<section class="box">
<nav>
<div id="menu">
<p:panelMenu model="#{primeMenuView.menuModel}" />
<!-- <ui:fragment rendered="#{menuView.getMenu(2).size() > 1}">
<div id="right">
<ul>
<ui:repeat var="menuitem" value="#{menuView.getMenu(2)}">
<h:outputText rendered="#{!empty menuitem.header}" value="&lt;/ul>&lt;h1>#{i18n[menuitem.header]}&lt;/h1>&lt;ul>" escape="false" />
<li><h:link outcome="#{menuitem.outcome}" value="#{i18n[menuitem.navigation.key]}" styleClass="#{menuitem.selected?'active':''}" /></li>
</ui:repeat>
</ul>
</div>
</ui:fragment>
-->
</div>
</nav>
<section id="main" class="flex2">
<div class="container top">
<h:link rendered="#{layoutView.manageContent}" styleClass="editorlink" value="#{i18n['layout.editTop']}" outcome="/pages/manage">
<f:param name="pagename" value="#{layoutView.pagepath}:top" />
</h:link>
</div>
<ui:insert name="title" />
<p:messages severity="info" />
<ui:insert name="edittab" />
<!-- <h:messages /> -->
<ui:repeat var="cont1" value="#{menuView.getPagecontent('top')}">
<h:outputText value="#{cont1.content}" escape="false" />
</ui:repeat>
<ui:insert name="content" />
<ui:repeat var="cont1" value="#{menuView.getPagecontent('bottom')}">
<h:outputText value="#{cont1.content}" escape="false" />
</ui:repeat>
<h:link rendered="#{layoutView.manageContent}" styleClass="editorlink" value="#{i18n['layout.editBottom']}" outcome="/pages/manage">
<f:param name="pagename" value="#{layoutView.pagepath}:bottom" />
</h:link>
</section>
<aside class="flex1">
<div id="aside">
<div class="ui-widget-header">Login</div>
<div class="ui-widget-content" style="text-align: center">
<ui:fragment rendered="#{sessionHandler.loggedIn}">
<h:outputText value="#{i18n['template.loggedInAs']}" />
<br />
<b><h:outputText value="#{sessionHandler.currentUser.nick}" /></b>
</ui:fragment>
<div>
<login:loginLogout />
</div>
</div>
<br />
<ui:fragment rendered="#{menuView.renderTopmenuChanger}">
<div class="ui-widget-header">Select Mode</div>
<div class="ui-widget-content" style="text-align: center">
<h:form>
<p:selectOneMenu value="#{menuView.menuChange}">
<p:ajax listener="#{menuView.menuChangeEvent}" />
<f:selectItems var="menuitem" value="#{menuView.viewChangeTopmenu}" itemLabel="#{i18n[menuitem.navigation.key]}" itemValue="#{menuitem.outcome}" />
</p:selectOneMenu>
</h:form>
</div>
</ui:fragment>
</div>
</aside>
</section>
<footer class="bgColor1"> </footer>
</h:body>
</f:view>
</html>
\ No newline at end of file
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:composite="http://java.sun.com/jsf/composite" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:p="http://primefaces.org/ui"
>
<composite:interface>
<composite:attribute name="isOneliner" required="false" />
<composite:attribute name="onError" required="false" />
</composite:interface>
<composite:implementation>
<h:form id="login">
<c:choose>
<c:when test="#{not empty cc.attrs.isOneliner}">
<p:inputText styleClass="form" id="linelogin" value="#{authView.login}" />
<p:password styleClass="form" id="linepwd" value="#{authView.password}" />
<p:commandButton styleClass="button" id="onelinesubmit" action="#{authView.executeLoginAction}" ajax="false" value="#{i18n['login.submit']}" />
</c:when>
<c:otherwise>
<h:panelGrid columns="2">
<h:outputLabel for="gridLogin" value="#{i18n['login.username']}" />
<p:inputText id="gridLogin" value="#{authView.login}" />
<h:outputLabel for="gridPwd" value="#{i18n['login.password']}" />
<p:password id="gridPwd" value="#{authView.password}" />
</h:panelGrid>
<p:commandButton id="gridsubmit" actionListener="#{authView.executeLogin(cc.attrs.onerror)}" ajax="false" value="#{i18n['login.submit']}" />
</c:otherwise>
</c:choose>
</h:form>
</composite:implementation>
</html>
\ No newline at end of file
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:composite="http://java.sun.com/jsf/composite" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:login="http://java.sun.com/jsf/composite/tools/login"
xmlns:p="http://primefaces.org/ui"
>
<composite:interface>
</composite:interface>
<composite:implementation>
<c:choose>
<c:when test='#{sessionHandler.isLoggedIn() }'>
<h:form>
<p:commandLink actionListener="#{authView.doLogout}" ajax="false">
<h:outputText value="#{i18n['login.logout']}" />
</p:commandLink>
</h:form>
</c:when>
<c:otherwise>
<login:login isOneliner="true" />
<br/>
<h:link value="#{i18n['submenu.user.create']}" outcome="/user/create" />
<br/>
<h:link value="#{i18n['submenu.auth.sendResetMail']}" outcome="/auth/sendResetMail" />
</c:otherwise>
</c:choose>
</composite:implementation>
</html>
\ No newline at end of file
/*
* Copyright Codecrew Ry
*
* All rights reserved.
*
* This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software.
*
* Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the
* copyright owner.
*
* A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in
* future versions of the Software.
*
*/
package fi.codecrew.moyamgmt;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Named
@RequestScoped
public class FrontpageView extends GenericView {
private static final long serialVersionUID = -3187538351756262504L;
private static final Logger logger = LoggerFactory.getLogger(FrontpageView.class);
public void initIndexView()
{
logger.info("Initializing index view");
}
public String getContent()
{
return "asdasdasd";
}
}
/*
* Copyright Codecrew Ry
*
* All rights reserved.
*
* This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software.
*
* Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the
* copyright owner.
*
* A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in
* future versions of the Software.
*
*/
package fi.codecrew.moyamgmt;
import java.io.Serializable;
import javax.ejb.EJB;
import javax.enterprise.context.Conversation;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.codecrew.moya.beans.EventBeanLocal;
import fi.codecrew.moya.beans.PermissionBeanLocal;
import fi.codecrew.moya.enums.apps.IAppPermission;
import fi.codecrew.moya.utilities.I18n;
import fi.codecrew.moyamgmt.handler.NavigationHandler;
public abstract class GenericView implements Serializable {
private static final long serialVersionUID = -4000065015178815761L;
@Inject
private Conversation conversation;
private static final Logger logger = LoggerFactory.getLogger(GenericView.class);
@Inject
protected NavigationHandler navihandler;
@EJB
protected PermissionBeanLocal permbean;
@EJB
private EventBeanLocal eventbean;
public void beginConversation() {
if (conversation.isTransient()) {
conversation.begin();
}
}
public void endConversation() {
if (!conversation.isTransient())
conversation.end();
}
public boolean hasPermission(IAppPermission perm) {
// boolean ret =
// FacesContext.getCurrentInstance().getExternalContext().isUserInRole(perm.getFullName());
return permbean.hasPermission(perm);
}
protected boolean requirePermissions(IAppPermission perm, boolean... externalChecks) {
boolean ret = requirePermissions(hasPermission(perm));
if (ret && externalChecks.length > 0) {
ret = requirePermissions(externalChecks);
}
if (!ret) {
logger.info("Permission required failed for {} Permission: {} (or extrachecks)", perm.getFullName(), perm);
}
return ret;
}
protected boolean requirePermissions(boolean... externalChecks) {
boolean ret = true;
for (boolean check : externalChecks) {
if (!check) {
ret = false;
break;
}
}
if (!ret) {
FacesContext fcont = FacesContext.getCurrentInstance();
HttpServletRequest req = (HttpServletRequest) fcont.getExternalContext().getRequest();
StringBuilder viewidbuilder = new StringBuilder().append(req.getContextPath()).append(req.getServletPath());
if (req.getQueryString() != null) {
viewidbuilder.append("?").append(req.getQueryString());
}
navihandler.saveDestination(viewidbuilder.toString());
logger.debug("Permission denied. Saving navi {} for later use", viewidbuilder.toString());
// navihandler.navigateTo("/permissionDenied");
fcont.getApplication().getNavigationHandler().handleNavigation(fcont, null, "/permissionDenied?faces-redirect=true");
}
return ret;
}
protected void addFaceMessage(String string, Object... params) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(I18n.get(string, params)));
}
}
/*
* Copyright Codecrew Ry
*
* All rights reserved.
*
* This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software.
*
* Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the
* copyright owner.
*
* A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in
* future versions of the Software.
*
*/
package fi.codecrew.moyamgmt.exceptions;
import java.util.Iterator;
import java.util.Map;
import javax.ejb.AccessLocalException;
import javax.ejb.EJBAccessException;
import javax.faces.FacesException;
import javax.faces.application.NavigationHandler;
import javax.faces.application.ViewExpiredException;
import javax.faces.context.ExceptionHandler;
import javax.faces.context.ExceptionHandlerWrapper;
import javax.faces.context.FacesContext;
import javax.faces.event.ExceptionQueuedEvent;
import javax.faces.event.ExceptionQueuedEventContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class BortalExceptionHandler extends ExceptionHandlerWrapper {
private static final Logger logger = LoggerFactory.getLogger(BortalExceptionHandler.class);
private final ExceptionHandler wrapped;
public BortalExceptionHandler(ExceptionHandler wrapped) {
this.wrapped = wrapped;
}
@Override
public ExceptionHandler getWrapped() {
return wrapped;
}
@Override
public void handle() throws FacesException {
Iterator<ExceptionQueuedEvent> i = getUnhandledExceptionQueuedEvents().iterator();
while (i.hasNext()) {
ExceptionQueuedEvent event = i.next();
ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource();
Throwable t = context.getException();
logger.debug("Found exception! handing it: {}", t.getClass().toString());
if (t instanceof ViewExpiredException) {
errorpage(i, t, "viewExpired");
}
Throwable cause = t.getCause();
for (int loop = 0; loop < 20 && cause != null; ++loop) {
logger.debug("Cause not null, but {}: {}, checking" + cause.getClass(), cause.getMessage());
if (cause instanceof EJBAccessException ||
cause instanceof AccessLocalException) {
logger.debug("Found Permission Denied cause: {}, {}", cause.getClass(), cause.getMessage());
// errorpage(i, t, "permissionDenied");
}
cause = cause.getCause();
}
}
// At this point, the queue will not contain any ViewExpiredEvents.
// Therefore, let the parent handle them.
getWrapped().handle();
}
private void errorpage(Iterator<ExceptionQueuedEvent> i, Throwable t, String navigateTo) {
logger.info("navigating to {} because root exception: {}", navigateTo, t.getClass());
ViewExpiredException vee = null;
if (t instanceof ViewExpiredException) {
vee = (ViewExpiredException) t;
}
FacesContext fc = FacesContext.getCurrentInstance();
Map<String, Object> requestMap = fc.getExternalContext().getRequestMap();
NavigationHandler nav = fc.getApplication().getNavigationHandler();
try {
// Push some useful stuff to the request scope for
// use in the page
if (vee != null) {
requestMap.put("currentViewId", vee.getViewId());
}
nav.handleNavigation(fc, null, navigateTo);
fc.renderResponse();
} finally {
i.remove();
}
}
}
/*
* Copyright Codecrew Ry
*
* All rights reserved.
*
* This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software.
*
* Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the
* copyright owner.
*
* A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in
* future versions of the Software.
*
*/
package fi.codecrew.moyamgmt.exceptions;
import javax.faces.context.ExceptionHandler;
import javax.faces.context.ExceptionHandlerFactory;
public class BortalExceptionHandlerFactory extends ExceptionHandlerFactory {
private ExceptionHandlerFactory parent;
public BortalExceptionHandlerFactory() {
super();
}
public BortalExceptionHandlerFactory(ExceptionHandlerFactory parent) {
this.parent = parent;
}
@Override
public ExceptionHandler getExceptionHandler() {
ExceptionHandler result = parent.getExceptionHandler();
result = new BortalExceptionHandler(result);
return result;
}
}
/*
* Copyright Codecrew Ry
*
* All rights reserved.
*
* This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software.
*
* Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the
* copyright owner.
*
* A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in
* future versions of the Software.
*
*/
package fi.codecrew.moyamgmt.handler;
import java.io.IOException;
import java.io.Serializable;
import javax.enterprise.context.Conversation;
import javax.enterprise.context.ConversationScoped;
import javax.faces.context.FacesContext;
import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ConversationScoped
public class NavigationHandler implements Serializable {
private static final long serialVersionUID = -5985927646178070598L;
private static final Logger logger = LoggerFactory.getLogger(NavigationHandler.class);
private String destNavi;
@Inject
private transient Conversation conversation;
public void saveNavigation(String navigation)
{
FacesContext fcont = FacesContext.getCurrentInstance();
HttpServletRequest req = (HttpServletRequest) fcont.getExternalContext().getRequest();
// TODO: Parse navigation correctly
StringBuilder viewidbuilder = new StringBuilder().append(req.getContextPath()).append(navigation);
viewidbuilder.append(".jsf");
saveDestination(viewidbuilder.toString());
}
public void saveDestination(String pageid) {
if (conversation.isTransient()) {
conversation.begin();
}
this.destNavi = pageid;
}
public void redirectToSaved() {
if (destNavi == null || destNavi.isEmpty()) {
HttpServletRequest req = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
destNavi = req.getContextPath();
}
redirectNavigation(destNavi);
}
public void redirectNavigation(String destinationUrl) {
try {
FacesContext.getCurrentInstance().getExternalContext().redirect(destinationUrl);
} catch (IOException e) {
logger.warn("Redirect failed!", e);
}
}
public void forward(String navigation) {
FacesContext fcont = FacesContext.getCurrentInstance();
javax.faces.application.NavigationHandler navihand = fcont.getApplication().getNavigationHandler();
navihand.handleNavigation(fcont, null, navigation);
}
}
/*
* Copyright Codecrew Ry
*
* All rights reserved.
*
* This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software.
*
* Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the
* copyright owner.
*
* A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in
* future versions of the Software.
*
*/
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.codecrew.moyamgmt.handler;
import java.util.EnumMap;
import java.util.Locale;
import java.util.TimeZone;
import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.faces.context.FacesContext;
import javax.inject.Inject;
import javax.inject.Named;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.codecrew.moya.beans.EventBeanLocal;
import fi.codecrew.moya.beans.PermissionBeanLocal;
import fi.codecrew.moya.beans.RoleBeanLocal;
import fi.codecrew.moya.clientutils.BortalLocalContextHolder;
import fi.codecrew.moya.enums.apps.IAppPermission;
import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.LanEventProperty;
import fi.codecrew.moya.model.LanEventPropertyKey;
/**
*
* @author tuukka
*/
@Named("mgmtSessionHandler")
@RequestScoped
public class SessionHandler {
private static final Logger logger = LoggerFactory.getLogger(SessionHandler.class);
//
// @Inject
// private HttpServletRequest httprequest;
//
@EJB
private RoleBeanLocal rolebean;
@EJB
private EventBeanLocal eventbean;
@EJB
private PermissionBeanLocal permbean;
@Inject
private SessionStore sessionStore;
private String template;
public TimeZone getTimezone() {
return TimeZone.getTimeZone("Europe/Helsinki");
}
public String getLocale() {
Locale ret = sessionStore.getLocale();
String retStr = "fi_FI";
if (ret != null) {
retStr = ret.toLanguageTag();
logger.info("Got langtag {}", retStr);
}
return retStr;
}
public String getFullscreen() {
template = "blipview";
return template;
}
public String getAdduserfullscreen() {
template = "adduser";
return template;
}
public String getTemplateName()
{
if (template == null) {
template = eventbean.getPropertyString(LanEventPropertyKey.EVENT_LAYOUT);
}
if (template == null) {
template = "insomnia2";
}
return template;
}
public String getTemplatePath()
{
return "/resources/templates/" + getTemplateName();
}
public String getTemplate() {
return getTemplatePath() + "/template.xhtml";
}
private EnumMap<LanEventPropertyKey, Boolean> boolPropertyCache = new EnumMap<>(LanEventPropertyKey.class);
public boolean isEventBoolProperty(String property)
{
LanEventPropertyKey prop = LanEventPropertyKey.valueOf(property);
if (!prop.isBoolean()) {
throw new RuntimeException("Trying to fetch boolean value for non-boolean property!");
}
boolean value = false;
if (boolPropertyCache.containsKey(prop)) {
value = boolPropertyCache.get(prop);
} else {
LanEventProperty propertyValue = eventbean.getProperty(prop);
if (propertyValue == null) {
if (prop.getDefaultvalue() != null && prop.getDefaultvalue().equals("1"))
value = true;
} else {
value = propertyValue.isBooleanValue();
}
boolPropertyCache.put(prop, value);
}
return value;
}
// public boolean hasPermission(String target, String permission) {
// RolePermission perm = RolePermission.valueOf(permission.toUpperCase());
// // RolePermission perm = null;
// // if (permission.equalsIgnoreCase("read")) {
// // perm = RolePermission.READ;
// // } else if (permission.equals("write")) {
// // perm = RolePermission.WRITE;
// // } else if (permission.equals("execute")) {
// // perm = RolePermission.EXECUTE;
// // }else {
// // throw new RuntimeException("permission " + permission +
// // " does not match any")
// // }
// if (perm == null) {
// logger.warn("Permission {} does not have matching value in RolePermission enum!");
// throw new
// RuntimeException("Matching role permission could not be found!");
// }
//
// return hasPermission(target, perm);
// }
//
// private HttpSession getHttpSession() {
// FacesContext ctx = FacesContext.getCurrentInstance();
// HttpSession sess = (HttpSession)
// ctx.getExternalContext().getSession(false);
// return sess;
// }
// public boolean hasPermission(String perm) {
// return permbean.hasPermission(perm);
// }
public String getDateFormat()
{
return "dd.MM.yyyy";
}
public String getDatetimeFormat()
{
return "dd.MM.yyyy HH:mm";
}
public String getShortDatetimeFormat()
{
return "dd.MM HH:MM:ss";
}
public boolean hasPermission(IAppPermission permission) {
if (permission == null) {
logger.warn("permission is null");
throw new RuntimeException("Empty target or permission!");
}
boolean ret = permbean.hasPermission(permission);
return ret;
}
public boolean isLoggedIn() {
boolean ret = permbean.isLoggedIn();
return ret;
}
public boolean isSuperadmin() {
return permbean.getCurrentUser().getUser().isSuperadmin();
}
public EventUser getCurrentUser() {
return permbean.getCurrentUser();
}
public String flushCache() {
return eventbean.flushCache();
}
public String navigateTo(String url) {
return url;
}
private String preurlString;
public String getRequestPreUrl()
{
if (preurlString == null)
{
Object ext = FacesContext.getCurrentInstance().getExternalContext().getRequest();
if (ext instanceof HttpServletRequest)
{
StringBuffer url = ((HttpServletRequest) ext).getRequestURL();
preurlString = url.substring(0, url.indexOf("/", 8));
} else {
preurlString = "";
}
}
return preurlString;
}
public boolean isInDevelopmentMode() {
return BortalLocalContextHolder.isInDevelopmentMode();
}
public SessionStore getSessionStore() {
return sessionStore;
}
public void setSessionStore(SessionStore sessionStore) {
this.sessionStore = sessionStore;
}
}
/*
* Copyright Codecrew Ry
*
* All rights reserved.
*
* This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software.
*
* Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the
* copyright owner.
*
* A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in
* future versions of the Software.
*
*/
package fi.codecrew.moyamgmt.handler;
import java.io.Serializable;
import java.util.Locale;
import javax.ejb.EJB;
import javax.enterprise.context.SessionScoped;
import javax.faces.context.FacesContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.codecrew.moya.beans.EventBeanLocal;
@SessionScoped
public class SessionStore implements Serializable {
private static final long serialVersionUID = 594517648650107916L;
private static final Locale DEFAULT_LOCALE = new Locale("fi");
@EJB
private EventBeanLocal eventbean;
private Locale locale;
private boolean manageContentLinks = false;
private static final Logger logger = LoggerFactory.getLogger(SessionStore.class);
public Locale getLocale() {
Locale ret = locale;
if (ret == null)
{
String retStr = eventbean.getCurrentEvent().getOrganiser().getBundleCountry();
if (retStr != null && !retStr.isEmpty()) {
try {
ret = Locale.forLanguageTag(retStr);
} catch (Throwable t) {
logger.warn("Error setting locale from current event for {}", retStr);
ret = null;
}
}
if (ret == null) {
ret = DEFAULT_LOCALE;
}
locale = ret;
}
return ret;
}
public void setLocale(Locale locale)
{
this.locale = locale;
FacesContext.getCurrentInstance().getViewRoot().setLocale(locale);
}
public boolean isManageContentLinks() {
return manageContentLinks;
}
public void setManageContentLinks(boolean manageContentLinks) {
this.manageContentLinks = manageContentLinks;
}
}
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "moya-mgmt"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.css"
],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"project": "src/tsconfig.app.json"
},
{
"project": "src/tsconfig.spec.json"
},
{
"project": "e2e/tsconfig.e2e.json"
}
],
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "css",
"component": {}
}
}
# Editor configuration, see http://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
max_line_length = off
trim_trailing_whitespace = false
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
/out-tsc
# dependencies
/node_modules
/node
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
testem.log
/typings
# e2e
/e2e/*.js
/e2e/*.map
# System Files
.DS_Store
Thumbs.db
# MoyaMgmt
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.0.3.
## Development server
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
## Code scaffolding
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|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/).
Before running the tests make sure you are serving the app via `ng serve`.
## 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).
import { MoyaMgmtPage } from './app.po';
describe('moya-mgmt App', () => {
let page: MoyaMgmtPage;
beforeEach(() => {
page = new MoyaMgmtPage();
});
it('should display message saying app works', () => {
page.navigateTo();
expect(page.getParagraphText()).toEqual('app works!');
});
});
import { browser, by, element } from 'protractor';
export class MoyaMgmtPage {
navigateTo() {
return browser.get('/');
}
getParagraphText() {
return element(by.css('app-root h1')).getText();
}
}
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/e2e",
"module": "commonjs",
"target": "es5",
"types": [
"jasmine",
"node"
]
}
}
// Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular/cli'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular/cli/plugins/karma')
],
client:{
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
files: [
{ pattern: './src/test.ts', watched: false }
],
preprocessors: {
'./src/test.ts': ['@angular/cli']
},
mime: {
'text/x-typescript': ['ts','tsx']
},
coverageIstanbulReporter: {
reports: [ 'html', 'lcovonly' ],
fixWebpackSourcePaths: true
},
angularCli: {
environment: 'dev'
},
reporters: config.angularCli && config.angularCli.codeCoverage
? ['progress', 'coverage-istanbul']
: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
});
};
{
"name": "moya-mgmt",
"version": "0.0.0",
"license": "UNLICENSED",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0",
"core-js": "^2.4.1",
"rxjs": "^5.1.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular/cli": "1.0.3",
"@angular/compiler-cli": "^4.0.0",
"@types/jasmine": "2.5.38",
"@types/node": "~6.0.60",
"codelyzer": "~2.0.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-coverage-istanbul-reporter": "^0.2.0",
"protractor": "~5.1.0",
"ts-node": "~2.0.0",
"tslint": "~4.5.0",
"typescript": "~2.2.0"
}
}
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <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"> 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> <modelVersion>4.0.0</modelVersion>
<artifactId>moya-mgmt-web</artifactId> <artifactId>moya-mgmt</artifactId>
<packaging>war</packaging> <packaging>war</packaging>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<artifactId>maven-war-plugin</artifactId> <artifactId>maven-war-plugin</artifactId>
<version>2.4</version> <version>${war-plugin-version}</version>
<configuration> <configuration>
<warSourceDirectory>WebContent</warSourceDirectory> <warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml> <failOnMissingWebXml>false</failOnMissingWebXml>
<packagingExcludes>%regex[WEB-INF/lib/(?!rewrite-.*\.jar)(?!moya-restpojo.*\.jar)(?!primefaces.*\.jar)(?!all-themes.*\.jar).*]</packagingExcludes> <packagingExcludes>%regex[WEB-INF/lib/(?!rewrite-.*\.jar)(?!moya-restpojo.*\.jar).*]</packagingExcludes>
</configuration> <webResources>
</plugin> <resource>
</plugins> <directory>./dist/</directory>
</build> </resource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.4</version>
<dependencies> <executions>
<dependency>
<groupId>fi.codecrew.moya</groupId>
<artifactId>moya-beans-client</artifactId>
<version>1.2-SNAPSHOT</version>
</dependency>
<dependency> <execution>
<groupId>org.primefaces</groupId> <!-- optional: you don't really need execution ids,
<artifactId>primefaces</artifactId> but it looks nice in your build log. -->
<version>${primefaces.version}</version> <id>install node and npm</id>
</dependency> <goals>
<goal>install-node-and-npm</goal>
</goals>
<configuration>
<nodeVersion>${js.node.version}</nodeVersion>
<npmVersion>${js.npm.version}</npmVersion>
</configuration>
</execution>
</dependencies> <execution>
<parent> <id>npm install</id>
<groupId>fi.codecrew.moya</groupId> <goals>
<artifactId>moya-parent</artifactId> <goal>npm</goal>
<version>1.2-SNAPSHOT</version> </goals>
<relativePath>../moya-parent/pom.xml</relativePath> </execution>
</parent>
<execution>
<id>npm run build</id>
<goals>
<goal>npm</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<arguments>run build</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>fi.codecrew.moya</groupId>
<artifactId>moya-beans-client</artifactId>
<version>1.2-SNAPSHOT</version>
</dependency>
</dependencies>
<parent>
<groupId>fi.codecrew.moya</groupId>
<artifactId>moya-parent</artifactId>
<version>1.2-SNAPSHOT</version>
<relativePath>../moya-parent/pom.xml</relativePath>
</parent>
</project> </project>
// 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: [
'./e2e/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
beforeLaunch: function() {
require('ts-node').register({
project: 'e2e/tsconfig.e2e.json'
});
},
onPrepare() {
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};
import { TestBed, async } from '@angular/core/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
AppComponent
],
}).compileComponents();
}));
it('should create the app', async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
it(`should have as title 'app works!'`, async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('app works!');
}));
it('should render title in a h1 tag', async(() => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain('app works!');
}));
});
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'app works!';
}
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
FormsModule,
HttpModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
export const environment = {
production: true
};
// The file contents for the current environment will overwrite these during build.
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
// The list of which env maps to which file can be found in `.angular-cli.json`.
export const environment = {
production: false
};
No preview for this file type
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>MoyaMgmt</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root>Loading...</app-root>
</body>
</html>
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
platformBrowserDynamic().bootstrapModule(AppModule);
/**
* This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file.
*
* This file is divided into 2 sections:
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
* file.
*
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
*
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
*/
/***************************************************************************************************
* BROWSER POLYFILLS
*/
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
// import 'core-js/es6/symbol';
// import 'core-js/es6/object';
// import 'core-js/es6/function';
// import 'core-js/es6/parse-int';
// import 'core-js/es6/parse-float';
// import 'core-js/es6/number';
// import 'core-js/es6/math';
// import 'core-js/es6/string';
// import 'core-js/es6/date';
// import 'core-js/es6/array';
// import 'core-js/es6/regexp';
// import 'core-js/es6/map';
// import 'core-js/es6/set';
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js'; // Run `npm install --save classlist.js`.
/** IE10 and IE11 requires the following to support `@angular/animation`. */
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/** Evergreen browsers require these. **/
import 'core-js/es6/reflect';
import 'core-js/es7/reflect';
/** ALL Firefox browsers require the following to support `@angular/animation`. **/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/***************************************************************************************************
* Zone JS is required by Angular itself.
*/
import 'zone.js/dist/zone'; // Included with Angular CLI.
/***************************************************************************************************
* APPLICATION IMPORTS
*/
/**
* Date, currency, decimal and percent pipes.
* Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
*/
// import 'intl'; // Run `npm install --save intl`.
/**
* Need to import at least one locale-data with intl.
*/
// import 'intl/locale-data/jsonp/en';
/* You can add global styles to this file, and also import other style files */
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/long-stack-trace-zone';
import 'zone.js/dist/proxy.js';
import 'zone.js/dist/sync-test';
import 'zone.js/dist/jasmine-patch';
import 'zone.js/dist/async-test';
import 'zone.js/dist/fake-async-test';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
declare var __karma__: any;
declare var require: any;
// Prevent Karma from running prematurely.
__karma__.loaded = function () {};
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);
// Finally, start Karma to run the tests.
__karma__.start();
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"module": "es2015",
"baseUrl": "",
"types": []
},
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/spec",
"module": "commonjs",
"target": "es5",
"baseUrl": "",
"types": [
"jasmine",
"node"
]
},
"files": [
"test.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}
/* SystemJS module definition */
declare var module: NodeModule;
interface NodeModule {
id: string;
}
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"baseUrl": "src",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2016",
"dom"
]
}
}
{
"rulesDirectory": [
"node_modules/codelyzer"
],
"rules": {
"callable-types": true,
"class-name": true,
"comment-format": [
true,
"check-space"
],
"curly": true,
"eofline": true,
"forin": true,
"import-blacklist": [
true,
"rxjs"
],
"import-spacing": true,
"indent": [
true,
"spaces"
],
"interface-over-type-literal": true,
"label-position": true,
"max-line-length": [
true,
140
],
"member-access": false,
"member-ordering": [
true,
"static-before-instance",
"variables-before-functions"
],
"no-arg": true,
"no-bitwise": true,
"no-console": [
true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-construct": true,
"no-debugger": true,
"no-empty": false,
"no-empty-interface": true,
"no-eval": true,
"no-inferrable-types": [
true,
"ignore-params"
],
"no-shadowed-variable": true,
"no-string-literal": false,
"no-string-throw": true,
"no-switch-case-fall-through": true,
"no-trailing-whitespace": true,
"no-unused-expression": true,
"no-use-before-declare": true,
"no-var-keyword": true,
"object-literal-sort-keys": false,
"one-line": [
true,
"check-open-brace",
"check-catch",
"check-else",
"check-whitespace"
],
"prefer-const": true,
"quotemark": [
true,
"single"
],
"radix": true,
"semicolon": [
"always"
],
"triple-equals": [
true,
"allow-null-check"
],
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
}
],
"typeof-compare": true,
"unified-signatures": true,
"variable-name": false,
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type"
],
"directive-selector": [
true,
"attribute",
"app",
"camelCase"
],
"component-selector": [
true,
"element",
"app",
"kebab-case"
],
"use-input-property-decorator": true,
"use-output-property-decorator": true,
"use-host-property-decorator": true,
"no-input-rename": true,
"no-output-rename": true,
"use-life-cycle-interface": true,
"use-pipe-transform-interface": true,
"component-class-suffix": true,
"directive-class-suffix": true,
"no-access-missing-member": true,
"templates-use-public": true,
"invoke-injectable": true
}
}
...@@ -14,9 +14,10 @@ ...@@ -14,9 +14,10 @@
<module>../moya-beans-client</module> <module>../moya-beans-client</module>
<module>../moya-beans</module> <module>../moya-beans</module>
<module>../moya-web</module> <module>../moya-web</module>
<module>../moya-mgmt-web</module> <module>../moya-mgmt</module>
<module>../moya-terminal-web</module> <module>../moya-terminal-web</module>
<module>../moya-ear</module> <module>../moya-ear</module>
<module>../moya-angular</module>
</modules> </modules>
<dependencies> <dependencies>
...@@ -38,6 +39,11 @@ ...@@ -38,6 +39,11 @@
<version>2.1</version> <version>2.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.sshd</groupId>
<artifactId>sshd-core</artifactId>
<version>0.14.0</version>
</dependency>
<dependency>
<!-- Java melody dependency --> <!-- Java melody dependency -->
<groupId>org.jrobin</groupId> <groupId>org.jrobin</groupId>
<artifactId>jrobin</artifactId> <artifactId>jrobin</artifactId>
......
...@@ -16,19 +16,6 @@ ...@@ -16,19 +16,6 @@
</session-config> </session-config>
<!-- Java melody monitoring -->
<filter>
<filter-name>javamelody</filter-name>
<filter-class>net.bull.javamelody.MonitoringFilter</filter-class>
<async-supported>true</async-supported>
</filter>
<filter-mapping>
<filter-name>javamelody</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>net.bull.javamelody.SessionListener</listener-class>
</listener>
<servlet> <servlet>
<servlet-name>Faces Servlet</servlet-name> <servlet-name>Faces Servlet</servlet-name>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<plugins> <plugins>
<plugin> <plugin>
<artifactId>maven-war-plugin</artifactId> <artifactId>maven-war-plugin</artifactId>
<version>2.4</version> <version>${war-plugin-version}</version>
<configuration> <configuration>
<warSourceDirectory>WebContent</warSourceDirectory> <warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml> <failOnMissingWebXml>false</failOnMissingWebXml>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<plugin> <plugin>
<groupId>pl.project13.maven</groupId> <groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId> <artifactId>git-commit-id-plugin</artifactId>
<version>2.1.10</version> <version>2.2.2</version>
<executions> <executions>
<execution> <execution>
<goals> <goals>
......
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
xsi:schemaLocation="http://ocpsoft.org/schema/rewrite-config-prettyfaces xsi:schemaLocation="http://ocpsoft.org/schema/rewrite-config-prettyfaces
http://ocpsoft.org/xml/ns/prettyfaces/rewrite-config-prettyfaces.xsd"> http://ocpsoft.org/xml/ns/prettyfaces/rewrite-config-prettyfaces.xsd">
<rewrite match="^/angular/.*" substitute="/angular.jsf" redirect="chain" /> <rewrite match="^(/angular/.*)$" substitute="/angular.jsf?pagename=$1" redirect="chain" />
</pretty-config> </pretty-config>
\ No newline at end of file
...@@ -28,20 +28,7 @@ ...@@ -28,20 +28,7 @@
<param-name>javax.faces.PROJECT_STAGE</param-name> <param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value> <param-value>Development</param-value>
</context-param> </context-param>
<!-- Java melody monitoring -->
<filter>
<filter-name>javamelody</filter-name>
<filter-class>net.bull.javamelody.MonitoringFilter</filter-class>
<async-supported>true</async-supported>
</filter>
<filter-mapping>
<filter-name>javamelody</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>net.bull.javamelody.SessionListener</listener-class>
</listener>
<filter> <filter>
<display-name>PrimefacesFileupload</display-name> <display-name>PrimefacesFileupload</display-name>
......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
>
<h:head>
<title></title>
</h:head>
<h:body>
<ui:composition template="#{sessionHandler.template}">
<f:metadata>
<f:viewParam name="pagename" value="#{angularPageName.pagename}" />
<f:event type="preRenderView" listener="#{angularPageName.init()}" />
</f:metadata>
<ui:define name="headerdata">
<!-- base href="/MoyaWeb/resources/angular-dist/"></base-->
<base href="/MoyaWeb/angular/"></base>
</ui:define>
<ui:define name="content">
<h:form>
<p:remoteCommand name="pageNameSetter" actionListener="#{angularPageName.pagenameRemoteCommand}" update=":mainMenu:panelmenu" />
</h:form>
<link rel="stylesheet" href="/MoyaWeb/resources/angular-dist/styles.bundle.css" />
<app-root>Lattaillaans</app-root>
<script type="text/javascript" src="/MoyaWeb/resources/angular-dist/inline.bundle.js"></script>
<script type="text/javascript" src="/MoyaWeb/resources/angular-dist/vendor.bundle.js"></script>
<script type="text/javascript" src="/MoyaWeb/resources/angular-dist/main.bundle.js"></script>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
$(document).ready(function() { $(document).ready(function () {
if (PrimeFaces.getCookie("moyaLeftMenu") != null) { if (PrimeFaces.getCookie("moyaLeftMenu") != null) {
var menuToExpand = PrimeFaces.getCookie("moyaLeftMenu").split(","); var menuToExpand = PrimeFaces.getCookie("moyaLeftMenu").split(",");
for (i = 0; i < menuToExpand.length; ++i) { for (i = 0; i < menuToExpand.length; ++i) {
$("#" + menuToExpand[i]).css("display", "block"); $("#" + menuToExpand[i]).css("display", "block");
} }
} }
}); });
\ No newline at end of file
/**
* One might wonder why this is there.
*
* It would be really nice just link to the angular -page, but there is this "nice" prettyfaces -rewriter
* and it does somehow catch my menulinks, and rewrite them to the .jsf -file, what is JUST what we need. PRKL!
*
* So let's make it the hard and dirty way.
*/
var angularMenuNavigation = function (url) {
if (window.angularRoute) {
var ngUrl = url.substring(8);
window.angularRoute(ngUrl);
pageNameSetter(url);
} else {
window.location.href = window.CONTEXTPATH + url;
}
};
\ No newline at end of file
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
<script type="text/javascript"> <script type="text/javascript">
window.CONTEXTPATH = "#{request.contextPath}";
$(function(){ $(function(){
$(window).resize(function() { $(window).resize(function() {
......
...@@ -16,6 +16,9 @@ ...@@ -16,6 +16,9 @@
<link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/templates/blipview/css/general.css" /> <link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/templates/blipview/css/general.css" />
<link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/templates/custom_components.css" /> <link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/templates/custom_components.css" />
<ui:insert name="headerdata" /> <ui:insert name="headerdata" />
<script type="text/javascript">
window.CONTEXTPATH = "#{request.contextPath}";
</script>
</h:head> </h:head>
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
<h:body> <h:body>
<!-- Javascript-lokalisaatiolippupuljausta --> <!-- Javascript-lokalisaatiolippupuljausta -->
<script type="text/javascript"> <script type="text/javascript">
window.CONTEXTPATH = "#{request.contextPath}";
$(document) $(document)
.ready( .ready(
function() { function() {
......
...@@ -17,6 +17,9 @@ ...@@ -17,6 +17,9 @@
<link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/templates/custom_components.css" /> <link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/templates/custom_components.css" />
<ui:insert name="headerdata" /> <ui:insert name="headerdata" />
<script type="text/javascript">
window.CONTEXTPATH = "#{request.contextPath}";
</script>
</h:head> </h:head>
......
...@@ -16,6 +16,9 @@ ...@@ -16,6 +16,9 @@
</title> </title>
<link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/templates/insomnia1/style.css" /> <link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/templates/insomnia1/style.css" />
<ui:insert name="headerdata" /> <ui:insert name="headerdata" />
<script type="text/javascript">
window.CONTEXTPATH = "#{request.contextPath}";
</script>
</h:head> </h:head>
<h:body > <h:body >
......
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
<link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/templates/insomnia2/css/general.css" /> <link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/templates/insomnia2/css/general.css" />
<ui:insert name="headerdata" /> <ui:insert name="headerdata" />
<h:outputScript name="prime_calendar.js" library="script" /> <h:outputScript name="prime_calendar.js" library="script" />
<script type="text/javascript">
window.CONTEXTPATH = "#{request.contextPath}";
</script>
</h:head> </h:head>
<h:body> <h:body>
<div id="header"> <div id="header">
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
<ui:insert name="headerdata" /> <ui:insert name="headerdata" />
<script language="javascript" type="text/javascript" src="#{request.contextPath}/resources/templates/moyav2/js/main.js"></script> <script language="javascript" type="text/javascript" src="#{request.contextPath}/resources/templates/moyav2/js/main.js"></script>
<script type="text/javascript"> <script type="text/javascript">
window.CONTEXTPATH = "#{request.contextPath}";
$(document).ready(function() { $(document).ready(function() {
<ui:repeat value="#{localeSelectorView.availableLocales}" var="loc" varStatus="idx"> <ui:repeat value="#{localeSelectorView.availableLocales}" var="loc" varStatus="idx">
$( $(
......
@media print {
header,#menu,.flex1,#header_left,#header_center,#header_right,nav,#menu,.languageSelector,#leftpanel, #rightpanel, #leftpanel, #rightpanel, #toppanel
{
display: none;
}
#main {
background: none;
border: none;
}
.no_print {
display: none;
}
.printImage {
max-width: 20cm;
}
}
\ No newline at end of file
/* This is file for styling (colors and font-sizes) */
.ui-widget {
font-size: 95% !important;
}
.bgColor1.ui-layout-unit {
}
.bgColor1 .ui-layout-unit-content {
background-image: none;
}
.bgColor1 .ui-layout-unit-header {
background-image: none;
}
.missing_i18n {
color: red;
-webkit-animation-name: blinker;
-webkit-animation-duration: 1s;
-webkit-animation-timing-function: linear;
-webkit-animation-iteration-count: infinite;
-moz-animation-name: blinker;
-moz-animation-duration: 1s;
-moz-animation-timing-function: linear;
-moz-animation-iteration-count: infinite;
animation-name: blinker;
animation-duration: 1s;
animation-timing-function: linear;
animation-iteration-count: infinite;
}
@-moz-keyframes blinker {
0% { opacity: 1.0; }
50% { opacity: 0.0; }
100% { opacity: 1.0; }
}
@-webkit-keyframes blinker {
0% { opacity: 1.0; }
50% { opacity: 0.0; }
100% { opacity: 1.0; }
}
@keyframes blinker {
0% { opacity: 1.0; }
50% { opacity: 0.0; }
100% { opacity: 1.0; }
}
/* Structual stuff, like sizes, margins etc.*/
.bgColor1.ui-layout-unit {
margin: 0px;
padding: 0px;
}
.bgColor1 .ui-layout-unit-content {
margin: 0px;
padding: 0px;
}
.bgColor1 .ui-layout-unit-header {
margin: 0px;
padding: 0px;
}
#header_right {
text-align: right;
}
#header_box {
display: flex;
display: -ms-flexbox;
display: -webkit-flex;
}
#mainlayoutpanel {
margin: 10px;
padding: 10px;
}
#header_center {
position: relative;
text-align: right;
-webkit-box-flex: 1; /* OLD - iOS 6-, Safari 3.1-6 */
-moz-box-flex: 1; /* OLD - Firefox 19- */
width: 20%; /* For old syntax, otherwise collapses. */
-webkit-flex: 1; /* Chrome */
-ms-flex: 1; /* IE 10 */
flex: 1; /* NEW, Spec - Opera 12.1, Firefox 20+ */
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html class="no-js" xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:tools="http://java.sun.com/jsf/composite/cditools" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:p="http://primefaces.org/ui"
xmlns:help="http://java.sun.com/jsf/composite/cditools/help"
xmlns:pe="http://primefaces.org/ui/extensions"
>
<f:view contentType="text/html" locale="#{sessionHandler.locale}">
<pe:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><h:outputText value="#{layoutView.getHeader()}" /></title>
<meta name="description" content="Lippukauppa" />
<meta name="author" content="CodeCrew ry" />
<meta http-equiv="Content-Language" content="#{sessionHandler.locale}" />
<link rel="icon" href="#{request.contextPath}/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/templates/primelayout/css/print.css" />
<link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/templates/primelayout/css/skinning.css" />
<link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/templates/primelayout/css/structual.css" />
<link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/templates/custom_components.css" />
<script type="text/javascript" src="#{request.contextPath}/resources/script/prime_calendar.js"></script>
<script type="text/javascript" src="#{request.contextPath}/resources/script/menufix.js"></script>
<ui:insert name="headerdata" />
<h:outputStylesheet>
.bgColor1 .ui-layout-unit-content {
background-color: #{layoutView.getLayoutProperty1('#68A3C2')};
}
.bgColor1 .ui-layout-unit-header {
background-color: #{layoutView.getLayoutProperty1('#68A3C2')};
}
</h:outputStylesheet>
</pe:head>
<h:body>
<!-- Javascript-lokalisaatiolippupuljausta -->
<h:form id="conversationKeepaliver">
<p:remoteCommand name="cdiKeepalive" onerror="PF('keepAliveDialog').show();" update=":cdiloop" actionListener="#{conversationKeepaliveView.ping()}" />
</h:form>
<p:dialog widgetVar="keepAliveDialog" showEffect="fade" hideEffect="explode" header="#{i18n['template.keepaliveError.title']}" modal="true">
<br />#{i18n['template.keepaliveError']}<br /><br />
<h:form>
<p:commandButton value="OK" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" onclick="location.reload();" />
</h:form>
</p:dialog>
<!--[if lt IE 7]>
<p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
<![endif]-->
<ui:insert name="title" />
<p:fieldset id="leftuserinfo" rendered="#{!sessionHandler.loggedIn}">
<div style="text-align: left; padding: 0.7em;">
<h:form>
<h:outputText rendered="#{authView.loginError}" styleClass="error" value="#{i18n['loginerror.message']}" /><br />
<p:inputText styleClass="form" id="linelogin" value="#{authView.login}" />
<p:watermark for="linelogin" value="#{i18n['login.username']}" />
<br />
<p:password styleClass="form" id="linepwd" value="#{authView.password}" />
<p:watermark for="linepwd" value="#{i18n['login.password']}" />
<br />
<br />
<p:commandButton update="messages" styleClass="button" id="onelinesubmit" action="#{authView.executeLoginAction}" ajax="false" value="#{i18n['login.submit']}" />
<br />
<br />
</h:form>
<ui:fragment rendered="#{authView.canCreateUser}">
<h:link value="#{i18n['submenu.user.create']}" outcome="/user/create" />
<br />
</ui:fragment>
<h:link value="#{i18n['submenu.auth.sendResetMail']}" outcome="/auth/sendResetMail" />
</div>
</p:fieldset>
<p:menubar rendered="#{primeMenuView.hasSecondaryMenu}" model="#{primeMenuView.secondaryMenuModel}" />
<ui:insert name="edittab" />
<ui:repeat var="cont1" value="#{menuView.getPagecontent('top')}">
<h:outputText value="#{cont1.content}" escape="false" />
</ui:repeat>
<ui:insert name="content" />
<ui:repeat var="cont1" value="#{menuView.getPagecontent('bottom')}">
<h:outputText value="#{cont1.content}" escape="false" />
</ui:repeat>
<h:link rendered="#{layoutView.manageContent}" styleClass="editorlink" value="#{i18n['layout.editBottom']}" outcome="/pages/manage">
<f:param name="pagename" value="#{layoutView.pagepath}:bottom" />
</h:link>
<h:form id="messages">
<p:growl id="growl" showDetail="true" sticky="true" widgetVar="messages_growl" />
</h:form>
<h:form>
<p:confirmDialog global="true" showEffect="fade" hideEffect="explode">
<p:commandButton value="Yes" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
<p:commandButton value="No" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
</p:confirmDialog>
</h:form>
<script type="text/javascript">
$(function() {
if(window.self === window.top) {
var url = document.location.href.split("/MoyaWeb/", 2);
var realUrl = "/MoyaNG";
if(url.length > 1) {
realUrl = "/MoyaNG/user/old?p=" + url[1];
}
document.location.href = realUrl;
}
});
</script>
<c:if test="#{sessionHandler.isInDevelopmentMode()}">
<script type="text/javascript">
$('*:contains("???"):not(:has(*))').filter(
function() {
return (this.textContent || this.innerText)
.indexOf("???") === 0;
}).addClass("missing_i18n");
</script>
</c:if>
<h:outputText id="cdiloop" value="#{conversationKeepaliveView.date}">
<f:convertDateTime pattern="#{sessionHandler.datetimeFormat}" timeZone="#{sessionHandler.timezone}" />
</h:outputText>
</h:body>
</f:view>
</html>
\ No newline at end of file
...@@ -57,6 +57,9 @@ ...@@ -57,6 +57,9 @@
</p:dialog> </p:dialog>
<script type="text/javascript"> <script type="text/javascript">
window.CONTEXTPATH = "#{request.contextPath}";
$(document) $(document)
.ready( .ready(
function() { function() {
...@@ -202,10 +205,13 @@ ...@@ -202,10 +205,13 @@
<div style="clear: both;"> </div> <div style="clear: both;"> </div>
</div> </div>
<div id="inIframe" style="color: red; font-weight: bold; ">Ollaan iframessa</div>
<!-- TODO: tyyleistys tähän, toisaalta tarttis tulla vaan teksti --> <!-- TODO: tyyleistys tähän, toisaalta tarttis tulla vaan teksti -->
<ui:insert name="title" /> <ui:insert name="title" />
<p:menubar rendered="#{primeMenuView.hasSecondaryMenu}" model="#{primeMenuView.secondaryMenuModel}" /> <p:menubar rendered="#{primeMenuView.hasSecondaryMenu}" model="#{primeMenuView.secondaryMenuModel}" />
...@@ -267,6 +273,12 @@ ...@@ -267,6 +273,12 @@
PrimeFaces.widgets.mainlayout.layout.saveCookie() PrimeFaces.widgets.mainlayout.layout.saveCookie()
} }
if(window.self !== window.top) {
$("#inIframe").show();
} else {
$("#inIframe").hide();
}
}); });
</script> </script>
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
<h:body> <h:body>
<!-- Javascript-lokalisaatiolippupuljausta --> <!-- Javascript-lokalisaatiolippupuljausta -->
<script type="text/javascript"> <script type="text/javascript">
window.CONTEXTPATH = "#{request.contextPath}";
$(document) $(document)
.ready( .ready(
function() { function() {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<plugin> <plugin>
<artifactId>maven-war-plugin</artifactId> <artifactId>maven-war-plugin</artifactId>
<version>2.5</version> <version>${war-plugin-version}</version>
<configuration> <configuration>
<warSourceDirectory>WebContent</warSourceDirectory> <warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml> <failOnMissingWebXml>false</failOnMissingWebXml>
......
...@@ -81,6 +81,32 @@ public class UserRestViewV2 { ...@@ -81,6 +81,32 @@ public class UserRestViewV2 {
} }
} }
@GET
@Path("/{userid}")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Get user", response = UserPojo.class)
public Response getEventUser(@PathParam("userid") @ApiParam("User ID") Integer userId) {
try {
if (permissionBean.hasPermission(UserPermission.VIEW_ALL) == false) {
return Response.status(Response.Status.FORBIDDEN).build();
}
// Get the user
EventUser eventUser = userBean.findByUserId(userId, false);
if (eventUser == null) {
return Response.status(Response.Status.NOT_FOUND).build();
}
// Return the EventUser
return Response.ok(pojoFactory.createUserPojo(eventUser)).build();
} catch (Exception e) {
logger.error("Finding event user failed", e);
return Response.serverError().build();
}
}
@GET @GET
@Path("/current") @Path("/current")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
......
package fi.codecrew.moya.rest.v2; package fi.codecrew.moya.rest.v2;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.GenericEntity;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import io.swagger.annotations.Api;
import fi.codecrew.moya.beans.PermissionBeanLocal; import fi.codecrew.moya.beans.PermissionBeanLocal;
import fi.codecrew.moya.beans.ProductBeanLocal; import fi.codecrew.moya.beans.ProductBeanLocal;
import fi.codecrew.moya.beans.UserBeanLocal; import fi.codecrew.moya.beans.UserBeanLocal;
......
package fi.codecrew.moya.rest.v3;
import fi.codecrew.moya.beans.PermissionBeanLocal;
import fi.codecrew.moya.beans.ProductBeanLocal;
import fi.codecrew.moya.beans.UserBeanLocal;
import fi.codecrew.moya.beans.VipBeanLocal;
import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.Vip;
import fi.codecrew.moya.model.VipProduct;
import fi.codecrew.moya.rest.v3.pojo.VipRestPojoV3;
import fi.codecrew.moya.utilities.SearchQuery;
import fi.codecrew.moya.utilities.SearchResult;
import io.swagger.annotations.Api;
import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.ws.rs.*;
import javax.ws.rs.core.GenericEntity;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* V3 remake of vipRestStuff. EventUser -> User
*/
@RequestScoped
@Path("/v3/vip")
@Api(value = "/v3/vip", description = "Vip list operations")
@Produces({ MediaType.APPLICATION_JSON + "; charset=UTF-8" })
@Consumes({ MediaType.APPLICATION_JSON })
public class VipRestViewV3 {
@EJB
private VipBeanLocal vipbean;
@EJB
private PermissionBeanLocal permbean;
@EJB
private UserBeanLocal userbean;
@EJB
private ProductBeanLocal prodbean;
@GET
@Path("/all")
public Response getAllVips() {
ArrayList<VipRestPojoV3> ret = VipRestPojoV3.create(vipbean.getAvailableVips());
return Response.ok(new GenericEntity<List<VipRestPojoV3>>(ret) {}).build();
}
@GET
@Path("/search/{searchQuery}")
public Response getAllVips(@PathParam(value = "searchQuery") String search) {
SearchQuery sq = new SearchQuery();
sq.setSearch(search);
sq.setPagesize(0);
SearchResult<Vip> result = vipbean.search(sq);
ArrayList<VipRestPojoV3> ret = VipRestPojoV3.create(result.getResults());
return Response.ok(new GenericEntity<List<VipRestPojoV3>>(ret) {}).build();
}
@DELETE
@Path("/{id}")
public Response deleteEntry(@PathParam("id") Integer id) {
Vip vip = vipbean.find(id);
vipbean.delete(vip);
return Response.ok(VipRestPojoV3.create(vip)).build();
}
@GET
@Path("/{id}")
public Response findEntry(@PathParam("id") Integer id) {
Vip vip = vipbean.find(id);
return Response.ok(VipRestPojoV3.create(vip)).build();
}
@POST
@Path("/create")
@Produces({ MediaType.APPLICATION_JSON })
@Consumes(MediaType.APPLICATION_JSON)
public Response createEntry(VipRestPojoV3 create) {
Vip vip = new Vip();
EventUser curruser = permbean.getCurrentUser();
EventUser eventuser = null;
if (create.userId != null) {
eventuser = userbean.findByUserId(create.userId, false);
}
EventUser host = curruser;
if (create.hostId != null) {
host = userbean.findByUserId(create.hostId, false);
}
vip.setDescription(create.description);
vip.setShortdescr(create.shortdescr);
vip.setCreated(new Date());
vip.setEvent(curruser.getEvent());
vip.setEventUser(eventuser);
vip.setCreator(curruser);
vip.setHost(host);
/*
for (VipProductPojo p : create.products) {
VipProduct prod = new VipProduct(vip);
vip.getProducts().add(prod);
if (p.productId != null) {
prod.setProduct(prodbean.findById(p.productId));
} else {
prod.setName(p.name);
}
prod.setQuantity(p.quantity);
prod.setNotes(p.notes);
}*/
vipbean.create(vip);
return Response.ok(VipRestPojoV3.create(vip)).build();
}
}
package fi.codecrew.moya.rest.v3.pojo;
import fi.codecrew.moya.model.Vip;
import fi.codecrew.moya.model.VipProduct;
import fi.codecrew.moya.rest.pojo.vip.v2.VipProductPojo;
import io.swagger.annotations.ApiModel;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* V3 version of vipstuff, eventuser -> user
*/
@XmlRootElement()
public class VipRestPojoV3 {
public Integer id;
public String description;
public String shortdescr;
public Date created;
public Integer userId;
public Integer creatorId;
public Integer hostId;
public List<VipProductPojo> products = new ArrayList<>();
public static ArrayList<VipRestPojoV3> create(List<Vip> vips) {
ArrayList<VipRestPojoV3> ret = new ArrayList<>();
for (Vip v : vips) {
ret.add(create(v));
}
return ret;
}
public static VipRestPojoV3 create(Vip v) {
VipRestPojoV3 r = new VipRestPojoV3();
r.id = v.getId();
r.description = v.getDescription();
r.shortdescr = v.getShortdescr();
r.created = v.getCreated();
if (v.getEventUser() != null) {
r.userId = v.getEventUser().getUser().getId();
}
if (v.getCreator() != null) {
r.creatorId = v.getCreator().getUser().getId();
}
if (v.getHost() != null) {
r.hostId = v.getHost().getUser().getId();
}
/*
for (VipProduct prod : v.getProducts()) {
r.products.add(VipProductPojo.create(prod));
}*/
return r;
}
}
...@@ -287,7 +287,9 @@ public class PrimeMenuView extends GenericCDIView { ...@@ -287,7 +287,9 @@ public class PrimeMenuView extends GenericCDIView {
item.setValue(key); item.setValue(key);
item.setOutcome(outcome); item.setOutcome(outcome);
} }
return item; return item;
} }
......
package fi.codecrew.moya.web.helper;
import fi.codecrew.moya.web.cdiview.GenericCDIView;
import javax.enterprise.context.ConversationScoped;
import javax.faces.context.FacesContext;
import javax.inject.Named;
import java.io.Serializable;
import java.util.Map;
/**
*
* Class to store current page when we are on angular -pages.
*
* Created by tuukka on 12/02/17.
*/
@Named
@ConversationScoped
public class AngularPageName extends GenericCDIView {
private static final long serialVersionUID = 1L;
private String pagename;
public void init() {
if(pagename == null) {
super.beginConversation();
}
}
public String getPagename() {
init();
return pagename;
}
public void setPagename(String pagename) {
init();
this.pagename = pagename;
}
public void pagenameRemoteCommand() {
init();
setPagename(((Map<String, String>)FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap()).get("pagename"));
}
}
...@@ -61,6 +61,10 @@ public class LayoutView implements Serializable { ...@@ -61,6 +61,10 @@ public class LayoutView implements Serializable {
private transient PermissionBeanLocal permbean; private transient PermissionBeanLocal permbean;
@Inject @Inject
private SessionStore sessionStore; private SessionStore sessionStore;
@Inject
private AngularPageName angularPageName;
@EJB @EJB
private transient MenuBeanLocal menubean; private transient MenuBeanLocal menubean;
...@@ -96,11 +100,11 @@ public class LayoutView implements Serializable { ...@@ -96,11 +100,11 @@ public class LayoutView implements Serializable {
{ {
selectedSet = new HashSet<>(); selectedSet = new HashSet<>();
selectedTop = menubean.findNavigation(getPagepath()); selectedTop = menubean.findNavigation(getPagepath());
if (selectedTop == null) if (selectedTop == null)
return null; return null;
while (selectedTop.getParent() != null) { while (selectedTop.getParent() != null) {
// logger.debug("Traversing to top {}, key {}", selectedTop, selectedTop.getKey());
selectedSet.add(selectedTop); selectedSet.add(selectedTop);
selectedTop = selectedTop.getParent(); selectedTop = selectedTop.getParent();
} }
...@@ -117,6 +121,7 @@ public class LayoutView implements Serializable { ...@@ -117,6 +121,7 @@ public class LayoutView implements Serializable {
} }
public String getPagepath() { public String getPagepath() {
FacesContext context = FacesContext.getCurrentInstance(); FacesContext context = FacesContext.getCurrentInstance();
if (pagename == null && if (pagename == null &&
context != null && context != null &&
......
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
<name>Moya Online Youth Accumulator</name> <name>Moya Online Youth Accumulator</name>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>1.2-SNAPSHOT</version> <version>1.2-SNAPSHOT</version>
<prerequisites>
<maven>3.1.0</maven>
</prerequisites>
<modules> <modules>
<module>moya-parent</module> <module>moya-parent</module>
...@@ -18,11 +21,11 @@ ...@@ -18,11 +21,11 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java-version>1.8</java-version> <java-version>1.8</java-version>
<!-- plugin versions --> <!-- plugin versions -->
<ejb-plugin-version>2.3</ejb-plugin-version> <ejb-plugin-version>2.5.1</ejb-plugin-version>
<war-plugin-version>2.4</war-plugin-version> <war-plugin-version>3.1.0</war-plugin-version>
<ear-plugin-version>2.9</ear-plugin-version> <ear-plugin-version>2.9</ear-plugin-version>
<compiler-plugin-version>3.2</compiler-plugin-version> <compiler-plugin-version>3.6.1</compiler-plugin-version>
<!-- dependency versions --> <!-- dependency versions -->
<javaee-api-version>7.0</javaee-api-version> <javaee-api-version>7.0</javaee-api-version>
<!-- EJB spec version --> <!-- EJB spec version -->
...@@ -44,6 +47,9 @@ ...@@ -44,6 +47,9 @@
<rewriteservlet.version>3.4.1.Final</rewriteservlet.version> <rewriteservlet.version>3.4.1.Final</rewriteservlet.version>
<iudex.standalone>1.0.23</iudex.standalone> <iudex.standalone>1.0.23</iudex.standalone>
<js.node.version>v8.6.0</js.node.version>
<js.npm.version>5.6.0</js.npm.version>
<eirslett.frontend.version>1.4</eirslett.frontend.version>
</properties> </properties>
<url>http://codecrew.fi</url> <url>http://codecrew.fi</url>
...@@ -86,11 +92,6 @@ ...@@ -86,11 +92,6 @@
<repositories> <repositories>
<repository> <repository>
<id>prime-repo</id>
<name>PrimeFaces Maven Repository</name>
<url>https://repository.primefaces.org</url>
</repository>
<repository>
<id>iudex</id> <id>iudex</id>
<url>http://iudex.fi/maven/</url> <url>http://iudex.fi/maven/</url>
</repository> </repository>
...@@ -99,8 +100,11 @@ ...@@ -99,8 +100,11 @@
<name>jvnet-nexus-releases</name> <name>jvnet-nexus-releases</name>
<url>https://maven.java.net/content/repositories/releases/</url> <url>https://maven.java.net/content/repositories/releases/</url>
</repository> </repository>
<!-- <repository>
--> <id>prime-repo</id>
<name>PrimeFaces Maven Repository</name>
<url>https://repository.primefaces.org</url>
</repository>
<repository> <repository>
<id>apache.snapshots</id> <id>apache.snapshots</id>
<url>http://repository.apache.org/snapshots/</url> <url>http://repository.apache.org/snapshots/</url>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!