This repository has been archived by the owner on Jan 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 327
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ui: improve docker reference parsing
Closes #2484
- Loading branch information
Showing
18 changed files
with
251 additions
and
72 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:bug | ||
ui: improve docker reference parsing | ||
``` |
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 |
---|---|---|
@@ -1,12 +1,22 @@ | ||
<span data-test-image-ref class="image-ref" title="Image"> | ||
<span class="image-ref__label"> | ||
{{@imageRef.label}} | ||
</span> | ||
<span class="image-ref__tag"> | ||
{{#if (eq @imageRef.label "sha256")}} | ||
{{truncate-commit @imageRef.tag}} | ||
{{else}} | ||
{{@imageRef.tag}} | ||
{{/if}} | ||
<span class="image-ref__uri" data-test-image-ref-uri> | ||
{{this.uri}} | ||
</span> | ||
|
||
{{#if this.hasTag}} | ||
<span class="image-ref__tag badge badge--info" data-test-image-ref-tag> | ||
{{this.presentableTag}} | ||
</span> | ||
{{/if}} | ||
|
||
{{#if this.tagIsDigest}} | ||
<CopyButton | ||
@clipboardText={{@imageRef.tag}} | ||
@success={{perform this.displayCopySuccess}} | ||
class="image-ref__copy-button focus-ring" | ||
title={{t "image-ref.copy-button-title"}} | ||
> | ||
<Pds::Icon @type={{if this.displayCopySuccess.isRunning "copy-success" "copy-action"}} /> | ||
</CopyButton> | ||
{{/if}} | ||
</span> |
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,51 @@ | ||
import Ember from 'ember'; | ||
import Component from '@glimmer/component'; | ||
import { Ref } from 'docker-parse-image'; | ||
import { action } from '@ember/object'; | ||
import { TaskGenerator, task, timeout } from 'ember-concurrency'; | ||
import { taskFor } from 'ember-concurrency-ts'; | ||
|
||
type Args = { | ||
imageRef?: Ref; | ||
}; | ||
|
||
export default class extends Component<Args> { | ||
get uri(): string { | ||
if (!this.args.imageRef) { | ||
return ''; | ||
} | ||
|
||
let { registry, namespace, repository } = this.args.imageRef; | ||
|
||
return [registry, namespace, repository].filter(Boolean).join('/'); | ||
} | ||
|
||
get hasTag(): boolean { | ||
return !!this.args.imageRef?.tag; | ||
} | ||
|
||
get tagIsDigest(): boolean { | ||
return this.args.imageRef?.tag?.includes(':') ?? false; | ||
} | ||
|
||
get presentableTag(): string | undefined { | ||
let tag = this.args.imageRef?.tag; | ||
|
||
if (!tag) { | ||
return; | ||
} | ||
|
||
if (this.tagIsDigest) { | ||
let [alg, digest] = tag.split(':'); | ||
return `${alg}:${digest.substr(0, 7)}`; | ||
} | ||
|
||
return tag; | ||
} | ||
|
||
@task({ restartable: true }) | ||
*displayCopySuccess(): TaskGenerator<void> { | ||
let duration = Ember.testing ? 0 : 2000; | ||
yield timeout(duration); | ||
} | ||
} |
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
41 changes: 26 additions & 15 deletions
41
ui/app/styles/components/navigation/artifact-overview.scss
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,35 +1,46 @@ | ||
.artifact-overview { | ||
padding-bottom: 0.5rem; | ||
|
||
h2 { | ||
border-bottom: 1px solid rgb(var(--border)); | ||
padding-bottom: 0.5rem; | ||
} | ||
|
||
table { | ||
padding: 0.5rem 0; | ||
padding: 0; | ||
font-size: 0.875rem; | ||
line-height: 17px; | ||
|
||
tr { | ||
th { | ||
font-weight: 500; | ||
color: rgb(var(--text-muted)); | ||
width: 158px; | ||
text-align: left; | ||
padding-bottom: 0.25rem; | ||
} | ||
th, | ||
td { | ||
padding-left: 0; | ||
padding-top: scale.$sm--2; | ||
padding-bottom: scale.$sm--2; | ||
vertical-align: top; | ||
} | ||
|
||
.status-indicator { | ||
display: flex; | ||
align-items: flex-end; | ||
padding-bottom: 0.25rem; | ||
} | ||
th { | ||
font-weight: normal; | ||
color: rgb(var(--text-muted)); | ||
padding-right: scale.$lg--10; | ||
text-align: left; | ||
} | ||
|
||
button { | ||
.status-indicator { | ||
display: flex; | ||
align-items: flex-end; | ||
padding-bottom: 0.25rem; | ||
} | ||
|
||
.refresh-health-check-button { | ||
padding: 0 0.25rem; | ||
height: inherit; | ||
display: flex; | ||
align-items: baseline; | ||
} | ||
|
||
.image-ref:first-child { | ||
margin-top: -1px; | ||
} | ||
} | ||
} |
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
Oops, something went wrong.