Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_advancedSettings() {
const options = {
title: this.state.messages.titlePopup,
message: this.state.messages.messagePopup,
buttons: [
{
label: this.state.messages.advancedSettings,
onClick: () => history.push({pathname: Routes.show_alert_condition(this.state.alert.stream.id, this.state.alert.condition)})
},
{
label: this.state.messages.done,
onClick: () => history.push({pathname: Routes.pluginRoute('WIZARD')})
},
]
};
confirmAlert(options);
},
_updateAlertField(field, value) {
function deleteOrganization(org) {
confirmAlert({
title: 'Delete organization',
message: `Are you sure you want to delete organization ${org.name}?`,
buttons: [
{
label: 'Cancel',
},
{
label: 'Delete',
onClick: () => {
deleteOrg(org)
.then(() => {
toast.success(`Org ${org.name} deleted.`);
})
.catch(err => {
toast.error(`Failed to delete org ${org.name}: ${err.message}`);
});
function deleteDevice(device) {
confirmAlert({
title: 'Delete device',
message: `Are you sure you want to delete device ${device.imei}?`,
buttons: [
{
label: 'Cancel',
},
{
label: 'Delete',
onClick: () => {
appState.deleteDevice(device)
.then(() => {
toast.success(`Device ${device.imei} deleted.`);
})
.catch(err => {
toast.error(`Failed to delete user ${device.imei} : ${err.message}`);
});
function deleteUser(user) {
confirmAlert({
title: 'Delete user',
message: `Are you sure you want to delete user ${user.username}?`,
buttons: [
{
label: 'Cancel',
},
{
label: 'Delete',
onClick: () => {
appState.deleteUser(user)
.then(() => {
toast.success(`User ${user.username} deleted.`);
})
.catch(err => {
toast.error(`Failed to delete user ${user.username}: ${err.message}`);
});
Delete() {
confirmAlert({
title: 'Confirm to Delete',
message: 'Are you sure you want to delete this Thing? This action cannot be undone!',
buttons: [
{
label: 'Yes',
onClick: () => {
this.setState({transmitting: true});
fetch(API_URL + "thing/delete.php", {credentials: 'include', method: "POST", body: JSON.stringify({"id": this.state.thingID})})
.then(res => res.json())
.then(
(result) => {
if (result.response === 200) {
this.setState({redirect: "/Dashboard"});
}
else {
this.setState({transmitting: false});
function deleteFleet(fleet) {
confirmAlert({
title: 'Delete fleet',
message: `Are you sure you want to delete fleet ${fleet.name}?`,
buttons: [
{
label: 'Cancel',
},
{
label: 'Delete',
onClick: () => {
appState.deleteFleet(fleet)
.then(() => {
toast.success(`Fleet ${fleet.name} deleted.`);
})
.catch(err => {
toast.error(`Failed to delete fleet ${fleet.name}: ${err.message}`);
});
function deleteVehicle(vehicle) {
confirmAlert({
title: 'Delete vehicle',
message: `Are you sure you want to delete vehicle ${vehicle.name}?`,
buttons: [
{
label: 'Cancel',
},
{
label: 'Delete',
onClick: () => {
appState.deleteVehicle(vehicle)
.then(() => {
toast.success(`Vehicle ${vehicle.name} deleted.`);
})
.catch(err => {
toast.error(`Failed to delete vehicle ${vehicle.name}: ${err.message}`);
});
showQuery(event) {
confirmAlert({
message: this.getQuery(),
buttons: [
{
label: 'OK',
}
]
});
event.preventDefault();
};