mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-06-20 15:40:29 +00:00
Add permission management
This commit is contained in:
committed by
Sylvain MATHIEU
parent
65172c18b5
commit
2664911455
@ -0,0 +1,6 @@
|
||||
<button [ngClass]="{allow: action === 'ALLOW', deny: action === 'DENY'}"
|
||||
mat-button
|
||||
[disabled]="disabled"
|
||||
(click)="change()">
|
||||
{{action}}
|
||||
</button>
|
@ -0,0 +1,8 @@
|
||||
.allow {
|
||||
background-color: green;
|
||||
border-radius: unset !important;
|
||||
}
|
||||
|
||||
.deny {
|
||||
background-color: darkred;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ActionButtonComponent } from './action-button.component';
|
||||
|
||||
describe('ActionButtonComponent', () => {
|
||||
let component: ActionButtonComponent;
|
||||
let fixture: ComponentFixture<ActionButtonComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ ActionButtonComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ActionButtonComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Software Name : GNS3 Web UI
|
||||
* Version: 3
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2022 Orange Business Services
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* This software is distributed under the GPL-3.0 or any later version,
|
||||
* the text of which is available at https://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* or see the "LICENSE" file for more details.
|
||||
*
|
||||
* Author: Sylvain MATHIEU, Elise LEBEAU
|
||||
*/
|
||||
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
||||
import {PermissionActions} from "@models/api/permission";
|
||||
|
||||
@Component({
|
||||
selector: 'app-action-button',
|
||||
templateUrl: './action-button.component.html',
|
||||
styleUrls: ['./action-button.component.scss']
|
||||
})
|
||||
export class ActionButtonComponent implements OnInit {
|
||||
|
||||
readonly DENY = 'DENY';
|
||||
readonly ALLOW = 'ALLOW';
|
||||
@Input() action: PermissionActions;
|
||||
@Input() disabled = true;
|
||||
@Output() update = new EventEmitter<PermissionActions>();
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
change() {
|
||||
this.action === PermissionActions.DENY ? this.action = PermissionActions.ALLOW : this.action = PermissionActions.DENY;
|
||||
this.update.emit(this.action);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user