mirror of
https://github.com/simon987/task_tracker.git
synced 2025-04-19 18:16:45 +00:00
[CodeFactor] Apply fixes
This commit is contained in:
parent
ad4e613d4a
commit
c0b05a1cd8
@ -1,5 +1,5 @@
|
|||||||
import {MatPaginatorIntl} from "@angular/material";
|
import {MatPaginatorIntl} from '@angular/material';
|
||||||
import {TranslateService} from "@ngx-translate/core";
|
import {TranslateService} from '@ngx-translate/core';
|
||||||
|
|
||||||
export function TranslatedPaginator(translate: TranslateService) {
|
export function TranslatedPaginator(translate: TranslateService) {
|
||||||
|
|
||||||
@ -8,7 +8,7 @@ export function TranslatedPaginator(translate: TranslateService) {
|
|||||||
getTranslations(translate, paginatorIntl);
|
getTranslations(translate, paginatorIntl);
|
||||||
|
|
||||||
translate.onLangChange.subscribe(() => {
|
translate.onLangChange.subscribe(() => {
|
||||||
getTranslations(translate, paginatorIntl)
|
getTranslations(translate, paginatorIntl);
|
||||||
});
|
});
|
||||||
|
|
||||||
return paginatorIntl;
|
return paginatorIntl;
|
||||||
@ -16,12 +16,12 @@ export function TranslatedPaginator(translate: TranslateService) {
|
|||||||
|
|
||||||
function getTranslations(tr: TranslateService, p: MatPaginatorIntl) {
|
function getTranslations(tr: TranslateService, p: MatPaginatorIntl) {
|
||||||
|
|
||||||
tr.get("logs.first_page_label").subscribe((t) => p.firstPageLabel = t);
|
tr.get('logs.first_page_label').subscribe((t) => p.firstPageLabel = t);
|
||||||
tr.get("logs.last_page_label").subscribe((t) => p.lastPageLabel = t);
|
tr.get('logs.last_page_label').subscribe((t) => p.lastPageLabel = t);
|
||||||
tr.get("logs.items_per_page").subscribe((t) => p.itemsPerPageLabel = t);
|
tr.get('logs.items_per_page').subscribe((t) => p.itemsPerPageLabel = t);
|
||||||
tr.get("logs.next_page").subscribe((t) => p.nextPageLabel = t);
|
tr.get('logs.next_page').subscribe((t) => p.nextPageLabel = t);
|
||||||
tr.get("logs.prev_page").subscribe((t) => p.previousPageLabel = t);
|
tr.get('logs.prev_page').subscribe((t) => p.previousPageLabel = t);
|
||||||
tr.get("logs.of").subscribe((of) =>
|
tr.get('logs.of').subscribe((of) =>
|
||||||
p.getRangeLabel = (page, pageSize, length) => `${page * pageSize + 1}-${Math.min(pageSize * (page + 1), length)} ${of} ${length}`
|
p.getRangeLabel = (page, pageSize, length) => `${page * pageSize + 1}-${Math.min(pageSize * (page + 1), length)} ${of} ${length}`
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import {Component, OnInit} from '@angular/core';
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {AuthService} from "../auth.service";
|
import {AuthService} from '../auth.service';
|
||||||
|
|
||||||
import * as moment from "moment"
|
import * as moment from 'moment';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-account-details',
|
selector: 'app-account-details',
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
import {Injectable} from '@angular/core';
|
import {Injectable} from '@angular/core';
|
||||||
import {HttpClient} from "@angular/common/http";
|
import {HttpClient} from '@angular/common/http';
|
||||||
import {Project} from "./models/project";
|
import {Project} from './models/project';
|
||||||
import {Credentials} from "./models/credentials";
|
import {Credentials} from './models/credentials';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ApiService {
|
export class ApiService {
|
||||||
|
|
||||||
// public url: string = window.location.protocol + "//" + window.location.hostname + "/api";
|
// public url: string = window.location.protocol + "//" + window.location.hostname + "/api";
|
||||||
public url = "https://tt.simon987.net/api";
|
public url = 'https://tt.simon987.net/api';
|
||||||
private options: {
|
private options: {
|
||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
responseType: "json"
|
responseType: 'json'
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@ -19,104 +19,104 @@ export class ApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getLogs(level: number) {
|
getLogs(level: number) {
|
||||||
return this.http.post(this.url + "/logs", {level: level, since: 1}, this.options);
|
return this.http.post(this.url + '/logs', {level: level, since: 1}, this.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
getProjects() {
|
getProjects() {
|
||||||
return this.http.get(this.url + "/project/list", this.options)
|
return this.http.get(this.url + '/project/list', this.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
getProject(id: number) {
|
getProject(id: number) {
|
||||||
return this.http.get(this.url + "/project/get/" + id, this.options)
|
return this.http.get(this.url + '/project/get/' + id, this.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
createProject(project: Project) {
|
createProject(project: Project) {
|
||||||
return this.http.post(this.url + "/project/create", project, this.options)
|
return this.http.post(this.url + '/project/create', project, this.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateProject(project: Project) {
|
updateProject(project: Project) {
|
||||||
return this.http.post(this.url + "/project/update/" + project.id, project, this.options)
|
return this.http.post(this.url + '/project/update/' + project.id, project, this.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
register(credentials: Credentials) {
|
register(credentials: Credentials) {
|
||||||
return this.http.post(this.url + "/register", credentials, this.options)
|
return this.http.post(this.url + '/register', credentials, this.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
login(credentials: Credentials) {
|
login(credentials: Credentials) {
|
||||||
return this.http.post(this.url + "/login", credentials, this.options)
|
return this.http.post(this.url + '/login', credentials, this.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
logout() {
|
logout() {
|
||||||
return this.http.get(this.url + "/logout", this.options)
|
return this.http.get(this.url + '/logout', this.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
getAccountDetails() {
|
getAccountDetails() {
|
||||||
return this.http.get(this.url + "/account", this.options)
|
return this.http.get(this.url + '/account', this.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
getMonitoringSnapshots(count: number, project: number) {
|
getMonitoringSnapshots(count: number, project: number) {
|
||||||
return this.http.get(this.url + `/project/monitoring/${project}?count=${count}`, this.options)
|
return this.http.get(this.url + `/project/monitoring/${project}?count=${count}`, this.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
getAssigneeStats(project: number) {
|
getAssigneeStats(project: number) {
|
||||||
return this.http.get(this.url + `/project/assignees/${project}`, this.options)
|
return this.http.get(this.url + `/project/assignees/${project}`, this.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
getWorkerStats() {
|
getWorkerStats() {
|
||||||
return this.http.get(this.url + `/worker/stats`, this.options)
|
return this.http.get(this.url + `/worker/stats`, this.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
getProjectAccess(project: number) {
|
getProjectAccess(project: number) {
|
||||||
return this.http.get(this.url + `/project/access_list/${project}`, this.options)
|
return this.http.get(this.url + `/project/access_list/${project}`, this.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
getManagerList() {
|
getManagerList() {
|
||||||
return this.http.get(this.url + "/manager/list", this.options)
|
return this.http.get(this.url + '/manager/list', this.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
getManagerListWithRoleOn(project: number) {
|
getManagerListWithRoleOn(project: number) {
|
||||||
return this.http.get(this.url + "/manager/list_for_project/" + project, this.options)
|
return this.http.get(this.url + '/manager/list_for_project/' + project, this.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
promote(managerId: number) {
|
promote(managerId: number) {
|
||||||
return this.http.get(this.url + `/manager/promote/${managerId}`, this.options)
|
return this.http.get(this.url + `/manager/promote/${managerId}`, this.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
demote(managerId: number) {
|
demote(managerId: number) {
|
||||||
return this.http.get(this.url + `/manager/demote/${managerId}`, this.options)
|
return this.http.get(this.url + `/manager/demote/${managerId}`, this.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
acceptWorkerAccessRequest(wid: number, pid: number) {
|
acceptWorkerAccessRequest(wid: number, pid: number) {
|
||||||
return this.http.post(this.url + `/project/accept_request/${pid}/${wid}`, null, this.options)
|
return this.http.post(this.url + `/project/accept_request/${pid}/${wid}`, null, this.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
rejectWorkerAccessRequest(wid: number, pid: number) {
|
rejectWorkerAccessRequest(wid: number, pid: number) {
|
||||||
return this.http.post(this.url + `/project/reject_request/${pid}/${wid}`, null, this.options)
|
return this.http.post(this.url + `/project/reject_request/${pid}/${wid}`, null, this.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
setManagerRoleOnProject(pid: number, role: number, manager: number) {
|
setManagerRoleOnProject(pid: number, role: number, manager: number) {
|
||||||
return this.http.post(this.url + `/manager/set_role_for_project/${pid}`,
|
return this.http.post(this.url + `/manager/set_role_for_project/${pid}`,
|
||||||
{"role": role, "manager": manager}, this.options)
|
{'role': role, 'manager': manager}, this.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
getSecret(pid: number) {
|
getSecret(pid: number) {
|
||||||
return this.http.get(this.url + `/project/secret/${pid}`, this.options)
|
return this.http.get(this.url + `/project/secret/${pid}`, this.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
setSecret(pid: number, secret: string) {
|
setSecret(pid: number, secret: string) {
|
||||||
return this.http.post(this.url + `/project/secret/${pid}`, {"secret": secret}, this.options)
|
return this.http.post(this.url + `/project/secret/${pid}`, {'secret': secret}, this.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
getWebhookSecret(pid: number) {
|
getWebhookSecret(pid: number) {
|
||||||
return this.http.get(this.url + `/project/webhook_secret/${pid}`, this.options)
|
return this.http.get(this.url + `/project/webhook_secret/${pid}`, this.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
setWebhookSecret(pid: number, secret: string) {
|
setWebhookSecret(pid: number, secret: string) {
|
||||||
return this.http.post(this.url + `/project/webhook_secret/${pid}`, {"webhook_secret": secret}, this.options)
|
return this.http.post(this.url + `/project/webhook_secret/${pid}`, {'webhook_secret': secret}, this.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
resetFailedTasks(pid: number) {
|
resetFailedTasks(pid: number) {
|
||||||
return this.http.post(this.url + `/project/reset_failed_tasks/${pid}`, null, this.options)
|
return this.http.post(this.url + `/project/reset_failed_tasks/${pid}`, null, this.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,34 +1,34 @@
|
|||||||
import {NgModule} from '@angular/core';
|
import {NgModule} from '@angular/core';
|
||||||
import {NavigationEnd, NavigationStart, Router, RouterModule, Routes} from '@angular/router';
|
import {NavigationEnd, NavigationStart, Router, RouterModule, Routes} from '@angular/router';
|
||||||
import {LogsComponent} from "./logs/logs.component";
|
import {LogsComponent} from './logs/logs.component';
|
||||||
import {ProjectDashboardComponent} from "./project-dashboard/project-dashboard.component";
|
import {ProjectDashboardComponent} from './project-dashboard/project-dashboard.component';
|
||||||
import {ProjectListComponent} from "./project-list/project-list.component";
|
import {ProjectListComponent} from './project-list/project-list.component';
|
||||||
import {CreateProjectComponent} from "./create-project/create-project.component";
|
import {CreateProjectComponent} from './create-project/create-project.component';
|
||||||
import {UpdateProjectComponent} from "./update-project/update-project.component";
|
import {UpdateProjectComponent} from './update-project/update-project.component';
|
||||||
import {Title} from "@angular/platform-browser";
|
import {Title} from '@angular/platform-browser';
|
||||||
import {filter} from "rxjs/operators";
|
import {filter} from 'rxjs/operators';
|
||||||
import {TranslateService} from "@ngx-translate/core";
|
import {TranslateService} from '@ngx-translate/core';
|
||||||
import {LoginComponent} from "./login/login.component";
|
import {LoginComponent} from './login/login.component';
|
||||||
import {AccountDetailsComponent} from "./account-details/account-details.component";
|
import {AccountDetailsComponent} from './account-details/account-details.component';
|
||||||
import {WorkerDashboardComponent} from "./worker-dashboard/worker-dashboard.component";
|
import {WorkerDashboardComponent} from './worker-dashboard/worker-dashboard.component';
|
||||||
import {ProjectPermsComponent} from "./project-perms/project-perms.component";
|
import {ProjectPermsComponent} from './project-perms/project-perms.component';
|
||||||
import {ManagerListComponent} from "./manager-list/manager-list.component";
|
import {ManagerListComponent} from './manager-list/manager-list.component';
|
||||||
import {IndexComponent} from "./index/index.component";
|
import {IndexComponent} from './index/index.component';
|
||||||
import {ProjectSecretComponent} from "./project-secret/project-secret.component";
|
import {ProjectSecretComponent} from './project-secret/project-secret.component';
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{path: "", component: IndexComponent},
|
{path: '', component: IndexComponent},
|
||||||
{path: "log", component: LogsComponent},
|
{path: 'log', component: LogsComponent},
|
||||||
{path: "login", component: LoginComponent},
|
{path: 'login', component: LoginComponent},
|
||||||
{path: "account", component: AccountDetailsComponent},
|
{path: 'account', component: AccountDetailsComponent},
|
||||||
{path: "projects", component: ProjectListComponent},
|
{path: 'projects', component: ProjectListComponent},
|
||||||
{path: "project/:id", component: ProjectDashboardComponent},
|
{path: 'project/:id', component: ProjectDashboardComponent},
|
||||||
{path: "project/:id/update", component: UpdateProjectComponent},
|
{path: 'project/:id/update', component: UpdateProjectComponent},
|
||||||
{path: "project/:id/perms", component: ProjectPermsComponent},
|
{path: 'project/:id/perms', component: ProjectPermsComponent},
|
||||||
{path: "project/:id/secret", component: ProjectSecretComponent},
|
{path: 'project/:id/secret', component: ProjectSecretComponent},
|
||||||
{path: "new_project", component: CreateProjectComponent},
|
{path: 'new_project', component: CreateProjectComponent},
|
||||||
{path: "workers", component: WorkerDashboardComponent},
|
{path: 'workers', component: WorkerDashboardComponent},
|
||||||
{path: "manager_list", component: ManagerListComponent},
|
{path: 'manager_list', component: ManagerListComponent},
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
@ -41,19 +41,19 @@ export class AppRoutingModule {
|
|||||||
router.events
|
router.events
|
||||||
.pipe(filter(event => event instanceof NavigationEnd))
|
.pipe(filter(event => event instanceof NavigationEnd))
|
||||||
.subscribe((event: NavigationStart) => {
|
.subscribe((event: NavigationStart) => {
|
||||||
this.updateTitle(translate, title, event.url)
|
this.updateTitle(translate, title, event.url);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
translate.onLangChange.subscribe(() =>
|
translate.onLangChange.subscribe(() =>
|
||||||
this.updateTitle(translate, title, router.url)
|
this.updateTitle(translate, title, router.url)
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateTitle(tr: TranslateService, title: Title, url: string) {
|
private updateTitle(tr: TranslateService, title: Title, url: string) {
|
||||||
url = url.substr(1);
|
url = url.substr(1);
|
||||||
tr.get("title." + url.substring(0, url.indexOf("/") == -1 ? url.length : url.indexOf("/")))
|
tr.get('title.' + url.substring(0, url.indexOf('/') == -1 ? url.length : url.indexOf('/')))
|
||||||
.subscribe((t) => title.setTitle(t))
|
.subscribe((t) => title.setTitle(t));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import {Component} from '@angular/core';
|
import {Component} from '@angular/core';
|
||||||
import {Router} from '@angular/router';
|
import {Router} from '@angular/router';
|
||||||
import {TranslateService} from "@ngx-translate/core";
|
import {TranslateService} from '@ngx-translate/core';
|
||||||
import {AuthService} from "./auth.service";
|
import {AuthService} from './auth.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
@ -10,25 +10,25 @@ import {AuthService} from "./auth.service";
|
|||||||
})
|
})
|
||||||
export class AppComponent {
|
export class AppComponent {
|
||||||
|
|
||||||
langChange(lang: any) {
|
|
||||||
this.translate.use(lang.lang)
|
|
||||||
}
|
|
||||||
|
|
||||||
langList: any[] = [
|
|
||||||
{lang: "fr", display: "Français"},
|
|
||||||
{lang: "en", display: "English"},
|
|
||||||
];
|
|
||||||
|
|
||||||
constructor(private translate: TranslateService,
|
constructor(private translate: TranslateService,
|
||||||
public router: Router,
|
public router: Router,
|
||||||
public authService: AuthService) {
|
public authService: AuthService) {
|
||||||
|
|
||||||
translate.addLangs([
|
translate.addLangs([
|
||||||
"en",
|
'en',
|
||||||
"fr"
|
'fr'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
translate.setDefaultLang("en");
|
translate.setDefaultLang('en');
|
||||||
|
}
|
||||||
|
|
||||||
|
langList: any[] = [
|
||||||
|
{lang: 'fr', display: 'Français'},
|
||||||
|
{lang: 'en', display: 'English'},
|
||||||
|
];
|
||||||
|
|
||||||
|
langChange(lang: any) {
|
||||||
|
this.translate.use(lang.lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -33,19 +33,19 @@ import {
|
|||||||
MatTabsModule,
|
MatTabsModule,
|
||||||
MatToolbarModule,
|
MatToolbarModule,
|
||||||
MatTreeModule
|
MatTreeModule
|
||||||
} from "@angular/material";
|
} from '@angular/material';
|
||||||
import {ApiService} from "./api.service";
|
import {ApiService} from './api.service';
|
||||||
import {MessengerService} from "./messenger.service";
|
import {MessengerService} from './messenger.service';
|
||||||
import {HttpClient, HttpClientModule} from "@angular/common/http";
|
import {HttpClient, HttpClientModule} from '@angular/common/http';
|
||||||
import {ProjectDashboardComponent} from './project-dashboard/project-dashboard.component';
|
import {ProjectDashboardComponent} from './project-dashboard/project-dashboard.component';
|
||||||
import {ProjectListComponent} from './project-list/project-list.component';
|
import {ProjectListComponent} from './project-list/project-list.component';
|
||||||
import {CreateProjectComponent} from './create-project/create-project.component';
|
import {CreateProjectComponent} from './create-project/create-project.component';
|
||||||
import {FormsModule, ReactiveFormsModule} from "@angular/forms";
|
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
||||||
import {UpdateProjectComponent} from './update-project/update-project.component';
|
import {UpdateProjectComponent} from './update-project/update-project.component';
|
||||||
import {SnackBarComponent} from "./messenger/snack-bar.component";
|
import {SnackBarComponent} from './messenger/snack-bar.component';
|
||||||
import {TranslateLoader, TranslateModule, TranslateService} from "@ngx-translate/core";
|
import {TranslateLoader, TranslateModule, TranslateService} from '@ngx-translate/core';
|
||||||
import {TranslateHttpLoader} from "@ngx-translate/http-loader";
|
import {TranslateHttpLoader} from '@ngx-translate/http-loader';
|
||||||
import {TranslatedPaginator} from "./TranslatedPaginatorConfiguration";
|
import {TranslatedPaginator} from './TranslatedPaginatorConfiguration';
|
||||||
import {LoginComponent} from './login/login.component';
|
import {LoginComponent} from './login/login.component';
|
||||||
import {AccountDetailsComponent} from './account-details/account-details.component';
|
import {AccountDetailsComponent} from './account-details/account-details.component';
|
||||||
import {WorkerDashboardComponent} from './worker-dashboard/worker-dashboard.component';
|
import {WorkerDashboardComponent} from './worker-dashboard/worker-dashboard.component';
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import {Component, OnInit} from '@angular/core';
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {MatDialogRef} from "@angular/material";
|
import {MatDialogRef} from '@angular/material';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-are-you-sure',
|
selector: 'app-are-you-sure',
|
||||||
@ -16,10 +16,10 @@ export class AreYouSureComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onNoClick() {
|
onNoClick() {
|
||||||
this.dialogRef.close(false)
|
this.dialogRef.close(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
onYesClick() {
|
onYesClick() {
|
||||||
this.dialogRef.close(true)
|
this.dialogRef.close(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import {Injectable} from '@angular/core';
|
import {Injectable} from '@angular/core';
|
||||||
import {ApiService} from "./api.service";
|
import {ApiService} from './api.service';
|
||||||
import {Credentials} from "./models/credentials";
|
import {Credentials} from './models/credentials';
|
||||||
import {MessengerService} from "./messenger.service";
|
import {MessengerService} from './messenger.service';
|
||||||
import {Router} from "@angular/router";
|
import {Router} from '@angular/router';
|
||||||
import {Manager} from "./models/manager";
|
import {Manager} from './models/manager';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@ -20,7 +20,7 @@ export class AuthService {
|
|||||||
.subscribe((data: any) => {
|
.subscribe((data: any) => {
|
||||||
this.account = data.content.manager;
|
this.account = data.content.manager;
|
||||||
this.logged = data.content.logged_in;
|
this.logged = data.content.logged_in;
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public login(credentials: Credentials) {
|
public login(credentials: Credentials) {
|
||||||
@ -31,14 +31,14 @@ export class AuthService {
|
|||||||
.subscribe((data: any) => {
|
.subscribe((data: any) => {
|
||||||
this.account = data.content.manager;
|
this.account = data.content.manager;
|
||||||
this.logged = true;
|
this.logged = true;
|
||||||
this.router.navigateByUrl("/account");
|
this.router.navigateByUrl('/account');
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
this.messengerService.show(error.error.message);
|
this.messengerService.show(error.error.message);
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public logout() {
|
public logout() {
|
||||||
@ -47,13 +47,13 @@ export class AuthService {
|
|||||||
() => {
|
() => {
|
||||||
this.account = null;
|
this.account = null;
|
||||||
this.logged = false;
|
this.logged = false;
|
||||||
this.router.navigateByUrl("login");
|
this.router.navigateByUrl('login');
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
this.messengerService.show(error.error.message);
|
this.messengerService.show(error.error.message);
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public register(credentials: Credentials) {
|
public register(credentials: Credentials) {
|
||||||
@ -63,12 +63,12 @@ export class AuthService {
|
|||||||
.subscribe((data: any) => {
|
.subscribe((data: any) => {
|
||||||
this.logged = true;
|
this.logged = true;
|
||||||
this.account = data.content.manager;
|
this.account = data.content.manager;
|
||||||
this.router.navigateByUrl("/account");
|
this.router.navigateByUrl('/account');
|
||||||
}),
|
}),
|
||||||
error => {
|
error => {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
this.messengerService.show(error.error.message);
|
this.messengerService.show(error.error.message);
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import {Component, OnInit} from '@angular/core';
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {Project} from "../models/project";
|
import {Project} from '../models/project';
|
||||||
import {ApiService} from "../api.service";
|
import {ApiService} from '../api.service';
|
||||||
import {MessengerService} from "../messenger.service";
|
import {MessengerService} from '../messenger.service';
|
||||||
import {Router} from "@angular/router";
|
import {Router} from '@angular/router';
|
||||||
import {AuthService} from "../auth.service";
|
import {AuthService} from '../auth.service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -26,10 +26,10 @@ export class CreateProjectComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cloneUrlChange() {
|
cloneUrlChange() {
|
||||||
let tokens = this.project.clone_url.split("/");
|
const tokens = this.project.clone_url.split('/');
|
||||||
|
|
||||||
if (tokens.length > 2) {
|
if (tokens.length > 2) {
|
||||||
this.project.git_repo = tokens[tokens.length - 2] + "/" + tokens[tokens.length - 1]
|
this.project.git_repo = tokens[tokens.length - 2] + '/' + tokens[tokens.length - 1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,13 +38,13 @@ export class CreateProjectComponent implements OnInit {
|
|||||||
|
|
||||||
this.apiService.createProject(this.project).subscribe(
|
this.apiService.createProject(this.project).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.router.navigateByUrl("/project/" + data["content"]["id"]);
|
this.router.navigateByUrl('/project/' + data['content']['id']);
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
console.log(error.error.message);
|
console.log(error.error.message);
|
||||||
this.messengerService.show(error.error.message);
|
this.messengerService.show(error.error.message);
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import {Component, OnInit} from '@angular/core';
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {ApiService} from "../api.service";
|
import {ApiService} from '../api.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-index',
|
selector: 'app-index',
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import {Component, OnInit} from '@angular/core';
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {Credentials} from "../models/credentials";
|
import {Credentials} from '../models/credentials';
|
||||||
import {ApiService} from "../api.service";
|
import {ApiService} from '../api.service';
|
||||||
import {MessengerService} from "../messenger.service";
|
import {MessengerService} from '../messenger.service';
|
||||||
import {Router} from "@angular/router";
|
import {Router} from '@angular/router';
|
||||||
import {AuthService} from "../auth.service";
|
import {AuthService} from '../auth.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-login',
|
selector: 'app-login',
|
||||||
@ -24,15 +24,15 @@ export class LoginComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
login() {
|
login() {
|
||||||
this.authService.login(this.credentials)
|
this.authService.login(this.credentials);
|
||||||
}
|
}
|
||||||
|
|
||||||
register() {
|
register() {
|
||||||
this.authService.register(this.credentials)
|
this.authService.register(this.credentials);
|
||||||
}
|
}
|
||||||
|
|
||||||
canCreate(): boolean {
|
canCreate(): boolean {
|
||||||
return this.credentials.username && this.credentials.username != "" &&
|
return this.credentials.username && this.credentials.username != '' &&
|
||||||
this.credentials.password == this.credentials.repeatPassword
|
this.credentials.password == this.credentials.repeatPassword;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import {Component, OnInit, ViewChild} from '@angular/core';
|
import {Component, OnInit, ViewChild} from '@angular/core';
|
||||||
import {ApiService} from "../api.service";
|
import {ApiService} from '../api.service';
|
||||||
import {getLogLevel, LogEntry} from "../models/logentry";
|
import {getLogLevel, LogEntry} from '../models/logentry';
|
||||||
|
|
||||||
import _ from "lodash"
|
import _ from 'lodash';
|
||||||
import * as moment from "moment";
|
import * as moment from 'moment';
|
||||||
import {MatButtonToggleChange, MatPaginator, MatSort, MatTableDataSource} from "@angular/material";
|
import {MatButtonToggleChange, MatPaginator, MatSort, MatTableDataSource} from '@angular/material';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-logs',
|
selector: 'app-logs',
|
||||||
@ -15,14 +15,14 @@ export class LogsComponent implements OnInit {
|
|||||||
|
|
||||||
logs: LogEntry[] = [];
|
logs: LogEntry[] = [];
|
||||||
data: MatTableDataSource<LogEntry>;
|
data: MatTableDataSource<LogEntry>;
|
||||||
filterLevel: number = 1;
|
filterLevel = 1;
|
||||||
logsCols: string[] = ["level", "timestamp", "message", "data"];
|
logsCols: string[] = ['level', 'timestamp', 'message', 'data'];
|
||||||
|
|
||||||
@ViewChild(MatPaginator) paginator: MatPaginator;
|
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||||
@ViewChild(MatSort) sort: MatSort;
|
@ViewChild(MatSort) sort: MatSort;
|
||||||
|
|
||||||
constructor(private apiService: ApiService) {
|
constructor(private apiService: ApiService) {
|
||||||
this.data = new MatTableDataSource<LogEntry>(this.logs)
|
this.data = new MatTableDataSource<LogEntry>(this.logs);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@ -36,26 +36,26 @@ export class LogsComponent implements OnInit {
|
|||||||
|
|
||||||
filterLevelChange(event: MatButtonToggleChange) {
|
filterLevelChange(event: MatButtonToggleChange) {
|
||||||
this.filterLevel = Number(event.value);
|
this.filterLevel = Number(event.value);
|
||||||
this.getLogs(Number(event.value))
|
this.getLogs(Number(event.value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public refresh() {
|
public refresh() {
|
||||||
this.getLogs(this.filterLevel)
|
this.getLogs(this.filterLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
private getLogs(level: number) {
|
private getLogs(level: number) {
|
||||||
this.apiService.getLogs(level).subscribe(
|
this.apiService.getLogs(level).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.data.data = _.map(data["content"]["logs"], (entry) => {
|
this.data.data = _.map(data['content']['logs'], (entry) => {
|
||||||
return <LogEntry>{
|
return <LogEntry>{
|
||||||
message: entry.message,
|
message: entry.message,
|
||||||
timestamp: moment.unix(entry.timestamp).format("YYYY-MM-DD HH:mm:ss"),
|
timestamp: moment.unix(entry.timestamp).format('YYYY-MM-DD HH:mm:ss'),
|
||||||
data: JSON.stringify(JSON.parse(entry.data), null, 2),
|
data: JSON.stringify(JSON.parse(entry.data), null, 2),
|
||||||
level: getLogLevel(entry.level),
|
level: getLogLevel(entry.level),
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import {Component, OnInit, ViewChild} from '@angular/core';
|
import {Component, OnInit, ViewChild} from '@angular/core';
|
||||||
import {ApiService} from "../api.service";
|
import {ApiService} from '../api.service';
|
||||||
import {MessengerService} from "../messenger.service";
|
import {MessengerService} from '../messenger.service';
|
||||||
import {TranslateService} from "@ngx-translate/core";
|
import {TranslateService} from '@ngx-translate/core';
|
||||||
import {MatPaginator, MatSort, MatTableDataSource} from "@angular/material";
|
import {MatPaginator, MatSort, MatTableDataSource} from '@angular/material';
|
||||||
|
|
||||||
import * as moment from "moment"
|
import * as moment from 'moment';
|
||||||
import {AuthService} from "../auth.service";
|
import {AuthService} from '../auth.service';
|
||||||
import {Manager} from "../models/manager";
|
import {Manager} from '../models/manager';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-manager-list',
|
selector: 'app-manager-list',
|
||||||
@ -28,7 +28,7 @@ export class ManagerListComponent implements OnInit {
|
|||||||
private translate: TranslateService,
|
private translate: TranslateService,
|
||||||
private authService: AuthService
|
private authService: AuthService
|
||||||
) {
|
) {
|
||||||
this.data = new MatTableDataSource<Manager>()
|
this.data = new MatTableDataSource<Manager>();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@ -38,34 +38,34 @@ export class ManagerListComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
canPromote(manager: Manager) {
|
canPromote(manager: Manager) {
|
||||||
return !manager.tracker_admin
|
return !manager.tracker_admin;
|
||||||
}
|
}
|
||||||
|
|
||||||
canDemote(manager: Manager) {
|
canDemote(manager: Manager) {
|
||||||
return manager.tracker_admin && manager.username != this.authService.account.username
|
return manager.tracker_admin && manager.username != this.authService.account.username;
|
||||||
}
|
}
|
||||||
|
|
||||||
public promote(manager: Manager) {
|
public promote(manager: Manager) {
|
||||||
this.apiService.promote(manager.id)
|
this.apiService.promote(manager.id)
|
||||||
.subscribe(() => this.getManagers())
|
.subscribe(() => this.getManagers());
|
||||||
}
|
}
|
||||||
|
|
||||||
public demote(manager: Manager) {
|
public demote(manager: Manager) {
|
||||||
this.apiService.demote(manager.id)
|
this.apiService.demote(manager.id)
|
||||||
.subscribe(() => this.getManagers())
|
.subscribe(() => this.getManagers());
|
||||||
}
|
}
|
||||||
|
|
||||||
private getManagers() {
|
private getManagers() {
|
||||||
this.apiService.getManagerList()
|
this.apiService.getManagerList()
|
||||||
.subscribe(data => {
|
.subscribe(data => {
|
||||||
this.data.data = data["content"]["managers"]
|
this.data.data = data['content']['managers'];
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
if (error && (error.status == 401 || error.status == 403)) {
|
if (error && (error.status == 401 || error.status == 403)) {
|
||||||
console.log(error.error.message);
|
console.log(error.error.message);
|
||||||
this.translate.get("manager_list.unauthorized")
|
this.translate.get('manager_list.unauthorized')
|
||||||
.subscribe(t => this.messengerService.show(t));
|
.subscribe(t => this.messengerService.show(t));
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {Component, EventEmitter, OnInit, Output} from '@angular/core';
|
import {Component, EventEmitter, OnInit, Output} from '@angular/core';
|
||||||
import {ApiService} from "../api.service";
|
import {ApiService} from '../api.service';
|
||||||
import {Manager} from "../models/manager";
|
import {Manager} from '../models/manager';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'manager-select',
|
selector: 'manager-select',
|
||||||
@ -23,7 +23,7 @@ export class ManagerSelectComponent implements OnInit {
|
|||||||
|
|
||||||
loadManagerList() {
|
loadManagerList() {
|
||||||
this.apiService.getManagerList()
|
this.apiService.getManagerList()
|
||||||
.subscribe(data => this.managerList = data["content"]["managers"])
|
.subscribe(data => this.managerList = data['content']['managers']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {Injectable} from '@angular/core';
|
import {Injectable} from '@angular/core';
|
||||||
import {Subject} from "rxjs";
|
import {Subject} from 'rxjs';
|
||||||
import {MessengerState} from "./messenger/messenger";
|
import {MessengerState} from './messenger/messenger';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class MessengerService {
|
export class MessengerService {
|
||||||
@ -11,12 +11,12 @@ export class MessengerService {
|
|||||||
this.messengerSubject.next({
|
this.messengerSubject.next({
|
||||||
message: message,
|
message: message,
|
||||||
hidden: false,
|
hidden: false,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
hide() {
|
hide() {
|
||||||
this.messengerSubject.next({
|
this.messengerSubject.next({
|
||||||
hidden: true,
|
hidden: true,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import {Component, OnInit} from '@angular/core';
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {MessengerService} from "../messenger.service";
|
import {MessengerService} from '../messenger.service';
|
||||||
import {MessengerState} from "./messenger";
|
import {MessengerState} from './messenger';
|
||||||
import {Subscription} from "rxjs";
|
import {Subscription} from 'rxjs';
|
||||||
import {MatSnackBar, MatSnackBarConfig} from "@angular/material";
|
import {MatSnackBar, MatSnackBarConfig} from '@angular/material';
|
||||||
import {TranslateService} from "@ngx-translate/core";
|
import {TranslateService} from '@ngx-translate/core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'messenger-snack-bar',
|
selector: 'messenger-snack-bar',
|
||||||
@ -27,11 +27,11 @@ export class SnackBarComponent implements OnInit {
|
|||||||
if (state.hidden) {
|
if (state.hidden) {
|
||||||
this.snackBar.dismiss();
|
this.snackBar.dismiss();
|
||||||
} else {
|
} else {
|
||||||
this.translate.get("messenger.close")
|
this.translate.get('messenger.close')
|
||||||
.subscribe(t =>
|
.subscribe(t =>
|
||||||
this.snackBar.open(state.message, t, <MatSnackBarConfig>{
|
this.snackBar.open(state.message, t, <MatSnackBarConfig>{
|
||||||
duration: 10 * 1000,
|
duration: 10 * 1000,
|
||||||
}))
|
}));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
export interface Credentials {
|
export interface Credentials {
|
||||||
username: string,
|
username: string;
|
||||||
password: string,
|
password: string;
|
||||||
repeatPassword: string,
|
repeatPassword: string;
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
export interface LogEntry {
|
export interface LogEntry {
|
||||||
level: string,
|
level: string;
|
||||||
message: string,
|
message: string;
|
||||||
data: any,
|
data: any;
|
||||||
timestamp: string,
|
timestamp: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum LogLevel {
|
export enum LogLevel {
|
||||||
FATAL = "fatal",
|
FATAL = 'fatal',
|
||||||
PANIC = "panic",
|
PANIC = 'panic',
|
||||||
ERROR = "error",
|
ERROR = 'error',
|
||||||
WARN = "warn",
|
WARN = 'warn',
|
||||||
INFO = "info",
|
INFO = 'info',
|
||||||
DEBUG = "debug",
|
DEBUG = 'debug',
|
||||||
TRACE = "trace",
|
TRACE = 'trace',
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getLogLevel(level: number): string {
|
export function getLogLevel(level: number): string {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
export interface Manager {
|
export interface Manager {
|
||||||
id: number;
|
id: number;
|
||||||
username: string
|
username: string;
|
||||||
tracker_admin: boolean
|
tracker_admin: boolean;
|
||||||
register_time: number
|
register_time: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ManagerRoleOnProject {
|
export class ManagerRoleOnProject {
|
||||||
@ -10,57 +10,57 @@ export class ManagerRoleOnProject {
|
|||||||
role: number;
|
role: number;
|
||||||
|
|
||||||
public static fromEntity(data: { role: number, manager: Manager }): ManagerRoleOnProject {
|
public static fromEntity(data: { role: number, manager: Manager }): ManagerRoleOnProject {
|
||||||
let m = new ManagerRoleOnProject();
|
const m = new ManagerRoleOnProject();
|
||||||
m.role = data.role;
|
m.role = data.role;
|
||||||
m.manager = data.manager;
|
m.manager = data.manager;
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
get readRole(): boolean {
|
get readRole(): boolean {
|
||||||
return (this.role & 1) != 0
|
return (this.role & 1) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
set readRole(role: boolean) {
|
set readRole(role: boolean) {
|
||||||
if (role) {
|
if (role) {
|
||||||
this.role |= 1
|
this.role |= 1;
|
||||||
} else {
|
} else {
|
||||||
this.role &= ~1
|
this.role &= ~1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get editRole(): boolean {
|
get editRole(): boolean {
|
||||||
return (this.role & 2) != 0
|
return (this.role & 2) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
set editRole(role: boolean) {
|
set editRole(role: boolean) {
|
||||||
if (role) {
|
if (role) {
|
||||||
this.role |= 2
|
this.role |= 2;
|
||||||
} else {
|
} else {
|
||||||
this.role &= ~2
|
this.role &= ~2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get manageRole(): boolean {
|
get manageRole(): boolean {
|
||||||
return (this.role & 4) != 0
|
return (this.role & 4) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
set manageRole(role: boolean) {
|
set manageRole(role: boolean) {
|
||||||
if (role) {
|
if (role) {
|
||||||
this.role |= 4
|
this.role |= 4;
|
||||||
} else {
|
} else {
|
||||||
this.role &= ~4
|
this.role &= ~4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get secretRole(): boolean {
|
get secretRole(): boolean {
|
||||||
return (this.role & 8) != 0
|
return (this.role & 8) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
set secretRole(role: boolean) {
|
set secretRole(role: boolean) {
|
||||||
if (role) {
|
if (role) {
|
||||||
this.role |= 8
|
this.role |= 8;
|
||||||
} else {
|
} else {
|
||||||
this.role &= ~8
|
this.role &= ~8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
export interface MonitoringSnapshot {
|
export interface MonitoringSnapshot {
|
||||||
new_task_count: number
|
new_task_count: number;
|
||||||
failed_task_count: number
|
failed_task_count: number;
|
||||||
closed_task_count: number
|
closed_task_count: number;
|
||||||
awaiting_verification_count: number
|
awaiting_verification_count: number;
|
||||||
time_stamp: number
|
time_stamp: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AssignedTasks {
|
export interface AssignedTasks {
|
||||||
assignee: string
|
assignee: string;
|
||||||
task_count: number
|
task_count: number;
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import {Worker} from "./worker"
|
import {Worker} from './worker';
|
||||||
|
|
||||||
export interface WorkerAccess {
|
export interface WorkerAccess {
|
||||||
submit: boolean
|
submit: boolean;
|
||||||
assign: boolean
|
assign: boolean;
|
||||||
request: boolean
|
request: boolean;
|
||||||
worker: Worker
|
worker: Worker;
|
||||||
project: number
|
project: number;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
export interface Worker {
|
export interface Worker {
|
||||||
id: number
|
id: number;
|
||||||
alias: string
|
alias: string;
|
||||||
created: number
|
created: number;
|
||||||
secret: string
|
secret: string;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import {Component, Input, OnInit} from '@angular/core';
|
import {Component, Input, OnInit} from '@angular/core';
|
||||||
import {Project} from "../models/project";
|
import {Project} from '../models/project';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'project-icon',
|
selector: 'project-icon',
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import {Component, OnInit} from '@angular/core';
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {ApiService} from "../api.service";
|
import {ApiService} from '../api.service';
|
||||||
import {Project} from "../models/project";
|
import {Project} from '../models/project';
|
||||||
import {AuthService} from "../auth.service";
|
import {AuthService} from '../auth.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-project-list',
|
selector: 'app-project-list',
|
||||||
@ -17,7 +17,7 @@ export class ProjectListComponent implements OnInit {
|
|||||||
projects: Project[];
|
projects: Project[];
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.getProjects()
|
this.getProjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh() {
|
refresh() {
|
||||||
@ -26,7 +26,7 @@ export class ProjectListComponent implements OnInit {
|
|||||||
|
|
||||||
getProjects() {
|
getProjects() {
|
||||||
this.apiService.getProjects().subscribe(data =>
|
this.apiService.getProjects().subscribe(data =>
|
||||||
this.projects = data["content"]["projects"]);
|
this.projects = data['content']['projects']);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import {Component, OnInit} from '@angular/core';
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {ApiService} from "../api.service";
|
import {ApiService} from '../api.service';
|
||||||
import {Project} from "../models/project";
|
import {Project} from '../models/project';
|
||||||
import {ActivatedRoute} from "@angular/router";
|
import {ActivatedRoute} from '@angular/router';
|
||||||
|
|
||||||
import * as moment from "moment"
|
import * as moment from 'moment';
|
||||||
import {WorkerAccess} from "../models/worker-access";
|
import {WorkerAccess} from '../models/worker-access';
|
||||||
import {AuthService} from "../auth.service";
|
import {AuthService} from '../auth.service';
|
||||||
import {Manager, ManagerRoleOnProject} from "../models/manager";
|
import {Manager, ManagerRoleOnProject} from '../models/manager';
|
||||||
import {MessengerService} from "../messenger.service";
|
import {MessengerService} from '../messenger.service';
|
||||||
import {TranslateService} from "@ngx-translate/core";
|
import {TranslateService} from '@ngx-translate/core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-project-perms',
|
selector: 'app-project-perms',
|
||||||
@ -28,58 +28,58 @@ export class ProjectPermsComponent implements OnInit {
|
|||||||
private projectId: number;
|
private projectId: number;
|
||||||
accesses: WorkerAccess[];
|
accesses: WorkerAccess[];
|
||||||
managerRoles: ManagerRoleOnProject;
|
managerRoles: ManagerRoleOnProject;
|
||||||
unauthorized: boolean = false;
|
unauthorized = false;
|
||||||
moment = moment;
|
moment = moment;
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.route.params.subscribe(params => {
|
this.route.params.subscribe(params => {
|
||||||
this.projectId = params["id"];
|
this.projectId = params['id'];
|
||||||
this.getProject();
|
this.getProject();
|
||||||
this.getProjectAccesses();
|
this.getProjectAccesses();
|
||||||
this.getProjectManagers();
|
this.getProjectManagers();
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public acceptRequest(wa: WorkerAccess) {
|
public acceptRequest(wa: WorkerAccess) {
|
||||||
this.apiService.acceptWorkerAccessRequest(wa.worker.id, this.projectId)
|
this.apiService.acceptWorkerAccessRequest(wa.worker.id, this.projectId)
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
this.getProjectAccesses();
|
this.getProjectAccesses();
|
||||||
this.translate.get("perms.set").subscribe(t => this.messenger.show(t));
|
this.translate.get('perms.set').subscribe(t => this.messenger.show(t));
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public rejectRequest(wa: WorkerAccess) {
|
public rejectRequest(wa: WorkerAccess) {
|
||||||
this.apiService.rejectWorkerAccessRequest(wa.worker.id, this.projectId)
|
this.apiService.rejectWorkerAccessRequest(wa.worker.id, this.projectId)
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
this.getProjectAccesses();
|
this.getProjectAccesses();
|
||||||
this.translate.get("perms.set").subscribe(t => this.messenger.show(t));
|
this.translate.get('perms.set').subscribe(t => this.messenger.show(t));
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private getProject() {
|
private getProject() {
|
||||||
this.apiService.getProject(this.projectId).subscribe(data => {
|
this.apiService.getProject(this.projectId).subscribe(data => {
|
||||||
this.project = data["content"]["project"]
|
this.project = data['content']['project'];
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private getProjectAccesses() {
|
private getProjectAccesses() {
|
||||||
this.apiService.getProjectAccess(this.projectId).subscribe(
|
this.apiService.getProjectAccess(this.projectId).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.accesses = data["content"]["accesses"]
|
this.accesses = data['content']['accesses'];
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
if (error && (error.status == 401 || error.status == 403)) {
|
if (error && (error.status == 401 || error.status == 403)) {
|
||||||
this.unauthorized = true;
|
this.unauthorized = true;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private getProjectManagers() {
|
private getProjectManagers() {
|
||||||
this.apiService.getManagerListWithRoleOn(this.projectId)
|
this.apiService.getManagerListWithRoleOn(this.projectId)
|
||||||
.subscribe(data => {
|
.subscribe(data => {
|
||||||
this.managerRoles = data["content"]["managers"].map(d =>
|
this.managerRoles = data['content']['managers'].map(d =>
|
||||||
ManagerRoleOnProject.fromEntity(d))
|
ManagerRoleOnProject.fromEntity(d));
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public refresh() {
|
public refresh() {
|
||||||
@ -90,7 +90,7 @@ export class ProjectPermsComponent implements OnInit {
|
|||||||
public onSelectManager(manager: Manager) {
|
public onSelectManager(manager: Manager) {
|
||||||
if (manager.id != this.auth.account.id) {
|
if (manager.id != this.auth.account.id) {
|
||||||
this.apiService.setManagerRoleOnProject(this.projectId, 1, manager.id)
|
this.apiService.setManagerRoleOnProject(this.projectId, 1, manager.id)
|
||||||
.subscribe(() => this.refresh())
|
.subscribe(() => this.refresh());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ export class ProjectPermsComponent implements OnInit {
|
|||||||
this.apiService.setManagerRoleOnProject(this.projectId, manager.role, manager.manager.id)
|
this.apiService.setManagerRoleOnProject(this.projectId, manager.role, manager.manager.id)
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
this.translate.get("perms.set").subscribe(t => this.messenger.show(t));
|
this.translate.get('perms.set').subscribe(t => this.messenger.show(t));
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import {Component, OnInit} from '@angular/core';
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {AuthService} from "../auth.service";
|
import {AuthService} from '../auth.service';
|
||||||
import {ApiService} from "../api.service";
|
import {ApiService} from '../api.service';
|
||||||
import {ActivatedRoute} from "@angular/router";
|
import {ActivatedRoute} from '@angular/router';
|
||||||
import {TranslateService} from "@ngx-translate/core";
|
import {TranslateService} from '@ngx-translate/core';
|
||||||
import {MessengerService} from "../messenger.service";
|
import {MessengerService} from '../messenger.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-project-secret',
|
selector: 'app-project-secret',
|
||||||
@ -25,7 +25,7 @@ export class ProjectSecretComponent implements OnInit {
|
|||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.route.params.subscribe(params => {
|
this.route.params.subscribe(params => {
|
||||||
this.projectId = params["id"];
|
this.projectId = params['id'];
|
||||||
this.getSecret();
|
this.getSecret();
|
||||||
this.getWebhookSecret();
|
this.getWebhookSecret();
|
||||||
});
|
});
|
||||||
@ -33,30 +33,30 @@ export class ProjectSecretComponent implements OnInit {
|
|||||||
|
|
||||||
getSecret() {
|
getSecret() {
|
||||||
this.apiService.getSecret(this.projectId).subscribe(data => {
|
this.apiService.getSecret(this.projectId).subscribe(data => {
|
||||||
this.secret = data["content"]["secret"]
|
this.secret = data['content']['secret'];
|
||||||
}, error => {
|
}, error => {
|
||||||
this.translate.get("messenger.unauthorized").subscribe(t => this.messenger.show(t))
|
this.translate.get('messenger.unauthorized').subscribe(t => this.messenger.show(t));
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getWebhookSecret() {
|
getWebhookSecret() {
|
||||||
this.apiService.getWebhookSecret(this.projectId).subscribe(data => {
|
this.apiService.getWebhookSecret(this.projectId).subscribe(data => {
|
||||||
this.webhookSecret = data["content"]["webhook_secret"]
|
this.webhookSecret = data['content']['webhook_secret'];
|
||||||
}, error => {
|
}, error => {
|
||||||
this.translate.get("messenger.unauthorized").subscribe(t => this.messenger.show(t))
|
this.translate.get('messenger.unauthorized').subscribe(t => this.messenger.show(t));
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onUpdate() {
|
onUpdate() {
|
||||||
this.apiService.setSecret(this.projectId, this.secret).subscribe(data => {
|
this.apiService.setSecret(this.projectId, this.secret).subscribe(data => {
|
||||||
this.translate.get("secret.ok").subscribe(t => this.messenger.show(t))
|
this.translate.get('secret.ok').subscribe(t => this.messenger.show(t));
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onWebhookUpdate() {
|
onWebhookUpdate() {
|
||||||
this.apiService.setWebhookSecret(this.projectId, this.webhookSecret).subscribe(data => {
|
this.apiService.setWebhookSecret(this.projectId, this.webhookSecret).subscribe(data => {
|
||||||
this.translate.get("secret.ok").subscribe(t => this.messenger.show(t))
|
this.translate.get('secret.ok').subscribe(t => this.messenger.show(t));
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh() {
|
refresh() {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
||||||
import {ApiService} from "../api.service";
|
import {ApiService} from '../api.service';
|
||||||
import {Project} from "../models/project";
|
import {Project} from '../models/project';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'project-select',
|
selector: 'project-select',
|
||||||
@ -22,7 +22,7 @@ export class ProjectSelectComponent implements OnInit {
|
|||||||
|
|
||||||
loadProjectList() {
|
loadProjectList() {
|
||||||
this.apiService.getProjects().subscribe(data => {
|
this.apiService.getProjects().subscribe(data => {
|
||||||
this.projectList = data["content"]["projects"]
|
this.projectList = data['content']['projects'];
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import {Component, OnInit} from '@angular/core';
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {Project} from "../models/project";
|
import {Project} from '../models/project';
|
||||||
import {ApiService} from "../api.service";
|
import {ApiService} from '../api.service';
|
||||||
import {ActivatedRoute, Router} from "@angular/router";
|
import {ActivatedRoute, Router} from '@angular/router';
|
||||||
import {MessengerService} from "../messenger.service";
|
import {MessengerService} from '../messenger.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-update-project',
|
selector: 'app-update-project',
|
||||||
@ -23,29 +23,29 @@ export class UpdateProjectComponent implements OnInit {
|
|||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.route.params.subscribe(params => {
|
this.route.params.subscribe(params => {
|
||||||
this.projectId = params["id"];
|
this.projectId = params['id'];
|
||||||
this.getProject();
|
this.getProject();
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private getProject() {
|
private getProject() {
|
||||||
this.apiService.getProject(this.projectId).subscribe(data => {
|
this.apiService.getProject(this.projectId).subscribe(data => {
|
||||||
this.project = data["content"]["project"];
|
this.project = data['content']['project'];
|
||||||
this.selectedProject = <Project>{id: this.project.chain}
|
this.selectedProject = <Project>{id: this.project.chain};
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
this.project.chain = this.selectedProject ? this.selectedProject.id : 0;
|
this.project.chain = this.selectedProject ? this.selectedProject.id : 0;
|
||||||
this.apiService.updateProject(this.project).subscribe(
|
this.apiService.updateProject(this.project).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.router.navigateByUrl("/project/" + this.project.id);
|
this.router.navigateByUrl('/project/' + this.project.id);
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
console.log(error.error.message);
|
console.log(error.error.message);
|
||||||
this.messengerService.show(error.error.message);
|
this.messengerService.show(error.error.message);
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import {Component, OnInit} from '@angular/core';
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {ApiService} from "../api.service";
|
import {ApiService} from '../api.service';
|
||||||
|
|
||||||
import {Chart} from "chart.js";
|
import {Chart} from 'chart.js';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-worker-dashboard',
|
selector: 'app-worker-dashboard',
|
||||||
@ -17,24 +17,24 @@ export class WorkerDashboardComponent implements OnInit {
|
|||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.setupChart();
|
this.setupChart();
|
||||||
this.refresh()
|
this.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
public refresh() {
|
public refresh() {
|
||||||
this.apiService.getWorkerStats()
|
this.apiService.getWorkerStats()
|
||||||
.subscribe(data => {
|
.subscribe(data => {
|
||||||
this.updateChart(data["content"]["stats"])
|
this.updateChart(data['content']['stats']);
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private setupChart() {
|
private setupChart() {
|
||||||
|
|
||||||
let elem = document.getElementById("worker-stats") as any;
|
const elem = document.getElementById('worker-stats') as any;
|
||||||
let ctx = elem.getContext("2d");
|
const ctx = elem.getContext('2d');
|
||||||
|
|
||||||
this.chart = new Chart(ctx, {
|
this.chart = new Chart(ctx, {
|
||||||
type: "bar",
|
type: 'bar',
|
||||||
data: {
|
data: {
|
||||||
labels: [],
|
labels: [],
|
||||||
datasets: [],
|
datasets: [],
|
||||||
@ -51,7 +51,7 @@ export class WorkerDashboardComponent implements OnInit {
|
|||||||
},
|
},
|
||||||
responsive: true
|
responsive: true
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateChart(data) {
|
private updateChart(data) {
|
||||||
@ -59,7 +59,7 @@ export class WorkerDashboardComponent implements OnInit {
|
|||||||
this.chart.data.labels = data.map(w => w.alias);
|
this.chart.data.labels = data.map(w => w.alias);
|
||||||
this.chart.data.datasets = [{
|
this.chart.data.datasets = [{
|
||||||
data: data.map(w => w.closed_task_count),
|
data: data.map(w => w.closed_task_count),
|
||||||
backgroundColor: "#FF3D00"
|
backgroundColor: '#FF3D00'
|
||||||
}];
|
}];
|
||||||
this.chart.update();
|
this.chart.update();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user