Added link handling

This commit is contained in:
pepper 2021-01-14 00:10:31 -05:00
parent 58eade2464
commit 964e863089
2 changed files with 13 additions and 23 deletions

View File

@ -18,20 +18,7 @@ class Historical extends Component {
error: false, error: false,
}; };
} }
componentDidMount() {
callAPI
.get("/all")
.then((request) => {
this.setState({
migs: request.data,
});
})
.catch((error) => {
this.setState({
error: true,
});
});
}
renderItems() { renderItems() {
if (!this.props.error) { if (!this.props.error) {
return <HistoricalSingle data={this.state.sidemigs} />; return <HistoricalSingle data={this.state.sidemigs} />;

View File

@ -15,6 +15,7 @@ import ToolkitProvider, {
const HistoricalSingle = () => { const HistoricalSingle = () => {
const [list, setList] = useState([]); const [list, setList] = useState([]);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [ticURl, setURL] = useState(null)
const { SearchBar } = Search; const { SearchBar } = Search;
const { ExportCSVButton } = CSVExport; const { ExportCSVButton } = CSVExport;
const sizePerPageRenderer = ({ const sizePerPageRenderer = ({
@ -45,6 +46,11 @@ const HistoricalSingle = () => {
console.log(data); console.log(data);
setList(data.data); setList(data.data);
setLoading(true); setLoading(true);
// Determine brand and set URL based on brand
console.log(data.data.brand)
if (data.data.brand === "VentraIP" ) {
console.log("memes")
}
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
@ -78,6 +84,7 @@ const HistoricalSingle = () => {
], ],
sizePerPageRenderer, // A numeric array is also available. the purpose of above example is custom the text sizePerPageRenderer, // A numeric array is also available. the purpose of above example is custom the text
}; };
const columns = [ const columns = [
{ dataField: "id", text: "ID", hidden: true }, { dataField: "id", text: "ID", hidden: true },
{ dataField: "brand", text: "Brand", sort: true }, { dataField: "brand", text: "Brand", sort: true },
@ -89,8 +96,9 @@ const HistoricalSingle = () => {
formatter: (cell, row) => ( formatter: (cell, row) => (
<a <a
href={ href={
"https://helpdesk.ventraip.com.au/profiles/ticket/" + row.ticket_id row.brand === "VentraIP" ? "https://helpdesk.ventraip.com.au/profiles/ticket/" + row.ticket_id : null
} }
target="_blank"
> >
{" "} {" "}
{cell}{" "} {cell}{" "}
@ -98,7 +106,7 @@ const HistoricalSingle = () => {
), ),
}, },
{ dataField: "booked_date", text: "Booked Date", sort: true }, { dataField: "booked_date", text: "Booked Date", sort: true },
{ dataField: "booked_time", text: "Booked Time", sort: true }, // { dataField: "booked_time", text: "Booked Time", sort: true },
{ dataField: "agent_booked", text: "Agent initials", sort: true }, { dataField: "agent_booked", text: "Agent initials", sort: true },
{ {
dataField: "domain", dataField: "domain",
@ -112,14 +120,9 @@ const HistoricalSingle = () => {
{ dataField: "original_server", text: "Original Server", sort: true }, { dataField: "original_server", text: "Original Server", sort: true },
{ dataField: "new_server", text: "New Server", sort: true }, { dataField: "new_server", text: "New Server", sort: true },
{ dataField: "migration_status", text: "Status", sort: true }, { dataField: "migration_status", text: "Status", sort: true },
{ dataField: "term_date", text: "Termination Date", sort: true }, // { dataField: "term_date", text: "Termination Date", sort: true },
{ dataField: "notes", text: "Notes", sort: true }, { dataField: "notes", text: "Notes", sort: true },
{ dataField: "submit_time", text: "Submit Time", sort: true }, // { dataField: "submit_time", text: "Submit Time", sort: true },
{
dataField: "report",
text: "Show Detailed Report",
formatter: (cell, row) => <a href={cell + row.id}> {cell} </a>,
},
]; ];
useEffect(() => { useEffect(() => {