agama/web/src/index.js
David Díaz c0b134f6db
[web] Update dependencies (2023-11-14) (#866)
Another boring PR for keeping dependencies up-to-date via `npm update` and `npm install @package/name@latest`.  No more `--lockfile-version 2`  because [OBS already supports version 3](2153192f0b/node_modules.py (L342-L343)) as we realized at https://github.com/openSUSE/agama/pull/843

Please, note that this time we manage to get rid of some dependencies which were there because cockpit-starter-kit (see https://github.com/openSUSE/agama/pull/127) but actually not needed anymore. In fact, they are no longer dependencies of starter-kit. Namely, 

* [core-js](https://github.com/zloirock/core-js)
  - As a weird side effect, few tests were _fixed_ to wait a bit for the expected content. Some black magic around _Promise.resolve_, I guess. Honestly, I didn't dig too further on it since waiting for the content is somehow _expected_.
*  [stdio](https://github.com/sgmonda/stdio)
* [sizzle](https://www.npmjs.com/package/sizzle)

Apart from these, [regenerator-runtime](https://github.com/facebook/regenerator) was dropped too because 

> It was added more than a year ago in the context of "Adapt React
> components to the Starter Kit". But probably is no longer needed since
> async functions, ES6 generators, and `yield` JavaScript operator have
> broad support among major browsers.

---

* [web] Update dependencies via `npm update`

* [web] Update icons packages to their latest version

* [web] Update Patternfly libraries to latest version

* [web] Drop core-js dependency

    It was added because of cockpit-starter-kit[1] but they already dropped
    it[2] because
    
    > starter-kit does not use it directly, and none of our derived projects
    > have it.
    
    Thus, in principle it does not make sense to keep it as Agama
dependency.
    
    As weird side-effect, a few test were fixed to "waitFor" the expeced
content.
    
    [1] https://github.com/openSUSE/agama/pull/127/commits/55c75c3379cb3f6ce9305e80918483055a739d71
    [2] 67c1c065e9

* [web] Update fast-sort to its latest version

* [web] Update ippadr.js to its latest version

* [web] Drop regenerator-runtime dependency

    It[1] was added more than a year ago[2] in the context of "Adapt React
    components to the Starter Kit". But probably is no longer needed since
    async functions, ES6 generators, and `yield` JavaScript operator have
    broad support among major browsers.
    
    [1] https://github.com/facebook/regenerator
    [2] https://github.com/openSUSE/agama/pull/127/commits/55c75c3379cb3f6ce9305e80918483055a739d71

* [web] Update sprintf-js to the latest version

* [web] Update typedoc and related dependencies

* [web] Update webpack and related dependencies

* [web] Update stylint and related dependencies

* [web] Update @babel and related dependencies

* [web] Update cspell dev dependencies

* [web] More babel dev dependencies updates

* [web] Update eslint and eslint-config dependencies

* [web] Update eslint-plugin dependencies

* [web] Update jest dependencies

* [web] Update jsdoc dependency

* [web] Update sass dependencies

* [web] Update terser-webpack-plugin

* [web] Drop stdio dev dependency

    It was there because cockpit-starter-kit, which dropped it a year
ago[1][2]

    [1] https://github.com/cockpit-project/starter-kit/pull/590
    [2] https://github.com/cockpit-project/starter-kit/pull/590/commits/6e1fd84c982c0456467f36678e2c754e841992b2

* [web] Drop sizzle dev dependency

    Which came from cockpit-starter-kit. It was dropped there few months
    ago, in Jun 2023[1]
    
    [1] https://github.com/cockpit-project/starter-kit/pull/662/commits/1e4659587508dafb16aa47b9ada42db52a4bec5b

* [web] Update qunit dev dependency to latest version

* [web] Update mini-css-extract-plugin

* [web] Update ajv dev dependency

* [web] Update @testing-library dependencies

* [web] Update @typescript-eslint dependencies

* [web] Update @types/jest

* [web] Adapt FileViewer test

For waiting for the expected content

* [web] Fix NetworkPage test

    Remove a leftover it.only and make examples wait a bit for the expected
content.

* [web] Little improvement in Sidebar test

* [web] Update ProductPage test

For waiting a bit to find the expected content
2023-11-15 17:03:23 +00:00

95 lines
3.8 KiB
JavaScript

/*
* Copyright (c) [2022-2023] SUSE LLC
*
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, contact SUSE LLC.
*
* To contact SUSE LLC about this file by physical or electronic mail, you may
* find current contact information at www.suse.com.
*/
import React from "react";
import { createRoot } from "react-dom/client";
import { HashRouter, Routes, Route } from "react-router-dom";
import { AgamaProviders } from "~/context/agama";
/**
* Import PF base styles before any JSX since components coming from PF may
* import styles dependent on variables and rules previously defined there.
*/
import "@patternfly/patternfly/patternfly-base.scss";
import App from "~/App";
import Main from "~/Main";
import DevServerWrapper from "~/DevServerWrapper";
import { Overview } from "~/components/overview";
import { ProductPage, ProductSelectionPage } from "~/components/product";
import { SoftwarePage } from "~/components/software";
import { ProposalPage as StoragePage, ISCSIPage, DASDPage, ZFCPPage } from "~/components/storage";
import { UsersPage } from "~/components/users";
import { L10nPage } from "~/components/l10n";
import { NetworkPage } from "~/components/network";
import { IssuesPage } from "~/components/core";
/**
* As JSX components might import CSS stylesheets, our styles must be imported
* after them to preserve our overrides (e.g., PF overrides).
*
* Because mini-css-extract-plugin maintains the order of the imported CSS,
* adding the overrides here ensures the overrides will be placed appropriately
* at the end of our stylesheet when it extracts the CSS from dist/index.js
*
* See https://github.com/cockpit-project/starter-kit/blob/aeb81718e75b54e5d50ee450fe2abfbcfa58f5e6/src/index.js
*/
import "~/assets/styles/index.scss";
/**
* When running in the development server add a special login wrapper which
* checks whether the user is authenticated. When building the code outside
* the development server an empty fragment (<></>) is used which is no-op.
* In the production builds the DevServerWrapper code is completely omitted.
*/
const LoginWrapper = (process.env.WEBPACK_SERVE) ? DevServerWrapper : React.Fragment;
const container = document.getElementById("root");
const root = createRoot(container);
root.render(
<LoginWrapper>
<AgamaProviders>
<HashRouter>
<Routes>
<Route path="/" element={<App />}>
<Route path="/" element={<Main />}>
<Route index element={<Overview />} />
<Route path="/overview" element={<Overview />} />
<Route path="/product" element={<ProductPage />} />
<Route path="/l10n" element={<L10nPage />} />
<Route path="/software" element={<SoftwarePage />} />
<Route path="/storage" element={<StoragePage />} />
<Route path="/storage/iscsi" element={<ISCSIPage />} />
<Route path="/storage/dasd" element={<DASDPage />} />
<Route path="/storage/zfcp" element={<ZFCPPage />} />
<Route path="/network" element={<NetworkPage />} />
<Route path="/users" element={<UsersPage />} />
<Route path="/issues" element={<IssuesPage />} />
</Route>
<Route path="products" element={<ProductSelectionPage />} />
</Route>
</Routes>
</HashRouter>
</AgamaProviders>
</LoginWrapper>
);