Skip to content

Commit

Permalink
Refactor create policy after policy details page link to edit policy
Browse files Browse the repository at this point in the history
Signed-off-by: bowenlan-amzn <[email protected]>
  • Loading branch information
bowenlan-amzn committed Jun 1, 2022
1 parent 7b1e394 commit 85078c9
Show file tree
Hide file tree
Showing 16 changed files with 1,072 additions and 293 deletions.
28 changes: 23 additions & 5 deletions models/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,29 @@ export interface Policy {
schema_version?: number;
}

export interface DocumentSMPolicy {
id: string;
seqNo: number;
primaryTerm: number;
policy: SMPolicy;
}
export interface SMPolicy {
name: string;
description: string;
creation: SMCreation;
deletion: SMDeletion;
snapshot_config: object;
deletion?: SMDeletion;
snapshot_config: SMSnapshotConfig;
enabled: boolean;
last_updated_time?: number;
}

export interface SMSnapshotConfig {
indices: string;
repository: string;
ignore_unavailable?: boolean;
include_global_state?: boolean;
partial?: boolean;
date_expression?: string;
}

export interface SMCreation {
Expand All @@ -92,13 +110,13 @@ export interface SMCreation {
}

export interface SMDeletion {
schedule: Cron;
condition: SMDeleteCondition;
schedule?: Cron;
condition?: SMDeleteCondition;
time_limit?: string;
}

export interface SMDeleteCondition {
max_count: number;
max_count?: number;
max_age?: string;
min_count?: number;
}
Expand Down
42 changes: 33 additions & 9 deletions public/pages/Main/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import { EditTransform, Transforms } from "../Transforms";
import TransformDetails from "../Transforms/containers/Transforms/TransformDetails";
import queryString from "query-string";
import Snapshots from "../Snapshots";
import SMPolicies from "../Snapshots/containers/SMPolicies";
import SMPolicyDetails from "../Snapshots/containers/SMPolicyDetails";
import CreateSMPolicy from "../Snapshots/containers/CreateSMPolicy";

enum Navigation {
Expand All @@ -40,6 +42,7 @@ enum Navigation {
Transforms = "Transform Jobs",
SnapshotManagement = "Snapshot Management",
Snapshots = "Snapshots",
SnapshotPolicies = "Snapshot Policies",
}

enum Pathname {
Expand All @@ -63,6 +66,9 @@ const HIDDEN_NAV_ROUTES = [
ROUTES.EDIT_POLICY,
ROUTES.POLICY_DETAILS,
ROUTES.CHANGE_POLICY,
ROUTES.SNAPSHOT_POLICY_DETAILS,
ROUTES.CREATE_SNAPSHOT_POLICY,
ROUTES.EDIT_SNAPSHOT_POLICY,
];

interface MainProps extends RouteComponentProps {}
Expand Down Expand Up @@ -113,19 +119,19 @@ export default class Main extends Component<MainProps, object> {
{
name: Navigation.SnapshotManagement,
id: 1,
href: `#${Pathname.Snapshots}`,
href: `#${Pathname.SnapshotPolicies}`,
items: [
{
name: Navigation.Snapshots,
name: Navigation.SnapshotPolicies,
id: 1,
href: `#${Pathname.Snapshots}`,
isSelected: pathname === Pathname.Snapshots,
href: `#${Pathname.SnapshotPolicies}`,
isSelected: pathname === Pathname.SnapshotPolicies,
},
{
name: Navigation.SnapshotManagement,
name: Navigation.Snapshots,
id: 2,
href: `#${Pathname.SnapshotPolicies}`,
isSelected: pathname === Pathname.SnapshotPolicies,
href: `#${Pathname.Snapshots}`,
isSelected: pathname === Pathname.Snapshots,
},
],
},
Expand Down Expand Up @@ -155,9 +161,27 @@ export default class Main extends Component<MainProps, object> {
)}
/>
<Route
path={ROUTES.CREATE_SM_POLICY}
path={ROUTES.SNAPSHOT_POLICIES}
render={(props: RouteComponentProps) => (
<SMPolicies {...props} snapshotManagementService={services.snapshotManagementService} />
)}
/>
<Route
path={ROUTES.SNAPSHOT_POLICY_DETAILS}
render={(props: RouteComponentProps) => (
<SMPolicyDetails {...props} snapshotManagementService={services.snapshotManagementService} />
)}
/>
<Route
path={ROUTES.CREATE_SNAPSHOT_POLICY}
render={(props: RouteComponentProps) => (
<CreateSMPolicy {...props} snapshotManagementService={services.snapshotManagementService} isEdit={false} />
)}
/>
<Route
path={ROUTES.EDIT_SNAPSHOT_POLICY}
render={(props: RouteComponentProps) => (
<CreateSMPolicy {...props} snapshotManagementService={services.snapshotManagementService} />
<CreateSMPolicy {...props} snapshotManagementService={services.snapshotManagementService} isEdit={true} />
)}
/>
<Route
Expand Down
Loading

0 comments on commit 85078c9

Please sign in to comment.