* deploy to staging

* login feedback implementation
* judge editor year sorting
This commit is contained in:
Danyi Dávid 2018-05-12 13:15:50 +02:00
parent 03a160dafe
commit d614d1b020
10 changed files with 110 additions and 68 deletions

View File

@ -47,7 +47,24 @@
"extractCss": true, "extractCss": true,
"namedChunks": false, "namedChunks": false,
"aot": true, "aot": true,
"extractLicenses": true, "extractLicenses": false,
"vendorChunk": false,
"buildOptimizer": true
},
"staging": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.stage.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": false,
"vendorChunk": false, "vendorChunk": false,
"buildOptimizer": true "buildOptimizer": true
} }

View File

@ -21,8 +21,6 @@ host('alfheim')
->user('yvan') ->user('yvan')
->forwardAgent() ->forwardAgent()
->set('ng_basehref', '/admin/') ->set('ng_basehref', '/admin/')
->set('ng_target', 'production')
->set('ng_environment', 'prod')
->set('env_vars', 'NODE_ENV=production') ->set('env_vars', 'NODE_ENV=production')
->set('deploy_path', '/mnt/apps/granprize/admin'); ->set('deploy_path', '/mnt/apps/granprize/admin');
@ -31,15 +29,13 @@ host('granprize')
->user('edvidan') ->user('edvidan')
->forwardAgent() ->forwardAgent()
->set('ng_basehref', '/admin/') ->set('ng_basehref', '/admin/')
->set('ng_target', 'production')
->set('ng_environment', 'prod')
->set('env_vars', 'NODE_ENV=production') ->set('env_vars', 'NODE_ENV=production')
->set('deploy_path', '/var/www/granprize.swedishchamber.hu/admin'); ->set('deploy_path', '/var/www/granprize.swedishchamber.hu/admin');
// Tasks // Tasks
desc('Prepare release'); desc('Prepare release');
task('deploy:ng-prepare', function() { task('deploy:ng-prepare', function() {
runLocally("ng build --base-href={{ng_basehref}} --target={{ng_target}} --environment={{ng_environment}}"); runLocally("ng build --base-href={{ng_basehref}} --configuration={{stage}} --output-path dist");
runLocally("tar -cJf dist.tar.xz dist"); runLocally("tar -cJf dist.tar.xz dist");
}); });

View File

@ -9,7 +9,8 @@ import {
MatButtonModule, MatButtonModule,
MatCardModule, MatCardModule,
MatFormFieldModule, MatFormFieldModule,
MatInputModule MatInputModule,
MatProgressSpinnerModule,
} from "@angular/material"; } from "@angular/material";
export function tokenGetterFunctionWrapper() { export function tokenGetterFunctionWrapper() {
@ -36,6 +37,7 @@ export function tokenGetterFunctionWrapper() {
MatFormFieldModule, MatFormFieldModule,
MatInputModule, MatInputModule,
MatButtonModule, MatButtonModule,
MatProgressSpinnerModule,
], ],
declarations: [AuthComponent] declarations: [AuthComponent]
}) })

View File

@ -55,9 +55,8 @@ export class AuthService {
this.router.navigate(['/']); this.router.navigate(['/']);
}, },
err => { err => {
console.log(err);
this.hasError = true; this.hasError = true;
this.errorMessage = "Hiba történt bejelentkezés közben."; this.errorMessage = "Access denied";
this.isLoading = false; this.isLoading = false;
} }
); );

View File

@ -1,9 +1,21 @@
.mat-card { .mat-card.login-panel {
min-width: 250px; min-width: 250px;
width: 25%; width: 25%;
margin: 150px auto auto; margin: 150px auto auto;
} }
.mat-card.error {
margin-bottom: 20px;
color: #ffffff;
/*background-color: #f44336;*/
background-color: #ff4081;
font-weight: 500;
}
.mat-form-field { .mat-form-field {
width: 100%; width: 100%;
} }
.mat-progress-spinner {
margin: auto;
}

View File

