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

Snapshot management UI #195

Merged
merged 27 commits into from
Jun 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b0c760d
snapshots page base
bowenlan-amzn May 14, 2022
f5b822f
add snapshots to side bar
bowenlan-amzn May 14, 2022
eaf9e60
breadcrumb for snapshots
bowenlan-amzn May 14, 2022
30f520a
backend cat snapshot works
bowenlan-amzn May 15, 2022
72f5c23
frontend page connect with server get snapshots
bowenlan-amzn May 15, 2022
c25395a
snapshot basic table
bowenlan-amzn May 16, 2022
1316483
Working on Snapshots table get snapshots, pagination
bowenlan-amzn May 30, 2022
2dc1b79
Snapshots table pagination sorting done
bowenlan-amzn May 30, 2022
0b7aaaa
Snapshots table uses in-meemory table, add filter for repo
bowenlan-amzn May 30, 2022
4d4ee05
Create snapshot form ongoing
bowenlan-amzn May 31, 2022
72e5ce8
Create snapshot form view finished
bowenlan-amzn May 31, 2022
7b1e394
Add create SM policy
bowenlan-amzn May 31, 2022
85078c9
Refactor create policy after policy details page link to edit policy
bowenlan-amzn Jun 1, 2022
e8aa7ed
Snapshot detail flyout, add buttons to snapshot policies table
bowenlan-amzn Jun 2, 2022
ebe066c
Wrapping up on create policy form
bowenlan-amzn Jun 14, 2022
059c73b
Wrapping repository pages
bowenlan-amzn Jun 16, 2022
a47e816
Got the advanced settings drop down
bowenlan-amzn Jun 16, 2022
a0aeff6
Finish mostly, left details
bowenlan-amzn Jun 17, 2022
7281025
Ready for demo
bowenlan-amzn Jun 17, 2022
747c286
Refactor the dir structure
bowenlan-amzn Jun 18, 2022
8e0236a
Beautiful refactor
bowenlan-amzn Jun 19, 2022
967ff1c
Address feature review comments
bowenlan-amzn Jun 22, 2022
4cfb667
Address comments
bowenlan-amzn Jun 22, 2022
8fff027
Address comments
bowenlan-amzn Jun 22, 2022
2691741
Address comments
bowenlan-amzn Jun 23, 2022
dffd9f2
Add notification part
bowenlan-amzn Jun 23, 2022
fca9dd9
Clean up sm dev logs
bowenlan-amzn Jun 23, 2022
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
98 changes: 98 additions & 0 deletions models/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

// TODO: Backend has PR out to change this model, this needs to be updated once that goes through

import { long } from "@opensearch-project/opensearch/api/types";
import { ActionType } from "../public/pages/VisualCreatePolicy/utils/constants";

