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

chore(ui): refactored dashboards client API to oats generated types and API #16438

Merged
merged 2 commits into from
Jan 13, 2020

Conversation

asalem1
Copy link
Contributor

@asalem1 asalem1 commented Jan 7, 2020

Closes #16393

Problem

Current API and types are dependent upon deprecated client API

Solution

Refactored the variables to utilize the new oats generated client API

@asalem1 asalem1 requested a review from ebb-tide January 7, 2020 23:35
@@ -81,8 +117,8 @@ export enum ActionTypes {
DeleteDashboardFailed = 'DELETE_DASHBOARD_FAILED',
EditDashboard = 'EDIT_DASHBOARD',
RemoveCell = 'REMOVE_CELL',
AddDashboardLabels = 'ADD_DASHBOARD_LABELS',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unpluralized these to accurately reflect their functionality

@@ -262,6 +298,46 @@ export const createDashboard = () => async (
}
}

export const cloneUtilFunc = async (dash: Dashboard, id: string) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this utility function is based on the client-api:

https://github.com/influxdata/influxdb-client-js/blob/master/src/wrappers/dashboards.ts#L247-L248

My first attempt at this refactor tried to flatten these into a synchronous progression, but the functionality was buggy.

Copy link
Contributor

@ebb-tide ebb-tide left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!


// Constants
import * as copy from 'src/shared/copy/notifications'
import {DEFAULT_DASHBOARD_NAME} from 'src/dashboards/constants/index'

// Types
import {RemoteDataState} from 'src/types'
import {CreateCell} from '@influxdata/influx'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this come from new client as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ll give a shot on Monday morning and if there aren’t any conflict/cascading issues then it’ll be in the PR :)

@@ -38,6 +39,7 @@ export type NewCell = Omit<Cell, 'id' | 'links' | 'dashboardID'>

export interface Dashboard extends Omit<GenDashboard, 'cells'> {
cells: Cell[]
labels: Label[]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@asalem1 asalem1 force-pushed the dashboard-client-chore branch from 684a3c8 to 61cef2c Compare January 13, 2020 15:55
@asalem1 asalem1 merged commit 03335cc into master Jan 13, 2020
@asalem1 asalem1 deleted the dashboard-client-chore branch January 13, 2020 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

refactor(ui): migrate dashboards to generated client
2 participants