From 3ef6ff223f810c9db3eca50ad1c6d2baa6879894 Mon Sep 17 00:00:00 2001 From: "Schiefelbein, Andrew" Date: Fri, 23 Oct 2020 15:20:56 -0500 Subject: [PATCH] Clean up image and make it work with cfgfactory Basic refactor to work with the new CTL methods Change-Id: I55e15a12949f2a8b61afb7aed617ceeb39231c26 --- client/src/app/ctl/image/image.component.css | 31 +++++++++++++++++++ client/src/app/ctl/image/image.component.html | 7 ++++- .../src/app/ctl/image/image.component.spec.ts | 2 -- client/src/app/ctl/image/image.component.ts | 10 +++--- client/src/app/ctl/image/image.module.ts | 4 --- pkg/ctl/image.go | 15 ++++++--- 6 files changed, 54 insertions(+), 15 deletions(-) create mode 100755 client/src/app/ctl/image/image.component.css diff --git a/client/src/app/ctl/image/image.component.css b/client/src/app/ctl/image/image.component.css new file mode 100755 index 0000000..d41e1a0 --- /dev/null +++ b/client/src/app/ctl/image/image.component.css @@ -0,0 +1,31 @@ +/* +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +*/ + +/* add border & center the table */ +.imageBorder { + padding-left: 10px; + padding-right: 10px; + padding-top: 10px; + padding-bottom: 10px; + border-spacing: 10px; + border:1px gray solid; + border-radius: 5px; + align-self: center; + width: 97%; +} + +.container { + padding-left: 10px; + padding-right: 10px; +} \ No newline at end of file diff --git a/client/src/app/ctl/image/image.component.html b/client/src/app/ctl/image/image.component.html index 1356511..b038ce1 100644 --- a/client/src/app/ctl/image/image.component.html +++ b/client/src/app/ctl/image/image.component.html @@ -1 +1,6 @@ - +

Airship Image Operations

+
+
+   Response: {{statusMsg}} +
+
\ No newline at end of file diff --git a/client/src/app/ctl/image/image.component.spec.ts b/client/src/app/ctl/image/image.component.spec.ts index c38b716..937f180 100644 --- a/client/src/app/ctl/image/image.component.spec.ts +++ b/client/src/app/ctl/image/image.component.spec.ts @@ -14,7 +14,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { ImageComponent } from './image.component'; -import { MatButtonModule } from '@angular/material/button'; import { ToastrModule } from 'ngx-toastr'; describe('ImageComponent', () => { @@ -24,7 +23,6 @@ describe('ImageComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ imports: [ - MatButtonModule, ToastrModule.forRoot() ], declarations: [ diff --git a/client/src/app/ctl/image/image.component.ts b/client/src/app/ctl/image/image.component.ts index 42b7ad9..1bf6bba 100644 --- a/client/src/app/ctl/image/image.component.ts +++ b/client/src/app/ctl/image/image.component.ts @@ -13,14 +13,15 @@ */ import { Component } from '@angular/core'; -import { WebsocketService } from '../../../services/websocket/websocket.service'; -import { WebsocketMessage, WSReceiver } from '../../../services/websocket/websocket.models'; -import { Log } from '../../../services/log/log.service'; -import { LogMessage } from '../../../services/log/log-message'; +import { WebsocketService } from 'src/services/websocket/websocket.service'; +import { WebsocketMessage, WSReceiver } from 'src/services/websocket/websocket.models'; +import { Log } from 'src/services/log/log.service'; +import { LogMessage } from 'src/services/log/log-message'; @Component({ selector: 'app-bare-metal', templateUrl: './image.component.html', + styleUrls: ['./image.component.css'] }) export class ImageComponent implements WSReceiver { @@ -28,6 +29,7 @@ export class ImageComponent implements WSReceiver { // TODO (aschiefe): extract these strings to constants type = 'ctl'; component = 'image'; + statusMsg: string; constructor(private websocketService: WebsocketService) { this.websocketService.registerFunctions(this); diff --git a/client/src/app/ctl/image/image.module.ts b/client/src/app/ctl/image/image.module.ts index 7b53bbc..c1343ee 100644 --- a/client/src/app/ctl/image/image.module.ts +++ b/client/src/app/ctl/image/image.module.ts @@ -14,12 +14,8 @@ import { NgModule } from '@angular/core'; import { ImageComponent } from './image.component'; -import { MatButtonModule } from '@angular/material/button'; @NgModule({ - imports: [ - MatButtonModule - ], declarations: [ ImageComponent ], diff --git a/pkg/ctl/image.go b/pkg/ctl/image.go index e8745d1..98301c3 100644 --- a/pkg/ctl/image.go +++ b/pkg/ctl/image.go @@ -15,9 +15,10 @@ package ctl import ( - "errors" "fmt" + "opendev.org/airship/airshipctl/pkg/config" + "opendev.org/airship/airshipctl/pkg/phase" "opendev.org/airship/airshipui/pkg/configs" ) @@ -42,7 +43,7 @@ func HandleImageRequest(user *string, request configs.WsMessage) configs.WsMessa subComponent := request.SubComponent switch subComponent { - case configs.Build: + case configs.Generate: // since this is long running cache it up // TODO: Test before running the geniso runningRequests[subComponent] = true @@ -63,7 +64,13 @@ func HandleImageRequest(user *string, request configs.WsMessage) configs.WsMessa return response } +// generate iso now just runs a phase and not an individual command func (c *Client) generateIso() (*string, error) { - err := errors.New("Isogen is no longer available") - return nil, err + cfgFactory := config.CreateFactory(AirshipConfigPath, KubeConfigPath) + p := &phase.RunCommand{ + Factory: cfgFactory, + } + p.Options.PhaseID.Name = config.BootstrapPhase + s := "Success" + return &s, p.RunE() }