Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Commit

Permalink
ui: readded app card components to lessen line changes in pr
Browse files Browse the repository at this point in the history
  • Loading branch information
Sabrina Ko committed Oct 29, 2021
1 parent 7c652c0 commit e0a59a0
Show file tree
Hide file tree
Showing 10 changed files with 503 additions and 1 deletion.
39 changes: 39 additions & 0 deletions ui/app/components/app-card.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{{!
## Usage
<AppCard class="my-custom-class">
<:meta-primary>
v5
</:meta-primary>
<:meta-secondary>
Starting…
</:meta-secondary>
<:actions>
<a href="...">Visit</a>
</:actions>
</AppCard>
}}

<div
data-test-app-card
class="app-card"
...attributes
>

<div class="app-card__meta">

<div class="app-card__meta__primary">
{{yield to="meta-primary"}}
</div>

<div class="app-card__meta__secondary">
{{yield to="meta-secondary"}}
</div>

</div>

<div class="app-card__actions">
{{yield to="actions"}}
</div>

</div>
34 changes: 34 additions & 0 deletions ui/app/components/app-card/build.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<AppCard
data-test-app-card-build={{@model.sequence}}
>
<:meta-primary>
<LinkTo
@route="workspace.projects.project.app.build"
@models={{array @model.sequence}}
class="app-card__sequence-link"
>
<b class="badge badge--version">v{{@model.sequence}}</b>
</LinkTo>
<OperationStatusIndicator @status={{or @model.pushedArtifact.status @model.status}} />
<GitCommit @commit={{@model.preload.jobDataSourceRef.git.commit}}/>
</:meta-primary>

<:meta-secondary>
{{#let (or @model.pushedArtifact @model) as |operation|}}
<Pds::Icon
@type={{icon-for-component operation.component.name}}
class="icon app-card__component-icon"
/>
<span>
{{t
(concat
"build_status"
".type-" operation.component.type
".state-" operation.status.state
)
}}
<b>{{component-name operation.component.name}}</b>
</span>
{{/let}}
</:meta-secondary>
</AppCard>
20 changes: 20 additions & 0 deletions ui/app/components/app-card/builds.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Card @classNames={{unless @builds.length 'empty-state'}}>
{{#if @builds.length}}
<Card::Header>
<h4>
<Pds::Icon @type="build" class="icon" />
<span>Latest build</span>
</h4>
<LinkTo @route="workspace.projects.project.app.builds">
View all builds
</LinkTo>
</Card::Header>

<AppCard::Build @model={{@builds.[0]}} />
{{else}}
<p>
<Pds::Icon @type="build" class="icon" />
<span>There are no builds to display yet</span>
</p>
{{/if}}
</Card>
35 changes: 35 additions & 0 deletions ui/app/components/app-card/deployment.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<AppCard
data-test-app-card-deployment={{@model.sequence}}
>
<:meta-primary>
<LinkTo
@route="workspace.projects.project.app.deployment"
@models={{array @model.sequence}}
class="app-card__sequence-link"
>
<b class="badge badge--version">v{{@model.sequence}}</b>
</LinkTo>
<OperationStatusIndicator @status={{@model.status}} />
<GitCommit @commit={{@model.preload.jobDataSourceRef.git.commit}}/>
</:meta-primary>

<:meta-secondary>
<Pds::Icon
@type={{icon-for-component @model.component.name}}
class="icon app-card__component-icon"
/>
<StatusReportIndicator @statusReport={{@model.statusReport}} />
</:meta-secondary>

<:actions>
{{#if @model.preload.deployUrl}}
<ExternalLink
href={{enforce-protocol @model.preload.deployUrl}}
title="Visit {{enforce-protocol @model.preload.deployUrl}}"
class="button button--secondary button--external-link app-card__launch-link"
>
<Pds::Icon @type="exit" class="icon" />
</ExternalLink>
{{/if}}
</:actions>
</AppCard>
23 changes: 23 additions & 0 deletions ui/app/components/app-card/deployments.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Card
data-test-latest-deployments
class={{unless @deployments.length 'empty-state'}}
>
{{#if @deployments.length}}
<Card::Header>
<h4>
<Pds::Icon @type="upload" class="icon" />
<span>Latest deployment</span>
</h4>
<LinkTo @route="workspace.projects.project.app.deployments">
View all deployments
</LinkTo>
</Card::Header>

<AppCard::Deployment @model={{@deployments.[0] }} />
{{else}}
<p>
<Pds::Icon @type="upload" class="icon" />
<span>There are no deployments to display yet</span>
</p>
{{/if}}
</Card>
35 changes: 35 additions & 0 deletions ui/app/components/app-card/release.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<AppCard
data-test-app-card-release={{@model.sequence}}
>
<:meta-primary>
<LinkTo
@route="workspace.projects.project.app.release"
@models={{array @model.sequence}}
class="app-card__sequence-link"
>
<b class="badge badge--version">v{{@model.sequence}}</b>
</LinkTo>
<OperationStatusIndicator @status={{@model.status}} />
<GitCommit @commit={{@model.preload.jobDataSourceRef.git.commit}}/>
</:meta-primary>

<:meta-secondary>
<Pds::Icon
@type={{icon-for-component @model.component.name}}
class="icon app-card__component-icon"
/>
<StatusReportIndicator @statusReport={{@model.statusReport}} />
</:meta-secondary>

<:actions>
{{#if @model.url}}
<ExternalLink
href={{enforce-protocol @model.url}}
title="Visit {{enforce-protocol @model.url}}"
class="button button--primary app-card__launch-link"
>
<Pds::Icon @type="exit" class="icon" />
</ExternalLink>
{{/if}}
</:actions>
</AppCard>
23 changes: 23 additions & 0 deletions ui/app/components/app-card/releases.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Card
data-test-latest-releases
@classNames={{unless @releases.length 'empty-state'}}
>
{{#if @releases.length}}
<Card::Header>
<h4>
<Pds::Icon @type="public-default" class="icon" />
<span>Latest release</span>
</h4>
<LinkTo @route="workspace.projects.project.app.releases">
View all releases
</LinkTo>
</Card::Header>

<AppCard::Release @model={{@releases.[0] }} />
{{else}}
<p>
<Pds::Icon @type="public-default" class="icon" />
<span>There are no releases to display yet</span>
</p>
{{/if}}
</Card>
2 changes: 1 addition & 1 deletion ui/app/components/status-report-meta-table/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<div class="artifact-overview">
<table>
<tbody>
{{#if (or has-block vars.shouldRenderCommit vars.shouldRenderHealthAndTag)}}
{{#if (or (or (has-block) vars.shouldRenderCommit) vars.shouldRenderHealthAndTag)}}
{{yield}}
{{else}}
{{t "page.deployment.overview.unavailable"}}
Expand Down
Loading

0 comments on commit e0a59a0

Please sign in to comment.