diff --git a/src/components/Experiment/Slices.jsx b/src/components/Experiment/Slices.jsx
index 3f027e54..3e95099e 100644
--- a/src/components/Experiment/Slices.jsx
+++ b/src/components/Experiment/Slices.jsx
@@ -5,11 +5,13 @@ import Pagination from "../common/Pagination";
import SearchBoxWithDropdown from "../../components/common/SearchBoxWithDropdown";
import SlicesTable from "../Slice/SlicesTable";
import SpinnerWithText from "../../components/common/SpinnerWithText";
+import DeleteModal from "../../components/common/DeleteModal";
import { getProjects } from "../../services/projectService.js";
import { autoCreateTokens } from "../../utils/manageTokens";
import { getSlices, deleteSlice } from "../../services/sliceService.js";
import { toast } from "react-toastify";
import paginate from "../../utils/paginate";
+import sleep from "../../utils/sleep";
import checkPortalType from "../../utils/checkPortalType";
import { default as portalData } from "../../services/portalData.json";
import _ from "lodash";
@@ -31,29 +33,30 @@ class Slices extends React.Component {
searchQuery: "",
sortColumn: { path: "name", order: "asc" },
showSpinner: false,
+ spinnerText: ""
};
async componentDidMount() {
// Show loading spinner and when waiting API response
- this.setState({ showSpinner: true });
+ this.setState({ showSpinner: true, spinnerText: "Loading slices..." });
try {
if (window.location.href.includes("/projects")) {
// call credential manager to generate tokens
autoCreateTokens("all").then(async () => {
const { data: res } = await getSlices();
const slices = res.data.filter(s => s.project_id === this.props.projectId);
- this.setState({ slices, showSpinner: false });
+ this.setState({ slices, showSpinner: false, spinnerText: "" });
});
} else {
// call PR first to check if the user has project.
const { data: res } = await getProjects("myProjects", 0, 200);
if (res.results.length === 0) {
- this.setState({ hasProject: false, showSpinner: false });
+ this.setState({ hasProject: false, showSpinner: false, spinnerText: "" });
} else {
// call credential manager to generate tokens
autoCreateTokens("all").then(async () => {
const { data: res } = await getSlices();
- this.setState({ slices: res.data, showSpinner: false });
+ this.setState({ slices: res.data, showSpinner: false, spinnerText: "" });
});
}
}
@@ -85,7 +88,12 @@ class Slices extends React.Component {
handleDeleteAllSlices = async () => {
try {
+ this.setState({
+ showSpinner: true,
+ spinnerText: "Deleting all active slices..."
+ })
await deleteSlice();
+ await sleep(5000);
window.location.reload();
}
catch (err) {
@@ -131,7 +139,8 @@ class Slices extends React.Component {
};
render() {
- const { hasProject, slices, pageSize, currentPage, sortColumn, searchQuery, filterQuery, showSpinner } = this.state;
+ const { hasProject, slices, pageSize, currentPage, sortColumn, searchQuery,
+ filterQuery, showSpinner, spinnerText, includeDeadSlices } = this.state;
const { totalCount, data } = this.getPageData();
return (
@@ -159,7 +168,7 @@ class Slices extends React.Component {
}
{
- showSpinner &&