зеркало из https://github.com/Azure/ipam.git
Fixed tons of linter warnings by removing uneeded dependencies and unused variables
This commit is contained in:
Родитель
c607716610
Коммит
32994a5c17
|
@ -9,8 +9,8 @@ http {
|
|||
}
|
||||
|
||||
upstream engine {
|
||||
server ipam-engine-dev;
|
||||
server ipam-engine-dev:8080 backup;
|
||||
server ipam-engine-dev max_fails=5;
|
||||
server ipam-engine-dev:8080 backup max_fails=5;
|
||||
}
|
||||
|
||||
server {
|
||||
|
|
|
@ -2,7 +2,7 @@ import * as React from "react";
|
|||
import { styled } from '@mui/material/styles';
|
||||
|
||||
import { useMsal } from "@azure/msal-react";
|
||||
import { InteractionRequiredAuthError, InteractionStatus } from "@azure/msal-browser";
|
||||
import { InteractionRequiredAuthError } from "@azure/msal-browser";
|
||||
import { callMsGraphUsersFilter } from "../../msal/graph";
|
||||
|
||||
import { useSnackbar } from 'notistack';
|
||||
|
@ -93,7 +93,7 @@ const gridStyle = {
|
|||
};
|
||||
|
||||
export default function Administration() {
|
||||
const { instance, inProgress, accounts } = useMsal();
|
||||
const { instance, accounts } = useMsal();
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
|
||||
const [admins, setAdmins] = React.useState(null);
|
||||
|
@ -107,6 +107,8 @@ export default function Administration() {
|
|||
const [selected, setSelected] = React.useState(null);
|
||||
const [sending, setSending] = React.useState(false);
|
||||
|
||||
const adminLoadedRef = React.useRef(false);
|
||||
|
||||
const columns = [
|
||||
{ name: "name", header: "Name", lockable: false, defaultFlex: 0.5 },
|
||||
{ name: "email", header: "Email", lockable: false, defaultFlex: 1 },
|
||||
|
@ -126,7 +128,11 @@ export default function Administration() {
|
|||
const unchanged = isEqual(admins, loadedAdmins);
|
||||
|
||||
React.useEffect(() => {
|
||||
refreshData();
|
||||
if(!adminLoadedRef.current) {
|
||||
adminLoadedRef.current = true;
|
||||
|
||||
refreshData();
|
||||
}
|
||||
}, []);
|
||||
|
||||
React.useEffect(() => {
|
||||
|
@ -218,7 +224,7 @@ export default function Administration() {
|
|||
try {
|
||||
setSending(true);
|
||||
const response = await instance.acquireTokenSilent(request);
|
||||
const data = await replaceAdmins(response.accessToken, admins);
|
||||
await replaceAdmins(response.accessToken, admins);
|
||||
enqueueSnackbar("Successfully updated admins", { variant: "success" });
|
||||
refreshData();
|
||||
} catch (e) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import SvgIcon from '@mui/material/SvgIcon';
|
||||
import { alpha, styled } from '@mui/material/styles';
|
||||
// import { alpha, styled } from '@mui/material/styles';
|
||||
import TreeView from '@mui/lab/TreeView';
|
||||
import TreeItem, { treeItemClasses } from '@mui/lab/TreeItem';
|
||||
import Collapse from '@mui/material/Collapse';
|
||||
|
@ -11,10 +11,10 @@ import { Typography } from '@mui/material';
|
|||
import { useSpring, animated } from '@react-spring/web';
|
||||
|
||||
import Space from "../../img/Space";
|
||||
import Block from "../../img/Block";
|
||||
import VNet from "../../img/VNet";
|
||||
import Subnet from "../../img/Subnet";
|
||||
import Endpoint from "../../img/Endpoint";
|
||||
// import Block from "../../img/Block";
|
||||
// import VNet from "../../img/VNet";
|
||||
// import Subnet from "../../img/Subnet";
|
||||
// import Endpoint from "../../img/Endpoint";
|
||||
|
||||
function MinusSquare(props) {
|
||||
return (
|
||||
|
|
|
@ -56,7 +56,7 @@ export default function AddBlock(props) {
|
|||
try {
|
||||
setSending(true);
|
||||
const response = await instance.acquireTokenSilent(request);
|
||||
const data = await createBlock(response.accessToken, space, body);
|
||||
await createBlock(response.accessToken, space, body);
|
||||
refresh();
|
||||
onCancel();
|
||||
} catch (e) {
|
||||
|
|
|
@ -32,7 +32,7 @@ export default function ConfirmDelete(props) {
|
|||
const { open, handleClose, space, block, refresh } = props;
|
||||
|
||||
const { instance, accounts } = useMsal();
|
||||
const { enqueueSnackbar, closeSnackbar } = useSnackbar();
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
|
||||
const [force, setForce] = React.useState(false);
|
||||
const [verify, setVerify] = React.useState(false);
|
||||
|
@ -55,7 +55,7 @@ export default function ConfirmDelete(props) {
|
|||
try {
|
||||
setSending(true);
|
||||
const response = await instance.acquireTokenSilent(request);
|
||||
const data = await deleteBlock(response.accessToken, space, block, force);
|
||||
await deleteBlock(response.accessToken, space, block, force);
|
||||
refresh();
|
||||
handleCancel();
|
||||
} catch (e) {
|
||||
|
|
|
@ -68,7 +68,7 @@ export default function EditReservations(props) {
|
|||
const [sending, setSending] = React.useState(false);
|
||||
const [refreshing, setRefreshing] = React.useState(false);
|
||||
|
||||
const empty = selectionModel.length == 0;
|
||||
const empty = selectionModel.length === 0;
|
||||
|
||||
const timer = React.useRef();
|
||||
|
||||
|
@ -188,7 +188,7 @@ export default function EditReservations(props) {
|
|||
}, [block]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if(copied != "") {
|
||||
if(copied !== "") {
|
||||
clearTimeout(timer.current);
|
||||
|
||||
timer.current = setTimeout(
|
||||
|
@ -247,7 +247,7 @@ export default function EditReservations(props) {
|
|||
try {
|
||||
setSending(true);
|
||||
const response = await instance.acquireTokenSilent(request);
|
||||
const data = await deleteBlockResvs(response.accessToken, space, block, selectionModel);
|
||||
await deleteBlockResvs(response.accessToken, space, block, selectionModel);
|
||||
handleClose();
|
||||
enqueueSnackbar("Successfully deleted IP Block reservations", { variant: "success" });
|
||||
refreshData();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as React from "react";
|
||||
import { styled } from "@mui/material/styles";
|
||||
|
||||
import { isEqual, unset } from 'lodash';
|
||||
import { isEqual } from 'lodash';
|
||||
|
||||
import { useSnackbar } from "notistack";
|
||||
|
||||
|
@ -158,7 +158,7 @@ export default function EditVnets(props) {
|
|||
try {
|
||||
setSending(true);
|
||||
const response = await instance.acquireTokenSilent(request);
|
||||
const data = await replaceBlockNetworks(response.accessToken, space, block.name, selectionModel);
|
||||
await replaceBlockNetworks(response.accessToken, space, block.name, selectionModel);
|
||||
handleClose();
|
||||
enqueueSnackbar("Successfully updated IP Block vNets", { variant: "success" });
|
||||
refresh();
|
||||
|
|
|
@ -84,7 +84,7 @@ export default function BlockDataGrid(props) {
|
|||
|
||||
React.useEffect(() => {
|
||||
if(selected) {
|
||||
if(selected.name != previous) {
|
||||
if(selected.name !== previous) {
|
||||
setSelectionModel([]);
|
||||
}
|
||||
|
||||
|
|
|
@ -66,16 +66,16 @@ export default function ConfigureIPAM() {
|
|||
const [refreshing, setRefreshing] = React.useState(false);
|
||||
const [selectedSpace, setSelectedSpace] = React.useState(null);
|
||||
|
||||
const configLoadedRef = React.useRef(false);
|
||||
|
||||
const spaces = useSelector(selectSpaces);
|
||||
|
||||
const dispatch = useDispatch();
|
||||
|
||||
var loaded = false;
|
||||
|
||||
React.useEffect(() => {
|
||||
if(!loaded) {
|
||||
if(!configLoadedRef.current) {
|
||||
refresh();
|
||||
loaded = true;
|
||||
configLoadedRef.current = true;
|
||||
}
|
||||
}, []);
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ export default function AddSpace(props) {
|
|||
try {
|
||||
setSending(true);
|
||||
const response = await instance.acquireTokenSilent(request);
|
||||
const data = await createSpace(response.accessToken, body);
|
||||
await createSpace(response.accessToken, body);
|
||||
setSpaceName({ value: "", error: false });
|
||||
setDescription({ value: "", error: false });
|
||||
refresh();
|
||||
|
|
|
@ -55,7 +55,7 @@ export default function ConfirmDelete(props) {
|
|||
try {
|
||||
setSending(true);
|
||||
const response = await instance.acquireTokenSilent(request);
|
||||
const data = await deleteSpace(response.accessToken, space, force);
|
||||
await deleteSpace(response.accessToken, space, force);
|
||||
refresh();
|
||||
handleCancel();
|
||||
} catch (e) {
|
||||
|
|
|
@ -80,7 +80,7 @@ export default function EditSpace(props) {
|
|||
try {
|
||||
setSending(true);
|
||||
const response = await instance.acquireTokenSilent(request);
|
||||
const data = await updateSpace(response.accessToken, space.name, body);
|
||||
await updateSpace(response.accessToken, space.name, body);
|
||||
refresh();
|
||||
onCancel();
|
||||
} catch (e) {
|
||||
|
|
|
@ -790,131 +790,3 @@ export default function NavDrawer() {
|
|||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
|
||||
// Top 100 films as rated by IMDb users. http://www.imdb.com/chart/top
|
||||
const top100Films = [
|
||||
{ title: 'The Shawshank Redemption', year: 1994 },
|
||||
{ title: 'The Godfather', year: 1972 },
|
||||
{ title: 'The Godfather: Part II', year: 1974 },
|
||||
{ title: 'The Dark Knight', year: 2008 },
|
||||
{ title: '12 Angry Men', year: 1957 },
|
||||
{ title: "Schindler's List", year: 1993 },
|
||||
{ title: 'Pulp Fiction', year: 1994 },
|
||||
{
|
||||
title: 'The Lord of the Rings: The Return of the King',
|
||||
year: 2003,
|
||||
},
|
||||
{ title: 'The Good, the Bad and the Ugly', year: 1966 },
|
||||
{ title: 'Fight Club', year: 1999 },
|
||||
{
|
||||
title: 'The Lord of the Rings: The Fellowship of the Ring',
|
||||
year: 2001,
|
||||
},
|
||||
{
|
||||
title: 'Star Wars: Episode V - The Empire Strikes Back',
|
||||
year: 1980,
|
||||
},
|
||||
{ title: 'Forrest Gump', year: 1994 },
|
||||
{ title: 'Inception', year: 2010 },
|
||||
{
|
||||
title: 'The Lord of the Rings: The Two Towers',
|
||||
year: 2002,
|
||||
},
|
||||
{ title: "One Flew Over the Cuckoo's Nest", year: 1975 },
|
||||
{ title: 'Goodfellas', year: 1990 },
|
||||
{ title: 'The Matrix', year: 1999 },
|
||||
{ title: 'Seven Samurai', year: 1954 },
|
||||
{
|
||||
title: 'Star Wars: Episode IV - A New Hope',
|
||||
year: 1977,
|
||||
},
|
||||
{ title: 'City of God', year: 2002 },
|
||||
{ title: 'Se7en', year: 1995 },
|
||||
{ title: 'The Silence of the Lambs', year: 1991 },
|
||||
{ title: "It's a Wonderful Life", year: 1946 },
|
||||
{ title: 'Life Is Beautiful', year: 1997 },
|
||||
{ title: 'The Usual Suspects', year: 1995 },
|
||||
{ title: 'Léon: The Professional', year: 1994 },
|
||||
{ title: 'Spirited Away', year: 2001 },
|
||||
{ title: 'Saving Private Ryan', year: 1998 },
|
||||
{ title: 'Once Upon a Time in the West', year: 1968 },
|
||||
{ title: 'American History X', year: 1998 },
|
||||
{ title: 'Interstellar', year: 2014 },
|
||||
{ title: 'Casablanca', year: 1942 },
|
||||
{ title: 'City Lights', year: 1931 },
|
||||
{ title: 'Psycho', year: 1960 },
|
||||
{ title: 'The Green Mile', year: 1999 },
|
||||
{ title: 'The Intouchables', year: 2011 },
|
||||
{ title: 'Modern Times', year: 1936 },
|
||||
{ title: 'Raiders of the Lost Ark', year: 1981 },
|
||||
{ title: 'Rear Window', year: 1954 },
|
||||
{ title: 'The Pianist', year: 2002 },
|
||||
{ title: 'The Departed', year: 2006 },
|
||||
{ title: 'Terminator 2: Judgment Day', year: 1991 },
|
||||
{ title: 'Back to the Future', year: 1985 },
|
||||
{ title: 'Whiplash', year: 2014 },
|
||||
{ title: 'Gladiator', year: 2000 },
|
||||
{ title: 'Memento', year: 2000 },
|
||||
{ title: 'The Prestige', year: 2006 },
|
||||
{ title: 'The Lion King', year: 1994 },
|
||||
{ title: 'Apocalypse Now', year: 1979 },
|
||||
{ title: 'Alien', year: 1979 },
|
||||
{ title: 'Sunset Boulevard', year: 1950 },
|
||||
{
|
||||
title: 'Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb',
|
||||
year: 1964,
|
||||
},
|
||||
{ title: 'The Great Dictator', year: 1940 },
|
||||
{ title: 'Cinema Paradiso', year: 1988 },
|
||||
{ title: 'The Lives of Others', year: 2006 },
|
||||
{ title: 'Grave of the Fireflies', year: 1988 },
|
||||
{ title: 'Paths of Glory', year: 1957 },
|
||||
{ title: 'Django Unchained', year: 2012 },
|
||||
{ title: 'The Shining', year: 1980 },
|
||||
{ title: 'WALL·E', year: 2008 },
|
||||
{ title: 'American Beauty', year: 1999 },
|
||||
{ title: 'The Dark Knight Rises', year: 2012 },
|
||||
{ title: 'Princess Mononoke', year: 1997 },
|
||||
{ title: 'Aliens', year: 1986 },
|
||||
{ title: 'Oldboy', year: 2003 },
|
||||
{ title: 'Once Upon a Time in America', year: 1984 },
|
||||
{ title: 'Witness for the Prosecution', year: 1957 },
|
||||
{ title: 'Das Boot', year: 1981 },
|
||||
{ title: 'Citizen Kane', year: 1941 },
|
||||
{ title: 'North by Northwest', year: 1959 },
|
||||
{ title: 'Vertigo', year: 1958 },
|
||||
{
|
||||
title: 'Star Wars: Episode VI - Return of the Jedi',
|
||||
year: 1983,
|
||||
},
|
||||
{ title: 'Reservoir Dogs', year: 1992 },
|
||||
{ title: 'Braveheart', year: 1995 },
|
||||
{ title: 'M', year: 1931 },
|
||||
{ title: 'Requiem for a Dream', year: 2000 },
|
||||
{ title: 'Amélie', year: 2001 },
|
||||
{ title: 'A Clockwork Orange', year: 1971 },
|
||||
{ title: 'Like Stars on Earth', year: 2007 },
|
||||
{ title: 'Taxi Driver', year: 1976 },
|
||||
{ title: 'Lawrence of Arabia', year: 1962 },
|
||||
{ title: 'Double Indemnity', year: 1944 },
|
||||
{
|
||||
title: 'Eternal Sunshine of the Spotless Mind',
|
||||
year: 2004,
|
||||
},
|
||||
{ title: 'Amadeus', year: 1984 },
|
||||
{ title: 'To Kill a Mockingbird', year: 1962 },
|
||||
{ title: 'Toy Story 3', year: 2010 },
|
||||
{ title: 'Logan', year: 2017 },
|
||||
{ title: 'Full Metal Jacket', year: 1987 },
|
||||
{ title: 'Dangal', year: 2016 },
|
||||
{ title: 'The Sting', year: 1973 },
|
||||
{ title: '2001: A Space Odyssey', year: 1968 },
|
||||
{ title: "Singin' in the Rain", year: 1952 },
|
||||
{ title: 'Toy Story', year: 1995 },
|
||||
{ title: 'Bicycle Thieves', year: 1948 },
|
||||
{ title: 'The Kid', year: 1921 },
|
||||
{ title: 'Inglourious Basterds', year: 2009 },
|
||||
{ title: 'Snatch', year: 2000 },
|
||||
{ title: '3 Idiots', year: 2009 },
|
||||
{ title: 'Monty Python and the Holy Grail', year: 1975 },
|
||||
];
|
||||
|
|
|
@ -2,8 +2,7 @@ import React from 'react';
|
|||
import { useSelector, useDispatch } from 'react-redux';
|
||||
|
||||
import {
|
||||
useMsal,
|
||||
useIsAuthenticated
|
||||
useMsal
|
||||
} from "@azure/msal-react";
|
||||
|
||||
import { InteractionRequiredAuthError } from "@azure/msal-browser";
|
||||
|
@ -22,10 +21,14 @@ function Refresh() {
|
|||
const { instance, accounts } = useMsal();
|
||||
const [intervalAllId, setIntervalAllId] = React.useState();
|
||||
const [intervalMeId, setIntervalMeId] = React.useState();
|
||||
|
||||
const refreshInterval = useSelector(getRefreshInterval);
|
||||
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const refreshAllRef = React.useRef();
|
||||
const refreshMeRef = React.useRef();
|
||||
const refreshMeRef = React.useRef(null);
|
||||
const refreshLoadedRef = React.useRef(false);
|
||||
|
||||
refreshAllRef.current = React.useCallback(() => {
|
||||
const request = {
|
||||
|
@ -58,6 +61,7 @@ function Refresh() {
|
|||
|
||||
(async() => {
|
||||
try {
|
||||
console.log("REFRESH ME...");
|
||||
const response = await instance.acquireTokenSilent(request)
|
||||
dispatch(getMeAsync(response.accessToken))
|
||||
} catch (e) {
|
||||
|
@ -83,13 +87,16 @@ function Refresh() {
|
|||
}, [refreshInterval]);
|
||||
|
||||
React.useEffect(()=>{
|
||||
refreshMeRef.current()
|
||||
clearInterval(intervalMeId);
|
||||
setIntervalMeId(
|
||||
setInterval(() => refreshMeRef.current(), 60 * 1000)
|
||||
);
|
||||
return () => {
|
||||
if(!refreshLoadedRef.current) {
|
||||
refreshLoadedRef.current = true;
|
||||
refreshMeRef.current()
|
||||
clearInterval(intervalMeId);
|
||||
setIntervalMeId(
|
||||
setInterval(() => refreshMeRef.current(), 60 * 1000)
|
||||
);
|
||||
return () => {
|
||||
clearInterval(intervalMeId);
|
||||
}
|
||||
}
|
||||
}, []);
|
||||
|
||||
|
|
|
@ -13,11 +13,7 @@ import {
|
|||
Dialog,
|
||||
DialogActions,
|
||||
DialogContent,
|
||||
DialogContentText,
|
||||
DialogTitle,
|
||||
Switch,
|
||||
Stack,
|
||||
Typography
|
||||
DialogTitle
|
||||
} from "@mui/material";
|
||||
|
||||
import {
|
||||
|
@ -60,7 +56,7 @@ export default function UserSettings(props) {
|
|||
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const changed = (refreshInterval == refreshValue) ? false : true;
|
||||
const changed = (refreshInterval === refreshValue) ? false : true;
|
||||
|
||||
React.useEffect(()=>{
|
||||
setRefreshValue(refreshInterval);
|
||||
|
@ -80,7 +76,7 @@ export default function UserSettings(props) {
|
|||
try {
|
||||
setSending(true);
|
||||
const response = await instance.acquireTokenSilent(request);
|
||||
const data = await updateMe(response.accessToken, body);
|
||||
await updateMe(response.accessToken, body);
|
||||
enqueueSnackbar("User settings updated", { variant: "success" });
|
||||
dispatch(getMeAsync(response.accessToken));
|
||||
handleClose();
|
||||
|
|
|
@ -115,7 +115,7 @@ const filterValue = [
|
|||
];
|
||||
|
||||
export default function ManageExclusions() {
|
||||
const { instance, inProgress, accounts } = useMsal();
|
||||
const { instance, accounts } = useMsal();
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
|
||||
const [loading, setLoading] = React.useState(true);
|
||||
|
@ -130,7 +130,7 @@ export default function ManageExclusions() {
|
|||
|
||||
const unchanged = isEqual(selected, loadedExclusions);
|
||||
|
||||
const message = `Click to Include/Exclude`;
|
||||
// const message = `Click to Include/Exclude`;
|
||||
|
||||
React.useEffect(() => {
|
||||
(subscriptions && selected) && setLoading(false);
|
||||
|
@ -205,7 +205,7 @@ export default function ManageExclusions() {
|
|||
let selectedValues = Object.values(selected);
|
||||
let update = selectedValues.map(item => item.subscription_id);
|
||||
const response = await instance.acquireTokenSilent(request);
|
||||
const data = await replaceExclusions(response.accessToken, update);
|
||||
await replaceExclusions(response.accessToken, update);
|
||||
enqueueSnackbar("Successfully updated exclusions", { variant: "success" });
|
||||
setLoadedExclusions(selected);
|
||||
dispatch(refreshAllAsync(response.accessToken))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
||||
import { values } from 'lodash';
|
||||
|
||||
import {
|
||||
fetchSpaces,
|
||||
fetchVNets,
|
||||
|
@ -234,7 +234,7 @@ export const ipamSlice = createSlice({
|
|||
console.log("-----------------");
|
||||
})
|
||||
.addCase(getMeAsync.fulfilled, (state, action) => {
|
||||
if(state.refreshInterval != action.payload['apiRefresh']) {
|
||||
if(state.refreshInterval !== action.payload['apiRefresh']) {
|
||||
state.refreshInterval = action.payload['apiRefresh'];
|
||||
}
|
||||
|
||||
|
|
|
@ -8,8 +8,6 @@ import Box from '@mui/material/Box';
|
|||
|
||||
import Visualize from '../analysis/visualize';
|
||||
import Peering from '../analysis/peering';
|
||||
import AnalysisTool from '../analysis/analysis';
|
||||
import GmailTreeView from '../analysis/conflicts';
|
||||
|
||||
function TabPanel(props) {
|
||||
const { children, value, index, ...other } = props;
|
||||
|
|
|
@ -11,7 +11,7 @@ const Welcome = () => {
|
|||
return (
|
||||
<React.Fragment>
|
||||
<Box sx={{ display: 'flex', flexDirection: 'column', justifyContent: 'center', alignItems: 'center', height: 'calc(100vh - 137px)' }}>
|
||||
<img src={ipamLogo} width="35%" height="auto" />
|
||||
<img src={ipamLogo} width="35%" height="auto" alt="Welcome to Azure IPAM!"/>
|
||||
<Typography variant="h3" gutterBottom component="div">
|
||||
Welcome to Azure IPAM!
|
||||
</Typography>
|
||||
|
|
|
@ -49,7 +49,7 @@ export async function callMsGraphUsersFilter(accessToken, nameFilter = "") {
|
|||
headers: headers,
|
||||
};
|
||||
|
||||
if (nameFilter != "") {
|
||||
if (nameFilter !== "") {
|
||||
endpoint += `$filter=startsWith(userPrincipalName,'${nameFilter}') OR startsWith(displayName, '${nameFilter}')&`;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче