utn-cli 2.1.9 → 2.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,53 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { closeReadLine } from '../utils/index.js';
4
+ import { execSync } from 'child_process';
5
+
6
+ export async function runGlobalBackup() {
7
+ const currentDir = process.cwd();
8
+ const entries = fs.readdirSync(currentDir, { withFileTypes: true });
9
+ const directories = entries.filter(entry => entry.isDirectory());
10
+
11
+ if (directories.length === 0) {
12
+ console.log('No se encontraron directorios en la carpeta actual.');
13
+ closeReadLine();
14
+ return;
15
+ }
16
+
17
+ let encontroAlguno = false;
18
+
19
+ for (const dir of directories) {
20
+ const fullPath = path.join(currentDir, dir.name);
21
+
22
+ if (!fs.existsSync(path.join(fullPath, '.git'))) continue;
23
+
24
+ encontroAlguno = true;
25
+ process.chdir(fullPath);
26
+
27
+ console.log(`\n[${dir.name}] Agregando cambios...`);
28
+ try {
29
+ execSync('git add .', { stdio: 'inherit' });
30
+ } catch {
31
+ console.error(`[${dir.name}] Error al ejecutar git add. Continuando...`);
32
+ process.chdir(currentDir);
33
+ continue;
34
+ }
35
+
36
+ console.log(`[${dir.name}] Realizando commit de respaldo...`);
37
+ try {
38
+ execSync('git commit -m "* NEW: Respaldo de código"', { stdio: 'inherit' });
39
+ } catch {
40
+ console.log(`[${dir.name}] Sin cambios para hacer commit o el commit falló.`);
41
+ }
42
+
43
+ process.chdir(currentDir);
44
+ }
45
+
46
+ if (!encontroAlguno) {
47
+ console.log('No se encontraron repositorios Git en los directorios actuales.');
48
+ } else {
49
+ console.log('\nRespaldo finalizado en todos los repositorios.');
50
+ }
51
+
52
+ closeReadLine();
53
+ }
package/index.js CHANGED
@@ -9,6 +9,7 @@ import { initBackend, updateBackend, addServiceBackend, showBackendVersion } fro
9
9
  import { initFrontend, updateFrontend, cloneFrontendComponent, showFrontendVersion } from './commands/frontend.js';
10
10
  import { runGlobalUpdate } from './commands/update.js';
11
11
  import { runGlobalPull } from './commands/pull.js';
12
+ import { runGlobalBackup } from './commands/backup.js';
12
13
  import { createComponent } from './commands/createComponent.js';
13
14
  import { runCommit } from './commands/commit.js';
14
15
 
@@ -112,6 +113,13 @@ program.command('pull')
112
113
  await runGlobalPull();
113
114
  });
114
115
 
116
+ // Define 'backup' command
117
+ program.command('backup')
118
+ .description('Recorre los directorios y realiza un commit de respaldo con el mensaje "* NEW: Respaldo de código" en cada repositorio Git.')
119
+ .action(async () => {
120
+ await runGlobalBackup();
121
+ });
122
+
115
123
  // Define 'create-component' command
116
124
  program.command('create-component')
117
125
  .description('Crea un nuevo servicio en el backend y un componente en el frontend simultáneamente.')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "utn-cli",
3
- "version": "2.1.9",
3
+ "version": "2.1.11",
4
4
  "description": "Herramienta CLI unificada para la gestión de plantillas en SIGU.",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -183,6 +183,22 @@
183
183
  .encabezado {
184
184
  font-size: 18px;
185
185
  }
186
+
187
+ .cabecera2 {
188
+ flex-direction: column;
189
+ align-items: flex-start;
190
+ gap: 10px;
191
+ }
192
+
193
+ .filtro-tarjetas {
194
+ width: 100%;
195
+ box-sizing: border-box;
196
+ }
197
+
198
+ .filtro-input {
199
+ width: 100%;
200
+ min-width: 0;
201
+ }
186
202
  }
187
203
 