@ -1,12 +1,16 @@
<mat-card> <mat-card class="login-panel">
<h2 mat-card-title="">GranPrize login</h2> <h2 mat-card-title>GranPrize login</h2>
<form name="login-form" class="login-form" (ngSubmit)="doSubmit()"> <form name="login-form" class="login-form" (ngSubmit)="doSubmit()" *ngIf="!isLoading">
<mat-form-field class="full-width"> <mat-form-field class="full-width">
<input name="username" type="text" matInput placeholder="Username" [(ngModel)]="userName"> <input name="username" type="text" matInput placeholder="Username" [(ngModel)]="userName">
</mat-form-field> </mat-form-field>
<mat-form-field class="full-width"> <mat-form-field class="full-width">
<input name="password" type="password" matInput placeholder="Password" [(ngModel)]="password"> <input name="password" type="password" matInput placeholder="Password" [(ngModel)]="password">
</mat-form-field> </mat-form-field>
<mat-card class="error mat-primary" *ngIf="hasError">{{errorMessage}}</mat-card>
<button mat-raised-button color="primary" [disabled]="!canLogin">Login</button> <button mat-raised-button color="primary" [disabled]="!canLogin">Login</button>
</form> </form>
<mat-card-content *ngIf="isLoading">
<mat-spinner color="warn"></mat-spinner>
</mat-card-content>
</mat-card> </mat-card>

View File

@ -1,4 +1,4 @@
<form class="judge-form" name="judge-form" (ngSubmit)="saveJudge()" > <form class="judge-form" name="judge-form" (ngSubmit)="saveJudge()">
<mat-form-field class="full-width"> <mat-form-field class="full-width">
<input name="name" type="text" matInput placeholder="Display name" [(ngModel)]="judge.name"> <input name="name" type="text" matInput placeholder="Display name" [(ngModel)]="judge.name">
</mat-form-field> </mat-form-field>
@ -14,7 +14,8 @@
Upload profile image Upload profile image
</button> </button>
<mat-divider></mat-divider> <mat-divider></mat-divider>
<mat-expansion-panel> <div class="mat-elevation-z8">
<mat-expansion-panel class="mat-elevation-z0">
<mat-expansion-panel-header> <mat-expansion-panel-header>
<mat-panel-title>Assign judege to year</mat-panel-title> <mat-panel-title>Assign judege to year</mat-panel-title>
<mat-panel-description>Type the year and the title of the judge</mat-panel-description> <mat-panel-description>Type the year and the title of the judge</mat-panel-description>
@ -33,6 +34,7 @@
</button> </button>
</mat-expansion-panel> </mat-expansion-panel>
<mat-card *ngIf="!judge.titles?.length"> <mat-card *ngIf="!judge.titles?.length">
<i>No records</i> <i>No records</i>
</mat-card> </mat-card>
@ -40,7 +42,7 @@
<ng-container matColumnDef="buttons"> <ng-container matColumnDef="buttons">
<mat-header-cell *matHeaderCellDef class="controls"></mat-header-cell> <mat-header-cell *matHeaderCellDef class="controls"></mat-header-cell>
<mat-cell *matCellDef="let row" class="controls"> <mat-cell *matCellDef="let row" class="controls">
<button type="button" mat-icon-button (click)="removeFromYear(row.year)"> <button type="button" mat-icon-button (click)="removeFromYear(row.year)" matTooltip="Delete this entry">
<mat-icon fontSet="fas" fontIcon="fa-trash"></mat-icon> <mat-icon fontSet="fas" fontIcon="fa-trash"></mat-icon>
</button> </button>
</mat-cell> </mat-cell>
@ -60,6 +62,7 @@
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row> <mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row> <mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>
</mat-table> </mat-table>
</div>
<button type="submit" mat-raised-button color="accent" class="save-button" [disabled]="!canSave"> <button type="submit" mat-raised-button color="accent" class="save-button" [disabled]="!canSave">
<i class="fas fa-save"></i> Save <i class="fas fa-save"></i> Save

View File

@ -32,6 +32,7 @@ export class JudgeEditorComponent implements OnInit {
judge: Judge, judge: Judge,
}) => { }) => {
this.judge = data.judge ? data.judge : new Judge(); this.judge = data.judge ? data.judge : new Judge();
this.sortByYear();
}); });
} }
@ -62,4 +63,8 @@ export class JudgeEditorComponent implements OnInit {
this.judgeService.persist(this.judge).subscribe(() => this.router.navigate(['/judges'])); this.judgeService.persist(this.judge).subscribe(() => this.router.navigate(['/judges']));
} }
} }
private sortByYear() {
this.judge.titles.sort((a,b) => a.year < b.year ? 1 : -1);
}
} }

View File

@ -0,0 +1,4 @@
export const environment = {
production: true,
apiUrl: 'http://granprize.dev.yvan.hu/api',
};