mirror of
https://github.com/simon987/task_tracker.git
synced 2025-12-10 13:44:30 +00:00
Task chaining + some refactoring
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import {AppPage} from './app.po';
|
||||
import {browser, logging} from 'protractor';
|
||||
|
||||
describe('workspace-project App', () => {
|
||||
describe('workspace-projectChange App', () => {
|
||||
let page: AppPage;
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -49,6 +49,7 @@ import {AccountDetailsComponent} from './account-details/account-details.compone
|
||||
import {WorkerDashboardComponent} from './worker-dashboard/worker-dashboard.component';
|
||||
import {ProjectPermsComponent} from './project-perms/project-perms.component';
|
||||
import {ManagerListComponent} from './manager-list/manager-list.component';
|
||||
import {ProjectSelectComponent} from './project-select/project-select.component';
|
||||
|
||||
|
||||
export function createTranslateLoader(http: HttpClient) {
|
||||
@@ -70,6 +71,7 @@ export function createTranslateLoader(http: HttpClient) {
|
||||
WorkerDashboardComponent,
|
||||
ProjectPermsComponent,
|
||||
ManagerListComponent,
|
||||
ProjectSelectComponent,
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
|
||||
@@ -1,36 +1,37 @@
|
||||
<div class="container">
|
||||
<mat-card class="mat-elevation-z8">
|
||||
<mat-card-title>{{"project.create_title" | translate}}</mat-card-title>
|
||||
<mat-card-subtitle>{{"project.create_subtitle" | translate}}</mat-card-subtitle>
|
||||
<mat-card-title>{{"project.create_title" | translate}}</mat-card-title>
|
||||
<mat-card-subtitle>{{"project.create_subtitle" | translate}}</mat-card-subtitle>
|
||||
|
||||
<mat-card-content>
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>{{"project.name" | translate}}</mat-label>
|
||||
<mat-card-content>
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>{{"project.name" | translate}}</mat-label>
|
||||
<input type="text" matInput [(ngModel)]="project.name" [placeholder]="'project.name' | translate">
|
||||
</mat-form-field>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>{{ "project.clone_url" | translate}}</mat-label>
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>{{ "project.clone_url" | translate}}</mat-label>
|
||||
<input type="text" matInput [(ngModel)]="project.clone_url" (change)="cloneUrlChange()"
|
||||
[placeholder]="'project.clone_url_placeholder' | translate">
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>{{ "project.git_repo" | translate }}</mat-label>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>{{ "project.git_repo" | translate }}</mat-label>
|
||||
<input type="text" matInput [(ngModel)]="project.git_repo"
|
||||
[placeholder]="'project.git_repo_placeholder' | translate">
|
||||
<mat-hint align="start">
|
||||
{{"project.git_repo_hint" | translate}}
|
||||
</mat-hint>
|
||||
</mat-form-field>
|
||||
<mat-hint align="start">
|
||||
{{"project.git_repo_hint" | translate}}
|
||||
</mat-hint>
|
||||
</mat-form-field>
|
||||
<project-select [(project)]="selectedProject"></project-select>
|
||||
|
||||
<mat-checkbox [(ngModel)]="project.public"
|
||||
[disabled]="!authService.logged || !authService.account.tracker_admin"
|
||||
style="padding-top: 1em">
|
||||
{{"project.public" | translate}}</mat-checkbox>
|
||||
{{"project.public" | translate}}</mat-checkbox>
|
||||
|
||||
</mat-card-content>
|
||||
</mat-card-content>
|
||||
<mat-card-actions>
|
||||
<button mat-raised-button color="primary" (click)="onSubmit()">{{'project.create' | translate}}</button>
|
||||
</mat-card-actions>
|
||||
</mat-card>
|
||||
</mat-card>
|
||||
</div>
|
||||
|
||||
@@ -14,6 +14,7 @@ import {AuthService} from "../auth.service";
|
||||
export class CreateProjectComponent implements OnInit {
|
||||
|
||||
project = <Project>{};
|
||||
selectedProject: Project = null;
|
||||
|
||||
constructor(private apiService: ApiService,
|
||||
private messengerService: MessengerService,
|
||||
@@ -33,6 +34,8 @@ export class CreateProjectComponent implements OnInit {
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
this.project.chain = this.selectedProject ? this.selectedProject.id : 0;
|
||||
|
||||
this.apiService.createProject(this.project).subscribe(
|
||||
data => {
|
||||
this.router.navigateByUrl("/project/" + data["id"]);
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
<div class="container">
|
||||
<mat-card class="table-container">
|
||||
<button mat-raised-button style="float: right"
|
||||
[title]="'dashboard.refresh' | translate"
|
||||
(click)="refresh()">
|
||||
<mat-icon>refresh</mat-icon>
|
||||
</button>
|
||||
<mat-card-header>
|
||||
<mat-card-title>{{"logs.title" | translate}}</mat-card-title>
|
||||
<mat-card-subtitle>{{"logs.subtitle" | translate}}</mat-card-subtitle>
|
||||
@@ -18,11 +23,6 @@
|
||||
<mat-button-toggle value="7">{{"logs.trace" | translate}}</mat-button-toggle>
|
||||
</mat-button-toggle-group>
|
||||
|
||||
<button mat-raised-button style="float: right"
|
||||
[title]="'dashboard.refresh' | translate"
|
||||
(click)="refresh()">
|
||||
<mat-icon>refresh</mat-icon>
|
||||
</button>
|
||||
<div class="mat-elevation-z8">
|
||||
|
||||
<mat-table [dataSource]="data" matSort matSortActive="timestamp"
|
||||
|
||||
@@ -7,4 +7,5 @@ export interface Project {
|
||||
git_repo: string;
|
||||
version: string;
|
||||
public: boolean;
|
||||
chain: number;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<div class="container">
|
||||
<mat-card class="mat-elevation-z8">
|
||||
<button mat-raised-button style="float: right"
|
||||
[title]="'dashboard.refresh' | translate"
|
||||
(click)="refresh()"
|
||||
>
|
||||
<mat-icon>refresh</mat-icon>
|
||||
</button>
|
||||
<mat-card-title *ngIf="project">{{"dashboard.title" | translate}} "{{project.name}}"</mat-card-title>
|
||||
<mat-card-content style="padding: 2em 0 1em">
|
||||
|
||||
<button mat-raised-button style="float: right"
|
||||
[title]="'dashboard.refresh' | translate"
|
||||
(click)="refresh()"
|
||||
>
|
||||
<mat-icon>refresh</mat-icon>
|
||||
</button>
|
||||
|
||||
<p *ngIf="project">
|
||||
{{"project.git_repo" | translate}}:
|
||||
@@ -54,6 +54,7 @@
|
||||
|
||||
</mat-card-content>
|
||||
<mat-card-actions>
|
||||
<!--TODO: auth-->
|
||||
<button mat-raised-button color="primary" *ngIf="project"
|
||||
[routerLink]="'/project/' + project.id + '/update'">{{"project.update" | translate}}</button>
|
||||
<button mat-raised-button color="primary" *ngIf="project"
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
<div class="container">
|
||||
<mat-card class="mat-elevation-z8">
|
||||
<button mat-raised-button style="float: right"
|
||||
[title]="'projects.refresh' | translate"
|
||||
(click)="refresh()">
|
||||
<mat-icon>refresh</mat-icon>
|
||||
</button>
|
||||
<mat-card-header>
|
||||
<mat-card-title>{{"projects.projects" | translate}}</mat-card-title>
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<mat-accordion>
|
||||
<mat-expansion-panel *ngFor="let project of projects">
|
||||
<mat-expansion-panel *ngFor="let project of projects" style="margin-top: 1em">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>
|
||||
<mat-icon *ngIf="project.public">public</mat-icon>
|
||||
|
||||
@@ -38,7 +38,7 @@ export class ProjectPermsComponent implements OnInit {
|
||||
|
||||
private getProject() {
|
||||
this.apiService.getProject(this.projectId).subscribe(data => {
|
||||
this.project = data["project"]
|
||||
this.project = data["projectChange"]
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
.mat-form-field {
|
||||
width: 100%;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<mat-form-field appearance="outline" style="margin-top: 1em">
|
||||
<mat-label>{{"project.chain" | translate}}</mat-label>
|
||||
<mat-select [(ngModel)]="project" (selectionChange)="projectChange.emit($event.value)"
|
||||
[placeholder]="'project.chain' | translate"
|
||||
(opened)="loadProjectList()">
|
||||
<mat-select-trigger>{{project?.name}}</mat-select-trigger>
|
||||
<mat-option disabled *ngIf="projectList == undefined">
|
||||
{{"project_select.loading" | translate}}
|
||||
</mat-option>
|
||||
<mat-option [value]="null" *ngIf="projectList">
|
||||
{{"project_select.none" | translate}}
|
||||
</mat-option>
|
||||
<mat-option *ngFor="let p of projectList" [value]="p">
|
||||
<mat-icon *ngIf="p.public">public</mat-icon>
|
||||
<mat-icon *ngIf="!p.public">lock</mat-icon>
|
||||
<span style="width: 3em; display: inline-block">{{p.id}}</span>
|
||||
{{p.name}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
@@ -0,0 +1,28 @@
|
||||
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
||||
import {ApiService} from "../api.service";
|
||||
import {Project} from "../models/project";
|
||||
|
||||
@Component({
|
||||
selector: 'project-select',
|
||||
templateUrl: './project-select.component.html',
|
||||
styleUrls: ['./project-select.component.css']
|
||||
})
|
||||
export class ProjectSelectComponent implements OnInit {
|
||||
|
||||
projectList: Project[];
|
||||
|
||||
@Input() project: Project;
|
||||
@Output() projectChange = new EventEmitter<Project>();
|
||||
|
||||
constructor(private apiService: ApiService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
loadProjectList() {
|
||||
this.apiService.getProjects().subscribe(data => {
|
||||
this.projectList = data["projects"]
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,7 @@
|
||||
enabled
|
||||
</mat-hint>
|
||||
</mat-form-field>
|
||||
<project-select [(project)]="selectedProject"></project-select>
|
||||
</form>
|
||||
</mat-card-content>
|
||||
<mat-card-actions>
|
||||
|
||||
@@ -18,6 +18,7 @@ export class UpdateProjectComponent implements OnInit {
|
||||
}
|
||||
|
||||
project: Project;
|
||||
selectedProject: Project;
|
||||
private projectId: number;
|
||||
|
||||
ngOnInit() {
|
||||
@@ -29,11 +30,13 @@ export class UpdateProjectComponent implements OnInit {
|
||||
|
||||
private getProject() {
|
||||
this.apiService.getProject(this.projectId).subscribe(data => {
|
||||
this.project = data["project"]
|
||||
this.project = data["project"];
|
||||
this.selectedProject = <Project>{id: this.project.chain}
|
||||
})
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
this.project.chain = this.selectedProject ? this.selectedProject.id : 0;
|
||||
this.apiService.updateProject(this.project).subscribe(
|
||||
data => {
|
||||
this.router.navigateByUrl("/project/" + this.project.id);
|
||||
|
||||
@@ -62,7 +62,8 @@
|
||||
"git_repo": "Git repository name",
|
||||
"motd": "Message of the day",
|
||||
"update": "Edit",
|
||||
"perms": "Permissions"
|
||||
"perms": "Permissions",
|
||||
"chain": "Chain tasks to"
|
||||
},
|
||||
"dashboard": {
|
||||
"title": "Dashboard for",
|
||||
@@ -117,5 +118,9 @@
|
||||
"promote": "Promote",
|
||||
"demote": "Demote",
|
||||
"register_time": "Register date"
|
||||
},
|
||||
"project_select": {
|
||||
"list_loading": "Loading project list...",
|
||||
"none": "None"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,8 @@
|
||||
"create": "Créer",
|
||||
"motd": "Message du jour",
|
||||
"update": "Mettre à jour",
|
||||
"perms": "Permissions"
|
||||
"perms": "Permissions",
|
||||
"chain": "Enchainer les tâches vers"
|
||||
},
|
||||
"dashboard": {
|
||||
"title": "Tableau de bord pour ",
|
||||
@@ -119,6 +120,10 @@
|
||||
"promote": "Promouvoir",
|
||||
"demote": "Rétrograder",
|
||||
"register_time": "Date d'inscription"
|
||||
},
|
||||
"project_select": {
|
||||
"list_loading": "Chargement de la liste de projets...",
|
||||
"none": "Aucun"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user