Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename App Repositories to Package Repositories #4795

Merged
merged 8 commits into from
May 31, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dashboard/src/components/AppList/AppListGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function AppListGrid(props: IAppListProps) {
Start browsing your <Link to={url.app.catalog(cluster, namespace)}>favourite apps</Link>{" "}
or check the{" "}
<a
href={`https://github.com/vmware-tanzu/kubeapps/blob/${appVersion}/docs/tutorials/getting-started.md`}
href={`https://github.com/vmware-tanzu/kubeapps/blob/${appVersion}/site/content/docs/latest/tutorials/getting-started.md`}
target="_blank"
rel="noopener noreferrer"
>
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/components/Catalog/Catalog.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ describe("pagination and package fetching", () => {
});
});

describe("filters by application repository", () => {
describe("filters by package repository", () => {
const mockDispatch = jest.fn();
let spyOnUseDispatch: jest.SpyInstance;
let fetchRepos: jest.SpyInstance;
Expand Down
10 changes: 5 additions & 5 deletions dashboard/src/components/Catalog/Catalog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export default function Catalog() {
.concat(flatten(csvs.map(c => getOperatorCategories(c)))),
).sort();

// We do not currently support app repositories on additional clusters.
// We do not currently support package repositories on additional clusters.
const supportedCluster = cluster === kubeappsCluster;
useEffect(() => {
if (!supportedCluster || namespace === globalReposNamespace) {
Expand Down Expand Up @@ -374,18 +374,18 @@ export default function Catalog() {
<CdsIcon shape="bundle" />
<p>The current catalog is empty.</p>
<p>
Manage your Helm Package Repositories in Kubeapps by visiting the App repositories
Manage your Package Repositories in Kubeapps by visiting the Package repositories
configuration page.
</p>
<Link to={app.config.apprepositories(cluster, namespace)}>
<CdsButton>Manage App Repositories</CdsButton>
<CdsButton>Manage Package Repositories</CdsButton>
</Link>
<p>
For help managing other packaging formats, such as Flux or Carvel, please refer to the{" "}
<a
target="_blank"
rel="noopener noreferrer"
href={`https://github.com/vmware-tanzu/kubeapps/blob/${appVersion}/docs/`}
href={`https://github.com/vmware-tanzu/kubeapps/tree/${appVersion}/site/content/docs/latest`}
>
Kubeapps documentation
</a>
Expand Down Expand Up @@ -432,7 +432,7 @@ export default function Catalog() {
)}
{allRepos.length > 0 && (
<div className="filter-section">
<label>Application Repository</label>
<label>Package Repository</label>
<FilterGroup
name={filterNames.REPO}
options={allRepos}
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/components/Catalog/PackageCatalogItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default function PackageCatalogItem(props: IPackageCatalogItem) {
// Get the pkg repository for the plugins that have one.
// Assuming an identifier will always be like: "repo/pkgName"
const splitIdentifier = availablePackageSummary.availablePackageRef?.identifier.split("/");
if (splitIdentifier && splitIdentifier?.length > 0) {
if (splitIdentifier && splitIdentifier?.length > 1) {
pkgRepository = splitIdentifier[0];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export function AppRepoAddDockerCreds({
<a
target="_blank"
rel="noreferrer"
href="https://github.com/vmware-tanzu/kubeapps/blob/main/site/content/docs/latest/howto/private-app-repository.md#associating-docker-image-pull-secrets-to-an-apprepository"
href={`https://github.com/vmware-tanzu/kubeapps/blob/${appVersion}/site/content/docs/latest/howto/private-app-repository.md#associating-docker-image-pull-secrets-to-an-apprepository`}
>
here
</a>
Expand All @@ -115,7 +115,7 @@ export function AppRepoAddDockerCreds({
Select existing secret(s) to access a private Docker registry and pull images from it.
More info{" "}
<a
href={`https://github.com/vmware-tanzu/kubeapps/blob/${appVersion}/docs/howto/private-app-repository.md`}
href={`https://github.com/vmware-tanzu/kubeapps/blob/${appVersion}/site/content/docs/latest/howto/private-app-repository.md`}
target="_blank"
rel="noopener noreferrer"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export function AppRepoAddButton({
disabled={disabled}
title={title}
>
{primary ? <CdsIcon shape="plus-circle" /> : <></>} {text || "Add App Repository"}
{primary ? <CdsIcon shape="plus-circle" /> : <></>} {text || "Add Package Repository"}
</CdsButton>
{modalIsOpen && (
<CdsModal size={"lg"} onCloseChange={closeModal}>
Expand Down
6 changes: 3 additions & 3 deletions dashboard/src/components/Config/AppRepoList/AppRepoForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ export function AppRepoForm(props: IAppRepoFormProps) {
<a
target="_blank"
rel="noopener noreferrer"
href={`https://github.com/vmware-tanzu/kubeapps/blob/${appVersion}/docs/howto/private-app-repository.md#modifying-the-synchronization-job`}
href={`https://github.com/vmware-tanzu/kubeapps/blob/${appVersion}/site/content/docs/latest/howto/private-app-repository.md#modifying-the-synchronization-job`}
>
here
</a>
Expand All @@ -614,8 +614,8 @@ export function AppRepoForm(props: IAppRepoFormProps) {

{namespace === kubeappsNamespace && (
<p>
<strong>NOTE:</strong> This App Repository will be created in the "{kubeappsNamespace}"
namespace and packages will be available in all namespaces for installation.
<strong>NOTE:</strong> This Package Repository will be created in the "{kubeappsNamespace}
" namespace and packages will be available in all namespaces for installation.
Copy link
Contributor

Choose a reason for hiding this comment

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

Won't HTML assume that new-line there is a word-break? (Not what's wanted in that situation, with the quote, I don't think?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

No, IRL it seems it works as expected. It is a breakline introduced by the linter.

</p>
)}
{validationError && (
Expand Down
10 changes: 6 additions & 4 deletions dashboard/src/components/Config/AppRepoList/AppRepoList.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ it("shows a warning if the cluster is not the default one", () => {
<AppRepoList />,
);
expect(wrapper.find(Alert)).toIncludeText(
"App Repositories are available on the default cluster only",
"Package Repositories can't be managed from this cluster",
);
});

Expand Down Expand Up @@ -148,12 +148,14 @@ describe("global and namespaced repositories", () => {
it("shows a message if no global or namespaced repos exist", () => {
const wrapper = mountWrapper(defaultStore, <AppRepoList />);
expect(
wrapper.find("p").filterWhere(p => p.text().includes("No global repositories found")),
wrapper
.find("p")
.filterWhere(p => p.text().includes("There are no global Package Repositories")),
).toExist();
expect(
wrapper
.find("p")
.filterWhere(p => p.text().includes("The current namespace doesn't have any repositories")),
.filterWhere(p => p.text().includes("There are no namespaced Package Repositories")),
).toExist();
});

Expand Down Expand Up @@ -184,7 +186,7 @@ describe("global and namespaced repositories", () => {
expect(wrapper.find(AppRepoControl)).not.toExist();
// The content related to namespaced repositories should exist
expect(
wrapper.find("h3").filterWhere(h => h.text().includes("Namespace Repositories")),
wrapper.find("h3").filterWhere(h => h.text().includes("Namespaced Repositories")),
).toExist();
});

Expand Down
41 changes: 22 additions & 19 deletions dashboard/src/components/Config/AppRepoList/AppRepoList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function AppRepoList() {
const [canEditGlobalRepos, setCanEditGlobalRepos] = useState(false);
const [namespace, setNamespace] = useState(allNSQuery ? "" : currentNamespace);

// We do not currently support app repositories on additional clusters.
// We do not currently support package repositories on additional clusters.
const supportedCluster = cluster === kubeappsCluster;
// useCallback stores the reference to the function, not the function execution
// so calling several times to refetchRepos would run the code inside, even
Expand Down Expand Up @@ -136,10 +136,10 @@ function AppRepoList() {
return (
<>
<PageHeader
title="Application Repositories"
title="Package Repositories"
buttons={[
<AppRepoAddButton
title="Add an App Repository"
title="Add a Package Repository"
key="add-repo-button"
namespace={currentNamespace}
kubeappsNamespace={globalReposNamespace}
Expand All @@ -161,17 +161,16 @@ function AppRepoList() {
/>
{!supportedCluster ? (
<Alert theme="warning">
<h5>App Repositories are available on the default cluster only</h5>
<h5>Package Repositories can't be managed from this cluster.</h5>
<p>
Currently the multi-cluster support in Kubeapps supports AppRepositories on the default
cluster only.
Currently, the Package Repositories must be managed from the default cluster (the one on
which Kubeapps has been installed).
</p>
<p>
The catalog of packages from AppRepositories on the default cluster which are available
for all namespaces will be available on additional clusters also, but you can not
currently create a private AppRepository for a particular namespace of an additional
cluster. We may in the future support AppRepositories on additional clusters but for now
you will need to switch back to your default cluster.
Any <i>global</i> Package Repository defined in the default cluster can be later used
across any target cluster.
<br />
However, <i>namespaced</i> Package Repositories can only be used on the default cluster.
</p>
</Alert>
) : (
Expand All @@ -190,26 +189,30 @@ function AppRepoList() {
<>
<LoadingWrapper
className="margin-t-xxl"
loadingText="Fetching Application Repositories..."
loadingText="Fetching Package Repositories..."
loaded={!isFetchingElem.repositories}
>
<h3>Global Repositories:</h3>
<p>Global repositories are available for all Kubeapps users.</p>
<p>Global Package Repositories are available for all Kubeapps users.</p>
{globalRepos.length ? (
<Table
valign="center"
columns={tableColumns}
data={getTableData(globalRepos, !canEditGlobalRepos)}
/>
) : (
<p>No global repositories found.</p>
<p>
There are no <i>global</i> Package Repositories yet. Click on the "Add Package
Repository" button to create one.
</p>
)}
{namespace !== globalReposNamespace && (
<>
<h3>Namespace Repositories: {namespace}</h3>
<h3>Namespaced Repositories: {namespace}</h3>
<p>
Namespaced Repositories are available in their namespace only. To switch to a
different one, use the "Current Context" selector in the top navigation.
Namespaced Package Repositories are available in their namespace only. To
switch to a different one, use the "Current Context" selector in the top
navigation.
</p>
{namespaceRepos.length ? (
<Table
Expand All @@ -219,8 +222,8 @@ function AppRepoList() {
/>
) : (
<p>
The current namespace doesn't have any repositories. Click on the button
"Add app repository" above to create the first one.
There are no <i>namespaced</i> Package Repositories in the '{namespace}'
namespace yet. Click on the "Add Package Repository" button to create one.
</p>
)}
</>
Expand Down
3 changes: 2 additions & 1 deletion dashboard/src/components/Header/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ function Menu({ clusters, appVersion, logout }: IContextSelectorProps) {
onClick={toggleOpen}
>
<div className="dropdown-menu-item" role="menuitem">
<CdsIcon solid={true} size="md" shape="library" /> <span>App Repositories</span>
<CdsIcon solid={true} size="md" shape="library" />{" "}
<span>Package Repositories</span>
</div>
</Link>
<div className="dropdown-divider" role="separator" />
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/components/LoginForm/LoginForm.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe("token login form", () => {
it("renders a link to the access control documentation", () => {
const wrapper = mountWrapper(defaultStore, <LoginForm {...defaultProps} />);
expect(wrapper.find("a").props()).toMatchObject({
href: "https://github.com/vmware-tanzu/kubeapps/blob/devel/docs/howto/access-control.md",
href: "https://github.com/vmware-tanzu/kubeapps/blob/devel/site/content/docs/latest/howto/access-control.md",
target: "_blank",
});
});
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/components/LoginForm/LoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function LoginForm(props: ILoginFormProps) {
)}
<div className="login-moreinfo">
<a
href={`https://github.com/vmware-tanzu/kubeapps/blob/${props.appVersion}/docs/howto/access-control.md`}
href={`https://github.com/vmware-tanzu/kubeapps/blob/${props.appVersion}/site/content/docs/latest/howto/access-control.md`}
target="_blank"
rel="noopener noreferrer"
>
Expand Down
4 changes: 2 additions & 2 deletions dashboard/src/components/SelectRepoForm/SelectRepoForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function SelectRepoForm({ cluster, namespace, app }: ISelectRepoFormProps) {
return (
<LoadingWrapper
className="margin-t-xxl"
loadingText="Fetching Application Repositories..."
loadingText="Fetching Package Repositories..."
loaded={!isFetching}
>
{fetchError && <Alert theme="danger">An error occurred: {fetchError.message}</Alert>}
Expand All @@ -84,7 +84,7 @@ function SelectRepoForm({ cluster, namespace, app }: ISelectRepoFormProps) {
<h5>Repositories not found. </h5>
Manage your repositories in Kubeapps by visiting the{" "}
<Link to={url.app.config.apprepositories(cluster, namespace)}>
App repositories configuration
Package Repositories configuration
</Link>{" "}
page.
</Alert>
Expand Down
6 changes: 3 additions & 3 deletions integration/tests/main/02-create-package-repository.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ test("Create a new package repository successfully", async ({ page }) => {

// Go to repos page
await page.click(".dropdown.kubeapps-menu button.kubeapps-nav-link");
await page.click('a.dropdown-menu-link:has-text("App Repositories")');
await page.click('a.dropdown-menu-link:has-text("Package Repositories")');
await page.waitForTimeout(3000);

// Add new repo
console.log('Creating repository "my-repo"');
await page.click('cds-button:has-text("Add App Repository")');
console.log('Creating package repository "my-repo"');
await page.click('cds-button:has-text("Add Package Repository")');
await page.fill("input#kubeapps-repo-name", "my-repo");
await page.fill("input#kubeapps-repo-url", "https://charts.gitlab.io/");
await page.click('cds-button:has-text("Install Repo")');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ test("Create a new private package repository successfully", async ({ page }) =>
await page.waitForTimeout(3000);

// Add new repo
await page.click('cds-button:has-text("Add App Repository")');
await page.click('cds-button:has-text("Add Package Repository")');
const repoName = utils.getRandomName("my-repo");
console.log(`Creating repository "${repoName}"`);
console.log(`Creating package repository "${repoName}"`);
await page.fill("input#kubeapps-repo-name", repoName);
await page.fill("input#kubeapps-repo-url", "http://chartmuseum-chartmuseum.kubeapps:8080");

Expand Down
4 changes: 2 additions & 2 deletions integration/tests/main/09-user-positive-installation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ test.describe("Limited user simple deployments", () => {

// Add new repo
const repoName = utils.getRandomName("repo-09");
console.log(`Creating repository "${repoName}"`);
await page.click('cds-button:has-text("Add App Repository")');
console.log(`Creating package repository "${repoName}"`);
await page.click('cds-button:has-text("Add Package Repository")');
await page.fill("input#kubeapps-repo-name", repoName);
await page.fill(
"input#kubeapps-repo-url",
Expand Down