mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-01-18 18:56:26 +00:00
Reset link support
This commit is contained in:
parent
72418a1a9f
commit
bf4f2dcdb7
@ -278,6 +278,7 @@ import { DataSourceFilter } from './filters/dataSourceFilter';
|
|||||||
import { ChangeHostnameActionComponent } from './components/project-map/context-menu/actions/change-hostname/change-hostname-action.component';
|
import { ChangeHostnameActionComponent } from './components/project-map/context-menu/actions/change-hostname/change-hostname-action.component';
|
||||||
import { ChangeHostnameDialogComponent } from './components/project-map/change-hostname-dialog/change-hostname-dialog.component';
|
import { ChangeHostnameDialogComponent } from './components/project-map/change-hostname-dialog/change-hostname-dialog.component';
|
||||||
import { ApplianceInfoDialogComponent } from './components/project-map/new-template-dialog/appliance-info-dialog/appliance-info-dialog.component';
|
import { ApplianceInfoDialogComponent } from './components/project-map/new-template-dialog/appliance-info-dialog/appliance-info-dialog.component';
|
||||||
|
import { ResetLinkActionComponent } from './components/project-map/context-menu/actions/reset-link/reset-link-action.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
@ -309,6 +310,7 @@ import { ApplianceInfoDialogComponent } from './components/project-map/new-templ
|
|||||||
StopCaptureActionComponent,
|
StopCaptureActionComponent,
|
||||||
ResumeLinkActionComponent,
|
ResumeLinkActionComponent,
|
||||||
SuspendLinkActionComponent,
|
SuspendLinkActionComponent,
|
||||||
|
ResetLinkActionComponent,
|
||||||
ProjectMapShortcutsComponent,
|
ProjectMapShortcutsComponent,
|
||||||
SettingsComponent,
|
SettingsComponent,
|
||||||
PreferencesComponent,
|
PreferencesComponent,
|
||||||
|
@ -5,7 +5,7 @@ import { SentryErrorHandler } from './sentry-error-handler';
|
|||||||
@Injectable()
|
@Injectable()
|
||||||
export class ToasterErrorHandler extends SentryErrorHandler {
|
export class ToasterErrorHandler extends SentryErrorHandler {
|
||||||
handleError(err: any): void {
|
handleError(err: any): void {
|
||||||
if (err.error && err.error.status && !(err.error.status === 403 || err.error.status === 404)) {
|
if (err.error && err.error.status && !(err.error.status === 403 || err.error.status === 404 || err.error.status === 405)) {
|
||||||
super.handleError(err);
|
super.handleError(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,4 @@
|
|||||||
|
<button mat-menu-item (click)="resetLink()">
|
||||||
|
<mat-icon>settings_backup_restore</mat-icon>
|
||||||
|
<span>Reset link</span>
|
||||||
|
</button>
|
@ -0,0 +1,21 @@
|
|||||||
|
import { Component, Input } from '@angular/core';
|
||||||
|
import { Server } from '../../../../../models/server';
|
||||||
|
import { Link } from '../../../../../models/link';
|
||||||
|
import { LinkService } from '../../../../../services/link.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-reset-link-action',
|
||||||
|
templateUrl: './reset-link-action.component.html'
|
||||||
|
})
|
||||||
|
export class ResetLinkActionComponent {
|
||||||
|
@Input() server: Server;
|
||||||
|
@Input() link: Link;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private linkService: LinkService
|
||||||
|
) {}
|
||||||
|
|
||||||
|
resetLink() {
|
||||||
|
this.linkService.resetLink(this.server, this.link).subscribe(() => {});
|
||||||
|
}
|
||||||
|
}
|
@ -141,6 +141,11 @@
|
|||||||
[server]="server"
|
[server]="server"
|
||||||
[link]="links[0]"
|
[link]="links[0]"
|
||||||
></app-suspend-link-action>
|
></app-suspend-link-action>
|
||||||
|
<app-reset-link-action
|
||||||
|
*ngIf="!projectService.isReadOnly(project) && drawings.length===0 && nodes.length===0 && links.length===1 && linkNodes.length === 0"
|
||||||
|
[server]="server"
|
||||||
|
[link]="links[0]"
|
||||||
|
></app-reset-link-action>
|
||||||
<app-lock-action
|
<app-lock-action
|
||||||
*ngIf="!projectService.isReadOnly(project) && (drawings.length>0 || nodes.length>0)"
|
*ngIf="!projectService.isReadOnly(project) && (drawings.length>0 || nodes.length>0)"
|
||||||
[server]="server"
|
[server]="server"
|
||||||
|
@ -92,6 +92,10 @@ export class LinkService {
|
|||||||
return this.httpServer.post(server, `/projects/${link.project_id}/links/${link.link_id}/stop_capture`, {});
|
return this.httpServer.post(server, `/projects/${link.project_id}/links/${link.link_id}/stop_capture`, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resetLink(server: Server, link: Link) {
|
||||||
|
return this.httpServer.post(server, `/projects/${link.project_id}/links/${link.link_id}/reset`, {});
|
||||||
|
}
|
||||||
|
|
||||||
streamPcap(server: Server, link: Link) {
|
streamPcap(server: Server, link: Link) {
|
||||||
return this.httpServer.get(server, `/projects/${link.project_id}/links/${link.link_id}/pcap`)
|
return this.httpServer.get(server, `/projects/${link.project_id}/links/${link.link_id}/pcap`)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user