• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2024 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17import {LogEntry, LogHeader} from 'viewers/common/ui_data_log';
18
19export class UiData {
20  currentSearches: CurrentSearch[] = [];
21  savedSearches: ListedSearch[] = [];
22  recentSearches: ListedSearch[] = [];
23  lastTraceFailed = false;
24  initialized = false;
25  searchViews: string[] = [];
26
27  static createEmpty() {
28    return new UiData();
29  }
30}
31
32export class CurrentSearch {
33  constructor(
34    readonly uid: number,
35    public query?: string,
36    public result?: SearchResult,
37  ) {}
38}
39
40export class SearchResult {
41  selectedIndex: undefined | number;
42  scrollToIndex: undefined | number;
43  currentIndex: undefined | number;
44  isFetchingData = false;
45
46  constructor(readonly headers: LogHeader[], readonly entries: LogEntry[]) {}
47}
48
49export class ListedSearch {
50  readonly timeMs: number;
51  constructor(readonly query: string, readonly name = query) {
52    this.timeMs = Date.now();
53  }
54}
55