Skip to content
This repository has been archived by the owner on Aug 22, 2022. It is now read-only.

Commit

Permalink
Merge pull request #742 from open-craft/arjun/bb-3864-dns-ui
Browse files Browse the repository at this point in the history
BB-3864: Add DomainSettings page
  • Loading branch information
arjunsinghy96 authored Apr 17, 2021
2 parents 0f1e905 + e57de43 commit 8059666
Show file tree
Hide file tree
Showing 40 changed files with 1,941 additions and 100 deletions.
18 changes: 18 additions & 0 deletions frontend/packages/api_client/src/models/OpenEdXInstanceConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ export interface OpenEdXInstanceConfig {
* @memberof OpenEdXInstanceConfig
*/
readonly isEmailVerified?: boolean;
/**
* State of DNS config verfication for external_domain
* @type {string}
* @memberof OpenEdXInstanceConfig
*/
readonly dnsConfigurationState?: OpenEdXInstanceConfigDnsConfigurationStateEnum;
}

export function OpenEdXInstanceConfigFromJSON(json: any): OpenEdXInstanceConfig {
Expand Down Expand Up @@ -158,6 +164,7 @@ export function OpenEdXInstanceConfigFromJSONTyped(json: any, ignoreDiscriminato
'draftStaticContentOverrides': !exists(json, 'draft_static_content_overrides') ? undefined : StaticContentOverridesFromJSON(json['draft_static_content_overrides']),
'staticPagesEnabled': !exists(json, 'static_pages_enabled') ? undefined : json['static_pages_enabled'],
'isEmailVerified': !exists(json, 'is_email_verified') ? undefined : json['is_email_verified'],
'dnsConfigurationState': !exists(json, 'dns_configuration_state') ? undefined : json['dns_configuration_state'],
};
}

Expand All @@ -181,4 +188,15 @@ export function OpenEdXInstanceConfigToJSON(value?: OpenEdXInstanceConfig | null
};
}

/**
* @export
* @enum {string}
*/
export enum OpenEdXInstanceConfigDnsConfigurationStateEnum {
Verified = 'verified',
Pending = 'pending',
Failed = 'failed',
NotRequired = 'not_required'
}


Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ export interface OpenEdXInstanceConfigUpdate {
* @memberof OpenEdXInstanceConfigUpdate
*/
readonly staticPagesEnabled?: string;
/**
* State of DNS config verfication for external_domain
* @type {string}
* @memberof OpenEdXInstanceConfigUpdate
*/
readonly dnsConfigurationState?: OpenEdXInstanceConfigUpdateDnsConfigurationStateEnum;
}

export function OpenEdXInstanceConfigUpdateFromJSON(json: any): OpenEdXInstanceConfigUpdate {
Expand All @@ -144,6 +150,7 @@ export function OpenEdXInstanceConfigUpdateFromJSONTyped(json: any, ignoreDiscri
'heroCoverImage': !exists(json, 'hero_cover_image') ? undefined : json['hero_cover_image'],
'draftStaticContentOverrides': !exists(json, 'draft_static_content_overrides') ? undefined : StaticContentOverridesFromJSON(json['draft_static_content_overrides']),
'staticPagesEnabled': !exists(json, 'static_pages_enabled') ? undefined : json['static_pages_enabled'],
'dnsConfigurationState': !exists(json, 'dns_configuration_state') ? undefined : json['dns_configuration_state'],
};
}

Expand All @@ -167,4 +174,15 @@ export function OpenEdXInstanceConfigUpdateToJSON(value?: OpenEdXInstanceConfigU
};
}

/**
* @export
* @enum {string}
*/
export enum OpenEdXInstanceConfigUpdateDnsConfigurationStateEnum {
Verified = 'verified',
Pending = 'pending',
Failed = 'failed',
NotRequired = 'not_required'
}


17 changes: 10 additions & 7 deletions frontend/src/console/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,13 +340,16 @@ export const updateFieldValue = (
}
});
}
} catch {
dispatch({
type: Types.UPDATE_INSTANCE_INFO_FAILURE,
data: {
[fieldName]: value
}
});
} catch (e) {
try {
const error = await e.json();
dispatch({
type: Types.UPDATE_INSTANCE_INFO_FAILURE,
data: sanitizeErrorFeedback(error)
});
} catch {
dispatch(push(ROUTES.Error.UNKNOWN_ERROR));
}
}
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import React from 'react';
import { setupComponentForTesting } from "utils/testing";
import { AddDomainButton } from './AddDomainModalButton';

it('renders without crashing', () => {
const tree = setupComponentForTesting(
<AddDomainButton />,
{
console: {
loading: false,
activeInstance: {
data: {
id: 1,
instanceName: "test",
subdomain: "test",
draftThemeConfig: {
version: 1,
mainColor: "#444444",
linkColor: "#FFAAFF"
},
draftStaticContentOverrides: {
homepageOverlayHtml: "Test overlay",
}
},
feedback: [],
loading: ['draftThemeConfig'],
deployment: null,
},
}
}
).toJSON();
expect(tree).toMatchSnapshot();
});

it('renders null when externalDomain in data', () => {
const tree = setupComponentForTesting(
<AddDomainButton />,
{
console: {
loading: false,
activeInstance: {
data: {
id: 1,
instanceName: "test",
externalDomain: 'example.com',
subdomain: "test",
draftThemeConfig: {
version: 1,
mainColor: "#444444",
linkColor: "#FFAAFF"
},
draftStaticContentOverrides: {
homepageOverlayHtml: "Test overlay",
}
},
feedback: [],
loading: ['draftThemeConfig'],
deployment: null,
},
}
}
).toJSON();
expect(tree).toMatchSnapshot();
})
Loading

0 comments on commit 8059666

Please sign in to comment.