mirror of
https://github.com/sartography/cr-connect-bpmn.git
synced 2025-02-22 05:08:32 +00:00
Git repo dialog component
This commit is contained in:
parent
ce022dfce5
commit
cbbccc77d2
12
src/app/git-repo-dialog/git-repo-dialog.component.html
Normal file
12
src/app/git-repo-dialog/git-repo-dialog.component.html
Normal file
@ -0,0 +1,12 @@
|
||||
<div mat-dialog-title>
|
||||
<h1>Git Repo</h1>
|
||||
</div>
|
||||
|
||||
<form [formGroup]="form">
|
||||
<formly-form [model]="model" [fields]="fields" [options]="options" [form]="form"></formly-form>
|
||||
</form>
|
||||
|
||||
<div mat-dialog-actions>
|
||||
<button [disabled]="form.invalid" (click)="onSubmit()" color="primary" mat-flat-button>Save</button>
|
||||
<button (click)="onNoClick()" mat-flat-button>Cancel</button>
|
||||
</div>
|
25
src/app/git-repo-dialog/git-repo-dialog.component.spec.ts
Normal file
25
src/app/git-repo-dialog/git-repo-dialog.component.spec.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { GitRepoDialogComponent } from './git-repo-dialog.component';
|
||||
|
||||
describe('GitRepoDialogComponent', () => {
|
||||
let component: GitRepoDialogComponent;
|
||||
let fixture: ComponentFixture<GitRepoDialogComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ GitRepoDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(GitRepoDialogComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
60
src/app/git-repo-dialog/git-repo-dialog.component.ts
Normal file
60
src/app/git-repo-dialog/git-repo-dialog.component.ts
Normal file
@ -0,0 +1,60 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import {FormGroup} from "@angular/forms";
|
||||
import {FormlyFieldConfig, FormlyFormOptions} from "@ngx-formly/core";
|
||||
import {MatDialogRef} from "@angular/material/dialog";
|
||||
import {ApiService} from 'sartography-workflow-lib';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-git-repo-dialog',
|
||||
templateUrl: './git-repo-dialog.component.html',
|
||||
styleUrls: ['./git-repo-dialog.component.scss']
|
||||
})
|
||||
export class GitRepoDialogComponent {
|
||||
form: FormGroup = new FormGroup({});
|
||||
model: any = {};
|
||||
options: FormlyFormOptions = {};
|
||||
fields: FormlyFieldConfig[] = [];
|
||||
|
||||
constructor(
|
||||
private api: ApiService,
|
||||
public dialogRef: MatDialogRef<GitRepoDialogComponent>,
|
||||
) {
|
||||
|
||||
this.api.gitRepo().subscribe(data => {
|
||||
let mockChanges = ['file1', 'file2']
|
||||
|
||||
this.fields = [
|
||||
{
|
||||
key: 'changed',
|
||||
type: 'select',
|
||||
templateOptions: {
|
||||
multiple: true,
|
||||
label: 'These are the changed files',
|
||||
rows: 5,
|
||||
options: this.listify(mockChanges),
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
listify(list: string[]) {
|
||||
let dict = []
|
||||
for (let item in list) {
|
||||
dict.push({label: list[item], value: item});
|
||||
}
|
||||
return dict;
|
||||
}
|
||||
|
||||
onNoClick() {
|
||||
console.log('form model : ', this.model);
|
||||
this.dialogRef.close();
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
// I think all we actually will return here is the comment
|
||||
this.dialogRef.close(this.model);
|
||||
}
|
||||
|
||||
}
|
@ -30,6 +30,7 @@ import { environment } from '../../environments/environment.runtime';
|
||||
import { FormControl } from '@angular/forms';
|
||||
import { SettingsService } from '../settings.service';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import {GitRepoDialogComponent} from "../git-repo-dialog/git-repo-dialog.component";
|
||||
|
||||
|
||||
export interface WorkflowSpecCategoryGroup {
|
||||
@ -375,10 +376,23 @@ export class WorkflowSpecListComponent implements OnInit {
|
||||
// get the state of the repo
|
||||
this.api.gitRepo().subscribe(data =>{
|
||||
|
||||
});
|
||||
const dialogRef = this.dialog.open(GitRepoDialogComponent, {
|
||||
height: '65vh',
|
||||
width: '50vw',
|
||||
});
|
||||
// display to user the changed files
|
||||
let comment = '';
|
||||
let branch = 'dan'; // I think this can be set from the gitrepo call above
|
||||
|
||||
/**
|
||||
// if they accept, call gitPush and gitMerge (i think)
|
||||
this.api.gitRepoPush(comment).subscribe(data => {
|
||||
this.api.gitRepoMerge(branch).subscribe(merge => {
|
||||
|
||||
});
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
gitPull() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user