Skip to content

Commit

Permalink
Add new client Podman to the pull command
Browse files Browse the repository at this point in the history
1.Fixes #18832

Signed-off-by: AllForNothing <sshijun@vmware.com>
  • Loading branch information
AllForNothing authored and AllForNothing committed Jun 27, 2023
1 parent 1d6c02f commit 8f58559
Show file tree
Hide file tree
Showing 19 changed files with 439 additions and 148 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@
</clr-dropdown>
</div>
<div class="right-pos">
<app-pull-command
[registryUrl]="registryUrl"
[projectName]="projectName"
[repoName]="repoName"
[selectedRow]="selectedRow"
class="mr-1"></app-pull-command>
<app-artifact-filter
[withDivider]="true"
(filterEvent)="filterEvent($event)"
Expand All @@ -142,11 +148,6 @@
{{ 'REPOSITORY.ARTIFACTS_COUNT' | translate }}
</ng-template>
</clr-dg-column>
<clr-dg-column class="pull-command-column">
<ng-template [clrDgHideableColumn]="{ hidden: hiddenArray[1] }">
{{ 'REPOSITORY.PULL_COMMAND' | translate }}
</ng-template>
</clr-dg-column>
<clr-dg-column *ngIf="depth">
<ng-template [clrDgHideableColumn]="{ hidden: hiddenArray[2] }">
{{ 'REPOSITORY.PLATFORM' | translate }}
Expand Down Expand Up @@ -244,15 +245,6 @@
</clr-tooltip>
</div>
</clr-dg-cell>
<clr-dg-cell>
<hbr-copy-input
[title]="getPullCommand(artifact)"
*ngIf="getPullCommand(artifact)"
[iconMode]="true"
[defaultValue]="
getPullCommand(artifact)
"></hbr-copy-input>
</clr-dg-cell>
<clr-dg-cell *ngIf="depth">
<div class="cell">
{{ artifact.platform?.os }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ import {
ArtifactFilterEvent,
ArtifactFront as Artifact,
ArtifactFront,
ArtifactType,
getPullCommandByDigest,
getPullCommandByTag,
} from '../../../artifact';
import { Project } from '../../../../../project';
import { ArtifactService as NewArtifactService } from '../../../../../../../../../ng-swagger-gen/services/artifact.service';
Expand Down Expand Up @@ -458,32 +455,6 @@ export class ArtifactListTabComponent implements OnInit, OnDestroy {
this.clrLoad(st);
}

getPullCommand(artifact: Artifact): string {
let pullCommand: string = '';
if (
artifact.type === ArtifactType.CHART &&
artifact.tags &&
artifact.tags[0]
) {
pullCommand = getPullCommandByTag(
artifact.type,
`${this.registryUrl ? this.registryUrl : location.hostname}/${
this.projectName
}/${this.repoName}`,
artifact.tags[0]?.name
);
} else {
pullCommand = getPullCommandByDigest(
artifact.type,
`${this.registryUrl ? this.registryUrl : location.hostname}/${
this.projectName
}/${this.repoName}`,
artifact.digest
);
}
return pullCommand;
}

canAddLabel(): boolean {
if (this.selectedRow && this.selectedRow.length === 1) {
return true;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
<clr-dropdown [clrCloseMenuOnItemClick]="false" class="mr-1" *ngIf="!isTagMode">
<button
[disabled]="
selectedRow?.length !== 1 || !hasPullCommand(selectedRow[0])
"
class="btn btn-link copy-pull-command"
clrDropdownTrigger>
{{ 'PUSH_IMAGE.COPY_PULL_COMMAND' | translate }}
<cds-icon shape="angle" direction="down"></cds-icon>
</button>
<clr-dropdown-menu clrPosition="bottom-right" *clrIfOpen>
<ng-container *ngIf="isImage(selectedRow[0])">
<div
class="flex"
aria-label="Dropdown header Action"
clrDropdownItem>
<hbr-copy-input
[title]="getPullCommandForDocker(selectedRow[0])"
[iconMode]="true"
[defaultValue]="
getPullCommandForDocker(selectedRow[0])
"></hbr-copy-input>
<span>{{ 'PUSH_IMAGE.DOCKER' | translate }}</span>
</div>
<div
class="flex"
aria-label="Dropdown header Action"
clrDropdownItem>
<hbr-copy-input
[title]="getPullCommandForPadMan(selectedRow[0])"
[iconMode]="true"
[defaultValue]="
getPullCommandForPadMan(selectedRow[0])
"></hbr-copy-input>
<span>{{ 'PUSH_IMAGE.PODMAN' | translate }}</span>
</div>
</ng-container>
<div
*ngIf="isCNAB(selectedRow[0])"
class="flex"
aria-label="Dropdown header Action"
clrDropdownItem>
<hbr-copy-input
[title]="getPullCommandForCNAB(selectedRow[0])"
[iconMode]="true"
[defaultValue]="
getPullCommandForCNAB(selectedRow[0])
"></hbr-copy-input>
<span>{{ 'PUSH_IMAGE.CNAB' | translate }}</span>
</div>
<div
*ngIf="isChart(selectedRow[0])"
class="flex"
aria-label="Dropdown header Action"
clrDropdownItem>
<hbr-copy-input
[title]="getPullCommandForChart(selectedRow[0])"
[iconMode]="true"
[defaultValue]="
getPullCommandForChart(selectedRow[0])
"></hbr-copy-input>
<span>{{ 'PUSH_IMAGE.HELM' | translate }}</span>
</div>
</clr-dropdown-menu>
</clr-dropdown>

<clr-dropdown [clrCloseMenuOnItemClick]="false" class="mr-1" *ngIf="isTagMode">
<button
[disabled]="
selectedTags?.length !== 1 || !hasPullCommandForTag(artifact)
"
class="btn btn-link copy-pull-command"
clrDropdownTrigger>
{{ 'PUSH_IMAGE.COPY_PULL_COMMAND' | translate }}
<cds-icon shape="angle" direction="down"></cds-icon>
</button>
<clr-dropdown-menu clrPosition="bottom-right" *clrIfOpen>
<ng-container *ngIf="isImage(artifact)">
<div
class="flex"
aria-label="Dropdown header Action"
clrDropdownItem>
<hbr-copy-input
[title]="getPullCommandForDockerByTag(artifact)"
[iconMode]="true"
[defaultValue]="
getPullCommandForDockerByTag(artifact)
"></hbr-copy-input>
<span>{{ 'PUSH_IMAGE.DOCKER' | translate }}</span>
</div>
<div
class="flex"
aria-label="Dropdown header Action"
clrDropdownItem>
<hbr-copy-input
[title]="getPullCommandForPadManByTag(artifact)"
[iconMode]="true"
[defaultValue]="
getPullCommandForPadManByTag(artifact)
"></hbr-copy-input>
<span>{{ 'PUSH_IMAGE.PODMAN' | translate }}</span>
</div>
</ng-container>
<div
*ngIf="isCNAB(artifact)"
class="flex"
aria-label="Dropdown header Action"
clrDropdownItem>
<hbr-copy-input
[title]="getPullCommandForCNABByTag(artifact)"
[iconMode]="true"
[defaultValue]="
getPullCommandForCNABByTag(artifact)
"></hbr-copy-input>
<span>{{ 'PUSH_IMAGE.CNAB' | translate }}</span>
</div>
<div
*ngIf="isChart(artifact)"
class="flex"
aria-label="Dropdown header Action"
clrDropdownItem>
<hbr-copy-input
[title]="getPullCommandForChartByTag(artifact)"
[iconMode]="true"
[defaultValue]="
getPullCommandForChartByTag(artifact)
"></hbr-copy-input>
<span>{{ 'PUSH_IMAGE.HELM' | translate }}</span>
</div>
</clr-dropdown-menu>
</clr-dropdown>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.copy-pull-command {
font-size: 14px;
}

.flex {
display: flex;
align-items: flex-end;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { PullCommandComponent } from './pull-command.component';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { SharedTestingModule } from '../../../../../../../../shared/shared.module';

describe('PullCommandComponent', () => {
let component: PullCommandComponent;
let fixture: ComponentFixture<PullCommandComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [PullCommandComponent],
imports: [SharedTestingModule],
}).compileComponents();

fixture = TestBed.createComponent(PullCommandComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Loading

0 comments on commit 8f58559

Please sign in to comment.