Skip to content

Commit

Permalink
feat(apps page): add openshift links
Browse files Browse the repository at this point in the history
lets add links to the environments in the openshift console fabric8-ui#454
  • Loading branch information
jstrachan committed Apr 28, 2017
1 parent f8c1dbc commit 5a2fa62
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 7 deletions.
15 changes: 11 additions & 4 deletions src/app/kubernetes/model/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OAuthConfig } from './../store/oauth-config-store';
import {OAuthConfig} from "./../store/oauth-config-store";
import {KubernetesResource} from "./kubernetesresource.model";
import {pathJoin} from "./utils";

Expand All @@ -11,6 +11,7 @@ export var resourceKindToCollectionName = {
"Event": "events",
"Namespace": "spaces",
"Pod": "pods",
"Project": "projects",
"ReplicationController": "replicationcontrollers",
"ReplicaSet": "replicasets",
"Route": "routes",
Expand Down Expand Up @@ -60,10 +61,16 @@ export function openShiftBrowseResourceUrl(resource: KubernetesResource, oauthCo
}
}
}
const namespace = resource.namespace;
const name = resource.name;
if (resource && openShiftConsoleUrl && namespace && name) {
return pathJoin(openShiftConsoleUrl, "/project/", namespace, "/browse", kinds, name);
if (kinds === "spaces" || kinds === "projects") {
if (name) {
return pathJoin(openShiftConsoleUrl, "/project/", name, "/overview");
}
} else {
const namespace = resource.namespace;
if (resource && openShiftConsoleUrl && namespace && name) {
return pathJoin(openShiftConsoleUrl, "/project/", namespace, "/browse", kinds, name);
}
}
}
return "";
Expand Down
7 changes: 7 additions & 0 deletions src/app/kubernetes/model/space.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import * as jsyaml from 'js-yaml';
import {Namespace, Namespaces, isSecretsNamespace, isSystemNamespace} from "./namespace.model";
import {ConfigMap} from "./configmap.model";
import {Entity} from "../../models/entity";
import {openShiftBrowseResourceUrl} from "./helpers";
import {currentOAuthConfig} from "../store/oauth-config-store";


export class SpaceConfig {
Expand Down Expand Up @@ -141,7 +143,12 @@ export class Space {
}

export class Environment {
openShiftConsoleUrl: string;

constructor(public key: string, public name: string, public namespaceName: string, public space: Space, public namespace: Namespace, public config: any, public order: number) {
if (namespace) {
this.openShiftConsoleUrl = openShiftBrowseResourceUrl(namespace, currentOAuthConfig());
}
}
}

Expand Down
13 changes: 10 additions & 3 deletions src/app/kubernetes/ui/app/list/list.app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@
<div class="col-md-2" *ngFor="let env of space.environments">
<div class="text-center">
<div class="header">
{{env.name}}
<span *ngIf="env.openShiftConsoleUrl">
<a [href]="env.openShiftConsoleUrl" title="View this environment in the OpenShift console" target="openshift">
{{env.name}}
</a>
</span>
<span *ngIf="!env.openShiftConsoleUrl">
{{env.name}}
</span>
</div>
</div>
</div>
Expand All @@ -31,7 +38,7 @@
</div>
</div>
<div *ngFor="let envInfo of app.environmentDetails" class="col-md-2">
<div class="card-pf card-pf-accented card-pf-aggregate-status">
<div class="card-pf card-pf-accented card-pf-aggregate-status" *ngIf="envInfo.deployment">
<h2 class="card-pf-title">
<span title="version of the application running in this environment">
<span class="card-pf-aggregate-status-count">
Expand All @@ -46,7 +53,7 @@ <h2 class="card-pf-title">
</span>
</span>

<span *ngIf="envInfo.deployment" class='pull-right dropdown-kebab-pf' dropdown>
<span class='pull-right dropdown-kebab-pf' dropdown>
<button class='btn btn-link kebab' type='button'
aria-haspopup='true' aria-expanded='true' dropdownToggle>
<span class='fa fa-ellipsis-v'></span>
Expand Down
4 changes: 4 additions & 0 deletions src/app/kubernetes/ui/app/list/list.app.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
font-weight: bolder;
}

.header a {
color: #363636;
}

.app-name {
font-size: 108%;
font-weight: bold;
Expand Down

0 comments on commit 5a2fa62

Please sign in to comment.