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

feat(pci-databases-analytics): update typings for databases api #14866

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ const mongo: database.Availability[] = [
lifecycle: mockedLifecycle,
region: 'GRA',
default: false,
backup: database.BackupTypeEnum.automatic,
backupRetentionDays: 0,
flavor: '',
maxDiskSize: 0,
maxNodeNumber: 0,
minDiskSize: 0,
minNodeNumber: 0,
network: database.NetworkTypeEnum.public,
startDate: '',
status: database.availability.StatusEnum.STABLE,
stepDiskSize: 0,
},
{
engine: 'mongodb',
Expand All @@ -55,6 +66,17 @@ const mongo: database.Availability[] = [
lifecycle: mockedLifecycle,
region: 'GRA',
default: false,
backup: database.BackupTypeEnum.automatic,
backupRetentionDays: 0,
flavor: '',
maxDiskSize: 0,
maxNodeNumber: 0,
minDiskSize: 0,
minNodeNumber: 0,
network: database.NetworkTypeEnum.public,
startDate: '',
status: database.availability.StatusEnum.STABLE,
stepDiskSize: 0,
},
{
engine: 'mongodb',
Expand All @@ -81,6 +103,17 @@ const mongo: database.Availability[] = [
lifecycle: mockedLifecycle,
region: 'GRA',
default: false,
backup: database.BackupTypeEnum.automatic,
backupRetentionDays: 0,
flavor: '',
maxDiskSize: 0,
maxNodeNumber: 0,
minDiskSize: 0,
minNodeNumber: 0,
network: database.NetworkTypeEnum.public,
startDate: '',
status: database.availability.StatusEnum.STABLE,
stepDiskSize: 0,
},
{
engine: 'mongodb',
Expand All @@ -107,6 +140,17 @@ const mongo: database.Availability[] = [
lifecycle: mockedLifecycle,
region: 'GRA',
default: false,
backup: database.BackupTypeEnum.automatic,
backupRetentionDays: 0,
flavor: '',
maxDiskSize: 0,
maxNodeNumber: 0,
minDiskSize: 0,
minNodeNumber: 0,
network: database.NetworkTypeEnum.public,
startDate: '',
status: database.availability.StatusEnum.STABLE,
stepDiskSize: 0,
},
];

Expand Down Expand Up @@ -136,6 +180,17 @@ const pg: database.Availability[] = [
lifecycle: mockedLifecycle,
region: 'GRA',
default: false,
backup: database.BackupTypeEnum.automatic,
backupRetentionDays: 0,
flavor: '',
maxDiskSize: 0,
maxNodeNumber: 0,
minDiskSize: 0,
minNodeNumber: 0,
network: database.NetworkTypeEnum.public,
startDate: '',
status: database.availability.StatusEnum.STABLE,
stepDiskSize: 0,
},
{
engine: 'postgresql',
Expand All @@ -162,6 +217,17 @@ const pg: database.Availability[] = [
lifecycle: mockedLifecycle,
region: 'GRA',
default: false,
backup: database.BackupTypeEnum.automatic,
backupRetentionDays: 0,
flavor: '',
maxDiskSize: 0,
maxNodeNumber: 0,
minDiskSize: 0,
minNodeNumber: 0,
network: database.NetworkTypeEnum.public,
startDate: '',
status: database.availability.StatusEnum.STABLE,
stepDiskSize: 0,
},
];

Expand All @@ -186,6 +252,17 @@ const grafana = [
lifecycle: mockedLifecycle,
region: 'GRA',
default: false,
backup: database.BackupTypeEnum.automatic,
backupRetentionDays: 0,
flavor: '',
maxDiskSize: 0,
maxNodeNumber: 0,
minDiskSize: 0,
minNodeNumber: 0,
network: database.NetworkTypeEnum.public,
startDate: '',
status: database.availability.StatusEnum.STABLE,
stepDiskSize: 0,
},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ export const mockedCapabilities: FullCapabilities = {
memory: { value: 0, unit: 'GB' },
storage: { value: 512, unit: 'MB' },
},
core: 0,
memory: 0,
storage: 0,
},
{
name: 'db1',
Expand All @@ -70,6 +73,9 @@ export const mockedCapabilities: FullCapabilities = {
memory: { value: 16, unit: 'GB' },
storage: { value: 20, unit: 'GB' },
},
core: 0,
memory: 0,
storage: 0,
},
{
name: 'db2',
Expand All @@ -81,6 +87,9 @@ export const mockedCapabilities: FullCapabilities = {
memory: { value: 32, unit: 'GB' },
storage: { value: 40, unit: 'GB' },
},
core: 0,
memory: 0,
storage: 0,
},
{
name: 'db3',
Expand All @@ -92,6 +101,9 @@ export const mockedCapabilities: FullCapabilities = {
memory: { value: 64, unit: 'GB' },
storage: { value: 40, unit: 'GB' },
},
core: 0,
memory: 0,
storage: 0,
},
],
options: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ export const mockedService: database.Service = {
nodeNumber: 2,
nodes: [mockedNode],
plan: 'plan',
region: 'region',
status: database.StatusEnum.CREATING,
storage: {
size: {
Expand Down Expand Up @@ -161,7 +160,6 @@ export const mockedServiceInte: database.Service = {
nodeNumber: 2,
nodes: [mockedNode],
plan: 'plan',
region: 'region',
status: database.StatusEnum.CREATING,
storage: {
size: {
Expand Down Expand Up @@ -193,6 +191,7 @@ export const mockedServiceCreation: database.ServiceCreation = {
plan: 'plan',
subnetId: 'subnetId',
version: 'version',
disk: undefined,
};

export const mockedServiceCreationWithEngine: ServiceCreationWithEngine = {
Expand Down Expand Up @@ -247,7 +246,6 @@ export const mockedServiceInteBase: database.Service = {
nodeNumber: 2,
nodes: [mockedNode],
plan: 'plan',
region: 'region',
status: database.StatusEnum.READY,
storage: {
size: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export const addNamespace = async ({

export type NamespaceEdition = Omit<
database.m3db.NamespaceCreation,
'name' | 'type'
>;
'name' | 'type' | 'resolution'
> & { resolution?: string };
export interface EditNamespace extends ServiceData {
namespace: NamespaceEdition;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export interface EditService extends ServiceData {
| 'ipRestrictions'
| 'maintenanceTime'
| 'plan'
| 'region'
| 'storage'
| 'version'
> & {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ const ForkForm = ({
},
plan: data.plan,
version: data.engineWithVersion.version,
ipRestrictions: data.ipRestrictions,
ipRestrictions: data.ipRestrictions as database.service.IpRestriction[],
forkFrom: {
serviceId: data.forkFrom.serviceId,
},
} as database.service.creation.ForkFrom,
};
if (data.network.type === database.NetworkTypeEnum.private) {
// endpoint does not expect the network id, but the linked openstackId instead
Expand All @@ -150,7 +150,7 @@ const ForkForm = ({
serviceInfos.disk = {
size:
model.result.flavor.storage.minimum.value + data.additionalStorage,
};
} as database.service.Disk;
}
switch (data.forkFrom.type) {
case ForkSourceType.now:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ describe('AddDatabase Component', () => {
it('should show success toast on successful database addition', async () => {
vi.mocked(databaseApi.addDatabase).mockResolvedValue({
name: 'MyDatabase',
default: false,
id: '',
});

render(<AddDatabase />, { wrapper: RouterWithQueryClientWrapper });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ const mockService: database.Service = {
nodes: [],
plan: '',
status: database.StatusEnum.READY,
region: '',
storage: null,
version: '',
backups: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const AddEditNamespace = ({
);

const onSubmit = form.handleSubmit((formValues) => {
const retentionFormValues: database.m3db.namespace.Retention = {
const retentionFormValues = {
periodDuration: convertDurationStringToISODuration(
formValues.periodDuration,
),
Expand All @@ -124,7 +124,7 @@ const AddEditNamespace = ({
bufferPastDuration: formValues.bufferPastDuration
? convertDurationStringToISODuration(formValues.bufferPastDuration)
: null,
};
} as database.m3db.namespace.Retention;

if (isEdition) {
if (Object.entries(form.formState.dirtyFields).length === 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe('AddEditPool', () => {
service={mockedService}
connectionPools={[]}
databases={[mockedDatabase]}
users={[mockedUser as GenericUser]}
users={[(mockedUser as unknown) as GenericUser]}
/>,
{
wrapper: RouterWithQueryClientWrapper,
Expand All @@ -76,7 +76,7 @@ describe('AddEditPool', () => {
service={mockedService}
connectionPools={[]}
databases={[mockedDatabase]}
users={[mockedUser as GenericUser]}
users={[(mockedUser as unknown) as GenericUser]}
/>,
{
wrapper: RouterWithQueryClientWrapper,
Expand All @@ -99,7 +99,7 @@ describe('AddEditPool', () => {
service={mockedService}
connectionPools={[]}
databases={[mockedDatabase]}
users={[mockedUser as GenericUser]}
users={[(mockedUser as unknown) as GenericUser]}
/>,
{
wrapper: RouterWithQueryClientWrapper,
Expand Down Expand Up @@ -130,7 +130,7 @@ describe('AddEditPool', () => {
service={mockedService}
connectionPools={[mockedConnectionPool]}
databases={[mockedDatabase]}
users={[mockedUser as GenericUser]}
users={[(mockedUser as unknown) as GenericUser]}
/>,
{
wrapper: RouterWithQueryClientWrapper,
Expand Down Expand Up @@ -161,7 +161,7 @@ describe('AddEditPool', () => {
service={mockedService}
connectionPools={[mockedConnectionPool]}
databases={[mockedDatabase]}
users={[mockedUser as GenericUser]}
users={[(mockedUser as unknown) as GenericUser]}
editedConnectionPool={mockedConnectionPool}
/>,
{
Expand Down Expand Up @@ -196,7 +196,7 @@ describe('AddEditPool', () => {
service={mockedService}
connectionPools={[mockedConnectionPool]}
databases={[mockedDatabase]}
users={[mockedUser as GenericUser]}
users={[(mockedUser as unknown) as GenericUser]}
/>,
{
wrapper: RouterWithQueryClientWrapper,
Expand Down Expand Up @@ -226,7 +226,7 @@ describe('AddEditPool', () => {
service={mockedService}
connectionPools={[mockedConnectionPool]}
databases={[mockedDatabase]}
users={[mockedUser as GenericUser]}
users={[(mockedUser as unknown) as GenericUser]}
/>,
{
wrapper: RouterWithQueryClientWrapper,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const IpsRestrictionsUpdate = ({
engine: service.engine,
projectId,
data: {
ipRestrictions: formValues.ipRestrictions as database.IpRestrictionCreation[],
ipRestrictions: formValues.ipRestrictions as database.service.IpRestriction[],
},
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function useUpdateTree(availabilities: database.Availability[]) {
engine: service.engine,
flavor: service.flavor,
plan: service.plan,
region: service.region,
region: service.nodes[0].region,
version: service.version,
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const OrderFunnel = ({
serviceInfos.disk = {
size:
model.result.flavor.storage.minimum.value + data.additionalStorage,
};
} as database.service.Disk;
}
addService(serviceInfos);
},
Expand Down
Loading
Loading