refs #2596. Create task options
testing/ogGui-multibranch/pipeline/head There was a failure building this commit Details

pull/33/head
Manuel Aranda Rosales 2025-08-05 10:37:56 +02:00
parent 17a3bfb2c5
commit cee95adcb4
5 changed files with 50 additions and 16 deletions

View File

@ -160,6 +160,8 @@ import { QueueConfirmationModalComponent } from './shared/queue-confirmation-mod
import { ModalOverlayComponent } from './shared/modal-overlay/modal-overlay.component';
import { ScrollToTopComponent } from './shared/scroll-to-top/scroll-to-top.component';
import { CreateTagModalComponent } from './components/repositories/show-git-images/create-tag-modal/create-tag-modal.component';
import { CreateBranchModalComponent } from './components/repositories/show-git-images/create-branch-modal/create-branch-modal.component';
import { ClientLogsModalComponent } from './components/groups/shared/client-logs-modal/client-logs-modal.component';
export function HttpLoaderFactory(http: HttpClient) {
return new TranslateHttpLoader(http, './locale/', '.json');
@ -276,7 +278,9 @@ registerLocaleData(localeEs, 'es-ES');
ClientPendingTasksComponent,
ModalOverlayComponent,
ScrollToTopComponent,
CreateTagModalComponent
CreateTagModalComponent,
CreateBranchModalComponent,
ClientLogsModalComponent
],
bootstrap: [AppComponent],
imports: [BrowserModule,

View File

@ -421,17 +421,28 @@ export class DeployImageComponent implements OnInit{
openScheduleModal(): void {
let scope = this.runScriptContext.type;
let selectedClients = null;
if ((!this.runScriptContext || this.runScriptContext.type === 'client' || this.selectedClients.length === 1) && this.selectedClients && this.selectedClients.length > 0) {
scope = 'clients';
selectedClients = this.selectedClients;
}
const dialogRef = this.dialog.open(CreateTaskComponent, {
width: '800px',
data: {
scope: this.runScriptContext.type,
organizationalUnit: this.runScriptContext['@id'],
source: 'assistant'
scope: scope,
selectedClients: selectedClients,
organizationalUnit: this.runScriptContext?.['@id'],
source: 'assistant',
runScriptContext: this.runScriptContext
}
});
dialogRef.afterClosed().subscribe((result: { [x: string]: any; }) => {
if (result) {
if (result !== undefined) {
const payload = {
method: this.selectedMethod,
diskNumber: this.selectedPartition.diskNumber,

View File

@ -10,11 +10,11 @@
</h4>
</div>
<div class="button-row">
<button class="action-button" [disabled]="selectedClients.length < 1 || (commandType === 'existing' && !selectedScript) || loading" (click)="save()">Ejecutar</button>
<button class="action-button" [disabled]="selectedClients.length < 1 || (commandType === 'existing' && !selectedScript) || (commandType === 'new' && !newScript.trim()) || loading" (click)="save()">Ejecutar</button>
</div>
<div class="button-row">
<button color="accent" class="action-button" [disabled]="selectedClients.length < 1 || (commandType === 'existing' && !selectedScript) || loading" (click)="openScheduleModal()">
<button color="accent" class="action-button" [disabled]="selectedClients.length < 1 || (commandType === 'existing' && !selectedScript) || (commandType === 'new' && !newScript.trim()) || loading" (click)="openScheduleModal()">
Opciones de programación
</button>
</div>

View File

@ -29,7 +29,7 @@ export class RunScriptAssistantComponent implements OnInit{
parameters: any = {};
selectedScript: any = null;
selectedClients: any[] = [];
allSelected: boolean = true;
allSelected: boolean = false;
commandType: string = 'existing';
newScript: string = '';
selection = new SelectionModel(true, []);
@ -56,7 +56,11 @@ export class RunScriptAssistantComponent implements OnInit{
this.clientId = this.clientData?.length ? this.clientData[0]['@id'] : null;
this.clientData.forEach((client: { selected: boolean; status: string}) => { client.selected = true; });
this.selectedClients = this.clientData.filter((client: { selected: boolean; status: string}) => client.selected);
this.selectedClients = this.clientData.filter(
(client: { selected: boolean; status: string }) => client.selected
);
this.allSelected = this.clientData.length > 0 && this.clientData.every((client: { selected: boolean }) => client.selected);
this.loadScripts()
}
@ -117,12 +121,15 @@ export class RunScriptAssistantComponent implements OnInit{
}
updateSelectedClients() {
this.selectedClients = this.clientData.filter((client: { selected: boolean; status: string}) => client.selected);
this.selectedClients = this.clientData.filter(
(client: { selected: boolean; status: string }) => client.selected
);
}
toggleSelectAll() {
this.allSelected = !this.allSelected;
this.clientData.forEach((client: { selected: boolean; status: string }) => { client.selected = this.allSelected; });
this.updateSelectedClients();
}
getPartitionsTooltip(client: any): string {
@ -198,21 +205,33 @@ export class RunScriptAssistantComponent implements OnInit{
}
openScheduleModal(): void {
let scope = this.runScriptContext.type;
let selectedClients = null;
if ((!this.runScriptContext || this.runScriptContext.type === 'client' || this.selectedClients.length === 1) && this.selectedClients && this.selectedClients.length > 0) {
scope = 'clients';
selectedClients = this.selectedClients;
}
const dialogRef = this.dialog.open(CreateTaskComponent, {
width: '800px',
data: {
scope: this.runScriptContext.type,
organizationalUnit: this.runScriptContext['@id'],
source: 'assistant'
scope: scope,
selectedClients: selectedClients,
organizationalUnit: this.runScriptContext?.['@id'],
source: 'assistant',
runScriptContext: this.runScriptContext
}
});
dialogRef.afterClosed().subscribe(result => {
console.log(result);
if (result) {
this.http.post(`${this.baseUrl}/command-task-scripts`, {
commandTask: result['@id'],
commandTask: result.taskId['@id'],
content: this.commandType === 'existing' ? this.scriptContent : this.newScript,
order: 1,
order: result.executionOrder,
type: 'run-script',
}).subscribe({
next: () => {

View File

@ -15,7 +15,7 @@ export class QueueConfirmationModalComponent {
) {}
onNoClick(): void {
this.dialogRef.close(false);
this.dialogRef.close();
}
onYesClick(): void {