summaryrefslogtreecommitdiffstats
path: root/admin/WebConsole3/frontend/src/app/service
diff options
context:
space:
mode:
Diffstat (limited to 'admin/WebConsole3/frontend/src/app/service')
-rw-r--r--admin/WebConsole3/frontend/src/app/service/og-commands.service.ts5
-rw-r--r--admin/WebConsole3/frontend/src/app/service/og-common.service.ts59
-rw-r--r--admin/WebConsole3/frontend/src/app/service/og-sweet-alert.service.ts104
3 files changed, 114 insertions, 54 deletions
diff --git a/admin/WebConsole3/frontend/src/app/service/og-commands.service.ts b/admin/WebConsole3/frontend/src/app/service/og-commands.service.ts
index 6b54a896..6194f123 100644
--- a/admin/WebConsole3/frontend/src/app/service/og-commands.service.ts
+++ b/admin/WebConsole3/frontend/src/app/service/og-commands.service.ts
@@ -7,17 +7,18 @@ import {Router} from '@angular/router';
import {Injectable} from '@angular/core';
import * as _ from 'lodash';
import {environment} from '../../environments/environment';
+import {Execution} from '../model/command';
@Injectable({
providedIn: 'root'
})
export class OGCommandsService {
public ogInstructions = '';
- public execution: any;
+ public execution: Execution;
private commands: any;
constructor(private router: Router, private ogCommonService: OgCommonService, private toaster: ToasterService, private ogSweetAlert: OgSweetAlertService, private commandService: CommandService, private translate: TranslateService) {
- this.execution = {};
+ this.execution = new Execution();
this.commands = environment.commands;
}
diff --git a/admin/WebConsole3/frontend/src/app/service/og-common.service.ts b/admin/WebConsole3/frontend/src/app/service/og-common.service.ts
index 88c87b08..b04c1def 100644
--- a/admin/WebConsole3/frontend/src/app/service/og-common.service.ts
+++ b/admin/WebConsole3/frontend/src/app/service/og-common.service.ts
@@ -282,7 +282,7 @@ export class OgCommonService {
} else {
// Comprobar el tipo de partición dependiendo del código
const elements = partitionTable.partitions.filter((element) => (element.id === partition.partitionCode));
- partition.parttype = (elements.length > 0) ? elements[0].type : '';
+ partition.type = (elements.length > 0) ? elements[0].type : '';
// Si es cache, actualizar su contenido
if (partition.partitionCode === 'ca') {
// actualizar el contenido de la cache
@@ -351,4 +351,61 @@ export class OgCommonService {
array.push(component.id);
}
}
+
+ getPartitionColor(partition) {
+ let color = '#c5e72b';
+ // Para la partición de datos se usa un color específico
+ if (this.isDATA(partition)) {
+ color = 'rgb(237,194,64)';
+ } else if (this.isEFI(partition)) {
+ color = '#bfe4e5';
+ } else if (this.isWINDOWS(partition)) {
+ color = '#00c0ef';
+ } else if (this.isLINUXSWAP(partition)) {
+ color = '#545454';
+ } else if (this.isLINUX(partition)) {
+ color = '#605ca8';
+ } else if (this.isCACHE(partition)) {
+ color = '#FC5A5A';
+ } else if (this.isFreeSpace(partition)) {
+ color = '#bcbcbc';
+ }
+ return color;
+ }
+
+ isEFI(partition) {
+ return partition.type === 'EFI';
+ }
+
+ isCACHE(partition) {
+ return partition.type === 'CACHE';
+ }
+
+ isEXTENDED(partition) {
+ return partition.type === 'EXTENDED';
+ }
+
+ isWINDOWS(partition) {
+ return partition.type === 'NTFS' || partition.type === 'WINDOWS';
+ }
+
+ isLINUX(partition) {
+ return typeof partition.type === 'string' && partition.type.includes('LINUX');
+ }
+
+ isLINUXSWAP(partition) {
+ return partition.type === 'LINUX-SWAP';
+ }
+
+ isDATA(partition) {
+ return partition.type === 'DATA';
+ }
+
+ isUNKNOWN(partition) {
+ return partition.type === 'UNKNOWN';
+ }
+
+ isFreeSpace(partition) {
+ return partition.type === 'free_space';
+ }
}
diff --git a/admin/WebConsole3/frontend/src/app/service/og-sweet-alert.service.ts b/admin/WebConsole3/frontend/src/app/service/og-sweet-alert.service.ts
index ad63ee1c..ce502a63 100644
--- a/admin/WebConsole3/frontend/src/app/service/og-sweet-alert.service.ts
+++ b/admin/WebConsole3/frontend/src/app/service/og-sweet-alert.service.ts
@@ -1,51 +1,53 @@
-import {Injectable} from '@angular/core';
-import Swal from 'sweetalert2';
-import {TranslateService} from '@ngx-translate/core';
-
-@Injectable({
- providedIn: 'root'
-})
-export class OgSweetAlertService {
- constructor(private translate: TranslateService) {}
-
- swal(options): Promise<any> {
- return Swal.fire(options);
- }
-
-
- success(title, message) {
- Swal.fire( title, message, 'success' );
- }
-
- error(title, message) {
- Swal.fire( title, message, 'error' );
- }
-
- warning(title, message) {
- Swal.fire( title, message, 'warning' );
- }
-
- info(title, message) {
- Swal.fire( title, message, 'info' );
- }
-
- question(title, message, okcallback?, cancelcallback?) {
- Swal.fire({
- title: title,
- text: message,
- type: 'info',
- showCancelButton: true,
- cancelButtonText: this.translate.instant('no'),
- cancelButtonClass: 'default',
- confirmButtonClass: 'primary',
- confirmButtonText: this.translate.instant('yes')
-
- }).then((response) => {
- if (response.dismiss) {
- cancelcallback(response);
- } else {
- okcallback(response);
- }
- });
- }
-}
+import {Injectable} from '@angular/core';
+import Swal from 'sweetalert2';
+import {TranslateService} from '@ngx-translate/core';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class OgSweetAlertService {
+ constructor(private translate: TranslateService) {}
+
+ swal(options): Promise<any> {
+ return Swal.fire(options);
+ }
+
+
+ success(title, message) {
+ Swal.fire( title, message, 'success' );
+ }
+
+ error(title, message) {
+ Swal.fire( title, message, 'error' );
+ }
+
+ warning(title, message) {
+ Swal.fire( title, message, 'warning' );
+ }
+
+ info(title, message) {
+ Swal.fire( title, message, 'info' );
+ }
+
+ question(title, message, okcallback?, cancelcallback?) {
+ Swal.fire({
+ title: title,
+ text: message,
+ type: 'info',
+ showCancelButton: true,
+ cancelButtonText: this.translate.instant('no'),
+ cancelButtonClass: 'default',
+ confirmButtonClass: 'primary',
+ confirmButtonText: this.translate.instant('yes')
+
+ }).then((response) => {
+ if (response.dismiss) {
+ if (typeof cancelcallback === 'function') {
+ cancelcallback(response);
+ }
+ } else {
+ okcallback(response);
+ }
+ });
+ }
+}