-
-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
157 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package handler | ||
|
||
import ( | ||
"github.com/analogj/scrutiny/webapp/backend/pkg/database" | ||
"github.com/gin-gonic/gin" | ||
"github.com/sirupsen/logrus" | ||
"net/http" | ||
) | ||
|
||
func DeleteDevice(c *gin.Context) { | ||
logger := c.MustGet("LOGGER").(logrus.FieldLogger) | ||
deviceRepo := c.MustGet("DEVICE_REPOSITORY").(database.DeviceRepo) | ||
|
||
err := deviceRepo.DeleteDevice(c, c.Param("wwn")) | ||
if err != nil { | ||
logger.Errorln("An error occurred while deleting device", err) | ||
c.JSON(http.StatusInternalServerError, gin.H{"success": false}) | ||
return | ||
} | ||
|
||
c.JSON(http.StatusOK, gin.H{"success": true}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...ayout/common/dashboard-device-delete-dialog/dashboard-device-delete-dialog.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<h2 mat-dialog-title>Delete {{data.title}}?</h2> | ||
<mat-dialog-content>This will delete all data associated with this device (including all historical data).</mat-dialog-content> | ||
<mat-dialog-actions> | ||
<button mat-button mat-dialog-close>Cancel</button> | ||
<!-- The mat-dialog-close directive optionally accepts a value as a result for the dialog. --> | ||
<button class="red-600" mat-button [mat-dialog-close]="true"> | ||
<mat-icon class="icon-size-20 mr-3" | ||
[svgIcon]="'delete_forever'"></mat-icon> | ||
Delete</button> | ||
</mat-dialog-actions> |
Empty file.
25 changes: 25 additions & 0 deletions
25
...ut/common/dashboard-device-delete-dialog/dashboard-device-delete-dialog.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { DashboardDeviceDeleteDialogComponent } from './dashboard-device-delete-dialog.component'; | ||
|
||
describe('DashboardDeviceDeleteDialogComponent', () => { | ||
let component: DashboardDeviceDeleteDialogComponent; | ||
let fixture: ComponentFixture<DashboardDeviceDeleteDialogComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ DashboardDeviceDeleteDialogComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(DashboardDeviceDeleteDialogComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
16 changes: 16 additions & 0 deletions
16
.../layout/common/dashboard-device-delete-dialog/dashboard-device-delete-dialog.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Component, OnInit, Inject } from '@angular/core'; | ||
import {MAT_DIALOG_DATA} from '@angular/material/dialog'; | ||
|
||
@Component({ | ||
selector: 'app-dashboard-device-delete-dialog', | ||
templateUrl: './dashboard-device-delete-dialog.component.html', | ||
styleUrls: ['./dashboard-device-delete-dialog.component.scss'] | ||
}) | ||
export class DashboardDeviceDeleteDialogComponent implements OnInit { | ||
|
||
constructor(@Inject(MAT_DIALOG_DATA) public data: {wwn: string, title: string}) { } | ||
|
||
ngOnInit(): void { | ||
} | ||
|
||
} |
52 changes: 52 additions & 0 deletions
52
...app/layout/common/dashboard-device-delete-dialog/dashboard-device-delete-dialog.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { RouterModule } from '@angular/router'; | ||
import { Overlay } from '@angular/cdk/overlay'; | ||
import { MAT_AUTOCOMPLETE_SCROLL_STRATEGY, MatAutocompleteModule } from '@angular/material/autocomplete'; | ||
import { MatButtonModule } from '@angular/material/button'; | ||
import { MatSelectModule } from '@angular/material/select'; | ||
import { MatFormFieldModule } from '@angular/material/form-field'; | ||
import { MatIconModule } from '@angular/material/icon'; | ||
import { MatInputModule } from '@angular/material/input'; | ||
import { SharedModule } from 'app/shared/shared.module'; | ||
import {DashboardDeviceDeleteDialogComponent} from 'app/layout/common/dashboard-device-delete-dialog/dashboard-device-delete-dialog.component' | ||
import { MatButtonToggleModule} from "@angular/material/button-toggle"; | ||
import {MatTabsModule} from "@angular/material/tabs"; | ||
import {MatSliderModule} from "@angular/material/slider"; | ||
import {MatSlideToggleModule} from "@angular/material/slide-toggle"; | ||
import {MatTooltipModule} from "@angular/material/tooltip"; | ||
import {dashboardRoutes} from "../../../modules/dashboard/dashboard.routing"; | ||
import {MatDividerModule} from "@angular/material/divider"; | ||
import {MatMenuModule} from "@angular/material/menu"; | ||
import {MatProgressBarModule} from "@angular/material/progress-bar"; | ||
import {MatSortModule} from "@angular/material/sort"; | ||
import {MatTableModule} from "@angular/material/table"; | ||
import {NgApexchartsModule} from "ng-apexcharts"; | ||
import { MatDialogModule } from '@angular/material/dialog'; | ||
|
||
@NgModule({ | ||
declarations: [ | ||
DashboardDeviceDeleteDialogComponent | ||
], | ||
imports : [ | ||
RouterModule.forChild([]), | ||
RouterModule.forChild(dashboardRoutes), | ||
MatButtonModule, | ||
MatDividerModule, | ||
MatTooltipModule, | ||
MatIconModule, | ||
MatMenuModule, | ||
MatProgressBarModule, | ||
MatSortModule, | ||
MatTableModule, | ||
NgApexchartsModule, | ||
SharedModule, | ||
MatDialogModule | ||
], | ||
exports : [ | ||
DashboardDeviceDeleteDialogComponent, | ||
], | ||
providers : [] | ||
}) | ||
export class DashboardDeviceDeleteDialogModule | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,6 +111,4 @@ <h1>No Devices Detected!</h1> | |
<code>scrutiny-collector-metrics run</code> | ||
|
||
</div> | ||
|
||
|
||
</ng-template> |