export interface ManagedIndexMetaData {
Expand Down Expand Up @@ -78,16 +79,113 @@ export interface Policy {
schema_version?: number;
}

export interface DocumentSMPolicy {
id: string;
seqNo: number;
primaryTerm: number;
policy: SMPolicy;
}

export interface DocumentSMPolicyWithMetadata {
id: string;
seqNo: number;
primaryTerm: number;
policy: SMPolicy;
metadata: SMMetadata;
}

export interface SMMetadata {
name: string;
creation?: SMWorkflowMetadata;
deletion?: SMWorkflowMetadata;
policy_seq_no?: number;
policy_primary_term?: number;
enabled: boolean;
}

export interface SMWorkflowMetadata {
trigger: {
time: number;
};
started: string[];
latest_execution: {
status: string;
start_time: long;
end_time?: long;
info?: {
message?: string;
cause?: string;
};
};
}

export interface SMPolicy {
name: string;
description: string;
creation: SMCreation;
deletion?: SMDeletion;
snapshot_config: SMSnapshotConfig;
enabled: boolean;
last_updated_time?: number;
notification?: Notification;
}

export interface Snapshot {
indices: string;
ignore_unavailable: boolean;
include_global_state: boolean;
partial: boolean;
metadata?: object;
}

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

export interface SMCreation {
schedule: Cron;
time_limit?: string;
}

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

export interface SMDeleteCondition {
max_count?: number;
max_age?: string;
min_count?: number;
}

export interface ErrorNotification {
destination?: Destination;
channel?: Channel;
message_template: MessageTemplate;
}

export interface Notification {
channel: Channel;
conditions?: SMNotificationCondition;
}

export interface Channel {
id: string;
}

export interface SMNotificationCondition {
creation?: boolean;
deletion?: boolean;
failure?: boolean;
time_limit_exceeded?: boolean;
}

export interface Destination {
chime?: {
url: string;
Expand Down
39 changes: 39 additions & 0 deletions public/components/CustomLabel/CustomLabel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import { EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiText } from "@elastic/eui";
import React from "react";

interface CustomLabelProps {
title: string;
isOptional?: boolean;
helpText?: string | JSX.Element;
}

const CustomLabel = ({ title, isOptional = false, helpText }: CustomLabelProps) => (
<>
<EuiFlexGroup gutterSize="xs">
<EuiFlexItem grow={false}>
<EuiText size="xs">
<h4>{title}</h4>
</EuiText>
</EuiFlexItem>

{isOptional ? (
<EuiFlexItem>
<EuiText size="xs" color="subdued">
<i> - optional</i>
</EuiText>
</EuiFlexItem>
) : null}
</EuiFlexGroup>

{helpText && typeof helpText === "string" ? <span style={{ fontWeight: 200, fontSize: "12px" }}>{helpText}</span> : helpText}

<EuiSpacer size="s" />
</>
);

export default CustomLabel;
8 changes: 8 additions & 0 deletions public/components/CustomLabel/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import CustomLabel from "./CustomLabel";

export default CustomLabel;
12 changes: 11 additions & 1 deletion public/index_management_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
TransformService,
NotificationService,
ServicesContext,
SnapshotManagementService,
} from "./services";
import { DarkModeContext } from "./components/DarkMode";
import Main from "./pages/Main";
Expand All @@ -30,7 +31,16 @@ export function renderApp(coreStart: CoreStart, params: AppMountParameters) {
const rollupService = new RollupService(http);
const transformService = new TransformService(http);
const notificationService = new NotificationService(http);
const services = { indexService, managedIndexService, policyService, rollupService, transformService, notificationService };
const snapshotManagementService = new SnapshotManagementService(http);
const services = {
indexService,
managedIndexService,
policyService,
rollupService,
transformService,
notificationService,
snapshotManagementService,
};

const isDarkMode = coreStart.uiSettings.get("theme:darkMode") || false;

Expand Down
44 changes: 43 additions & 1 deletion public/models/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { IndexService, ManagedIndexService, PolicyService, RollupService, TransformService, NotificationService } from "../services";
import { Direction, Query } from "@elastic/eui";
import { SMPolicy } from "../../models/interfaces";
import {
IndexService,
ManagedIndexService,
PolicyService,
RollupService,
TransformService,
NotificationService,
SnapshotManagementService,
} from "../services";

export interface BrowserServices {
indexService: IndexService;
Expand All @@ -12,4 +22,36 @@ export interface BrowserServices {
rollupService: RollupService;
transformService: TransformService;
notificationService: NotificationService;
snapshotManagementService: SnapshotManagementService;
}

export interface SMPoliciesQueryParams {
from: number;
size: number;
sortField: keyof SMPolicy;
sortOrder: Direction;
}

interface ArgsWithQuery {
query: Query;
queryText: string;
error: null;
}
interface ArgsWithError {
query: null;
queryText: string;
error: Error;
}
export type OnSearchChangeArgs = ArgsWithQuery | ArgsWithError;

export interface LatestActivities {
activityType: "Creation" | "Deletion";
status?: string;
snapshot?: string;
start_time?: number;
end_time?: number;
info?: {
message?: string;
cause?: string;
};
}
Loading