Skip to content

Commit

Permalink
Fixes sync errors (#6739)
Browse files Browse the repository at this point in the history
## Motivation for features / changes
Recently merged hparam column PRs (#6732, #6733, #6736) will cause build
and lint errors during 1p sync.

## Technical description of changes
- import map from rxjs/operators instead of rxjs
- `DataTableUtils` -> `dataTableUtils`
- use proper string signature on CardStateMap in tests
  • Loading branch information
hoonji authored Feb 1, 2024
1 parent 65e6eb3 commit 933f37a
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions tensorboard/webapp/hparams/_redux/hparams_reducers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
import {Action, ActionReducer, createReducer, on} from '@ngrx/store';
import {DataTableUtils} from '../../widgets/data_table/utils';
import {dataTableUtils} from '../../widgets/data_table/utils';
import {persistentSettingsLoaded} from '../../persistent_settings';
import {Side} from '../../widgets/data_table/types';
import * as actions from './hparams_actions';
Expand Down Expand Up @@ -153,7 +153,7 @@ const reducer: ActionReducer<HparamsState, Action> = createReducer(
actions.dashboardHparamColumnOrderChanged,
(state, {source, destination, side}) => {
const {dashboardDisplayedHparamColumns: columns} = state;
const newColumns = DataTableUtils.moveColumn(
const newColumns = dataTableUtils.moveColumn(
columns,
source,
destination,
Expand Down
4 changes: 2 additions & 2 deletions tensorboard/webapp/hparams/_redux/hparams_reducers_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import * as actions from './hparams_actions';
import {reducers} from './hparams_reducers';
import {buildHparamSpec, buildHparamsState, buildMetricSpec} from './testing';
import {ColumnHeaderType, Side} from '../../widgets/data_table/types';
import {DataTableUtils} from '../../widgets/data_table/utils';
import {persistentSettingsLoaded} from '../../persistent_settings';
import {dataTableUtils} from '../../widgets/data_table/utils';

describe('hparams/_redux/hparams_reducers_test', () => {
describe('#persistentSettingsLoaded', () => {
Expand Down Expand Up @@ -673,7 +673,7 @@ describe('hparams/_redux/hparams_reducers_test', () => {
dashboardDisplayedHparamColumns: fakeColumns,
});
const moveColumnSpy = spyOn(
DataTableUtils,
dataTableUtils,
'moveColumn'
).and.callThrough();

Expand Down
4 changes: 2 additions & 2 deletions tensorboard/webapp/metrics/store/metrics_reducers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ import {
TimeSeriesData,
TimeSeriesLoadable,
} from './metrics_types';
import {DataTableUtils} from '../../widgets/data_table/utils';
import {dataTableUtils} from '../../widgets/data_table/utils';

function buildCardMetadataList(tagMetadata: TagMetadata): CardMetadata[] {
const results: CardMetadata[] = [];
Expand Down Expand Up @@ -1438,7 +1438,7 @@ const reducer = createReducer(
dataTableMode === DataTableMode.RANGE
? [...state.rangeSelectionHeaders]
: [...state.singleSelectionHeaders];
headers = DataTableUtils.moveColumn(headers, source, destination, side);
headers = dataTableUtils.moveColumn(headers, source, destination, side);

if (dataTableMode === DataTableMode.RANGE) {
return {
Expand Down
4 changes: 2 additions & 2 deletions tensorboard/webapp/metrics/store/metrics_selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import {ColumnHeader, DataTableMode} from '../../widgets/data_table/types';
import {Extent} from '../../widgets/line_chart_v2/lib/public_types';
import {memoize} from '../../util/memoize';
import {getDashboardDisplayedHparamColumns} from '../../hparams/_redux/hparams_selectors';
import {DataTableUtils} from '../../widgets/data_table/utils';
import {dataTableUtils} from '../../widgets/data_table/utils';

const selectMetricsState =
createFeatureSelector<MetricsState>(METRICS_FEATURE_KEY);
Expand Down Expand Up @@ -669,6 +669,6 @@ export const getGroupedHeadersForCard = memoize((cardId: string) =>
getColumnHeadersForCard(cardId),
getDashboardDisplayedHparamColumns,
(standardColumns, hparamColumns) =>
DataTableUtils.groupColumns([...standardColumns, ...hparamColumns])
dataTableUtils.groupColumns([...standardColumns, ...hparamColumns])
)
);
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
ColumnHeader,
DataTableMode,
} from '../../../../widgets/data_table/types';
import {map} from 'rxjs';
import {map} from 'rxjs/operators';

function headersWithoutRuns(headers: ColumnHeader[]) {
return headers.filter((header) => header.type !== 'RUN');
Expand Down
4 changes: 2 additions & 2 deletions tensorboard/webapp/runs/store/runs_selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
} from '../../hparams/_redux/hparams_selectors';
import {HparamValue, RunToHparamsAndMetrics} from '../../hparams/types';
import {ColumnHeader, SortingInfo} from '../../widgets/data_table/types';
import {DataTableUtils} from '../../widgets/data_table/utils';
import {dataTableUtils} from '../../widgets/data_table/utils';

const getRunsState = createFeatureSelector<RunsState>(RUNS_FEATURE_KEY);

Expand Down Expand Up @@ -340,6 +340,6 @@ export const getGroupedRunsTableHeaders = createSelector(
}
return newColumn;
});
return DataTableUtils.groupColumns(columns);
return dataTableUtils.groupColumns(columns);
}
);
2 changes: 1 addition & 1 deletion tensorboard/webapp/widgets/data_table/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function groupColumns(columns: ColumnHeader[]): ColumnHeader[] {
return Array.from(headerGroups.values()).flat();
}

export const DataTableUtils = {
export const dataTableUtils = {
moveColumn,
groupColumns,
};
12 changes: 6 additions & 6 deletions tensorboard/webapp/widgets/data_table/utils_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ limitations under the License.
==============================================================================*/

import {ColumnHeaderType, Side} from './types';
import {DataTableUtils} from './utils';
import {dataTableUtils} from './utils';

describe('data table utils', () => {
describe('groupColumns', () => {
Expand Down Expand Up @@ -58,7 +58,7 @@ describe('data table utils', () => {
},
];

expect(DataTableUtils.groupColumns(inputColumns)).toEqual([
expect(dataTableUtils.groupColumns(inputColumns)).toEqual([
{
type: ColumnHeaderType.RUN,
name: 'run',
Expand Down Expand Up @@ -128,7 +128,7 @@ describe('data table utils', () => {
];

it('returns original headers if source is not found', () => {
const moveResult = DataTableUtils.moveColumn(
const moveResult = dataTableUtils.moveColumn(
fakeColumns,
{
type: ColumnHeaderType.HPARAM,
Expand All @@ -149,7 +149,7 @@ describe('data table utils', () => {
});

it('returns original headers if source equals dest', () => {
const moveResult = DataTableUtils.moveColumn(
const moveResult = dataTableUtils.moveColumn(
fakeColumns,
{
type: ColumnHeaderType.HPARAM,
Expand Down Expand Up @@ -190,7 +190,7 @@ describe('data table utils', () => {
},
].forEach(({testDesc, side, expectedResult}) => {
it(`if destination not found, moves source ${testDesc}`, () => {
const moveResult = DataTableUtils.moveColumn(
const moveResult = dataTableUtils.moveColumn(
fakeColumns,
fakeColumns[1],
{
Expand All @@ -207,7 +207,7 @@ describe('data table utils', () => {
});

it('swaps source and destination positions if destination is found', () => {
const moveResult = DataTableUtils.moveColumn(
const moveResult = dataTableUtils.moveColumn(
fakeColumns,
fakeColumns[1],
fakeColumns[0],
Expand Down

0 comments on commit 933f37a

Please sign in to comment.