Minor bugfixes
This commit is contained in:
parent
ffde81c85b
commit
f4bf8564db
@ -277,6 +277,7 @@ class Auth extends BaseController {
|
||||
// If 'remember me' feature is desired, set the multiplier higher.
|
||||
// By default, a token will expire after half an hour, but can be
|
||||
// refreshed by a call to /api/refresh.
|
||||
|
||||
return JWT::encode(array(
|
||||
'exp' => time() + (60 * 30) * $mult, // 30 minutes * $mult
|
||||
'uid' => (int)$userId,
|
||||
|
@ -37,23 +37,21 @@ export class ApiInterceptor implements HttpInterceptor {
|
||||
});
|
||||
|
||||
return next.handle(request).pipe(
|
||||
tap((evt: HttpEvent<any>) => {
|
||||
tap(evt => {
|
||||
if (evt instanceof HttpHeaderResponse ||
|
||||
!(evt instanceof HttpResponseBase)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((evt.status === 401 || evt.status === 400) &&
|
||||
(evt.url + '').indexOf('login') === -1) {
|
||||
sessionStorage.removeItem(this.JWT_KEY);
|
||||
this.router.navigate(['']);
|
||||
return;
|
||||
}
|
||||
|
||||
const response: ApiResponse = evt.body;
|
||||
if (response.data) {
|
||||
sessionStorage.setItem(this.JWT_KEY, response.data[0]);
|
||||
}
|
||||
}, error => {
|
||||
if ((error.status === 401 || error.status === 400)) {
|
||||
sessionStorage.removeItem(this.JWT_KEY);
|
||||
this.router.navigate(['/']);
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
|
@ -2,13 +2,15 @@ import { NgModule } from '@angular/core';
|
||||
import { BrowserModule, Title } from '@angular/platform-browser';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import { DragulaModule } from 'ng2-dragula/ng2-dragula';
|
||||
|
||||
import { APP_ROUTING, ROUTE_COMPONENTS } from './app.routes';
|
||||
import { ROUTES } from './app.routes';
|
||||
import { AppComponent } from './app.component';
|
||||
import { ApiInterceptor } from './app.api-http';
|
||||
|
||||
import { Login } from './login/login.component';
|
||||
import { BoardModule } from './board/board.module';
|
||||
import { DashboardModule } from './dashboard/dashboard.module';
|
||||
import { SettingsModule } from './settings/settings.module';
|
||||
@ -19,12 +21,12 @@ import { SharedModule } from './shared/shared.module';
|
||||
BrowserModule,
|
||||
FormsModule,
|
||||
HttpClientModule,
|
||||
APP_ROUTING,
|
||||
DragulaModule,
|
||||
BoardModule,
|
||||
DashboardModule,
|
||||
SettingsModule,
|
||||
SharedModule
|
||||
SharedModule,
|
||||
RouterModule.forRoot(ROUTES)
|
||||
],
|
||||
providers: [
|
||||
{
|
||||
@ -35,7 +37,7 @@ import { SharedModule } from './shared/shared.module';
|
||||
],
|
||||
declarations: [
|
||||
AppComponent,
|
||||
...ROUTE_COMPONENTS
|
||||
Login
|
||||
],
|
||||
bootstrap: [ AppComponent ]
|
||||
})
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
import { Routes } from '@angular/router';
|
||||
|
||||
import { BoardDisplay } from './board/board.component';
|
||||
import { Login } from './login/login.component';
|
||||
@ -33,7 +33,3 @@ export const ROUTES: Routes = [
|
||||
}
|
||||
];
|
||||
|
||||
export const ROUTE_COMPONENTS = [ Login ];
|
||||
|
||||
export const APP_ROUTING = RouterModule.forRoot(ROUTES);
|
||||
|
||||
|
@ -55,14 +55,14 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="no-boards center" *ngIf="noBoards()">
|
||||
<div class="no-boards center" *ngIf="!loading && boards.length === 0">
|
||||
<h1>{{ strings['boards_noBoards'] }}</h1>
|
||||
|
||||
<p>{{ noBoardsMessage }}</p>
|
||||
</div>
|
||||
|
||||
<div class="no-boards center"
|
||||
*ngIf="!loading && !activeBoard && !noBoards() && !activeUser.default_board_id">
|
||||
*ngIf="!loading && !activeBoard && this.boards.length > 0 && !activeUser.default_board_id">
|
||||
<h1>{{ strings['boards_noDefault'] }}</h1>
|
||||
|
||||
<p>{{ strings['boards_noDefaultMessage'] }}
|
||||
|
@ -224,22 +224,13 @@ export class BoardDisplay implements OnInit, OnDestroy, AfterContentInit {
|
||||
});
|
||||
}
|
||||
|
||||
noBoards(): boolean {
|
||||
if (this.loading) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this.boards || this.boards.length === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private updateBoards(): void {
|
||||
this.boardService.getBoards().subscribe((response: ApiResponse) => {
|
||||
this.boards = [];
|
||||
this.updateBoardsList(response.data[1]);
|
||||
if (response.data.length > 1) {
|
||||
this.updateBoardsList(response.data[1]);
|
||||
}
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -457,6 +457,43 @@ export class ColumnDisplay implements OnInit, OnDestroy {
|
||||
return () => { this.showViewModal(taskId); };
|
||||
}
|
||||
|
||||
showModal(taskId: number = 0) {
|
||||
if (taskId === 0) {
|
||||
this.modalProps = new Task();
|
||||
this.modalProps.column_id = this.columnData.id;
|
||||
|
||||
this.modal.open(this.MODAL_ID + this.columnData.id);
|
||||
return;
|
||||
}
|
||||
|
||||
let editTask = this.columnData.tasks.find(task => task.id === taskId);
|
||||
|
||||
this.modalProps = new Task(editTask.id, editTask.title,
|
||||
editTask.description, editTask.color,
|
||||
editTask.due_date, editTask.points,
|
||||
editTask.position, editTask.column_id,
|
||||
editTask.comments, editTask.attachments,
|
||||
[], []);
|
||||
|
||||
this.activeBoard.users.forEach(user => {
|
||||
editTask.assignees.forEach(assignee => {
|
||||
if (assignee.id === user.id) {
|
||||
this.modalProps.assignees.push(user);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
this.activeBoard.categories.forEach(category => {
|
||||
editTask.categories.forEach(cat => {
|
||||
if (cat.id === category.id) {
|
||||
this.modalProps.categories.push(category);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
this.modal.open(this.MODAL_ID + this.columnData.id);
|
||||
}
|
||||
|
||||
private convertToTask(updatedTask: any) {
|
||||
let task = new Task(updatedTask.id,
|
||||
updatedTask.title,
|
||||
@ -583,43 +620,6 @@ export class ColumnDisplay implements OnInit, OnDestroy {
|
||||
this.modal.open(this.MODAL_VIEW_ID + this.columnData.id);
|
||||
}
|
||||
|
||||
private showModal(taskId: number = 0) {
|
||||
if (taskId === 0) {
|
||||
this.modalProps = new Task();
|
||||
this.modalProps.column_id = this.columnData.id;
|
||||
|
||||
this.modal.open(this.MODAL_ID + this.columnData.id);
|
||||
return;
|
||||
}
|
||||
|
||||
let editTask = this.columnData.tasks.find(task => task.id === taskId);
|
||||
|
||||
this.modalProps = new Task(editTask.id, editTask.title,
|
||||
editTask.description, editTask.color,
|
||||
editTask.due_date, editTask.points,
|
||||
editTask.position, editTask.column_id,
|
||||
editTask.comments, editTask.attachments,
|
||||
[], []);
|
||||
|
||||
this.activeBoard.users.forEach(user => {
|
||||
editTask.assignees.forEach(assignee => {
|
||||
if (assignee.id === user.id) {
|
||||
this.modalProps.assignees.push(user);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
this.activeBoard.categories.forEach(category => {
|
||||
editTask.categories.forEach(cat => {
|
||||
if (cat.id === category.id) {
|
||||
this.modalProps.categories.push(category);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
this.modal.open(this.MODAL_ID + this.columnData.id);
|
||||
}
|
||||
|
||||
private preventEnter(event: any) {
|
||||
if (event && event.stopPropagation) {
|
||||
event.stopPropagation();
|
||||
|
Reference in New Issue
Block a user