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

fix: add subdomain if present #308

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 7 additions & 3 deletions containers/clusterForms/shared/clusterRunning/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,20 @@ const ClusterRunning: FunctionComponent = () => {

const { managementCluster } = useAppSelector(({ api }) => api);

const { clusterName, domainName, subDomainName, vaultAuth } = managementCluster ?? {};

const fullDomainName = `${subDomainName ? `${subDomainName}.${domainName}` : domainName}`;

const onOpenConsole = useCallback(() => {
dispatch(setSelectedCluster(managementCluster));
}, [dispatch, managementCluster]);

return (
<ClusterReady
onOpenConsole={onOpenConsole}
clusterName={managementCluster?.clusterName}
domainName={managementCluster?.domainName}
kbotPassword={managementCluster?.vaultAuth?.kbotPassword}
clusterName={clusterName}
domainName={fullDomainName}
kbotPassword={vaultAuth?.kbotPassword}
/>
);
};
Expand Down
9 changes: 4 additions & 5 deletions containers/clusterForms/shared/setupForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import Typography from '../../../../components/typography';
import ControlledCheckbox from '../../../../components/controlledFields/checkbox';
import { EMAIL_REGEX, LOWER_KEBAB_CASE_REGEX } from '../../../../constants';
import { InstallValues, InstallationType } from '../../../../types/redux';
import { GitProvider } from '../../../../types';
import { EXCLUSIVE_PLUM } from '../../../../constants/colors';
import { BISCAY } from '../../../../constants/colors';

Expand Down Expand Up @@ -50,15 +49,15 @@ const SetupForm: FunctionComponent = () => {

const subDomainHelperText = !subDomain ? '' : `${subDomain}.${domainName}`;

const { cloudDomains, cloudRegions, installationStep, installType, values, gitProvider } =
useAppSelector(({ api, installation }) => ({
const { cloudDomains, cloudRegions, installationStep, installType, values } = useAppSelector(
({ api, installation }) => ({
cloudDomains: api.cloudDomains,
cloudRegions: api.cloudRegions,
installationStep: installation.installationStep,
installType: installation.installType,
values: installation.values,
gitProvider: installation.gitProvider,
}));
}),
);

const cloudRegionLabel = useMemo(
() =>
Expand Down
6 changes: 0 additions & 6 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,4 @@ export default defineConfig({

viewportWidth: 1440,
viewportHeight: 900,

e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
},
},
});
5 changes: 5 additions & 0 deletions tests/mocks/mockClusterResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const mockClusterResponse: ClusterResponse = {
cluster_id: '4dg3dv',
cluster_type: ClusterType.MANAGEMENT,
domain_name: 'k-ray.space',
subdomain_name: '',
dns_provider: 'civo',
git_provider: 'github',
git_host: 'github.com',
Expand All @@ -23,6 +24,7 @@ export const mockClusterResponse: ClusterResponse = {
admin_email: 'derrick@kubeshop.io',
cloud_provider: InstallationType.AWS,
domain_name: 'kgetpods.biz',
subdomain_name: '',
cluster_id: 'nice',
creation_timestamp: '1693932566',
dns_provider: 'civo',
Expand All @@ -49,6 +51,7 @@ export const mockClusterResponse: ClusterResponse = {
admin_email: 'derrick@kubeshop.io',
cloud_provider: InstallationType.DIGITAL_OCEAN,
domain_name: 'kgetpods.biz',
subdomain_name: '',
cluster_id: 'one',
creation_timestamp: '1693932566',
dns_provider: 'civo',
Expand All @@ -75,6 +78,7 @@ export const mockClusterResponse: ClusterResponse = {
admin_email: 'derrick@kubeshop.io',
cloud_provider: InstallationType.LOCAL,
domain_name: 'kgetpods.biz',
subdomain_name: '',
cluster_id: 'draft',
creation_timestamp: '1693932566',
dns_provider: 'civo',
Expand All @@ -101,6 +105,7 @@ export const mockClusterResponse: ClusterResponse = {
admin_email: 'derrick@kubeshop.io',
cloud_provider: InstallationType.GOOGLE,
domain_name: 'kgetpods.biz',
subdomain_name: '',
cluster_id: 'four',
creation_timestamp: '1693932566',
dns_provider: 'civo',
Expand Down
3 changes: 3 additions & 0 deletions types/provision/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export interface ClusterResponse {
cloud_provider: InstallationType;
cloud_region: string;
domain_name: string;
subdomain_name: string;
dns_provider: string;
cluster_id: string;
cluster_type: ClusterType.MANAGEMENT;
Expand All @@ -73,6 +74,7 @@ export interface ClusterResponse {
cloud_region: string;
creation_timestamp: string;
domain_name: string;
subdomain_name: string;
dns_provider: string;
environment?: EnvironmentResponse;
git_auth: {
Expand Down Expand Up @@ -142,6 +144,7 @@ export interface Cluster {
cloudRegion?: string;
creationDate?: string;
domainName: string;
subDomainName?: string;
dnsProvider: string;
environment?: ClusterEnvironment;
gitProvider: string;
Expand Down
2 changes: 2 additions & 0 deletions utils/mapClustersFromRaw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const mapClusterFromRaw = (cluster: ClusterResponse) => {
cloudProvider: cluster.cloud_provider,
cloudRegion: cluster.cloud_region,
domainName: cluster.domain_name,
subDomainName: cluster.subdomain_name,
dnsProvider: cluster.dns_provider,
gitAuth: {
gitOwner: cluster.git_auth.git_owner,
Expand Down Expand Up @@ -82,6 +83,7 @@ export const mapClusterFromRaw = (cluster: ClusterResponse) => {
status: curVal.status,
type: curVal.cluster_type as ClusterType,
domainName: curVal.domain_name,
subDomainName: curVal.subdomain_name,
gitProvider: cluster.git_provider,
adminEmail: cluster.alerts_email,
gitAuth: {
Expand Down