diff --git a/ogWebconsole/src/app/app.module.ts b/ogWebconsole/src/app/app.module.ts index bbdb13b..633da32 100644 --- a/ogWebconsole/src/app/app.module.ts +++ b/ogWebconsole/src/app/app.module.ts @@ -205,7 +205,7 @@ export function HttpLoaderFactory(http: HttpClient) { EnvVarsComponent, MenusComponent, CreateMenuComponent, - CreateMultipleClientComponent, + CreateMultipleClientComponent ], bootstrap: [AppComponent], imports: [BrowserModule, diff --git a/ogWebconsole/src/app/components/commands/main-commands/execute-command/execute-command.component.spec.ts b/ogWebconsole/src/app/components/commands/main-commands/execute-command/execute-command.component.spec.ts index 62231e0..df1a797 100644 --- a/ogWebconsole/src/app/components/commands/main-commands/execute-command/execute-command.component.spec.ts +++ b/ogWebconsole/src/app/components/commands/main-commands/execute-command/execute-command.component.spec.ts @@ -10,11 +10,13 @@ import { MatDialogModule, MatDialogRef, MAT_DIALOG_DATA } from '@angular/materia import { MatFormFieldModule } from '@angular/material/form-field'; import { MatInputModule } from '@angular/material/input'; import { MatTableModule } from '@angular/material/table'; -import { MatSelectModule } from '@angular/material/select'; +import { MatSelectModule } from '@angular/material/select'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { TranslateModule } from '@ngx-translate/core'; import { ToastrModule, ToastrService } from 'ngx-toastr'; import { DataService } from '../data.service'; +import {MatIconModule} from "@angular/material/icon"; +import {MatMenu, MatMenuModule} from "@angular/material/menu"; describe('ExecuteCommandComponent', () => { let component: ExecuteCommandComponent; @@ -31,9 +33,11 @@ describe('ExecuteCommandComponent', () => { MatInputModule, MatCheckboxModule, MatButtonModule, + MatMenuModule, BrowserAnimationsModule, MatTableModule, MatSelectModule, + MatIconModule, ToastrModule.forRoot(), TranslateModule.forRoot() ], diff --git a/ogWebconsole/src/app/components/groups/components/client-main-view/create-image/create-image.component.spec.ts b/ogWebconsole/src/app/components/groups/components/client-main-view/create-image/create-image.component.spec.ts index a8d5c56..1cb70ef 100644 --- a/ogWebconsole/src/app/components/groups/components/client-main-view/create-image/create-image.component.spec.ts +++ b/ogWebconsole/src/app/components/groups/components/client-main-view/create-image/create-image.component.spec.ts @@ -16,7 +16,6 @@ import { ActivatedRoute } from '@angular/router'; import { TranslateModule } from '@ngx-translate/core'; import { ToastrModule, ToastrService } from 'ngx-toastr'; import { of } from 'rxjs'; -import { DataService } from '../../client-tab-view/data.service'; describe('CreateImageComponent', () => { let component: CreateImageComponent; @@ -42,7 +41,6 @@ describe('CreateImageComponent', () => { providers: [ FormBuilder, ToastrService, - DataService, provideHttpClient(), provideHttpClientTesting(), { diff --git a/ogWebconsole/src/app/components/groups/components/client-main-view/deploy-image/deploy-image.component.spec.ts b/ogWebconsole/src/app/components/groups/components/client-main-view/deploy-image/deploy-image.component.spec.ts index 5703e5a..a6a2e2b 100644 --- a/ogWebconsole/src/app/components/groups/components/client-main-view/deploy-image/deploy-image.component.spec.ts +++ b/ogWebconsole/src/app/components/groups/components/client-main-view/deploy-image/deploy-image.component.spec.ts @@ -15,7 +15,6 @@ import { MatRadioModule } from '@angular/material/radio'; // Importar MatRadioMo import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { TranslateModule } from '@ngx-translate/core'; import { ToastrModule, ToastrService } from 'ngx-toastr'; -import { DataService } from '../../client-tab-view/data.service'; import { provideRouter } from '@angular/router'; import { MatSelectModule } from '@angular/material/select'; @@ -28,7 +27,7 @@ describe('DeployImageComponent', () => { declarations: [DeployImageComponent], imports: [ ReactiveFormsModule, - FormsModule, + FormsModule, MatDialogModule, MatFormFieldModule, MatInputModule, @@ -36,7 +35,7 @@ describe('DeployImageComponent', () => { MatButtonModule, MatTableModule, MatDividerModule, - MatRadioModule, + MatRadioModule, MatSelectModule, BrowserAnimationsModule, ToastrModule.forRoot(), @@ -45,7 +44,6 @@ describe('DeployImageComponent', () => { providers: [ FormBuilder, ToastrService, - DataService, provideHttpClient(), provideHttpClientTesting(), provideRouter([]), diff --git a/ogWebconsole/src/app/components/groups/groups.component.spec.ts b/ogWebconsole/src/app/components/groups/groups.component.spec.ts index b5646bf..1dd83f5 100644 --- a/ogWebconsole/src/app/components/groups/groups.component.spec.ts +++ b/ogWebconsole/src/app/components/groups/groups.component.spec.ts @@ -22,9 +22,6 @@ import { MatTabsModule } from '@angular/material/tabs'; import { MatCardModule } from '@angular/material/card'; import { TranslateModule } from '@ngx-translate/core'; import { JoyrideModule } from 'ngx-joyride'; -import { AdvancedSearchComponent } from './components/advanced-search/advanced-search.component'; -import { ClientTabViewComponent } from './components/client-tab-view/client-tab-view.component'; -import { OrganizationalUnitTabViewComponent } from './components/organizational-unit-tab-view/organizational-unit-tab-view.component'; import { MatMenuModule } from '@angular/material/menu'; describe('GroupsComponent', () => { @@ -33,7 +30,7 @@ describe('GroupsComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - declarations: [GroupsComponent, AdvancedSearchComponent, ClientTabViewComponent, OrganizationalUnitTabViewComponent], + declarations: [GroupsComponent], imports: [ HttpClientTestingModule, ToastrModule.forRoot(), @@ -99,13 +96,6 @@ describe('GroupsComponent', () => { expect(component.getFilters).toHaveBeenCalled(); }); - it('should call onTabChange method', () => { - spyOn(component, 'onTabChange'); - const event = { index: 2 } as any; - component.onTabChange(event); - expect(component.onTabChange).toHaveBeenCalledWith(event); - }); - it('should call onSelectUnidad method', () => { spyOn(component, 'onSelectUnidad'); const unidad = { id: '1', name: 'Test' } as any; diff --git a/ogWebconsole/src/app/components/groups/shared/clients/create-client/create-client.component.ts b/ogWebconsole/src/app/components/groups/shared/clients/create-client/create-client.component.ts index d7f7e45..dbc6f6b 100644 --- a/ogWebconsole/src/app/components/groups/shared/clients/create-client/create-client.component.ts +++ b/ogWebconsole/src/app/components/groups/shared/clients/create-client/create-client.component.ts @@ -5,7 +5,6 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { MatSnackBar } from '@angular/material/snack-bar'; import { ToastrService } from 'ngx-toastr'; import { DataService } from '../../../services/data.service'; -import * as Papa from 'papaparse'; @Component({ selector: 'app-create-client', @@ -158,62 +157,6 @@ export class CreateClientComponent implements OnInit { ); } - onFileUpload(event: any): void { - const file = event.target.files[0]; - if (file) { - const reader = new FileReader(); - - reader.onload = (e: any) => { - const textData = e.target.result; - const regex = /host\s+(\S+)\s+\{\s+hardware\s+ethernet\s+([\da-fA-F:]+);\s+fixed-address\s+([\d.]+);\s+\}/g; - let match; - const clients = []; - - while ((match = regex.exec(textData)) !== null) { - clients.push({ - name: match[1], - mac: match[2], - ip: match[3] - }); - } - - if (clients.length > 0) { - this.uploadedClients = clients; - this.toastService.success('Archivo cargado correctamente, los datos están listos para enviarse.', 'Éxito'); - this.showTextarea = false; - } else { - this.toastService.error('No se encontraron datos válidos', 'Error'); - this.showTextarea = true; - } - }; - - reader.readAsText(file); - } - } - - onTextarea(text: string): void { - const regex = /host\s+(\S+)\s+\{\s+hardware\s+ethernet\s+([\da-fA-F:]+);\s+fixed-address\s+([\d.]+);\s+\}/g; - let match; - const clients = []; - - while ((match = regex.exec(text)) !== null) { - clients.push({ - name: match[1], - mac: match[2], - ip: match[3] - }); - } - - if (clients.length > 0) { - this.uploadedClients = clients; - this.toastService.success('Datos cargados correctamente, los datos están listos para enviarse.', 'Éxito'); - this.showTextarea = false; - } else { - this.toastService.error('No se encontraron datos válidos', 'Error'); - this.showTextarea = true; - } - } - onSubmit(): void { if (this.isSingleClientForm) { if (this.clientForm.valid) { @@ -266,10 +209,6 @@ export class CreateClientComponent implements OnInit { } } - toggleClientForm(): void { - this.isSingleClientForm = !this.isSingleClientForm; - } - onNoClick(): void { this.dialogRef.close(); } diff --git a/ogWebconsole/src/app/components/groups/shared/clients/create-multiple-client/create-multiple-client.component.html b/ogWebconsole/src/app/components/groups/shared/clients/create-multiple-client/create-multiple-client.component.html index 91955c9..fd678aa 100644 --- a/ogWebconsole/src/app/components/groups/shared/clients/create-multiple-client/create-multiple-client.component.html +++ b/ogWebconsole/src/app/components/groups/shared/clients/create-multiple-client/create-multiple-client.component.html @@ -3,10 +3,10 @@