Added first version of frontend part
This commit is contained in:
parent
800a832975
commit
bff62a725d
87 changed files with 10322 additions and 0 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1 +1,3 @@
|
|||
backend-legacy/config/config-user.php
|
||||
*/nbproject/private
|
||||
*/node_modules/*
|
||||
|
|
57
frontend/.angular-cli.json
Normal file
57
frontend/.angular-cli.json
Normal file
|
@ -0,0 +1,57 @@
|
|||
{
|
||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||
"project": {
|
||||
"name": "pdnsmanager"
|
||||
},
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"project": "src/tsconfig.spec.json"
|
||||
},
|
||||
{
|
||||
"project": "e2e/tsconfig.e2e.json"
|
||||
}
|
||||
],
|
||||
"test": {
|
||||
"karma": {
|
||||
"config": "./karma.conf.js"
|
||||
}
|
||||
},
|
||||
"defaults": {
|
||||
"styleExt": "scss",
|
||||
"component": {}
|
||||
}
|
||||
}
|
13
frontend/.editorconfig
Normal file
13
frontend/.editorconfig
Normal file
|
@ -0,0 +1,13 @@
|
|||
# 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
|
14
frontend/e2e/app.e2e-spec.ts
Normal file
14
frontend/e2e/app.e2e-spec.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { PdnsmanagerPage } from './app.po';
|
||||
|
||||
describe('pdnsmanager App', () => {
|
||||
let page: PdnsmanagerPage;
|
||||
|
||||
beforeEach(() => {
|
||||
page = new PdnsmanagerPage();
|
||||
});
|
||||
|
||||
it('should display welcome message', () => {
|
||||
page.navigateTo();
|
||||
expect(page.getParagraphText()).toEqual('Welcome to app!!');
|
||||
});
|
||||
});
|
11
frontend/e2e/app.po.ts
Normal file
11
frontend/e2e/app.po.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
import { browser, by, element } from 'protractor';
|
||||
|
||||
export class PdnsmanagerPage {
|
||||
navigateTo() {
|
||||
return browser.get('/');
|
||||
}
|
||||
|
||||
getParagraphText() {
|
||||
return element(by.css('app-root h1')).getText();
|
||||
}
|
||||
}
|
13
frontend/e2e/tsconfig.e2e.json
Normal file
13
frontend/e2e/tsconfig.e2e.json
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../out-tsc/e2e",
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"types": [
|
||||
"jasmine",
|
||||
"jasminewd2",
|
||||
"node"
|
||||
]
|
||||
}
|
||||
}
|
33
frontend/karma.conf.js
Normal file
33
frontend/karma.conf.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
// 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
|
||||
},
|
||||
coverageIstanbulReporter: {
|
||||
reports: [ 'html', 'lcovonly' ],
|
||||
fixWebpackSourcePaths: true
|
||||
},
|
||||
angularCli: {
|
||||
environment: 'dev'
|
||||
},
|
||||
reporters: ['progress', 'kjhtml'],
|
||||
port: 9876,
|
||||
colors: true,
|
||||
logLevel: config.LOG_INFO,
|
||||
autoWatch: true,
|
||||
browsers: ['Chrome'],
|
||||
singleRun: false
|
||||
});
|
||||
};
|
49
frontend/nbproject/customs.json
Normal file
49
frontend/nbproject/customs.json
Normal file
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
"elements": {
|
||||
"app-sort": {
|
||||
"attributes": {
|
||||
"field": {}
|
||||
}
|
||||
},
|
||||
"app-navbar-entry": {
|
||||
"attributes": {
|
||||
"icon": {},
|
||||
"right": {},
|
||||
"target": {}
|
||||
}
|
||||
},
|
||||
"app-fa-icon": {
|
||||
"attributes": {
|
||||
"fixedWidth": {},
|
||||
"size": {},
|
||||
"icon": {},
|
||||
"animate": {}
|
||||
}
|
||||
},
|
||||
"app-modal-container": {},
|
||||
"ng-content": {
|
||||
"attributes": {
|
||||
"select": {}
|
||||
}
|
||||
},
|
||||
"ng-select": {},
|
||||
"router-outlet": {},
|
||||
"app-alert-message": {
|
||||
"attributes": {
|
||||
"strong": {}
|
||||
}
|
||||
},
|
||||
"li": {},
|
||||
"app-navbar": {
|
||||
"attributes": {
|
||||
"brand": {}
|
||||
}
|
||||
},
|
||||
"app-alert": {}
|
||||
},
|
||||
"attributes": {
|
||||
"routerLinkActive": {},
|
||||
"*ngfor": {},
|
||||
"class": {}
|
||||
}
|
||||
}
|
5
frontend/nbproject/project.properties
Normal file
5
frontend/nbproject/project.properties
Normal file
|
@ -0,0 +1,5 @@
|
|||
file.reference.pdnsmanager-angular-src=src
|
||||
file.reference.pdnsmanager-pdnsmanager-angular=.
|
||||
files.encoding=UTF-8
|
||||
site.root.folder=${file.reference.pdnsmanager-pdnsmanager-angular}
|
||||
source.folder=${file.reference.pdnsmanager-angular-src}
|
9
frontend/nbproject/project.xml
Normal file
9
frontend/nbproject/project.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.web.clientproject</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/clientside-project/1">
|
||||
<name>pdnsmanager-angular</name>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
8367
frontend/package-lock.json
generated
Normal file
8367
frontend/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
51
frontend/package.json
Normal file
51
frontend/package.json
Normal file
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
"name": "pdnsmanager",
|
||||
"version": "0.0.0",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve --proxy-config proxy.conf.json",
|
||||
"build": "ng build",
|
||||
"test": "ng test",
|
||||
"lint": "ng lint",
|
||||
"e2e": "ng e2e"
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@angular/animations": "^4.3.1",
|
||||
"@angular/common": "^4.3.1",
|
||||
"@angular/compiler": "^4.3.1",
|
||||
"@angular/core": "^4.3.1",
|
||||
"@angular/forms": "^4.3.1",
|
||||
"@angular/http": "^4.3.1",
|
||||
"@angular/platform-browser": "^4.3.1",
|
||||
"@angular/platform-browser-dynamic": "^4.3.1",
|
||||
"@angular/router": "^4.3.1",
|
||||
"bootstrap": "^4.0.0-alpha.6",
|
||||
"core-js": "^2.4.1",
|
||||
"font-awesome": "^4.7.0",
|
||||
"rxjs": "^5.1.0",
|
||||
"zone.js": "^0.8.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular/cli": "^1.2.3",
|
||||
"@angular/compiler-cli": "^4.3.1",
|
||||
"@angular/language-service": "^4.3.1",
|
||||
"@types/jasmine": "~2.5.53",
|
||||
"@types/jasminewd2": "~2.0.2",
|
||||
"@types/node": "~6.0.60",
|
||||
"codelyzer": "~3.0.1",
|
||||
"jasmine-core": "~2.6.2",
|
||||
"jasmine-spec-reporter": "~4.1.0",
|
||||
"karma": "~1.7.0",
|
||||
"karma-chrome-launcher": "~2.1.1",
|
||||
"karma-cli": "~1.0.1",
|
||||
"karma-coverage-istanbul-reporter": "^1.2.1",
|
||||
"karma-jasmine": "~1.1.0",
|
||||
"karma-jasmine-html-reporter": "^0.2.2",
|
||||
"protractor": "~5.1.2",
|
||||
"ts-node": "~3.0.4",
|
||||
"tslint": "~5.3.2",
|
||||
"typescript": "~2.3.3"
|
||||
}
|
||||
}
|
28
frontend/protractor.conf.js
Normal file
28
frontend/protractor.conf.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
// 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() {}
|
||||
},
|
||||
onPrepare() {
|
||||
require('ts-node').register({
|
||||
project: 'e2e/tsconfig.e2e.json'
|
||||
});
|
||||
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
|
||||
}
|
||||
};
|
6
frontend/proxy.conf.json
Normal file
6
frontend/proxy.conf.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"/api": {
|
||||
"target": "http://localhost:8000",
|
||||
"secure": false
|
||||
}
|
||||
}
|
33
frontend/src/app/app-routing.module.ts
Normal file
33
frontend/src/app/app-routing.module.ts
Normal file
|
@ -0,0 +1,33 @@
|
|||
import {NgModule} from '@angular/core';
|
||||
import {Routes, RouterModule} from '@angular/router';
|
||||
|
||||
import {DomainsComponent} from './pages/domains/domains.component';
|
||||
import {UsersComponent} from './pages/users/users.component';
|
||||
import {LoginComponent} from './pages/login/login.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: 'domains',
|
||||
component: DomainsComponent
|
||||
},
|
||||
{
|
||||
path: 'users',
|
||||
component: UsersComponent
|
||||
},
|
||||
{
|
||||
path: '',
|
||||
component: LoginComponent,
|
||||
pathMatch: 'full'
|
||||
},
|
||||
{
|
||||
path: '',
|
||||
redirectTo: '/',
|
||||
pathMatch: 'prefix'
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forRoot(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class AppRoutingModule {}
|
12
frontend/src/app/app.component.html
Normal file
12
frontend/src/app/app.component.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
<app-navbar *ngIf="sessionService.getIsLoggedIn()" brand="PDNS Manager">
|
||||
<app-navbar-entry icon="navicon" target="/domains">Domains</app-navbar-entry>
|
||||
<app-navbar-entry icon="users" target="/users">Users</app-navbar-entry>
|
||||
<app-navbar-entry icon="sign-out" right (click)="logout()" neverActive>Logout</app-navbar-entry>
|
||||
</app-navbar>
|
||||
<app-navbar *ngIf="!sessionService.getIsLoggedIn()" brand="PDNS Manager"></app-navbar>
|
||||
|
||||
<div class="container">
|
||||
<router-outlet></router-outlet>
|
||||
</div>
|
||||
|
||||
<app-modal-container></app-modal-container>
|
3
frontend/src/app/app.component.scss
Normal file
3
frontend/src/app/app.component.scss
Normal file
|
@ -0,0 +1,3 @@
|
|||
div.container {
|
||||
padding-top: 20px;
|
||||
}
|
23
frontend/src/app/app.component.spec.ts
Normal file
23
frontend/src/app/app.component.spec.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
import { TestBed, async } from '@angular/core/testing';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
||||
import { AppComponent } from './app.component';
|
||||
|
||||
describe('AppComponent', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
RouterTestingModule
|
||||
],
|
||||
declarations: [
|
||||
AppComponent
|
||||
],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
it('should create the app', async(() => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.debugElement.componentInstance;
|
||||
expect(app).toBeTruthy();
|
||||
}));
|
||||
});
|
28
frontend/src/app/app.component.ts
Normal file
28
frontend/src/app/app.component.ts
Normal file
|
@ -0,0 +1,28 @@
|
|||
import { Component } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
import { SessionService } from './services/session/session.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
templateUrl: './app.component.html',
|
||||
styleUrls: ['./app.component.scss']
|
||||
})
|
||||
export class AppComponent {
|
||||
title = 'app';
|
||||
|
||||
constructor(private sessionService: SessionService,
|
||||
private router: Router) { }
|
||||
|
||||
/**
|
||||
* Starts the logout procedure using the SessionService.
|
||||
*/
|
||||
logout() {
|
||||
this.sessionService.logOut()
|
||||
.then(() => {
|
||||
this.router.navigate(['/']);
|
||||
}, () => {
|
||||
|
||||
});
|
||||
}
|
||||
}
|
49
frontend/src/app/app.module.ts
Normal file
49
frontend/src/app/app.module.ts
Normal file
|
@ -0,0 +1,49 @@
|
|||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { HttpModule } from '@angular/http';
|
||||
|
||||
import { AppRoutingModule } from './app-routing.module';
|
||||
import { AppComponent } from './app.component';
|
||||
|
||||
import { NavbarComponent } from './partials/navbar/navbar.component';
|
||||
import { NavbarEntryComponent } from './partials/navbar-entry/navbar-entry.component';
|
||||
import { FaIconComponent } from './partials/fa-icon/fa-icon.component';
|
||||
import { AlertComponent } from './partials/alert/alert.component';
|
||||
import { AlertMessageComponent } from './partials/alert-message/alert-message.component';
|
||||
import { ModalContainerComponent } from './partials/modal-container/modal-container.component';
|
||||
import { SortComponent } from './partials/sort/sort.component';
|
||||
|
||||
import { DomainsComponent } from './pages/domains/domains.component';
|
||||
import { UsersComponent } from './pages/users/users.component';
|
||||
import { LoginComponent } from './pages/login/login.component';
|
||||
|
||||
import { HttpService } from './services/http/http.service';
|
||||
import { ModalService } from './services/modal/modal.service';
|
||||
import { SessionService } from './services/session/session.service';
|
||||
import { DomainsService } from './services/domains/domains.service';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
NavbarComponent,
|
||||
NavbarEntryComponent,
|
||||
FaIconComponent,
|
||||
DomainsComponent,
|
||||
UsersComponent,
|
||||
LoginComponent,
|
||||
AlertComponent,
|
||||
AlertMessageComponent,
|
||||
ModalContainerComponent,
|
||||
SortComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
AppRoutingModule,
|
||||
FormsModule,
|
||||
HttpModule
|
||||
],
|
||||
providers: [SessionService, HttpService, DomainsService, ModalService],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
export class AppModule { }
|
12
frontend/src/app/interfaces/domains-answer.ts
Normal file
12
frontend/src/app/interfaces/domains-answer.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
export interface DomainsAnswer {
|
||||
pages: {
|
||||
current: number,
|
||||
total: number
|
||||
},
|
||||
data: {
|
||||
id: number,
|
||||
name: string,
|
||||
type: string,
|
||||
records: number
|
||||
}[]
|
||||
}
|
3
frontend/src/app/interfaces/empty-answer.ts
Normal file
3
frontend/src/app/interfaces/empty-answer.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
export interface EmptyAnswer {
|
||||
|
||||
}
|
7
frontend/src/app/interfaces/modal-options.ts
Normal file
7
frontend/src/app/interfaces/modal-options.ts
Normal file
|
@ -0,0 +1,7 @@
|
|||
export interface ModalOptions {
|
||||
heading: string,
|
||||
body: string,
|
||||
acceptText: string,
|
||||
dismisText: string,
|
||||
acceptClass: string
|
||||
}
|
3
frontend/src/app/interfaces/session-answer.ts
Normal file
3
frontend/src/app/interfaces/session-answer.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
export interface SessionAnswer {
|
||||
status: string
|
||||
}
|
4
frontend/src/app/interfaces/sort-event.ts
Normal file
4
frontend/src/app/interfaces/sort-event.ts
Normal file
|
@ -0,0 +1,4 @@
|
|||
export interface SortEvent {
|
||||
field: string,
|
||||
order: number
|
||||
}
|
54
frontend/src/app/pages/domains/domains.component.html
Normal file
54
frontend/src/app/pages/domains/domains.component.html
Normal file
|
@ -0,0 +1,54 @@
|
|||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="cell-vertical-middle">
|
||||
<div>
|
||||
<strong>ID</strong>
|
||||
<app-sort #sortId field="id" (sort)="sort($event)"></app-sort>
|
||||
</div>
|
||||
</td>
|
||||
<td class="cell-vertical-middle">
|
||||
<div class="form-inline">
|
||||
<strong>Name</strong>
|
||||
<app-sort #sortName field="name" (sort)="sort($event)"></app-sort>
|
||||
<input class="form-control no-shadow" placeholder="Search" autocomplete="off"
|
||||
type="text" [(ngModel)]="searchName" (ngModelChange)="loadDomains()">
|
||||
</div>
|
||||
</td>
|
||||
<td class="cell-vertical-middle">
|
||||
<div class="form-inline">
|
||||
<strong>Type</strong>
|
||||
<app-sort #sortType field="type" (sort)="sort($event)"></app-sort>
|
||||
<select class="form-control no-shadow" [(ngModel)]="searchType" (ngModelChange)="loadDomains()">
|
||||
<option value="none">No filter...</option>
|
||||
<option value="MASTER">Master</option>
|
||||
<option value="NATIVE">Native</option>
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
<td class="cell-vertical-middle">
|
||||
<div>
|
||||
<strong>Records</strong>
|
||||
<app-sort #sortRecords field="records" (sort)="sort($event)"></app-sort>
|
||||
</div>
|
||||
</td>
|
||||
<td class="cell-vertical-middle"></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let domain of data.data">
|
||||
<td>{{domain.id}}</td>
|
||||
<td>{{domain.name}}</td>
|
||||
<td>{{domain.type}}</td>
|
||||
<td>{{domain.records}}</td>
|
||||
<td>
|
||||
<div>
|
||||
<app-fa-icon icon="trash" (click)="deleteDomain(domain.id, domain.name)"></app-fa-icon>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
7
frontend/src/app/pages/domains/domains.component.scss
Normal file
7
frontend/src/app/pages/domains/domains.component.scss
Normal file
|
@ -0,0 +1,7 @@
|
|||
tbody {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.cell-vertical-middle {
|
||||
vertical-align: middle !important;
|
||||
}
|
25
frontend/src/app/pages/domains/domains.component.spec.ts
Normal file
25
frontend/src/app/pages/domains/domains.component.spec.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DomainsComponent } from './domains.component';
|
||||
|
||||
describe('DomainsComponent', () => {
|
||||
let component: DomainsComponent;
|
||||
let fixture: ComponentFixture<DomainsComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ DomainsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DomainsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
94
frontend/src/app/pages/domains/domains.component.ts
Normal file
94
frontend/src/app/pages/domains/domains.component.ts
Normal file
|
@ -0,0 +1,94 @@
|
|||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
|
||||
import { DomainsService } from 'app/services/domains/domains.service';
|
||||
import { DomainsAnswer } from 'app/interfaces/domains-answer';
|
||||
import { ModalService } from 'app/services/modal/modal.service';
|
||||
import { SortComponent } from 'app/partials/sort/sort.component';
|
||||
import { SortEvent } from 'app/interfaces/sort-event';
|
||||
|
||||
@Component({
|
||||
selector: 'app-domains',
|
||||
templateUrl: './domains.component.html',
|
||||
styleUrls: ['./domains.component.scss']
|
||||
})
|
||||
export class DomainsComponent implements OnInit {
|
||||
|
||||
data: DomainsAnswer = { pages: { current: 1, total: 1 }, data: [] };
|
||||
|
||||
@ViewChild('sortId') sortId: SortComponent;
|
||||
@ViewChild('sortName') sortName: SortComponent;
|
||||
@ViewChild('sortType') sortType: SortComponent;
|
||||
@ViewChild('sortRecords') sortRecords: SortComponent;
|
||||
|
||||
private sortField: string = null;
|
||||
private sortOrder: number = 0;
|
||||
|
||||
private searchName: string;
|
||||
private searchType: string = 'none';
|
||||
|
||||
constructor(private domainsService: DomainsService,
|
||||
private modalService: ModalService) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.loadDomains();
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the domains from the server using the parameters specified in
|
||||
* the properties of the components.
|
||||
*/
|
||||
loadDomains() {
|
||||
let field = this.sortField ? this.sortField : '';
|
||||
let searchType = this.searchType === 'none' ? '' : this.searchType;
|
||||
|
||||
this.domainsService.getDomains(1, field, this.sortOrder, this.searchName, searchType)
|
||||
.then((data: DomainsAnswer) => {
|
||||
this.data = data;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a domain.
|
||||
*
|
||||
* @param id Id of domain to delete
|
||||
* @param name Name of domain to delete (only used for modal dialog)
|
||||
*/
|
||||
deleteDomain(id: number, name: string) {
|
||||
this.modalService.showMessage({
|
||||
heading: 'Delete Domain?',
|
||||
body: `Are you shure you want to delete the zone ${ name }?`,
|
||||
acceptText: 'Delete',
|
||||
dismisText: 'Cancel',
|
||||
acceptClass: 'danger'
|
||||
})
|
||||
.then(() => {
|
||||
this.domainsService.deleteDomain(id);
|
||||
this.loadDomains();
|
||||
}, () => {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes a sort event and applies the data to the current component state.
|
||||
*
|
||||
* @param event The SortEvent to process
|
||||
*/
|
||||
sort(event: SortEvent) {
|
||||
this.sortId.resetIfNotField(event.field);
|
||||
this.sortName.resetIfNotField(event.field);
|
||||
this.sortType.resetIfNotField(event.field);
|
||||
this.sortRecords.resetIfNotField(event.field);
|
||||
|
||||
if (event.order === 0) {
|
||||
this.sortField = null;
|
||||
} else {
|
||||
this.sortField = event.field;
|
||||
}
|
||||
|
||||
this.sortOrder = event.order;
|
||||
|
||||
this.loadDomains();
|
||||
}
|
||||
|
||||
}
|
31
frontend/src/app/pages/login/login.component.html
Normal file
31
frontend/src/app/pages/login/login.component.html
Normal file
|
@ -0,0 +1,31 @@
|
|||
<div class="row">
|
||||
<div class="col-12 col-md-6 col-lg-3 offset-md-6">
|
||||
|
||||
<app-alert *ngIf="loginError">
|
||||
<app-alert-message strong>Username or password wrong!</app-alert-message>
|
||||
</app-alert>
|
||||
|
||||
<form #loginForm="ngForm" (ngSubmit)="tryLogin()">
|
||||
<div class="form-group">
|
||||
<label class="control-label">Username</label>
|
||||
<input type="text" class="form-control" placeholder="Username"
|
||||
autocapitalize="none" autocomplete="off" name="username"
|
||||
ngModel #name="ngModel" required>
|
||||
</div>
|
||||
<app-alert *ngIf="name.errors && (name.dirty || name.touched || submited)">
|
||||
<app-alert-message *ngIf="name.errors.required">Name is required!</app-alert-message>
|
||||
</app-alert>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label" >Password</label>
|
||||
<input type="password" class="form-control" placeholder="Password"
|
||||
name="password" #password="ngModel" required ngModel>
|
||||
</div>
|
||||
<app-alert *ngIf="password.errors && (password.dirty || password.touched || submited)">
|
||||
<app-alert-message *ngIf="password.errors.required">Password is required!</app-alert-message>
|
||||
</app-alert>
|
||||
|
||||
<button type="submit" class="btn btn-primary" >Login</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
0
frontend/src/app/pages/login/login.component.scss
Normal file
0
frontend/src/app/pages/login/login.component.scss
Normal file
25
frontend/src/app/pages/login/login.component.spec.ts
Normal file
25
frontend/src/app/pages/login/login.component.spec.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { LoginComponent } from './login.component';
|
||||
|
||||
describe('LoginComponent', () => {
|
||||
let component: LoginComponent;
|
||||
let fixture: ComponentFixture<LoginComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ LoginComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(LoginComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
39
frontend/src/app/pages/login/login.component.ts
Normal file
39
frontend/src/app/pages/login/login.component.ts
Normal file
|
@ -0,0 +1,39 @@
|
|||
import { Component, ViewChild } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { NgForm } from '@angular/forms';
|
||||
|
||||
import { SessionService } from 'app/services/session/session.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-login',
|
||||
templateUrl: './login.component.html',
|
||||
styleUrls: ['./login.component.scss']
|
||||
})
|
||||
export class LoginComponent {
|
||||
@ViewChild('loginForm') loginForm: NgForm;
|
||||
|
||||
private submited = false;
|
||||
private loginError = false;
|
||||
|
||||
constructor(private sessionService: SessionService,
|
||||
private router: Router) { }
|
||||
|
||||
/**
|
||||
* Tries a login atempt to the server using the data from the login form.
|
||||
* If this is successfull the login in performed, if not an error will be
|
||||
* shown.
|
||||
*/
|
||||
tryLogin() {
|
||||
this.submited = true;
|
||||
if (!this.loginForm.valid) { return; }
|
||||
const value = this.loginForm.value;
|
||||
this.sessionService.tryLogin(value.username, value.password).then(() => {
|
||||
this.loginForm.reset();
|
||||
this.submited = false;
|
||||
this.loginError = false;
|
||||
this.router.navigate(['/domains']);
|
||||
}, () => {
|
||||
this.loginError = true;
|
||||
});
|
||||
}
|
||||
}
|
3
frontend/src/app/pages/users/users.component.html
Normal file
3
frontend/src/app/pages/users/users.component.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
<p>
|
||||
users works!
|
||||
</p>
|
0
frontend/src/app/pages/users/users.component.scss
Normal file
0
frontend/src/app/pages/users/users.component.scss
Normal file
25
frontend/src/app/pages/users/users.component.spec.ts
Normal file
25
frontend/src/app/pages/users/users.component.spec.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { UsersComponent } from './users.component';
|
||||
|
||||
describe('UsersComponent', () => {
|
||||
let component: UsersComponent;
|
||||
let fixture: ComponentFixture<UsersComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ UsersComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(UsersComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
15
frontend/src/app/pages/users/users.component.ts
Normal file
15
frontend/src/app/pages/users/users.component.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-users',
|
||||
templateUrl: './users.component.html',
|
||||
styleUrls: ['./users.component.scss']
|
||||
})
|
||||
export class UsersComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
<p><ng-content></ng-content></p>
|
|
@ -0,0 +1,3 @@
|
|||
p {
|
||||
margin: 0px !important;
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AlertMessageComponent } from './alert-message.component';
|
||||
|
||||
describe('AlertMessageComponent', () => {
|
||||
let component: AlertMessageComponent;
|
||||
let fixture: ComponentFixture<AlertMessageComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ AlertMessageComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AlertMessageComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
|
@ -0,0 +1,12 @@
|
|||
import {Component} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-alert-message',
|
||||
templateUrl: './alert-message.component.html',
|
||||
styleUrls: ['./alert-message.component.scss']
|
||||
})
|
||||
export class AlertMessageComponent {
|
||||
|
||||
constructor() {}
|
||||
|
||||
}
|
3
frontend/src/app/partials/alert/alert.component.html
Normal file
3
frontend/src/app/partials/alert/alert.component.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
<div class="alert" [ngClass]="'alert-' + type" role="alert">
|
||||
<ng-content></ng-content>
|
||||
</div>
|
0
frontend/src/app/partials/alert/alert.component.scss
Normal file
0
frontend/src/app/partials/alert/alert.component.scss
Normal file
25
frontend/src/app/partials/alert/alert.component.spec.ts
Normal file
25
frontend/src/app/partials/alert/alert.component.spec.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AlertComponent } from './alert.component';
|
||||
|
||||
describe('AlertComponent', () => {
|
||||
let component: AlertComponent;
|
||||
let fixture: ComponentFixture<AlertComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ AlertComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AlertComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
13
frontend/src/app/partials/alert/alert.component.ts
Normal file
13
frontend/src/app/partials/alert/alert.component.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-alert',
|
||||
templateUrl: './alert.component.html',
|
||||
styleUrls: ['./alert.component.scss']
|
||||
})
|
||||
export class AlertComponent {
|
||||
|
||||
@Input() type = 'danger';
|
||||
|
||||
constructor() {}
|
||||
}
|
11
frontend/src/app/partials/fa-icon/fa-icon.component.html
Normal file
11
frontend/src/app/partials/fa-icon/fa-icon.component.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
<span class="fa"
|
||||
[class.fa-lg]="size == 1"
|
||||
[class.fa-2x]="size == 2"
|
||||
[class.fa-3x]="size == 3"
|
||||
[class.fa-4x]="size == 4"
|
||||
[class.fa-5x]="size == 5"
|
||||
[class.fa-fw]="fixedWidth !== false"
|
||||
[class.fa-spin]="animate == 'spin'"
|
||||
[class.fa-pulse]="animate == 'pulse'"
|
||||
[ngClass]="'fa-' + icon"
|
||||
></span>
|
0
frontend/src/app/partials/fa-icon/fa-icon.component.scss
Normal file
0
frontend/src/app/partials/fa-icon/fa-icon.component.scss
Normal file
25
frontend/src/app/partials/fa-icon/fa-icon.component.spec.ts
Normal file
25
frontend/src/app/partials/fa-icon/fa-icon.component.spec.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { FaIconComponent } from './fa-icon.component';
|
||||
|
||||
describe('FaIconComponent', () => {
|
||||
let component: FaIconComponent;
|
||||
let fixture: ComponentFixture<FaIconComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ FaIconComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(FaIconComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
16
frontend/src/app/partials/fa-icon/fa-icon.component.ts
Normal file
16
frontend/src/app/partials/fa-icon/fa-icon.component.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-fa-icon',
|
||||
templateUrl: './fa-icon.component.html',
|
||||
styleUrls: ['./fa-icon.component.scss']
|
||||
})
|
||||
export class FaIconComponent {
|
||||
|
||||
@Input() icon: string;
|
||||
@Input() size = 0;
|
||||
@Input() fixedWidth = false;
|
||||
@Input() animate = '';
|
||||
|
||||
constructor() {}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
<div class="modal fade" [class.show]="animate" [class.in]="animate" [hidden]="!show" (click)="onDismis()">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">{{options.heading}}</h5>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>{{options.body}}</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" (click)="onDismis()">{{options.dismisText}}</button>
|
||||
<button type="button" class="btn" [ngClass]="'btn-' + options.acceptClass" (click)="onAccept()">{{options.acceptText}}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-backdrop fade" [hidden]="!show" [class.show]="animate" [class.in]="animate"></div>
|
|
@ -0,0 +1,3 @@
|
|||
div.modal {
|
||||
display: block;
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ModalContainerComponent } from './modal-container.component';
|
||||
|
||||
describe('ModalContainerComponent', () => {
|
||||
let component: ModalContainerComponent;
|
||||
let fixture: ComponentFixture<ModalContainerComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ModalContainerComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ModalContainerComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
|
@ -0,0 +1,83 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { ModalService } from 'app/services/modal/modal.service';
|
||||
import { ModalOptions } from 'app/interfaces/modal-options';
|
||||
|
||||
@Component({
|
||||
selector: 'app-modal-container',
|
||||
templateUrl: './modal-container.component.html',
|
||||
styleUrls: ['./modal-container.component.scss']
|
||||
})
|
||||
export class ModalContainerComponent implements OnInit {
|
||||
|
||||
private options: ModalOptions = {
|
||||
heading: '',
|
||||
body: '',
|
||||
acceptText: '',
|
||||
dismisText: '',
|
||||
acceptClass: 'primary'
|
||||
};
|
||||
|
||||
private show: boolean = false;
|
||||
private animate: boolean = false;
|
||||
|
||||
private currentResolve: Function;
|
||||
private currentReject: Function;
|
||||
|
||||
constructor(private modalService: ModalService) { }
|
||||
|
||||
/**
|
||||
* Registers this ModalContainerComponent to the ModalService.
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.modalService.registerModalContainer(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Receives a modal options component and sets the internal config
|
||||
* accordingly. Also the modal dialog is shown with correct animation.
|
||||
*/
|
||||
showMessage(options: ModalOptions): Promise<void> {
|
||||
this.options = options;
|
||||
|
||||
this.show = true;
|
||||
window.setTimeout(() => this.animate = true, 50);
|
||||
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
this.currentResolve = resolve;
|
||||
this.currentReject = reject;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides the modal dialog with correct animation.
|
||||
*/
|
||||
hideModal() {
|
||||
this.animate = false;
|
||||
window.setTimeout(() => this.show = false, 50);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler if the user triggers a dismis action.
|
||||
*/
|
||||
onDismis() {
|
||||
this.hideModal();
|
||||
if (this.currentReject) {
|
||||
this.currentReject();
|
||||
this.currentResolve = null;
|
||||
this.currentReject = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler if the user triggers a accept action.
|
||||
*/
|
||||
onAccept() {
|
||||
this.hideModal();
|
||||
if (this.currentResolve) {
|
||||
this.currentResolve();
|
||||
this.currentResolve = null;
|
||||
this.currentReject = null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
<li class="nav-item" [routerLinkActive]="neverActive === false ? 'active' : ''">
|
||||
<a [routerLink]="target" class="nav-link">
|
||||
<app-fa-icon *ngIf="icon" [icon]="icon"></app-fa-icon>
|
||||
<span *ngIf="icon"> </span>
|
||||
<ng-content></ng-content>
|
||||
</a>
|
||||
</li>
|
|
@ -0,0 +1,25 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { NavbarEntryComponent } from './navbar-entry.component';
|
||||
|
||||
describe('NavbarEntryComponent', () => {
|
||||
let component: NavbarEntryComponent;
|
||||
let fixture: ComponentFixture<NavbarEntryComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ NavbarEntryComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(NavbarEntryComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
|
@ -0,0 +1,15 @@
|
|||
import { Component, Input } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-navbar-entry',
|
||||
templateUrl: './navbar-entry.component.html',
|
||||
styleUrls: ['./navbar-entry.component.scss']
|
||||
})
|
||||
export class NavbarEntryComponent {
|
||||
|
||||
@Input() icon: string;
|
||||
@Input() target: string;
|
||||
@Input() neverActive = false;
|
||||
|
||||
constructor() { }
|
||||
}
|
18
frontend/src/app/partials/navbar/navbar.component.html
Normal file
18
frontend/src/app/partials/navbar/navbar.component.html
Normal file
|
@ -0,0 +1,18 @@
|
|||
<nav class="navbar navbar-toggleable-sm navbar-inverse bg-inverse">
|
||||
<div class="container">
|
||||
<button *ngIf="!isEmpty()" class="navbar-toggler navbar-toggler-right" (click)="toggleMenu()">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
<a class="navbar-brand" href="#">{{ brand }}</a>
|
||||
|
||||
<div class="navbar-collapse" [class.collapse]="!open">
|
||||
<ul #navbarEntries class="navbar-nav mr-auto">
|
||||
<ng-content select="app-navbar-entry:not([right])"></ng-content>
|
||||
</ul>
|
||||
<ul #navbarEntriesRight class="navbar-nav">
|
||||
<ng-content select="app-navbar-entry[right]"></ng-content>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
6
frontend/src/app/partials/navbar/navbar.component.scss
Normal file
6
frontend/src/app/partials/navbar/navbar.component.scss
Normal file
|
@ -0,0 +1,6 @@
|
|||
/* Workaround for bootstrap 4 alpha 6*/
|
||||
@media(max-width:768px){
|
||||
.navbar .container {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
25
frontend/src/app/partials/navbar/navbar.component.spec.ts
Normal file
25
frontend/src/app/partials/navbar/navbar.component.spec.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { NavbarComponent } from './navbar.component';
|
||||
|
||||
describe('NavbarComponent', () => {
|
||||
let component: NavbarComponent;
|
||||
let fixture: ComponentFixture<NavbarComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ NavbarComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(NavbarComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
46
frontend/src/app/partials/navbar/navbar.component.ts
Normal file
46
frontend/src/app/partials/navbar/navbar.component.ts
Normal file
|
@ -0,0 +1,46 @@
|
|||
import { Component, ViewChild, ElementRef, Input } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-navbar',
|
||||
templateUrl: './navbar.component.html',
|
||||
styleUrls: ['./navbar.component.scss']
|
||||
})
|
||||
export class NavbarComponent {
|
||||
@Input() brand: string;
|
||||
|
||||
private open: Boolean = false;
|
||||
|
||||
@ViewChild('navbarEntries') navbarEntries: any;
|
||||
@ViewChild('navbarEntriesRight') navbarEntriesRight: any;
|
||||
|
||||
constructor() { }
|
||||
|
||||
/**
|
||||
* Toggles if the menu is open.
|
||||
*/
|
||||
toggleMenu() {
|
||||
this.open = !this.open;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if both ng-content slots are empty.
|
||||
*
|
||||
* @returns true if the slots are empty, false otherwise
|
||||
*/
|
||||
isEmpty() {
|
||||
let isEmpty = true;
|
||||
|
||||
if (this.navbarEntries && this.navbarEntries.nativeElement.children) {
|
||||
if (this.navbarEntries.nativeElement.children.length > 0) {
|
||||
isEmpty = false;
|
||||
}
|
||||
}
|
||||
if (this.navbarEntriesRight && this.navbarEntriesRight.nativeElement.children) {
|
||||
if (this.navbarEntriesRight.nativeElement.children.length > 0) {
|
||||
isEmpty = false;
|
||||
}
|
||||
}
|
||||
|
||||
return isEmpty;
|
||||
}
|
||||
}
|
3
frontend/src/app/partials/sort/sort.component.html
Normal file
3
frontend/src/app/partials/sort/sort.component.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
<app-fa-icon *ngIf="order === 0" icon="sort" fixedWidth (click)="toggle()"></app-fa-icon>
|
||||
<app-fa-icon *ngIf="order === 1" icon="sort-amount-asc" fixedWidth (click)="toggle()"></app-fa-icon>
|
||||
<app-fa-icon *ngIf="order === -1" icon="sort-amount-desc" fixedWidth (click)="toggle()"></app-fa-icon>
|
0
frontend/src/app/partials/sort/sort.component.scss
Normal file
0
frontend/src/app/partials/sort/sort.component.scss
Normal file
25
frontend/src/app/partials/sort/sort.component.spec.ts
Normal file
25
frontend/src/app/partials/sort/sort.component.spec.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { SortComponent } from './sort.component';
|
||||
|
||||
describe('SortComponent', () => {
|
||||
let component: SortComponent;
|
||||
let fixture: ComponentFixture<SortComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ SortComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SortComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
56
frontend/src/app/partials/sort/sort.component.ts
Normal file
56
frontend/src/app/partials/sort/sort.component.ts
Normal file
|
@ -0,0 +1,56 @@
|
|||
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
||||
|
||||
import { SortEvent } from 'app/interfaces/sort-event';
|
||||
|
||||
@Component({
|
||||
selector: 'app-sort',
|
||||
templateUrl: './sort.component.html',
|
||||
styleUrls: ['./sort.component.scss']
|
||||
})
|
||||
export class SortComponent {
|
||||
|
||||
@Output() sort = new EventEmitter<SortEvent>();
|
||||
|
||||
@Input() field: string;
|
||||
private order: number = 0;
|
||||
|
||||
constructor() { }
|
||||
|
||||
/**
|
||||
* Resets the sort order for this field. No SortEvent is emitted.
|
||||
*/
|
||||
public reset() {
|
||||
this.order = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the sort order for this field, except if this field is the one
|
||||
* provided as parameter.
|
||||
*
|
||||
* @param field The fieldname not to reset
|
||||
*/
|
||||
public resetIfNotField(field: string) {
|
||||
if (this.field !== field) {
|
||||
this.reset();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cycles between the three sort states possible. Emits a SortEvent.
|
||||
*/
|
||||
toggle() {
|
||||
if (this.order === 0) {
|
||||
this.order = 1;
|
||||
} else if (this.order === 1) {
|
||||
this.order = -1;
|
||||
} else if (this.order === -1) {
|
||||
this.order = 0;
|
||||
}
|
||||
|
||||
this.sort.emit({
|
||||
field: this.field,
|
||||
order: this.order
|
||||
});
|
||||
}
|
||||
|
||||
}
|
15
frontend/src/app/services/domains/domains.service.spec.ts
Normal file
15
frontend/src/app/services/domains/domains.service.spec.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { DomainsService } from './domains.service';
|
||||
|
||||
describe('DomainsService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [DomainsService]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([DomainsService], (service: DomainsService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
75
frontend/src/app/services/domains/domains.service.ts
Normal file
75
frontend/src/app/services/domains/domains.service.ts
Normal file
|
@ -0,0 +1,75 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { HttpService } from 'app/services/http/http.service';
|
||||
import { DomainsAnswer } from 'app/interfaces/domains-answer';
|
||||
import { EmptyAnswer } from 'app/interfaces/empty-answer';
|
||||
|
||||
@Injectable()
|
||||
export class DomainsService {
|
||||
|
||||
constructor(private httpService: HttpService) { }
|
||||
|
||||
/**
|
||||
* Gets a domain list from the API
|
||||
*
|
||||
* @param page The page which should be loaded from the API
|
||||
* @param field The field to order the results by
|
||||
* @param order If the results should be ordered asc or desc
|
||||
* @param searchName A string which is used as searchstring on the name
|
||||
* @param searchType The type of domains which should be retrieved
|
||||
*
|
||||
* @returns A Promise for a DomainsAnswer object
|
||||
*/
|
||||
getDomains(page: number, field: string, order: number, searchName: string, searchType: string) {
|
||||
let _order = order === 1 ? 1 : 0;
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
let body: any = {
|
||||
sort: {
|
||||
field: field,
|
||||
order: _order
|
||||
},
|
||||
action: 'getDomains',
|
||||
page: page
|
||||
};
|
||||
|
||||
if (searchName) {
|
||||
body.name = searchName;
|
||||
}
|
||||
if (searchType) {
|
||||
body.type = searchType;
|
||||
}
|
||||
|
||||
this.httpService.post<DomainsAnswer>('api/domains.php', body)
|
||||
.then((data: DomainsAnswer) => {
|
||||
resolve(data);
|
||||
}, (err) => {
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes one domain.
|
||||
*
|
||||
* @param id Id of the domain to delete
|
||||
*
|
||||
* @returns A Promise for an empty content
|
||||
*/
|
||||
deleteDomain(id: number) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const body = {
|
||||
action: 'deleteDomain',
|
||||
id: id
|
||||
};
|
||||
|
||||
this.httpService.post<EmptyAnswer>('api/domains.php', body)
|
||||
.then(() => {
|
||||
resolve();
|
||||
}, (err) => {
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
15
frontend/src/app/services/http/http.service.spec.ts
Normal file
15
frontend/src/app/services/http/http.service.spec.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { HttpService } from './http.service';
|
||||
|
||||
describe('HttpService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [HttpService]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([HttpService], (service: HttpService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
65
frontend/src/app/services/http/http.service.ts
Normal file
65
frontend/src/app/services/http/http.service.ts
Normal file
|
@ -0,0 +1,65 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { Http, Headers, URLSearchParams } from '@angular/http';
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
|
||||
@Injectable()
|
||||
export class HttpService {
|
||||
|
||||
constructor(private http: Http) { }
|
||||
|
||||
/*
|
||||
* Makes a GET request
|
||||
*
|
||||
* @param url URL which should be used
|
||||
* @param params A URLSearchParams object for the request params
|
||||
*
|
||||
* @returns A Promise for a object of type T
|
||||
*/
|
||||
get<T>(url: string, params?: URLSearchParams) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const headers = new Headers();
|
||||
headers.set('Content-Type', 'application/json')
|
||||
|
||||
this.http.get(url, {
|
||||
headers: headers,
|
||||
params: params
|
||||
}).subscribe((res) => {
|
||||
resolve(<T> res.json() || {});
|
||||
}, (err: HttpErrorResponse) => {
|
||||
if (err.error instanceof Error) {
|
||||
reject(err.error);
|
||||
} else {
|
||||
reject(Error(`Backend returned code ${ err.status }`));
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a POST request
|
||||
*
|
||||
* @param url URL which should be used
|
||||
* @param data Data to use as body
|
||||
*
|
||||
* @returns A Promise for a object of type T
|
||||
*/
|
||||
post<T>(url: string, data: any) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const headers = new Headers();
|
||||
headers.set('Content-Type', 'application/json')
|
||||
|
||||
this.http.post(url, data, {
|
||||
headers: headers
|
||||
}).subscribe((res) => {
|
||||
resolve(<T> res.json() || {});
|
||||
}, (err: HttpErrorResponse) => {
|
||||
if (err.error instanceof Error) {
|
||||
reject(err.error);
|
||||
} else {
|
||||
reject(Error(`Backend returned code ${ err.status }`));
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
}
|
15
frontend/src/app/services/modal/modal.service.spec.ts
Normal file
15
frontend/src/app/services/modal/modal.service.spec.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { ModalService } from './modal.service';
|
||||
|
||||
describe('ModalService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [ModalService]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([ModalService], (service: ModalService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
32
frontend/src/app/services/modal/modal.service.ts
Normal file
32
frontend/src/app/services/modal/modal.service.ts
Normal file
|
@ -0,0 +1,32 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { ModalContainerComponent } from 'app/partials/modal-container/modal-container.component';
|
||||
import { ModalOptions } from 'app/interfaces/modal-options';
|
||||
|
||||
@Injectable()
|
||||
export class ModalService {
|
||||
|
||||
container: ModalContainerComponent;
|
||||
|
||||
constructor() { }
|
||||
|
||||
/**
|
||||
* Registers a ModalContainerComponent as output for the service
|
||||
*
|
||||
* @param container ModalContainerComponent to use
|
||||
*/
|
||||
registerModalContainer(container: ModalContainerComponent) {
|
||||
this.container = container;
|
||||
}
|
||||
|
||||
/**
|
||||
* Forwards modal options to a ModalContainerComponent to show them there.
|
||||
*
|
||||
* @param options ModalOptions to use
|
||||
*/
|
||||
showMessage(options: ModalOptions) {
|
||||
if (this.container) {
|
||||
return this.container.showMessage(options);
|
||||
}
|
||||
}
|
||||
}
|
15
frontend/src/app/services/session/session.service.spec.ts
Normal file
15
frontend/src/app/services/session/session.service.spec.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { SessionService } from './session.service';
|
||||
|
||||
describe('SessionService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [SessionService]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([SessionService], (service: SessionService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
102
frontend/src/app/services/session/session.service.ts
Normal file
102
frontend/src/app/services/session/session.service.ts
Normal file
|
@ -0,0 +1,102 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { HttpService } from 'app/services/http/http.service';
|
||||
|
||||
import { SessionAnswer } from 'app/interfaces/session-answer';
|
||||
|
||||
@Injectable()
|
||||
export class SessionService {
|
||||
|
||||
private isLoggedIn = false;
|
||||
private userType: string;
|
||||
|
||||
constructor(private httpService: HttpService) {
|
||||
this.loadState();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if the user is logged in
|
||||
*
|
||||
* @returns true if the user is logged in, false otherwise
|
||||
*/
|
||||
getIsLoggedIn() {
|
||||
return this.isLoggedIn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the user type
|
||||
*
|
||||
* @returns User type of the current session
|
||||
*/
|
||||
getUserType() {
|
||||
return this.userType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries a login to the server.
|
||||
*
|
||||
* @param username Username to use
|
||||
* @param password Password to use
|
||||
*
|
||||
* @returns A Promise
|
||||
*/
|
||||
tryLogin(username: string, password: string) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const body = { user: username, password: password };
|
||||
|
||||
this.httpService.post<SessionAnswer>('api/index.php', body)
|
||||
.then((data: SessionAnswer) => {
|
||||
if (data.status === 'success') {
|
||||
this.isLoggedIn = true;
|
||||
this.userType = 'admin';
|
||||
this.saveState();
|
||||
resolve();
|
||||
} else {
|
||||
reject(Error('Username or Password wrong'));
|
||||
}
|
||||
}, (err) => {
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a log out request to the server.
|
||||
*
|
||||
* @returns A Promise
|
||||
*/
|
||||
logOut() {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.httpService.get<any>('api/logout.php')
|
||||
.then(() => {
|
||||
this.isLoggedIn = false;
|
||||
this.userType = '';
|
||||
this.saveState();
|
||||
resolve();
|
||||
}, (err) => {
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the state to the sessionStorage.
|
||||
*/
|
||||
saveState() {
|
||||
sessionStorage.setItem('state', JSON.stringify({
|
||||
isLoggedIn: this.isLoggedIn,
|
||||
userType: this.userType
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the state from the sessionStorage.
|
||||
*/
|
||||
loadState() {
|
||||
let state = JSON.parse(sessionStorage.getItem('state'));
|
||||
if (state) {
|
||||
this.isLoggedIn = state.isLoggedIn;
|
||||
this.userType = state.userType;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
0
frontend/src/assets/.gitkeep
Normal file
0
frontend/src/assets/.gitkeep
Normal file
3
frontend/src/environments/environment.prod.ts
Normal file
3
frontend/src/environments/environment.prod.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
export const environment = {
|
||||
production: true
|
||||
};
|
8
frontend/src/environments/environment.ts
Normal file
8
frontend/src/environments/environment.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
// 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
|
||||
};
|
BIN
frontend/src/favicon.ico
Normal file
BIN
frontend/src/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
14
frontend/src/index.html
Normal file
14
frontend/src/index.html
Normal file
|
@ -0,0 +1,14 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>PDNS Manager</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>
|
11
frontend/src/main.ts
Normal file
11
frontend/src/main.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
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);
|
72
frontend/src/polyfills.ts
Normal file
72
frontend/src/polyfills.ts
Normal file
|
@ -0,0 +1,72 @@
|
|||
/**
|
||||
* 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/weak-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`.
|
||||
|
||||
/** Evergreen browsers require these. **/
|
||||
import 'core-js/es6/reflect';
|
||||
import 'core-js/es7/reflect';
|
||||
|
||||
|
||||
/**
|
||||
* Required to support Web Animations `@angular/animation`.
|
||||
* Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-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';
|
14
frontend/src/styles.scss
Normal file
14
frontend/src/styles.scss
Normal file
|
@ -0,0 +1,14 @@
|
|||
/* You can add global styles to this file, and also import other style files */
|
||||
|
||||
/* Bootstrap and customizations */
|
||||
@import '~bootstrap/scss/bootstrap.scss';
|
||||
|
||||
/* Add font awesome */
|
||||
$fa-font-path: "~font-awesome/fonts";
|
||||
@import '~font-awesome/scss/font-awesome';
|
||||
|
||||
/* Custom global rules */
|
||||
.no-shadow {
|
||||
box-shadow: none !important;
|
||||
border-color: #CCC !important;
|
||||
}
|
32
frontend/src/test.ts
Normal file
32
frontend/src/test.ts
Normal file
|
@ -0,0 +1,32 @@
|
|||
// 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 const __karma__: any;
|
||||
declare const 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();
|
13
frontend/src/tsconfig.app.json
Normal file
13
frontend/src/tsconfig.app.json
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../out-tsc/app",
|
||||
"module": "es2015",
|
||||
"baseUrl": "",
|
||||
"types": []
|
||||
},
|
||||
"exclude": [
|
||||
"test.ts",
|
||||
"**/*.spec.ts"
|
||||
]
|
||||
}
|
20
frontend/src/tsconfig.spec.json
Normal file
20
frontend/src/tsconfig.spec.json
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../out-tsc/spec",
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"baseUrl": "",
|
||||
"types": [
|
||||
"jasmine",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"test.ts"
|
||||
],
|
||||
"include": [
|
||||
"**/*.spec.ts",
|
||||
"**/*.d.ts"
|
||||
]
|
||||
}
|
5
frontend/src/typings.d.ts
vendored
Normal file
5
frontend/src/typings.d.ts
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
/* SystemJS module definition */
|
||||
declare var module: NodeModule;
|
||||
interface NodeModule {
|
||||
id: string;
|
||||
}
|
20
frontend/tsconfig.json
Normal file
20
frontend/tsconfig.json
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"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"
|
||||
]
|
||||
}
|
||||
}
|
135
frontend/tslint.json
Normal file
135
frontend/tslint.json
Normal file
|
@ -0,0 +1,135 @@
|
|||
{
|
||||
"rulesDirectory": [
|
||||
"node_modules/codelyzer"
|
||||
],
|
||||
"rules": {
|
||||
"arrow-return-shorthand": true,
|
||||
"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-duplicate-super": true,
|
||||
"no-empty": false,
|
||||
"no-empty-interface": true,
|
||||
"no-eval": true,
|
||||
"no-inferrable-types": [
|
||||
true,
|
||||
"ignore-params"
|
||||
],
|
||||
"no-misused-new": true,
|
||||
"no-non-null-assertion": true,
|
||||
"no-shadowed-variable": true,
|
||||
"no-string-literal": false,
|
||||
"no-string-throw": true,
|
||||
"no-switch-case-fall-through": true,
|
||||
"no-trailing-whitespace": true,
|
||||
"no-unnecessary-initializer": 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
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue