fix: namespace localStorage keys with username
testing/ogGui-multibranch/pipeline/head There was a failure building this commit Details
oggui-debian-package/pipeline/head This commit looks good Details

main
Juan Manuel Bardallo 2026-09-23 14:00:45 +02:00
parent 744e721598
commit c5010fca0a
1 changed files with 11 additions and 6 deletions

View File

@ -7,6 +7,7 @@ import { HttpClient } from "@angular/common/http";
import { ToastrService } from "ngx-toastr";
import { ActivatedRoute, Router } from "@angular/router";
import { ConfigService } from '@services/config.service';
import { AuthService } from '@services/auth.service';
import {DeployMethodConfigDialogComponent} from "./deploy-method-config-dialog/deploy-method-config-dialog.component";
import { CreateTaskComponent } from "../../../../commands/commands-task/create-task/create-task.component";
import { MatDialog } from "@angular/material/dialog";
@ -19,6 +20,7 @@ import { QueueConfirmationModalComponent } from "../../../../../shared/queue-con
})
export class DeployImageComponent implements OnInit {
public translate = inject(TranslateService);
public authService = inject(AuthService);
baseUrl: string;
@Output() dataChange = new EventEmitter<any>();
@ -153,11 +155,12 @@ export class DeployImageComponent implements OnInit {
this.runScriptContext = params['runScriptContext'] ? JSON.parse(params['runScriptContext']) : null;
});
const savedAction = localStorage.getItem('deploy_postDeployAction');
const username = this.authService.username || 'default';
const savedAction = localStorage.getItem(`deploy_postDeployAction_${username}`);
if (savedAction) {
this.postDeployAction = savedAction;
}
const savedPxePermanent = localStorage.getItem('deploy_pxePermanent');
const savedPxePermanent = localStorage.getItem(`deploy_pxePermanent_${username}`);
if (savedPxePermanent !== null) {
this.pxePermanent = savedPxePermanent === 'true';
}
@ -171,7 +174,8 @@ export class DeployImageComponent implements OnInit {
(response: any) => {
this.pxeTemplates = response?.['hydra:member'] || [];
const savedTemplateUuid = localStorage.getItem('deploy_selectedPxeTemplateUuid');
const username = this.authService.username || 'default';
const savedTemplateUuid = localStorage.getItem(`deploy_selectedPxeTemplateUuid_${username}`);
if (savedTemplateUuid && this.postDeployAction === 'pxeTemplate') {
const match = this.pxeTemplates.find(t => t.uuid === savedTemplateUuid);
if (match) {
@ -541,10 +545,11 @@ export class DeployImageComponent implements OnInit {
}
private enqueuePostDeployActions() {
localStorage.setItem('deploy_postDeployAction', this.postDeployAction);
localStorage.setItem('deploy_pxePermanent', String(this.pxePermanent));
const username = this.authService.username || 'default';
localStorage.setItem(`deploy_postDeployAction_${username}`, this.postDeployAction);
localStorage.setItem(`deploy_pxePermanent_${username}`, String(this.pxePermanent));
if (this.selectedPxeTemplate?.uuid) {
localStorage.setItem('deploy_selectedPxeTemplateUuid', this.selectedPxeTemplate.uuid);
localStorage.setItem(`deploy_selectedPxeTemplateUuid_${username}`, this.selectedPxeTemplate.uuid);
}
if (this.postDeployAction === 'none') {