Skip to content

Commit

Permalink
Make package lists of origin/name/version work
Browse files Browse the repository at this point in the history
* Set the `depotUrl` in habitat.conf.js to "http://52.37.151.35:9632"
* Go to http://localhost:3000/#/pkgs/chef/discourse
* A list of discourse packages in the chef origin should show up
* Clicking on the breadcrumbs should work as expected
  • Loading branch information
Nathan L Smith committed Mar 31, 2016
1 parent 65133b0 commit 2186ffa
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 36 deletions.
10 changes: 10 additions & 0 deletions web/app/AppComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ import {removeNotification, routeChange} from "./actions/index";
name: "PackagesForOrigin",
component: PackagesPageComponent
},
{
path: "/pkgs/:origin/:name",
name: "PackagesForOriginAndName",
component: PackagesPageComponent,
},
{
path: "/pkgs/:origin/:name/:version",
name: "PackagesForOriginAndNameAndVersion",
component: PackagesPageComponent,
},
{
path: "/pkgs/:origin/:name/:version/:release",
name: "Package",
Expand Down
49 changes: 49 additions & 0 deletions web/app/PackageBreadcrumbsComponent.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import {Component} from "angular2/core";
import {RouterLink} from "angular2/router";

@Component({
directives: [RouterLink],
inputs: ["ident", "params"],
selector: "package-breadcrumbs",
template: `
<span class="hab-package-breadcrumbs">
<span *ngIf="showAll">All Packages</span>
<span *ngIf="params.filter === 'mine'">My Packages</span>
<a *ngIf="!ident.origin && !params.filter && !showAll" [routerLink]="['Packages']">*</a>
<a [routerLink]="['PackagesForOrigin',
{ origin: ident.origin }]">
{{ident.origin}}
</a>
<span *ngIf="ident.name">/</span>
<a [routerLink]="['PackagesForOriginAndName',
{ origin: ident.origin,
name: ident.name }]">
{{ident.name}}
</a>
<span *ngIf="ident.version">/</span>
<a [routerLink]="['PackagesForOriginAndNameAndVersion',
{ origin: ident.origin, name: ident.name,
version: ident.version }]">
{{ident.version}}
</a>
<span *ngIf="ident.release">/</span>
<a [routerLink]="['Package',
{ origin: ident.origin, name: ident.name,
version: ident.version, release: ident.release }]">
{{ident.release}}
</a>
</span>`
})

export class PackageBreadcrumbsComponent {
private ident;
private params;

constructor() {
this.params = this.params || {};
}

get showAll() {
return Object.keys(this.ident).length === 0;
}
}
14 changes: 4 additions & 10 deletions web/app/package-page/PackagePageComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
import {AppStore} from "../AppStore";
import {Component, OnInit} from "angular2/core";
import {Package} from "../records/Package";
import {PackageBreadcrumbsComponent} from "../PackageBreadcrumbsComponent";
import {PackageListComponent} from "./PackageListComponent";
import {RouteParams, RouterLink} from "angular2/router";
import {isPackage, packageString} from "../util";
import {fetchPackage} from "../actions/index";

@Component({
directives: [PackageListComponent, RouterLink],
directives: [PackageBreadcrumbsComponent, PackageListComponent, RouterLink],
template: `
<div>
<div *ngIf="!package" class="hab-package">
Expand All @@ -23,15 +24,8 @@ import {fetchPackage} from "../actions/index";
</div>
<div *ngIf="package" class="hab-package">
<h2>
<a [routerLink]="['PackagesForOrigin', { origin: package.ident.origin }]">
{{package.ident.origin}}
</a>
/
{{package.ident.name}}
/
{{package.ident.version}}
/
{{package.ident.release}}
<package-breadcrumbs [ident]="package.ident">
</package-breadcrumbs>
</h2>
<div class="hab-package-info">
<dl>
Expand Down
32 changes: 6 additions & 26 deletions web/app/packages-page/PackagesPageComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,20 @@
// 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 {AppStore} from "../AppStore";
import {Component, OnInit} from "angular2/core";
import {RouteParams, RouterLink} from "angular2/router";
import {AppStore} from "../AppStore";
import {PackageBreadcrumbsComponent} from "../PackageBreadcrumbsComponent";
import {filterPackagesBy, requestRoute} from "../actions/index";

@Component({
directives: [RouterLink],
directives: [PackageBreadcrumbsComponent, RouterLink],
template: `
<div class="hab-packages">
<h2>
<span *ngIf="filter === 'mine'">My Packages</span>
<span *ngIf="showAll">All Packages</span>
<span *ngIf="origin">{{origin}}</span>
<span *ngIf="name">
<a [routerLink]="['Packages']">*</a>
/
{{name}}
</span>
<package-breadcrumbs [ident]="routeParams.params"
[params]="routeParams.params">
</package-breadcrumbs>
</h2>
<hr>
<ul class="hab-packages-plan-list">
Expand Down Expand Up @@ -51,26 +47,10 @@ import {filterPackagesBy, requestRoute} from "../actions/index";
export class PackagesPageComponent implements OnInit {
constructor(private store: AppStore, private routeParams: RouteParams) { }

get origin() {
return this.routeParams.params["origin"];
}

get filter() {
return this.routeParams.params["filter"];
}

get name() {
return this.routeParams.params["name"];
}

get packages() {
return this.store.getState().packages.visible;
}

get showAll() {
return Object.keys(this.routeParams.params).length === 0;
}

ngOnInit() {
if (!this.store.getState().user.isSignedIn) {
this.store.dispatch(requestRoute(["Home"]));
Expand Down

1 comment on commit 2186ffa

@chef-delivery
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delivery Status:

Verify Build Acceptance
<a href='https://delivery.chef.co/e/chef/#/organizations/bldr/projects/bldr/changes/35fe74df-1403-4282-a368-71a35f9b8f7f/status/verify', target='_blank'><img src='https://img.shields.io/badge/Unit-Passed-brightgreen.svg', alt='Unit'> <a href='https://delivery.chef.co/e/chef/#/organizations/bldr/projects/bldr/changes/35fe74df-1403-4282-a368-71a35f9b8f7f/status/build', target='_blank'><img src='https://img.shields.io/badge/Unit-Passed-brightgreen.svg', alt='Unit'> <a href='https://delivery.chef.co/e/chef/#/organizations/bldr/projects/bldr/changes/35fe74df-1403-4282-a368-71a35f9b8f7f/status/acceptance', target='_blank'><img src='https://img.shields.io/badge/Provision-Passed-brightgreen.svg', alt='Provision'>
<a href='https://delivery.chef.co/e/chef/#/organizations/bldr/projects/bldr/changes/35fe74df-1403-4282-a368-71a35f9b8f7f/status/verify', target='_blank'><img src='https://img.shields.io/badge/Lint-Passed-brightgreen.svg', alt='Lint'> <a href='https://delivery.chef.co/e/chef/#/organizations/bldr/projects/bldr/changes/35fe74df-1403-4282-a368-71a35f9b8f7f/status/build', target='_blank'><img src='https://img.shields.io/badge/Lint-Passed-brightgreen.svg', alt='Lint'> <a href='https://delivery.chef.co/e/chef/#/organizations/bldr/projects/bldr/changes/35fe74df-1403-4282-a368-71a35f9b8f7f/status/acceptance', target='_blank'><img src='https://img.shields.io/badge/Deploy-Skipped-lightgrey.svg', alt='Deploy'>
<a href='https://delivery.chef.co/e/chef/#/organizations/bldr/projects/bldr/changes/35fe74df-1403-4282-a368-71a35f9b8f7f/status/verify', target='_blank'><img src='https://img.shields.io/badge/Syntax-Skipped-lightgrey.svg', alt='Syntax'> <a href='https://delivery.chef.co/e/chef/#/organizations/bldr/projects/bldr/changes/35fe74df-1403-4282-a368-71a35f9b8f7f/status/build', target='_blank'><img src='https://img.shields.io/badge/Syntax-Skipped-lightgrey.svg', alt='Syntax'> <a href='https://delivery.chef.co/e/chef/#/organizations/bldr/projects/bldr/changes/35fe74df-1403-4282-a368-71a35f9b8f7f/status/acceptance', target='_blank'><img src='https://img.shields.io/badge/Smoke-Skipped-lightgrey.svg', alt='Smoke'>
<a href='https://delivery.chef.co/e/chef/#/organizations/bldr/projects/bldr/changes/35fe74df-1403-4282-a368-71a35f9b8f7f/status/build', target='_blank'><img src='https://img.shields.io/badge/Quality-Skipped-lightgrey.svg', alt='Quality'> <a href='https://delivery.chef.co/e/chef/#/organizations/bldr/projects/bldr/changes/35fe74df-1403-4282-a368-71a35f9b8f7f/status/acceptance', target='_blank'><img src='https://img.shields.io/badge/Functional-Passed-brightgreen.svg', alt='Functional'>
<a href='https://delivery.chef.co/e/chef/#/organizations/bldr/projects/bldr/changes/35fe74df-1403-4282-a368-71a35f9b8f7f/status/build', target='_blank'><img src='https://img.shields.io/badge/Security-Skipped-lightgrey.svg', alt='Security'>
<a href='https://delivery.chef.co/e/chef/#/organizations/bldr/projects/bldr/changes/35fe74df-1403-4282-a368-71a35f9b8f7f/status/build', target='_blank'><img src='https://img.shields.io/badge/Publish-Skipped-lightgrey.svg', alt='Publish'>

Please sign in to comment.