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

[8] VDisk page (frontend) #24

Open
wants to merge 3 commits into
base: 4-nodelist-frontend
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ Bob Management GUI changelog
- Node list page, backend (#19)
- Home page, frontend (#22)
- Node list page, frontend (#23)
- VDisk list page, backend (#20)
153 changes: 96 additions & 57 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,65 @@ paths:
description: Node Not Found
security:
- api_key: []
/api/v1/vdisks/list:
get:
tags:
- services::api
summary: Returns simple list of all known vdisks
description: |-
Returns simple list of all known vdisks

# Errors

This function will return an error if a call to the primary node will fail
operationId: get_vdisks_list
responses:
'200':
description: Simple Node List
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/dto.VDisk'
'401':
description: Unauthorized
security:
- api_key: []
/api/v1/vdisks/{vdisk_id}:
get:
tags:
- services::api
summary: Returns vdisk inforamtion by their id
description: |-
Returns vdisk inforamtion by their id

# Errors

This function will return an error if a call to the main node will fail or vdisk with
specified id not found
operationId: get_vdisk_info
parameters:
- name: vdisk_id
in: path
required: true
schema:
type: integer
format: int64
minimum: 0
responses:
'200':
description: VDisk Inforamtion
content:
application/json:
schema:
$ref: '#/components/schemas/VDisk'
'401':
description: Unauthorized
'404':
description: VDisk not found
security:
- api_key: []
components:
schemas:
BobConnectionData:
Expand Down Expand Up @@ -310,26 +369,26 @@ components:
type: object
description: Disk count by their status
required:
- good
- bad
- offline
- Good
- Bad
- Offline
properties:
bad:
Bad:
type: integer
format: int64
minimum: 0
good:
Good:
type: integer
format: int64
minimum: 0
offline:
Offline:
type: integer
format: int64
minimum: 0
example:
bad: 0
good: 0
offline: 0
Bad: 0
Good: 0
Offline: 0
DiskProblem:
type: string
description: Defines kind of problem on disk
Expand All @@ -344,7 +403,7 @@ components:
status:
type: string
enum:
- good
- Good
- type: object
required:
- status
Expand All @@ -362,15 +421,15 @@ components:
status:
type: string
enum:
- bad
- Bad
- type: object
required:
- status
properties:
status:
type: string
enum:
- offline
- Offline
description: |-
Defines disk status

Expand All @@ -382,9 +441,9 @@ components:
type: string
description: Defines disk status names
enum:
- good
- bad
- offline
- Good
- Bad
- Offline
Hostname:
type: string
MetricsEntryModel:
Expand Down Expand Up @@ -423,26 +482,26 @@ components:
type: object
description: Node count by their status
required:
- good
- bad
- offline
- Good
- Bad
- Offline
properties:
bad:
Bad:
type: integer
format: int64
minimum: 0
good:
Good:
type: integer
format: int64
minimum: 0
offline:
Offline:
type: integer
format: int64
minimum: 0
example:
bad: 0
good: 0
offline: 0
Bad: 0
Good: 0
Offline: 0
NodeInfo:
type: object
required:
Expand Down Expand Up @@ -497,7 +556,7 @@ components:
status:
type: string
enum:
- good
- Good
- type: object
required:
- status
Expand All @@ -515,15 +574,15 @@ components:
status:
type: string
enum:
- bad
- Bad
- type: object
required:
- status
properties:
status:
type: string
enum:
- offline
- Offline
description: |-
Defines status of node

Expand All @@ -536,9 +595,9 @@ components:
type: string
description: Defines node status names
enum:
- good
- bad
- offline
- Good
- Bad
- Offline
Operation:
type: string
description: Types of operations on BOB cluster
Expand Down Expand Up @@ -629,7 +688,7 @@ components:
status:
type: string
enum:
- good
- Good
- type: object
required:
- status
Expand All @@ -647,7 +706,7 @@ components:
status:
type: string
enum:
- offline
- Offline
description: |-
Replica status. It's either good or offline with the reasons why it is offline

Expand Down Expand Up @@ -1021,36 +1080,16 @@ components:
status:
$ref: '#/components/schemas/VDiskStatus'
VDiskStatus:
oneOf:
- type: object
required:
- status
properties:
status:
type: string
enum:
- good
- type: object
required:
- status
properties:
status:
type: string
enum:
- bad
- type: object
required:
- status
properties:
status:
type: string
enum:
- offline
type: string
description: |-
Virtual disk status.

Variants - Virtual Disk status
status == 'bad' when at least one of its replicas has problems
enum:
- Good
- Bad
- Offline
dto.Node:
type: object
required:
Expand Down
2 changes: 2 additions & 0 deletions backend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ impl Modify for SecurityAddon {
services::api::raw_configuration_by_node,
services::api::get_node_info,
services::api::get_nodes_list,
services::api::get_vdisk_info,
services::api::get_vdisks_list,
),
components(
schemas(models::shared::Credentials, models::shared::Hostname, models::shared::BobConnectionData,
Expand Down
16 changes: 2 additions & 14 deletions backend/src/models/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,8 @@ pub enum DiskProblem {
#[cfg_attr(all(feature = "swagger", debug_assertions), derive(ToSchema))]
#[tsync]
pub enum DiskStatus {
#[serde(rename = "good")]
Good,
#[serde(rename = "bad")]
Bad { problems: Vec<DiskProblem> },
#[serde(rename = "offline")]
Offline,
}

Expand All @@ -82,7 +79,6 @@ impl DiskStatus {

/// Defines disk status names
#[derive(Debug, Clone, Eq, PartialEq, Serialize, Hash, EnumIter)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(all(feature = "swagger", debug_assertions), derive(ToSchema))]
#[tsync]
pub enum DiskStatusName {
Expand Down Expand Up @@ -190,11 +186,8 @@ impl NodeProblem {
#[cfg_attr(all(feature = "swagger", debug_assertions), derive(ToSchema))]
#[tsync]
pub enum NodeStatus {
#[serde(rename = "good")]
Good,
#[serde(rename = "bad")]
Bad { problems: Vec<NodeProblem> },
#[serde(rename = "offline")]
Offline,
}

Expand Down Expand Up @@ -227,7 +220,6 @@ impl TypedMetrics {

/// Defines node status names
#[derive(Debug, Clone, Eq, PartialEq, Serialize, Hash, EnumIter)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(all(feature = "swagger", debug_assertions), derive(ToSchema))]
#[tsync]
pub enum NodeStatusName {
Expand Down Expand Up @@ -273,9 +265,7 @@ pub enum ReplicaProblem {
#[cfg_attr(all(feature = "swagger", debug_assertions), derive(ToSchema))]
#[tsync]
pub enum ReplicaStatus {
#[serde(rename = "good")]
Good,
#[serde(rename = "offline")]
Offline { problems: Vec<ReplicaProblem> },
}

Expand Down Expand Up @@ -330,6 +320,7 @@ impl Add for SpaceInfo {
/// Virtual disk Component
#[derive(Debug, Clone, Eq, PartialEq, Serialize)]
#[cfg_attr(all(feature = "swagger", debug_assertions), derive(ToSchema))]
#[tsync]
pub struct VDisk {
pub id: u64,

Expand All @@ -347,17 +338,14 @@ pub struct VDisk {
/// Variants - Virtual Disk status
/// status == 'bad' when at least one of its replicas has problems
#[derive(Debug, Clone, Eq, PartialEq, Serialize)]
#[serde(tag = "status")]
// #[serde(tag = "status")]
#[cfg_attr(all(feature = "swagger", debug_assertions), derive(ToSchema))]
#[tsync]
// #[cfg_attr(all(feature = "swagger", debug_assertions),
// schema(example = json!({"status": "good"})))]
pub enum VDiskStatus {
#[serde(rename = "good")]
Good,
#[serde(rename = "bad")]
Bad,
#[serde(rename = "offline")]
Offline,
}

Expand Down
Loading
Loading