-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #224 from chef/nls/create-proj
Merged change d3cb427d-d43a-45b0-8627-b381aaa59ebf From review branch nls/create-proj into master Signed-off-by: adam <[email protected]>
- Loading branch information
Showing
10 changed files
with
154 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright:: Copyright (c) 2016 Chef Software, Inc. | ||
// | ||
// The terms of the Evaluation Agreement (Bldr) between Chef Software Inc. and the party accessing | ||
// this file ("Licensee") apply to Licensee's use of the Software until such time that the Software | ||
// is made available under an open source license such as the Apache 2.0 License. | ||
|
||
import {addProject} from "../actions"; | ||
import {AppStore} from "../AppStore"; | ||
import {Component, OnInit} from "angular2/core"; | ||
import {ControlGroup, FormBuilder, Validators} from "angular2/common"; | ||
|
||
@Component({ | ||
template: ` | ||
<div class="bldr-project-create"> | ||
<h2>Add Project</h2> | ||
<p> | ||
All projects require a derivation (your username or organization | ||
name) and a path to the plan in the source code repository. | ||
</p> | ||
<form [ngFormModel]="form" (ngSubmit)="addProject(form.value)" #formValues="ngForm"> | ||
<div class="scm-repo-fields"> | ||
<label>GitHub Repository</label> | ||
smith / example | ||
<a href="#">(change)</a> | ||
</div> | ||
<div class="project-fields"> | ||
<div class="deriv"> | ||
<label for="derivation">Project Derivation</label> | ||
<input ngControl="derivation" disabled id="derivation" name="derivation"> | ||
</div> | ||
<div class="name"> | ||
<label for="name">Project Name</label> | ||
<input ngControl="name" id="name" name="name" placeholder="Required. Max 40 characters." required> | ||
</div> | ||
<div class="plan"> | ||
<label for="plan">Path to Plan file</label> | ||
<p>The location in the repository of the plan.sh that will build this project.</p> | ||
<input ngControl="plan" id="plan" name="plan" required> | ||
</div> | ||
<div class="submit"> | ||
<button type="submit">Save Project</button> | ||
</div> | ||
</div> | ||
</form> | ||
</div>` | ||
}) | ||
|
||
export class ProjectCreatePageComponent { | ||
private form: ControlGroup; | ||
|
||
constructor(private formBuilder: FormBuilder, private store: AppStore) { | ||
this.form = formBuilder.group({ | ||
derivation: ["smith", Validators.required], | ||
name: ["", Validators.required], | ||
plan: ["/plan.sh", Validators.required], | ||
}); | ||
|
||
} | ||
|
||
private addProject(values) { | ||
this.store.dispatch(addProject(values)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
.bldr-project-create { | ||
form { | ||
@include outer-container; | ||
} | ||
|
||
.scm-repo-fields { | ||
@include span-columns(3); | ||
} | ||
|
||
.project-fields { | ||
@include span-columns(9); | ||
@include outer-container; | ||
|
||
.deriv, .name { | ||
@include span-columns(6); | ||
} | ||
|
||
.plan, .submit { | ||
@include span-columns(12); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.bldr-projects { | ||
a.create { | ||
display: block; | ||
float: right; | ||
margin-top: -2.5em; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,33 @@ | ||
import {expect} from "./helper"; | ||
|
||
describe("Projects list", () => { | ||
beforeEach(() => { | ||
browser.get("#/projects"); | ||
describe("Projects", () => { | ||
describe("Projects list", () => { | ||
beforeEach(() => { | ||
browser.get("#/projects"); | ||
}); | ||
|
||
it("has links", () => { | ||
expect(element.all(by.css(".bldr-projects ul a")).count()).to.eventually. | ||
be.greaterThan(0); | ||
}); | ||
|
||
it("has a create link", () => { | ||
expect(element.all(by.css(".bldr-projects a.create")).count()).to.eventually. | ||
equal(1); | ||
}); | ||
}); | ||
|
||
it("has links", () => { | ||
expect(element.all(by.css(".bldr-projects ul a")).count()).to.eventually. | ||
be.greaterThan(0); | ||
describe("Create a project", () => { | ||
beforeEach(() => { | ||
browser.get("#/projects"); | ||
element(by.css(".bldr-projects a.create")).click(); | ||
element(by.css("input[name=name]")).sendKeys("testname"); | ||
element(by.css(".bldr-project-create form")).submit(); | ||
}); | ||
|
||
it("creates a list entry for the new Project", () => { | ||
expect(element(by.css(".bldr-projects ul a")).getText()).to.eventually. | ||
equal("smith / testname"); | ||
}); | ||
}); | ||
}); |