Skip to content

Commit

Permalink
Merge pull request #4852 from jelly/re-use-cockpit-os-relase
Browse files Browse the repository at this point in the history
WebUI: Use Cockpit's os-release implementation
  • Loading branch information
KKoukiou committed Jun 22, 2023
2 parents ddd2883 + 1424858 commit 40445be
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 41 deletions.
7 changes: 3 additions & 4 deletions ui/webui/src/components/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import {
Page,
} from "@patternfly/react-core";

import { read_os_release as readOsRelease } from "os-release.js";

import { AddressContext, LanguageContext } from "./Common.jsx";
import { AnacondaHeader } from "./AnacondaHeader.jsx";
import { AnacondaWizard } from "./AnacondaWizard.jsx";
Expand All @@ -35,7 +37,6 @@ import { PayloadsClient } from "../apis/payloads";

import { readBuildstamp, getIsFinal } from "../helpers/betanag.js";
import { readConf } from "../helpers/conf.js";
import { getOsReleaseByKey } from "../helpers/product.js";

export const Application = () => {
const [address, setAddress] = useState();
Expand Down Expand Up @@ -70,9 +71,7 @@ export const Application = () => {
ex => console.error("Failed to parse anaconda buildstamp file")
);

getOsReleaseByKey("PRETTY_NAME").then(
setPrettyName
);
readOsRelease().then(osRelease => setPrettyName(osRelease.PRETTY_NAME));
}, []);

const onAddNotification = (notificationProps) => {
Expand Down
6 changes: 2 additions & 4 deletions ui/webui/src/components/localization/InstallationLanguage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
} from "@patternfly/react-core";

import { EmptyStatePanel } from "cockpit-components-empty-state.jsx";
import { read_os_release as readOsRelease } from "os-release.js";
import { AddressContext, LanguageContext } from "../Common.jsx";
import { setLocale } from "../../apis/boss.js";

Expand All @@ -53,7 +54,6 @@ import {
setLangCookie
} from "../../helpers/language.js";
import { AnacondaPage } from "../AnacondaPage.jsx";
import { getOsReleaseByKey } from "../../helpers/product.js";

import "./InstallationLanguage.scss";

Expand Down Expand Up @@ -321,9 +321,7 @@ export const InstallationLanguage = ({ idPrefix, setIsFormValid, onAddErrorNotif
const [distributionName, setDistributionName] = useState("");

useEffect(() => {
getOsReleaseByKey("NAME").then(
setDistributionName
);
readOsRelease().then(osRelease => setDistributionName(osRelease.NAME));
}, []);

return (
Expand Down
33 changes: 0 additions & 33 deletions ui/webui/src/helpers/product.js

This file was deleted.

0 comments on commit 40445be

Please sign in to comment.