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,
};
}
componentDidMount() {
callAPI
.get("/all")
.then((request) => {
this.setState({
migs: request.data,
});
})
.catch((error) => {
this.setState({
error: true,
});
});
}
renderItems() {
if (!this.props.error) {
return <HistoricalSingle data={this.state.sidemigs} />;

View File

@ -15,6 +15,7 @@ import ToolkitProvider, {
const HistoricalSingle = () => {
const [list, setList] = useState([]);
const [loading, setLoading] = useState(false);
const [ticURl, setURL] = useState(null)
const { SearchBar } = Search;
const { ExportCSVButton } = CSVExport;
const sizePerPageRenderer = ({
@ -45,6 +46,11 @@ const HistoricalSingle = () => {
console.log(data);
setList(data.data);
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) {
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
};
const columns = [
{ dataField: "id", text: "ID", hidden: true },
{ dataField: "brand", text: "Brand", sort: true },
@ -89,8 +96,9 @@ const HistoricalSingle = () => {
formatter: (cell, row) => (
<a
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}{" "}
@ -98,7 +106,7 @@ const HistoricalSingle = () => {
),
},
{ 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: "domain",
@ -112,14 +120,9 @@ const HistoricalSingle = () => {
{ dataField: "original_server", text: "Original Server", sort: true },
{ dataField: "new_server", text: "New Server", 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: "submit_time", text: "Submit Time", sort: true },
{
dataField: "report",
text: "Show Detailed Report",
formatter: (cell, row) => <a href={cell + row.id}> {cell} </a>,
},
// { dataField: "submit_time", text: "Submit Time", sort: true },
];
useEffect(() => {