More work on UI

This commit is contained in:
simon987
2019-01-23 19:38:33 -05:00
parent cbd32daf02
commit 1d656099f5
31 changed files with 288 additions and 131 deletions

View File

@@ -0,0 +1,4 @@
.mat-form-field {
width: 100%;
}

View File

@@ -0,0 +1,29 @@
<mat-card>
<mat-card-title>Update project</mat-card-title>
<mat-card-subtitle>Changes are saved in real time</mat-card-subtitle>
<mat-card-content>
<form>
<mat-form-field>
<input type="text" matInput [(ngModel)]="project.name" name="name" placeholder="Name">
</mat-form-field>
<mat-form-field>
<textarea matInput placeholder="Message of the day"></textarea>
</mat-form-field>
<mat-form-field>
<input type="text" matInput [(ngModel)]="project.clone_url" name="clone_url"
placeholder="Git clone url">
</mat-form-field>
<mat-form-field>
<input type="text" matInput [(ngModel)]="project.git_repo" name="clone_url"
placeholder='Full repository name (e.g. "simon987/task_tracker")'>
<mat-hint align="start">Changes on the <strong>master</strong> branch will be tracked if webhooks are
enabled
</mat-hint>
</mat-form-field>
<input type="hidden" name="version" value="{{project.version}}">
</form>
</mat-card-content>
</mat-card>

View File

@@ -0,0 +1,40 @@
import {Component, OnInit} from '@angular/core';
import {Project} from "../models/project";
import {ApiService} from "../api.service";
import {ActivatedRoute} from "@angular/router";
@Component({
selector: 'app-update-project',
templateUrl: './update-project.component.html',
styleUrls: ['./update-project.component.css']
})
export class UpdateProjectComponent implements OnInit {
constructor(private apiService: ApiService, private route: ActivatedRoute) {
}
private project: Project;
private projectId: number;
ngOnInit() {
this.route.params.subscribe(params => {
this.projectId = params["id"];
this.getProject();
})
}
private getProject() {
this.apiService.getProject(this.projectId).subscribe(data => {
this.project = <Project>{
name: data["project"]["name"],
clone_url: data["project"]["clone_url"],
git_repo: data["project"]["git_repo"],
motd: data["project"]["motd"],
priority: data["project"]["priority"],
version: data["project"]["version"]
}
})
}
}