Skip to content

Commit

Permalink
Liniiit
Browse files Browse the repository at this point in the history
Lint
Signed-off-by: Michael Nelson <minelson@vmware.com>
  • Loading branch information
absoludity committed Mar 8, 2023
1 parent 6d23694 commit 4d04cd1
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 32 deletions.
52 changes: 26 additions & 26 deletions dashboard/src/components/Config/PkgRepoList/PkgRepoForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,88 +206,88 @@ export function PkgRepoForm(props: IPkgRepoFormProps) {
setPassCredentials(!!repo.auth?.passCredentials);
setSyncInterval(repo.interval);
setCustomCA(
repo.tlsConfig?.packageRepoTlsConfigOneOf?.case == "certAuthority"
repo.tlsConfig?.packageRepoTlsConfigOneOf?.case === "certAuthority"
? repo.tlsConfig?.packageRepoTlsConfigOneOf?.value
: "",
);
setAuthCustomHeader(
repo.auth?.packageRepoAuthOneOf?.case == "header"
repo.auth?.packageRepoAuthOneOf?.case === "header"
? repo.auth?.packageRepoAuthOneOf?.value
: "",
);
setBearerToken(
repo.auth?.packageRepoAuthOneOf?.case == "header"
repo.auth?.packageRepoAuthOneOf?.case === "header"
? repo.auth?.packageRepoAuthOneOf?.value
: "",
);
setBasicPassword(
repo.auth?.packageRepoAuthOneOf?.case == "usernamePassword"
repo.auth?.packageRepoAuthOneOf?.case === "usernamePassword"
? repo.auth?.packageRepoAuthOneOf?.value.password
: "",
);
setBasicUser(
repo.auth?.packageRepoAuthOneOf?.case == "usernamePassword"
repo.auth?.packageRepoAuthOneOf?.case === "usernamePassword"
? repo.auth?.packageRepoAuthOneOf?.value.username
: "",
);
setSecretEmail(
repo.auth?.packageRepoAuthOneOf?.case == "dockerCreds"
repo.auth?.packageRepoAuthOneOf?.case === "dockerCreds"
? repo.auth?.packageRepoAuthOneOf?.value.email
: "",
);
setSecretPassword(
repo.auth?.packageRepoAuthOneOf?.case == "dockerCreds"
repo.auth?.packageRepoAuthOneOf?.case === "dockerCreds"
? repo.auth?.packageRepoAuthOneOf?.value.password
: "",
);
setSecretServer(
repo.auth?.packageRepoAuthOneOf?.case == "dockerCreds"
repo.auth?.packageRepoAuthOneOf?.case === "dockerCreds"
? repo.auth?.packageRepoAuthOneOf?.value.server
: "",
);
setSecretUser(
repo.auth?.packageRepoAuthOneOf?.case == "dockerCreds"
repo.auth?.packageRepoAuthOneOf?.case === "dockerCreds"
? repo.auth?.packageRepoAuthOneOf?.value.username
: "",
);
setSshKnownHosts(
repo.auth?.packageRepoAuthOneOf?.case == "sshCreds"
repo.auth?.packageRepoAuthOneOf?.case === "sshCreds"
? repo.auth?.packageRepoAuthOneOf?.value.knownHosts
: "",
);
setSshPrivateKey(
repo.auth?.packageRepoAuthOneOf?.case == "sshCreds"
repo.auth?.packageRepoAuthOneOf?.case === "sshCreds"
? repo.auth?.packageRepoAuthOneOf?.value.privateKey
: "",
);
setTlsAuthCert(
repo.auth?.packageRepoAuthOneOf?.case == "tlsCertKey"
repo.auth?.packageRepoAuthOneOf?.case === "tlsCertKey"
? repo.auth?.packageRepoAuthOneOf?.value.cert
: "",
);
setTlsAuthKey(
repo.auth?.packageRepoAuthOneOf?.case == "tlsCertKey"
repo.auth?.packageRepoAuthOneOf?.case === "tlsCertKey"
? repo.auth?.packageRepoAuthOneOf?.value.key
: "",
);
setOpaqueData(
repo.auth?.packageRepoAuthOneOf?.case == "opaqueCreds"
repo.auth?.packageRepoAuthOneOf?.case === "opaqueCreds"
? JSON.stringify(repo.auth?.packageRepoAuthOneOf?.value.data)
: "",
);
setAuthMethod(repo.auth?.type || PackageRepositoryAuth_PackageRepositoryAuthType.UNSPECIFIED);
setSecretAuthName(
repo.auth?.packageRepoAuthOneOf?.case == "secretRef"
repo.auth?.packageRepoAuthOneOf?.case === "secretRef"
? repo.auth?.packageRepoAuthOneOf?.value.name
: "",
);
setSecretTLSName(
repo.tlsConfig?.packageRepoTlsConfigOneOf?.case == "secretRef"
repo.tlsConfig?.packageRepoTlsConfigOneOf?.case === "secretRef"
? repo.tlsConfig?.packageRepoTlsConfigOneOf?.value.name
: "",
);
setIsUserManagedSecret(!!(repo.auth?.packageRepoAuthOneOf?.case == "secretRef"));
setIsUserManagedCASecret(!!(repo.tlsConfig?.packageRepoTlsConfigOneOf?.case == "secretRef"));
setIsUserManagedSecret(!!(repo.auth?.packageRepoAuthOneOf?.case === "secretRef"));
setIsUserManagedCASecret(!!(repo.tlsConfig?.packageRepoTlsConfigOneOf?.case === "secretRef"));

// setting custom details for the Helm plugin
if (repo.packageRepoRef?.plugin?.name === PluginNames.PACKAGES_HELM) {
Expand All @@ -309,49 +309,49 @@ export function PkgRepoForm(props: IPkgRepoFormProps) {
}
if (
helmPackageRepositoryCustomDetail?.imagesPullSecret?.dockerRegistryCredentialOneOf
?.case == "secretRef" ||
?.case === "secretRef" ||
helmPackageRepositoryCustomDetail?.imagesPullSecret?.dockerRegistryCredentialOneOf
?.case == "credentials"
?.case === "credentials"
) {
setUseSameAuthCreds(false);
setIsUserManagedPSSecret(
!!(
helmPackageRepositoryCustomDetail?.imagesPullSecret?.dockerRegistryCredentialOneOf
?.case == "secretRef"
?.case === "secretRef"
),
);
setHelmPsAuthMethod(PackageRepositoryAuth_PackageRepositoryAuthType.DOCKER_CONFIG_JSON);
setSecretPSName(
helmPackageRepositoryCustomDetail?.imagesPullSecret?.dockerRegistryCredentialOneOf
?.case == "secretRef"
?.case === "secretRef"
? helmPackageRepositoryCustomDetail?.imagesPullSecret?.dockerRegistryCredentialOneOf
?.value
: "",
);
setPullSecretEmail(
helmPackageRepositoryCustomDetail?.imagesPullSecret?.dockerRegistryCredentialOneOf
?.case == "credentials"
?.case === "credentials"
? helmPackageRepositoryCustomDetail?.imagesPullSecret?.dockerRegistryCredentialOneOf
?.value.email
: "",
);
setPullSecretUser(
helmPackageRepositoryCustomDetail?.imagesPullSecret?.dockerRegistryCredentialOneOf
?.case == "credentials"
?.case === "credentials"
? helmPackageRepositoryCustomDetail?.imagesPullSecret?.dockerRegistryCredentialOneOf
?.value.username
: "",
);
setPullSecretPassword(
helmPackageRepositoryCustomDetail?.imagesPullSecret?.dockerRegistryCredentialOneOf
?.case == "credentials"
?.case === "credentials"
? helmPackageRepositoryCustomDetail?.imagesPullSecret?.dockerRegistryCredentialOneOf
?.value.password
: "",
);
setPullSecretServer(
helmPackageRepositoryCustomDetail?.imagesPullSecret?.dockerRegistryCredentialOneOf
?.case == "credentials"
?.case === "credentials"
? helmPackageRepositoryCustomDetail?.imagesPullSecret?.dockerRegistryCredentialOneOf
?.value.server
: "",
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/shared/KubeappsGrpcClient.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2021-2022 the Kubeapps contributors.
// SPDX-License-Identifier: Apache-2.0
import { ServiceType } from "@bufbuild/protobuf";
import type { ServiceType } from "@bufbuild/protobuf";
import { createGrpcWebTransport } from "@bufbuild/connect-web";
import { createPromiseClient, Interceptor, PromiseClient, Transport } from "@bufbuild/connect";
import { PackagesService } from "gen/kubeappsapis/core/packages/v1alpha1/packages_connect";
Expand Down
7 changes: 2 additions & 5 deletions dashboard/src/shared/PackageRepositoriesService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ export class PackageRepositoriesService {
private static buildEncodedCustomDetail(request: IPkgRepoFormData) {
// if using a plugin with customDetail, encode its custom fields,
// otherwise skip it
console.log(`customDetail: ${JSON.stringify(request.customDetail)}`);
if (!request.customDetail) {
return;
}
Expand All @@ -274,11 +273,9 @@ export class PackageRepositoriesService {
});

// populate the imagesPullSecret if it's not empty
// UPTOHERE: Not sure why can't use the OneOf below.
console.log(`imagePullSecret: ${JSON.stringify(detail.imagesPullSecret)}`);
if (
detail?.imagesPullSecret?.dockerRegistryCredentialOneOf?.case == "secretRef" ||
(detail?.imagesPullSecret?.dockerRegistryCredentialOneOf?.case == "credentials" &&
detail?.imagesPullSecret?.dockerRegistryCredentialOneOf?.case === "secretRef" ||
(detail?.imagesPullSecret?.dockerRegistryCredentialOneOf?.case === "credentials" &&
Object.values(
(detail?.imagesPullSecret?.dockerRegistryCredentialOneOf?.value ||
{}) as DockerCredentials,
Expand Down

0 comments on commit 4d04cd1

Please sign in to comment.