188
204
  @media (max-width: 480px) {
@@ -73,7 +73,7 @@
73
73
  @if (esDashboard) {
74
74
  <div class="filtro-tarjetas">
75
75
  <mat-icon class="filtro-icono">search</mat-icon>
76
- <input class="filtro-input" type="text" placeholder="Buscar tarjeta..." [value]="filtro"
76
+ <input #filtroInput class="filtro-input" type="text" placeholder="Buscar tarjeta..." [value]="filtro"
77
77
  (input)="onFiltroChange($event)" aria-label="Buscar tarjeta por nombre" />
78
78
  @if (filtro) {
79
79
  <button class="filtro-limpiar" (click)="limpiarFiltro()" title="Limpiar búsqueda"
@@ -1,5 +1,5 @@
1
1
  import { HttpClient } from '@angular/common/http';
2
- import { Component, OnInit, OnDestroy, NgZone } from '@angular/core';
2
+ import { Component, OnInit, OnDestroy, NgZone, AfterViewChecked, ViewChild, ElementRef } from '@angular/core';
3
3
  import { RouterOutlet, Router } from '@angular/router';
4
4
  import { DatosGlobalesService } from '../../../datos-globales.service';
5
5
  import { Location, CommonModule } from '@angular/common';
@@ -19,7 +19,10 @@ import { MatMenuModule } from '@angular/material/menu';
19
19
  templateUrl: './contenedor-componentes.component.html',
20
20
  styleUrl: './contenedor-componentes.component.css'
21
21
  })
22
- export class ContenedorComponentesComponent implements OnInit, OnDestroy {
22
+ export class ContenedorComponentesComponent implements OnInit, OnDestroy, AfterViewChecked {
23
+ @ViewChild('filtroInput') filtroInput?: ElementRef<HTMLInputElement>;
24
+ private focusDone = false;
25
+
23
26
  public TienePermiso: boolean = false;
24
27
  public Titulo: string = '';
25
28
  public Modulo: string = '';
@@ -208,6 +211,13 @@ export class ContenedorComponentesComponent implements OnInit, OnDestroy {
208
211
  this.router.navigate(['/Actividad']);
209
212
  }
210
213
 
214
+ ngAfterViewChecked() {
215
+ if (!this.focusDone && this.filtroInput?.nativeElement) {
216
+ this.filtroInput.nativeElement.focus();
217
+ this.focusDone = true;
218
+ }
219
+ }
220
+
211
221
  ngOnDestroy() {
212
222
  if (this.intervaloUsuarios) {
213
223
  clearInterval(this.intervaloUsuarios);
@@ -14,6 +14,27 @@
14
14
  box-sizing: border-box;
15
15
  }
16
16
 
17
+ .drag-handle {
18
+ display: flex;
19
+ align-items: center;
20
+ justify-content: center;
21
+ padding: 2px 0;
22
+ color: #bbb;
23
+ cursor: grab;
24
+ touch-action: none;
25
+ }
26
+
27
+ .drag-handle:active {
28
+ cursor: grabbing;
29
+ color: #888;
30
+ }
31
+
32
+ .drag-handle mat-icon {
33
+ font-size: 20px;
34
+ width: 20px;
35
+ height: 20px;
36
+ }
37
+
17
38
  .tarjeta-opaca {
18
39
  opacity: 0.15;
19
40
  filter: grayscale(50%);
@@ -1,6 +1,11 @@
1
1
  <div class="contenido" cdkDropList cdkDropListOrientation="mixed" (cdkDropListDropped)="drop($event)">
2
2
  @for (tarjeta of tarjetas; track tarjeta.titulo) {
3
3
  <div cdkDrag [class.tarjeta-opaca]="esDimmed(tarjeta)">
4
+ @if(isMobile) {
5
+ <div class="drag-handle" cdkDragHandle aria-label="Arrastrar tarjeta">
6
+ <mat-icon>drag_indicator</mat-icon>
7
+ </div>
8
+ }
4
9
  @switch (tarjeta.type) {
5
10
  @case ('single') {
6
11
  <app-tarjeta [rutaASeguir]="$any(tarjeta).rutaASeguir" [titulo]="tarjeta.titulo" [descripcion]="tarjeta.descripcion"
@@ -1,4 +1,4 @@
1
- import { Component, OnInit, OnDestroy } from "@angular/core";
1
+ import { Component, OnInit, OnDestroy, HostListener } from "@angular/core";
2
2
  import { CommonModule } from "@angular/common";
3
3
  import { Subject } from "rxjs";
4
4
  import { takeUntil } from "rxjs/operators";
@@ -6,6 +6,7 @@ import { TarjetaComponent } from "../../Componentes/Nucleo/tarjeta/tarjeta.compo
6
6
  import { TarjetaMultipleComponent } from "../../Componentes/Nucleo/tarjeta-multiple/tarjeta-multiple.component";
7
7
  import { TarjetaReporteComponent } from "../../Componentes/Nucleo/tarjeta-reporte/tarjeta-reporte.component";
8
8
  import { TarjetaPersonalizadaComponent } from "../../Componentes/Nucleo/tarjeta-personalizada/tarjeta-personalizada.component";
9
+ import { MatIconModule } from "@angular/material/icon";
9
10
  import { HttpClient } from "@angular/common/http";
10
11
  import { DatosGlobalesService } from '../../datos-globales.service';
11
12
  import { DragDropModule, CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop';
@@ -55,7 +56,7 @@ type AnyTarjetaConfig = TarjetaConfig | TarjetaMultipleConfig | TarjetaReporteCo
55
56
  @Component({
56
57
  selector: "app-contenedor-principal",
57
58
  standalone: true,
58
- imports: [TarjetaComponent, TarjetaMultipleComponent, TarjetaReporteComponent, TarjetaPersonalizadaComponent, CommonModule, DragDropModule],
59
+ imports: [TarjetaComponent, TarjetaMultipleComponent, TarjetaReporteComponent, TarjetaPersonalizadaComponent, CommonModule, DragDropModule, MatIconModule],
59
60
  templateUrl: "./contenedor-principal.component.html",
60
61
  styleUrl: "./contenedor-principal.component.css"
61
62
  })
@@ -65,8 +66,14 @@ export class ContenedorPrincipalComponent implements OnInit, OnDestroy {
65
66
  public cantidadMaxima: number = 0;
66
67
  public tarjetas: AnyTarjetaConfig[] = [];
67
68
  public filtro: string = '';
69
+ public isMobile: boolean = window.innerWidth <= 768;
68
70
  private destroy$ = new Subject<void>();
69
71
 
72
+ @HostListener('window:resize')
73
+ onResize(): void {
74
+ this.isMobile = window.innerWidth <= 768;
75
+ }
76
+
70
77
  constructor(private http: HttpClient, private datosGlobalesService: DatosGlobalesService) {
71
78
  this.cantidad = 0;
72
79
  this.cantidadMaxima = 0;