Fixed linter errors, added pre-commit script and instructions
This commit is contained in:
parent
03ae894776
commit
ae8b16c825
8 changed files with 27 additions and 21 deletions
18
README.md
18
README.md
|
@ -5,7 +5,7 @@
|
|||
|
||||
This development version contains known bugs and security vulnerabilities. Do not use it!
|
||||
|
||||
## Development Commands
|
||||
## Development Setup
|
||||
Before you can start you have to configure the backend manually with a valid config-user.php
|
||||
|
||||
Also you have to install Angular CLI globally using
|
||||
|
@ -17,23 +17,29 @@
|
|||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
Then change in the backend-legacy folder and start the backend in one terminal.
|
||||
|
||||
Finally you have to setup a pre-commit hook using
|
||||
```bash
|
||||
ln utils/pre-commit.hook .git/hooks/pre-commit
|
||||
```
|
||||
|
||||
## Development Commands
|
||||
To run a development instance change in the backend-legacy folder and start the backend in one terminal.
|
||||
```bash
|
||||
cd backend-legacy
|
||||
php -S localhost:8000
|
||||
```
|
||||
|
||||
|
||||
Afterwords you can run the development-server in another terminal using
|
||||
```bash
|
||||
npm start
|
||||
```
|
||||
|
||||
Then you now go to a browser and open http://localhost:4200
|
||||
Then you can go to a browser and open http://localhost:4200
|
||||
|
||||
If you want to lint the project run
|
||||
```bash
|
||||
npm run lint
|
||||
```
|
||||
this command will be in a commit hook so that it is impossible to commit code which does not pass the linter.
|
||||
this command will also be in the provided commit hook so that it is impossible to commit code which does not pass the linter.
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
export interface EmptyAnswer {
|
||||
|
||||
}
|
|
@ -21,10 +21,10 @@ export class DomainsComponent implements OnInit {
|
|||
@ViewChild('sortRecords') sortRecords: SortComponent;
|
||||
|
||||
private sortField: string = null;
|
||||
private sortOrder: number = 0;
|
||||
private sortOrder = 0;
|
||||
|
||||
private searchName: string;
|
||||
private searchType: string = 'none';
|
||||
private searchType = 'none';
|
||||
|
||||
constructor(private domainsService: DomainsService,
|
||||
private modalService: ModalService) { }
|
||||
|
@ -38,8 +38,8 @@ export class DomainsComponent implements OnInit {
|
|||
* the properties of the components.
|
||||
*/
|
||||
loadDomains() {
|
||||
let field = this.sortField ? this.sortField : '';
|
||||
let searchType = this.searchType === 'none' ? '' : this.searchType;
|
||||
const field = this.sortField ? this.sortField : '';
|
||||
const searchType = this.searchType === 'none' ? '' : this.searchType;
|
||||
|
||||
this.domainsService.getDomains(1, field, this.sortOrder, this.searchName, searchType)
|
||||
.then((data: DomainsAnswer) => {
|
||||
|
|
|
@ -17,8 +17,8 @@ export class ModalContainerComponent implements OnInit {
|
|||
acceptClass: 'primary'
|
||||
};
|
||||
|
||||
private show: boolean = false;
|
||||
private animate: boolean = false;
|
||||
private show = false;
|
||||
private animate = false;
|
||||
|
||||
private currentResolve: Function;
|
||||
private currentReject: Function;
|
||||
|
|
|
@ -12,7 +12,7 @@ export class SortComponent {
|
|||
@Output() sort = new EventEmitter<SortEvent>();
|
||||
|
||||
@Input() field: string;
|
||||
private order: number = 0;
|
||||
private order = 0;
|
||||
|
||||
constructor() { }
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ 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 {
|
||||
|
@ -21,10 +20,10 @@ export class DomainsService {
|
|||
* @returns A Promise for a DomainsAnswer object
|
||||
*/
|
||||
getDomains(page: number, field: string, order: number, searchName: string, searchType: string) {
|
||||
let _order = order === 1 ? 1 : 0;
|
||||
const _order = order === 1 ? 1 : 0;
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
let body: any = {
|
||||
const body: any = {
|
||||
sort: {
|
||||
field: field,
|
||||
order: _order
|
||||
|
@ -63,7 +62,7 @@ export class DomainsService {
|
|||
id: id
|
||||
};
|
||||
|
||||
this.httpService.post<EmptyAnswer>('api/domains.php', body)
|
||||
this.httpService.post<{}>('api/domains.php', body)
|
||||
.then(() => {
|
||||
resolve();
|
||||
}, (err) => {
|
||||
|
|
|
@ -92,7 +92,7 @@ export class SessionService {
|
|||
* Loads the state from the sessionStorage.
|
||||
*/
|
||||
loadState() {
|
||||
let state = JSON.parse(sessionStorage.getItem('state'));
|
||||
const state = JSON.parse(sessionStorage.getItem('state'));
|
||||
if (state) {
|
||||
this.isLoggedIn = state.isLoggedIn;
|
||||
this.userType = state.userType;
|
||||
|
|
4
utils/pre-commit.hook
Executable file
4
utils/pre-commit.hook
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
cd frontend
|
||||
npm run lint
|
Loading…
Reference in a new issue