<commit_before>// Copyright 2020 The LUCI Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import { Route, Router } from '@vaadin/router';

import './components/page_layout';
import './context/build_state/build_state_provider';
import './context/invocation_state/invocation_state_provider';

const notFoundRoute: Route = {
  path: '/:path*',
  action: async (_ctx, cmd) => {
    await import(
      /* webpackChunkName: "not_found_page" */
      /* webpackPrefetch: true */
      './pages/not_found_page');
    return cmd.component('milo-not-found-page');
  },
};

export const NOT_FOUND_URL = '/ui/not-found';
const BASE_URL = '/ui/';

const appRoot = document.getElementById('app-root');
export const router = new Router(appRoot, {baseUrl: BASE_URL});
router.setRoutes({
  path: '/',
  component: 'milo-page-layout',
  children: [
    {
      path: '/login',
      name: 'login',
      action: async (_ctx, cmd) => {
        await import(
          /* webpackChunkName: "login_page" */
          /* webpackPrefetch: true */
          './pages/login_page');
        return cmd.component('milo-login-page');
      },
    },
    {
      path: '/error',
      name: 'error',
      action: async (_ctx, cmd) => {
        await import(
          /* webpackChunkName: "error_page" */
          /* webpackPrefetch: true */
          './pages/error_page');
        return cmd.component('milo-error-page');
      },
    },
    {
      path: '/',
      component: 'milo-invocation-state-provider',
      children: [
        {
          path: '/inv/:invocation_id',
          name: 'invocation',
          action: async (_ctx, cmd) => {
            await import(
              /* webpackChunkName: "invocation_page" */
              /* webpackPrefetch: true */
              './pages/invocation_page');
            return cmd.component('milo-invocation-page');
          },
          children: [
            {
              path: '/',
              action: (ctx, cmd) => cmd.redirect(router.urlForName('invocation-test-results', ctx.params).slice(BASE_URL.length)),
            },
            {
              path: '/test-results',
              name: 'invocation-test-results',
              action: async (_ctx, cmd) => {
                await import(
                  /* webpackChunkName: "test_results_tab" */
                  /* webpackPrefetch: true */
                  './pages/test_results_tab');
                return cmd.component('milo-test-results-tab');
              },
            },
            {
              path: '/invocation-details',
              name: 'invocation-details',
              action: async (_ctx, cmd) => {
                await import(
                  /* webpackChunkName: "invocation_details_tab" */
                  /* webpackPrefetch: true */
                  './pages/invocation_page/invocation_details_tab');
                return cmd.component('milo-invocation-details-tab');
              },
            },
          ],
        },
        {
          path: '/p/:project/:bucket/:builder/:build_num_or_id',
          component: 'milo-build-state-provider',
          children: [
            {
              path: '/',
              name: 'build',
              action: async (_ctx, cmd) => {<commit_msg>[resultui] add missing 'builders' in build page URL<commit_after>// Copyright 2020 The LUCI Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import { Route, Router } from '@vaadin/router';

import './components/page_layout';
import './context/build_state/build_state_provider';
import './context/invocation_state/invocation_state_provider';

const notFoundRoute: Route = {
  path: '/:path*',
  action: async (_ctx, cmd) => {
    await import(
      /* webpackChunkName: "not_found_page" */
      /* webpackPrefetch: true */
      './pages/not_found_page');
    return cmd.component('milo-not-found-page');
  },
};

export const NOT_FOUND_URL = '/ui/not-found';
const BASE_URL = '/ui/';

const appRoot = document.getElementById('app-root');
export const router = new Router(appRoot, {baseUrl: BASE_URL});
router.setRoutes({
  path: '/',
  component: 'milo-page-layout',
  children: [
    {
      path: '/login',
      name: 'login',
      action: async (_ctx, cmd) => {
        await import(
          /* webpackChunkName: "login_page" */
          /* webpackPrefetch: true */
          './pages/login_page');
        return cmd.component('milo-login-page');
      },
    },
    {
      path: '/error',
      name: 'error',
      action: async (_ctx, cmd) => {
        await import(
          /* webpackChunkName: "error_page" */
          /* webpackPrefetch: true */
          './pages/error_page');
        return cmd.component('milo-error-page');
      },
    },
    {
      path: '/',
      component: 'milo-invocation-state-provider',
      children: [
        {
          path: '/inv/:invocation_id',
          name: 'invocation',
          action: async (_ctx, cmd) => {
            await import(
              /* webpackChunkName: "invocation_page" */
              /* webpackPrefetch: true */
              './pages/invocation_page');
            return cmd.component('milo-invocation-page');
          },
          children: [
            {
              path: '/',
              action: (ctx, cmd) => cmd.redirect(router.urlForName('invocation-test-results', ctx.params).slice(BASE_URL.length)),
            },
            {
              path: '/test-results',
              name: 'invocation-test-results',
              action: async (_ctx, cmd) => {
                await import(
                  /* webpackChunkName: "test_results_tab" */
                  /* webpackPrefetch: true */
                  './pages/test_results_tab');
                return cmd.component('milo-test-results-tab');
              },
            },
            {
              path: '/invocation-details',
              name: 'invocation-details',
              action: async (_ctx, cmd) => {
                await import(
                  /* webpackChunkName: "invocation_details_tab" */
                  /* webpackPrefetch: true */
                  './pages/invocation_page/invocation_details_tab');
                return cmd.component('milo-invocation-details-tab');
              },
            },
          ],
        },
        {
          path: '/p/:project/builders/:bucket/:builder/:build_num_or_id',
          component: 'milo-build-state-provider',
          children: [
            {
              path: '/',
              name: 'build',
              action: async (_ctx, cmd) => {
{'fraction_non_alphanumeric': 0.13844529497162467, 'fraction_numerical': 0.0021116536887950377, 'mean_word_length': 1.8286674132138858, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4652264', 'n_tokens_mistral': 2109, 'n_tokens_neox': 2107, 'n_words': 493}