Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Merge pull request #19 from xtreme-vikram-yadav/plugin-octant-state
Browse files Browse the repository at this point in the history
Add property to hold partial state shared by octant
  • Loading branch information
wwitzel3 authored Jun 3, 2021
2 parents 332848c + 6efe7de commit 1c9c0cf
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
16 changes: 16 additions & 0 deletions plugin/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,22 @@ export type TableFilters = {
};
};

/**
*
* ClientState holds the partial state shared by octant
*/
export type ClientState = {
clientID: () => string;
namespace: () => string;
contextName: () => string;
filters: () => [
{
key: () => string;
value: () => string;
}
]
};

/**
* createPrintResponse generates a PrintResponse
* @param config config will be appended to the Config card of the resource summary
Expand Down
10 changes: 7 additions & 3 deletions plugin/octant.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Component } from "./components/component";
import { FlexLayoutConfig } from "./components/flexlayout";
import { ExtensionConfig } from "./components/extension";
import { PodStatusConfig } from "./components/pod-status";
import { ClientState } from "./helpers";

/**
* Key defines the interface expected for request keys when performing actions using the DashboardClient.
Expand Down Expand Up @@ -41,10 +42,11 @@ export interface LabelSelector {
/**
* ObjectRequest defines the request object passed in to print, tab, and objectStatus handlers.
* @property {object} object - resource of the request, for example a Pod or Deployment
* @property {object} clientState - container for the partial state shared by octant.
*/
export interface ObjectRequest {
readonly clientID: string;
readonly object: any;
readonly clientState: ClientState;
}

export interface PrintResponse {
Expand All @@ -71,20 +73,22 @@ export interface ObjectStatusResponse {
* ActionRequest defines the request object passed in to an action handler.
* @property {string} actionName - name of the action being sent, match this to dispatch to different handlers.
* @property {any} payload - action payload
* @property {object} clientState - container for the partial state shared by octant.
*/
export interface ActionRequest {
readonly clientID: string;
readonly actionName: string;
readonly payload: any;
readonly clientState: ClientState;
}

/**
* ContentRequest defines the request object passed in to a content handler.
* @property {string} contentPath - full content path of the request, parse this to handle child navigation.
* @property {object} clientState - container for the partial state shared by octant.
*/
export interface ContentRequest {
readonly clientID: string;
readonly contentPath: string;
readonly clientState: ClientState;
}

export interface ActionResponse {
Expand Down

0 comments on commit 1c9c0cf

Please sign in to comment.