diff --git a/ogWebconsole/src/app/app.module.ts b/ogWebconsole/src/app/app.module.ts index 607ce23..1690c08 100644 --- a/ogWebconsole/src/app/app.module.ts +++ b/ogWebconsole/src/app/app.module.ts @@ -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, diff --git a/ogWebconsole/src/app/components/groups/components/client-main-view/deploy-image/deploy-image.component.ts b/ogWebconsole/src/app/components/groups/components/client-main-view/deploy-image/deploy-image.component.ts index 54265c6..14a0c04 100644 --- a/ogWebconsole/src/app/components/groups/components/client-main-view/deploy-image/deploy-image.component.ts +++ b/ogWebconsole/src/app/components/groups/components/client-main-view/deploy-image/deploy-image.component.ts @@ -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, diff --git a/ogWebconsole/src/app/components/groups/components/client-main-view/run-script-assistant/run-script-assistant.component.html b/ogWebconsole/src/app/components/groups/components/client-main-view/run-script-assistant/run-script-assistant.component.html index a17794d..7b154c9 100644 --- a/ogWebconsole/src/app/components/groups/components/client-main-view/run-script-assistant/run-script-assistant.component.html +++ b/ogWebconsole/src/app/components/groups/components/client-main-view/run-script-assistant/run-script-assistant.component.html @@ -10,11 +10,11 @@
diff --git a/ogWebconsole/src/app/components/groups/components/client-main-view/run-script-assistant/run-script-assistant.component.ts b/ogWebconsole/src/app/components/groups/components/client-main-view/run-script-assistant/run-script-assistant.component.ts index b1135d9..61297c8 100644 --- a/ogWebconsole/src/app/components/groups/components/client-main-view/run-script-assistant/run-script-assistant.component.ts +++ b/ogWebconsole/src/app/components/groups/components/client-main-view/run-script-assistant/run-script-assistant.component.ts @@ -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: () => { diff --git a/ogWebconsole/src/app/shared/queue-confirmation-modal/queue-confirmation-modal.component.ts b/ogWebconsole/src/app/shared/queue-confirmation-modal/queue-confirmation-modal.component.ts index 2e6571b..722873c 100644 --- a/ogWebconsole/src/app/shared/queue-confirmation-modal/queue-confirmation-modal.component.ts +++ b/ogWebconsole/src/app/shared/queue-confirmation-modal/queue-confirmation-modal.component.ts @@ -15,7 +15,7 @@ export class QueueConfirmationModalComponent { ) {} onNoClick(): void { - this.dialogRef.close(false); + this.dialogRef.close(); } onYesClick(): void {