Skip to content

Commit

Permalink
Merge pull request #102 from newrelic/develop
Browse files Browse the repository at this point in the history
Merging major revision from develop branch
  • Loading branch information
aso1124 authored Oct 29, 2021
2 parents ebd97f1 + 6e934e2 commit f6b32bf
Show file tree
Hide file tree
Showing 54 changed files with 8,488 additions and 4,135 deletions.
23 changes: 0 additions & 23 deletions extended-webpackrc.js

This file was deleted.

8 changes: 5 additions & 3 deletions nerdlets/find-user/components/search-bar/SearchBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import AsyncSelect from 'react-select/async'
import sortBy from 'lodash.sortby'

import { HeadingText, NerdGraphQuery, Stack, StackItem } from 'nr1'
import { FIND_USER_ATTRIBUTE } from '../../../shared/config/MetricConfig'
import { activeEvents } from '../../../shared/config/VideoConfig'
import {
FIND_USER_ATTRIBUTE,
VIDEO_EVENTS,
} from '../../../shared/config/constants'

const searchBar = props => {
const loadData = async searchTerm => {
Expand All @@ -20,7 +22,7 @@ const searchBar = props => {
userCondition += `uniques(${u})`
userClause += `${u} like '%${searchTerm}%'`
})
const nrql = `FROM ${activeEvents()} SELECT ${userCondition} WHERE ${userClause} ${duration.since} LIMIT MAX `
const nrql = `FROM ${VIDEO_EVENTS} SELECT ${userCondition} WHERE ${userClause} ${duration.since} LIMIT MAX `

const query = `{
actor {
Expand Down
4 changes: 2 additions & 2 deletions nerdlets/find-user/components/session/SessionContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from '../../../shared/utils/quality-score'
import QosKpiGrid from '../../../shared/components/qos/QosKpiGrid'
import SessionTable from './SessionTable'
import { FIND_USER_ATTRIBUTE } from '../../../shared/config/MetricConfig'
import { FIND_USER_ATTRIBUTE } from '../../../shared/config/constants'

export default class SessionContainer extends React.Component {
state = {
Expand Down Expand Up @@ -50,7 +50,7 @@ export default class SessionContainer extends React.Component {
if (view.def.qualityScoreStrategy) {
view.qualityScore = metricQualityScore(
view.value,
view.def.threshold.critical,
view.def.threshold ? view.def.threshold.critical : null,
view.def.qualityScoreStrategy
)
}
Expand Down
59 changes: 44 additions & 15 deletions nerdlets/find-user/components/session/SessionTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ import {
} from '../../../shared/utils/date-formatter'
import { getThresholdClass } from '../../../shared/utils/threshold'
import videoConfig from '../../../shared/config/VideoConfig'
import { FIND_USER_ATTRIBUTE } from '../../../shared/config/MetricConfig'
import { activeEvents } from '../../../shared/config/VideoConfig'
import { FIND_USER_ATTRIBUTE, VIDEO_EVENTS } from '../../../shared/config/constants'

export default class SessionTable extends React.Component {
state = {
column_1: TableHeaderCell.SORTING_TYPE.ASCENDING,
column_4: TableHeaderCell.SORTING_TYPE.ASCENDING,
column: 1,
sortingType: TableHeaderCell.SORTING_TYPE.ASCENDING,
}

getViewQualityCount = (views, threshold, above) => {
Expand Down Expand Up @@ -52,8 +51,12 @@ export default class SessionTable extends React.Component {
this.props.chooseSession(session, scope)
}

onSortTable(key, event, sortingData) {
this.setState({ [key]: sortingData.nextSortingType })
onSortTable(column, evt, { nextSortingType }) {
if (column === this.state.column) {
this.setState({ sortingType: nextSortingType })
} else {
this.setState({ column: column, sortingType: nextSortingType })
}
}

shouldComponentUpdate(nextProps, nextState) {
Expand All @@ -66,15 +69,14 @@ export default class SessionTable extends React.Component {
}

render() {

const { accountId, duration, user, sessionViews } = this.props

let userClause = ''
FIND_USER_ATTRIBUTE.forEach(u => {
if (userClause) userClause += ' OR '
userClause += `${u} = '${user}'`
})
const nrql = `FROM ${activeEvents()} SELECT min(timestamp), max(timestamp) WHERE ${userClause} LIMIT MAX ${duration.since} facet viewSession`
const nrql = `FROM ${VIDEO_EVENTS} SELECT min(timestamp), max(timestamp) WHERE ${userClause} LIMIT MAX ${duration.since} facet viewSession`

return (
<NrqlQuery accountId={accountId} query={nrql}>
Expand Down Expand Up @@ -123,24 +125,51 @@ export default class SessionTable extends React.Component {
className="session-table__table-header"
value={({ item }) => item.minTime}
sortable
sortingType={this.state.column_1}
onClick={this.onSortTable.bind(this, 'column_1')}
sortingType={
this.state.column === 1
? this.state.sortingType
: TableHeaderCell.SORTING_TYPE.NONE
}
onClick={this.onSortTable.bind(this, 1)}
>
Start Time
</TableHeaderCell>
<TableHeaderCell className="session-table__table-header">
<TableHeaderCell
className="session-table__table-header"
value={({ item }) => item.maxTime}
sortable
sortingType={
this.state.column === 2
? this.state.sortingType
: TableHeaderCell.SORTING_TYPE.NONE
}
onClick={this.onSortTable.bind(this, 2)}
>
End Time
</TableHeaderCell>
<TableHeaderCell className="session-table__table-header">
<TableHeaderCell
className="session-table__table-header"
value={({ item }) => item.duration}
sortable
sortingType={
this.state.column === 3
? this.state.sortingType
: TableHeaderCell.SORTING_TYPE.NONE
}
onClick={this.onSortTable.bind(this, 3)}
>
Duration
</TableHeaderCell>
<TableHeaderCell
className="session-table__table-header"
value={({ item }) => item.qualityScore}
sortable
sortingType={this.state.column_4}
sortingOrder={0}
onClick={this.onSortTable.bind(this, 'column_4')}
sortingType={
this.state.column === 4
? this.state.sortingType
: TableHeaderCell.SORTING_TYPE.NONE
}
onClick={this.onSortTable.bind(this, 4)}
>
Quality Score
</TableHeaderCell>
Expand Down
Loading

0 comments on commit f6b32bf

Please sign in to comment.