Skip to content

Commit

Permalink
Web/update lint (#2322)
Browse files Browse the repository at this point in the history
* Updates for eslint-fix run.

* Adding lint to ci check

Co-authored-by: phix <peter.hicks@astronomer.io>
Co-authored-by: Willy Lulciuc <willy@datakin.com>
  • Loading branch information
3 people authored Dec 15, 2022
1 parent bc27201 commit ef68ee5
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 34 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ jobs:
- v1-web-{{ .Branch }}
- run: npm install
- run: npm run test
- run: npm run eslint-fix
- run: npm run build
- save_cache:
paths:
Expand Down
10 changes: 5 additions & 5 deletions web/src/components/core/date-picker/MqDatePicker.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// SPDX-License-Identifier: Apache-2.0

import React from 'react'
import { DateTimePicker } from '@material-ui/pickers'
import { Theme } from '@material-ui/core'
import { alpha } from '@material-ui/core/styles'
import React from 'react'
import createStyles from '@material-ui/core/styles/createStyles'
import withStyles, { WithStyles } from '@material-ui/core/styles/withStyles'
import { DateTimePicker } from '@material-ui/pickers'
import { alpha } from '@material-ui/core/styles'

const styles = (theme: Theme) =>
createStyles({
Expand Down Expand Up @@ -57,7 +57,7 @@ type DatePickerProps = WithStyles<typeof styles> & OwnProps

class MqDatePicker extends React.Component<DatePickerProps> {
render() {
const { classes, value, onChange, label = '', format = "MMM DD yyyy hh:mm a" } = this.props
const { classes, value, onChange, label = '', format = 'MMM DD yyyy hh:mm a' } = this.props
return (
<DateTimePicker
label={label}
Expand All @@ -70,4 +70,4 @@ class MqDatePicker extends React.Component<DatePickerProps> {
}
}

export default withStyles(styles)(MqDatePicker)
export default withStyles(styles)(MqDatePicker)
1 change: 0 additions & 1 deletion web/src/components/jobs/Runs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import RunInfo from './RunInfo'
import RunStatus from './RunStatus'
import transitions from '@material-ui/core/styles/transitions'


const styles = (theme: Theme) => {
return createStyles({
status: {
Expand Down
4 changes: 1 addition & 3 deletions web/src/components/search/SearchPlaceholder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ const styles = (theme: Theme) =>

const importI18next = () => {
const i18next = require('i18next')
return (
i18next
)
return i18next
}

const SearchPlaceholder: React.FC<WithStyles<typeof styles>> = ({ classes }) => {
Expand Down
8 changes: 4 additions & 4 deletions web/src/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ export const formatUpdatedAt = (updatedAt: string) => {
}

export const fileSize = (data: string) => {
const size = encodeURI(data).split(/%..|./).length - 1;
const size = encodeURI(data).split(/%..|./).length - 1
return {
kiloBytes: size / 1024,
megaBytes: (size / 1024) / 1024
kiloBytes: size / 1024,
megaBytes: size / 1024 / 1024
}
}
}
6 changes: 3 additions & 3 deletions web/src/helpers/time.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ export function stopWatchDuration(durationMs: number) {
}

export function formatDatePicker(val: string) {
return moment(val).format("YYYY-MM-DDTHH:mm:ss")
return moment(val).format('YYYY-MM-DDTHH:mm:ss')
}

export function formatDateAPIQuery(val: string) {
return moment(val).format("YYYY-MM-DDTHH:mm:ss[.000Z]")
}
return moment(val).format('YYYY-MM-DDTHH:mm:ss[.000Z]')
}
13 changes: 11 additions & 2 deletions web/src/store/actionCreators/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@

import * as actionTypes from './actionTypes'

import { Event, Dataset, DatasetVersion, Job, LineageGraph, Namespace, Run, Search } from '../../types/api'
import {
Dataset,
DatasetVersion,
Event,
Job,
LineageGraph,
Namespace,
Run,
Search
} from '../../types/api'
import { JobOrDataset } from '../../components/lineage/types'

export const fetchEvents = (after: string, before: string, limit: number) => ({
Expand All @@ -14,7 +23,7 @@ export const fetchEvents = (after: string, before: string, limit: number) => ({
}
})

export const fetchEventsSuccess = (events: Event[]) => ({
export const fetchEventsSuccess = (events: Event[]) => ({
type: actionTypes.FETCH_EVENTS_SUCCESS,
payload: {
events
Expand Down
6 changes: 1 addition & 5 deletions web/src/store/reducers/events.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
// SPDX-License-Identifier: Apache-2.0

import { Event } from '../../types/api'
import {
FETCH_EVENTS,
FETCH_EVENTS_SUCCESS,
RESET_EVENTS
} from '../actionCreators/actionTypes'
import { FETCH_EVENTS, FETCH_EVENTS_SUCCESS, RESET_EVENTS } from '../actionCreators/actionTypes'
import { fetchEventsSuccess } from '../actionCreators'

export type IEventsState = { isLoading: boolean; result: Event[]; init: boolean }
Expand Down
2 changes: 1 addition & 1 deletion web/src/store/reducers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { Reducer, combineReducers } from 'redux'
import { connectRouter } from 'connected-react-router'
import datasetVersions, { IDatasetVersionsState } from './datasetVersions'
import datasets, { IDatasetsState } from './datasets'
import events, { IEventsState } from './events'
import display, { IDisplayState } from './display'
import events, { IEventsState } from './events'
import jobs, { IJobsState } from './jobs'
import lineage, { ILineageState } from './lineage'
import namespaces, { INamespacesState } from './namespaces'
Expand Down
4 changes: 2 additions & 2 deletions web/src/store/requests/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ import { genericFetchWrapper } from './index'
export const getEvents = async (after = '', before = '', limit = 100, sortDirection = 'desc') => {
const url = `${API_URL}/events/lineage?limit=${limit}&before=${before}&after=${after}&sortDirection=${sortDirection}`
return genericFetchWrapper(url, { method: 'GET' }, 'fetchEvents').then((r: Events) => {
return r.events.map((d) => ({ ...d }))
return r.events.map(d => ({ ...d }))
})
}
}
13 changes: 10 additions & 3 deletions web/src/store/sagas/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import * as Effects from 'redux-saga/effects'
import {
FETCH_DATASETS,
FETCH_DATASET_VERSIONS,
FETCH_EVENTS,
FETCH_JOBS,
FETCH_LINEAGE,
FETCH_RUNS,
FETCH_SEARCH,
FETCH_EVENTS
FETCH_SEARCH
} from '../actionCreators/actionTypes'
import { Namespaces } from '../../types/api'
import { all, put, take } from 'redux-saga/effects'
Expand All @@ -26,7 +26,14 @@ import {
fetchRunsSuccess,
fetchSearchSuccess
} from '../actionCreators'
import { getDatasetVersions, getDatasets, getEvents, getJobs, getNamespaces, getRuns } from '../requests'
import {
getDatasetVersions,
getDatasets,
getEvents,
getJobs,
getNamespaces,
getRuns
} from '../requests'
import { getLineage } from '../requests/lineage'
import { getSearch } from '../requests/search'

Expand Down
8 changes: 4 additions & 4 deletions web/src/types/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ export interface Event {
facets: object
}
inputs: {
name: string,
namespace: string,
name: string
namespace: string
facets: object
}[]
outputs: {
name: string,
namespace: string,
name: string
namespace: string
facets: object
}[]
}
Expand Down
2 changes: 1 addition & 1 deletion web/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ export interface IJob extends Job {
latestRuns?: Run[]
}

export type IFilterByDisplay = 'namespace' | 'sourceName'
export type IFilterByDisplay = 'namespace' | 'sourceName'

0 comments on commit ef68ee5

Please sign in to comment.