stub out remaning CTL integrations
Change-Id: Ife8125fab22c7aefc68cd6994f740940b269b380
This commit is contained in:
parent
95875e9200
commit
e4d36d3c54
@ -12,12 +12,12 @@
|
||||
# limitations under the License.
|
||||
*/
|
||||
|
||||
import {NgModule} from '@angular/core';
|
||||
import {RouterModule, Routes} from '@angular/router';
|
||||
import {HomeComponent} from './home/home.component';
|
||||
import {CtlComponent} from './ctl/ctl.component';
|
||||
import {LoginComponent} from './login/login.component';
|
||||
import {AuthGuard} from 'src/services/auth-guard/auth-guard.service';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
import { HomeComponent } from './home/home.component';
|
||||
import { CtlComponent } from './ctl/ctl.component';
|
||||
import { LoginComponent } from './login/login.component';
|
||||
import { AuthGuard } from 'src/services/auth-guard/auth-guard.service';
|
||||
|
||||
const routes: Routes = [{
|
||||
path: 'ctl',
|
||||
@ -35,8 +35,8 @@ const routes: Routes = [{
|
||||
}];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forRoot(routes)],
|
||||
exports: [RouterModule]
|
||||
imports: [RouterModule.forRoot(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
|
||||
export class AppRoutingModule {}
|
||||
export class AppRoutingModule { }
|
||||
|
@ -48,10 +48,30 @@ export class AppComponent implements OnInit, WSReceiver {
|
||||
displayName: 'Bare Metal',
|
||||
route: 'ctl/baremetal',
|
||||
iconName: 'server'
|
||||
}, {
|
||||
displayName: 'Cluster',
|
||||
route: 'ctl/cluster',
|
||||
iconName: 'server'
|
||||
} , {
|
||||
displayName: 'Config',
|
||||
route: 'ctl/config',
|
||||
iconName: 'doc'
|
||||
}, {
|
||||
displayName: 'Documents',
|
||||
route: 'ctl/documents',
|
||||
iconName: 'doc'
|
||||
}, {
|
||||
displayName: 'Image',
|
||||
route: 'ctl/image',
|
||||
iconName: 'doc'
|
||||
}, {
|
||||
displayName: 'Phase',
|
||||
route: 'ctl/phase',
|
||||
iconName: 'doc'
|
||||
}, {
|
||||
displayName: 'Secret',
|
||||
route: 'ctl/secret',
|
||||
iconName: 'doc'
|
||||
}]
|
||||
}, {
|
||||
displayName: 'Dashboards',
|
||||
|
@ -12,26 +12,26 @@
|
||||
# limitations under the License.
|
||||
*/
|
||||
|
||||
import {BrowserModule} from '@angular/platform-browser';
|
||||
import {NgModule} from '@angular/core';
|
||||
import {AppRoutingModule} from './app-routing.module';
|
||||
import {AppComponent} from './app.component';
|
||||
import {RouterModule} from '@angular/router';
|
||||
import {HttpClientModule} from '@angular/common/http';
|
||||
import {WebsocketService} from '../services/websocket/websocket.service';
|
||||
import {ToastrModule} from 'ngx-toastr';
|
||||
import {MonacoEditorModule, NgxMonacoEditorConfig} from 'ngx-monaco-editor';
|
||||
import {MatSidenavModule} from '@angular/material/sidenav';
|
||||
import {MatIconModule} from '@angular/material/icon';
|
||||
import {MatExpansionModule} from '@angular/material/expansion';
|
||||
import {FlexLayoutModule} from '@angular/flex-layout';
|
||||
import {MatListModule} from '@angular/material/list';
|
||||
import {MatToolbarModule} from '@angular/material/toolbar';
|
||||
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
|
||||
import {MatButtonModule} from '@angular/material/button';
|
||||
import {MatTabsModule} from '@angular/material/tabs';
|
||||
import {CtlModule} from './ctl/ctl.module';
|
||||
import {MatProgressBarModule} from '@angular/material/progress-bar';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { AppRoutingModule } from './app-routing.module';
|
||||
import { AppComponent } from './app.component';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { WebsocketService } from '../services/websocket/websocket.service';
|
||||
import { ToastrModule } from 'ngx-toastr';
|
||||
import { MonacoEditorModule, NgxMonacoEditorConfig } from 'ngx-monaco-editor';
|
||||
import { MatSidenavModule } from '@angular/material/sidenav';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatExpansionModule } from '@angular/material/expansion';
|
||||
import { FlexLayoutModule } from '@angular/flex-layout';
|
||||
import { MatListModule } from '@angular/material/list';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatTabsModule } from '@angular/material/tabs';
|
||||
import { CtlModule } from './ctl/ctl.module';
|
||||
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
||||
import monacoConfig from './monaco-config';
|
||||
|
||||
|
||||
|
2
client/src/app/ctl/baremetal/baremetal.component.html
Normal file → Executable file
2
client/src/app/ctl/baremetal/baremetal.component.html
Normal file → Executable file
@ -1 +1 @@
|
||||
<button mat-raised-button color="accent" (click)="generateIso()">Generate ISO</button>
|
||||
<h1>Image component</h1>
|
38
client/src/app/ctl/baremetal/baremetal.component.spec.ts
Normal file → Executable file
38
client/src/app/ctl/baremetal/baremetal.component.spec.ts
Normal file → Executable file
@ -1,21 +1,20 @@
|
||||
/*
|
||||
# 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.
|
||||
*/
|
||||
|
||||
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
import {BaremetalComponent} from './baremetal.component';
|
||||
import {MatButtonModule} from '@angular/material/button';
|
||||
import {ToastrModule} from 'ngx-toastr';
|
||||
/*
|
||||
# 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.
|
||||
*/
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { BaremetalComponent } from './baremetal.component';
|
||||
import { ToastrModule } from 'ngx-toastr';
|
||||
|
||||
describe('BaremetalComponent', () => {
|
||||
let component: BaremetalComponent;
|
||||
@ -24,14 +23,13 @@ describe('BaremetalComponent', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MatButtonModule,
|
||||
ToastrModule.forRoot()
|
||||
],
|
||||
declarations: [
|
||||
BaremetalComponent
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
8
client/src/app/ctl/baremetal/baremetal.component.ts
Normal file → Executable file
8
client/src/app/ctl/baremetal/baremetal.component.ts
Normal file → Executable file
@ -27,7 +27,7 @@ export class BaremetalComponent implements WSReceiver {
|
||||
className = this.constructor.name;
|
||||
// TODO (aschiefe): extract these strings to constants
|
||||
type = 'ctl';
|
||||
component = 'baremetal';
|
||||
component = 'image';
|
||||
|
||||
constructor(private websocketService: WebsocketService) {
|
||||
this.websocketService.registerFunctions(this);
|
||||
@ -38,11 +38,7 @@ export class BaremetalComponent implements WSReceiver {
|
||||
this.websocketService.printIfToast(message);
|
||||
} else {
|
||||
// TODO (aschiefe): determine what should be notifications and what should be 86ed
|
||||
Log.Debug(new LogMessage('Message received in baremetal', this.className, message));
|
||||
Log.Debug(new LogMessage('Message received in image', this.className, message));
|
||||
}
|
||||
}
|
||||
|
||||
generateIso(): void {
|
||||
this.websocketService.sendMessage(new WebsocketMessage(this.type, this.component, 'generateISO'));
|
||||
}
|
||||
}
|
||||
|
8
client/src/app/ctl/baremetal/baremetal.module.ts
Normal file → Executable file
8
client/src/app/ctl/baremetal/baremetal.module.ts
Normal file → Executable file
@ -12,17 +12,15 @@
|
||||
# limitations under the License.
|
||||
*/
|
||||
|
||||
import {NgModule} from '@angular/core';
|
||||
import {BaremetalComponent} from './baremetal.component';
|
||||
import {MatButtonModule} from '@angular/material/button';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { BaremetalComponent } from './baremetal.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
MatButtonModule
|
||||
],
|
||||
declarations: [
|
||||
BaremetalComponent
|
||||
],
|
||||
providers: []
|
||||
})
|
||||
export class BaremetalModule {}
|
||||
export class BaremetalModule { }
|
||||
|
1
client/src/app/ctl/cluster/cluster.component.html
Executable file
1
client/src/app/ctl/cluster/cluster.component.html
Executable file
@ -0,0 +1 @@
|
||||
<h1>Cluster component</h1>
|
44
client/src/app/ctl/cluster/cluster.component.spec.ts
Executable file
44
client/src/app/ctl/cluster/cluster.component.spec.ts
Executable file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
# 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.
|
||||
*/
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { ClusterComponent } from './cluster.component';
|
||||
import { ToastrModule } from 'ngx-toastr';
|
||||
|
||||
describe('ClusterComponent', () => {
|
||||
let component: ClusterComponent;
|
||||
let fixture: ComponentFixture<ClusterComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
ToastrModule.forRoot()
|
||||
],
|
||||
declarations: [
|
||||
ClusterComponent
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ClusterComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
44
client/src/app/ctl/cluster/cluster.component.ts
Executable file
44
client/src/app/ctl/cluster/cluster.component.ts
Executable file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
# 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.
|
||||
*/
|
||||
|
||||
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';
|
||||
|
||||
@Component({
|
||||
selector: 'app-bare-metal',
|
||||
templateUrl: './cluster.component.html',
|
||||
})
|
||||
|
||||
export class ClusterComponent implements WSReceiver {
|
||||
className = this.constructor.name;
|
||||
// TODO (aschiefe): extract these strings to constants
|
||||
type = 'ctl';
|
||||
component = 'cluster';
|
||||
|
||||
constructor(private websocketService: WebsocketService) {
|
||||
this.websocketService.registerFunctions(this);
|
||||
}
|
||||
|
||||
async receiver(message: WebsocketMessage): Promise<void> {
|
||||
if (message.hasOwnProperty('error')) {
|
||||
this.websocketService.printIfToast(message);
|
||||
} else {
|
||||
// TODO (aschiefe): determine what should be notifications and what should be 86ed
|
||||
Log.Debug(new LogMessage('Message received in cluster', this.className, message));
|
||||
}
|
||||
}
|
||||
}
|
26
client/src/app/ctl/cluster/cluster.module.ts
Executable file
26
client/src/app/ctl/cluster/cluster.module.ts
Executable file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
# 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.
|
||||
*/
|
||||
|
||||
import { NgModule } from '@angular/core';
|
||||
import { ClusterComponent } from './cluster.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
],
|
||||
declarations: [
|
||||
ClusterComponent
|
||||
],
|
||||
providers: []
|
||||
})
|
||||
export class ClusterModule { }
|
1
client/src/app/ctl/config/config.component.html
Executable file
1
client/src/app/ctl/config/config.component.html
Executable file
@ -0,0 +1 @@
|
||||
<h1>Config component</h1>
|
44
client/src/app/ctl/config/config.component.spec.ts
Executable file
44
client/src/app/ctl/config/config.component.spec.ts
Executable file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
# 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.
|
||||
*/
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { ConfigComponent } from './config.component';
|
||||
import { ToastrModule } from 'ngx-toastr';
|
||||
|
||||
describe('ConfigComponent', () => {
|
||||
let component: ConfigComponent;
|
||||
let fixture: ComponentFixture<ConfigComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
ToastrModule.forRoot()
|
||||
],
|
||||
declarations: [
|
||||
ConfigComponent
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ConfigComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
44
client/src/app/ctl/config/config.component.ts
Executable file
44
client/src/app/ctl/config/config.component.ts
Executable file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
# 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.
|
||||
*/
|
||||
|
||||
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';
|
||||
|
||||
@Component({
|
||||
selector: 'app-bare-metal',
|
||||
templateUrl: './config.component.html',
|
||||
})
|
||||
|
||||
export class ConfigComponent implements WSReceiver {
|
||||
className = this.constructor.name;
|
||||
// TODO (aschiefe): extract these strings to constants
|
||||
type = 'ctl';
|
||||
component = 'config';
|
||||
|
||||
constructor(private websocketService: WebsocketService) {
|
||||
this.websocketService.registerFunctions(this);
|
||||
}
|
||||
|
||||
async receiver(message: WebsocketMessage): Promise<void> {
|
||||
if (message.hasOwnProperty('error')) {
|
||||
this.websocketService.printIfToast(message);
|
||||
} else {
|
||||
// TODO (aschiefe): determine what should be notifications and what should be 86ed
|
||||
Log.Debug(new LogMessage('Message received in config', this.className, message));
|
||||
}
|
||||
}
|
||||
}
|
26
client/src/app/ctl/config/config.module.ts
Executable file
26
client/src/app/ctl/config/config.module.ts
Executable file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
# 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.
|
||||
*/
|
||||
|
||||
import { NgModule } from '@angular/core';
|
||||
import { ConfigComponent } from './config.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
],
|
||||
declarations: [
|
||||
ConfigComponent
|
||||
],
|
||||
providers: []
|
||||
})
|
||||
export class ConfigModule { }
|
@ -12,24 +12,50 @@
|
||||
# limitations under the License.
|
||||
*/
|
||||
|
||||
import {NgModule} from '@angular/core';
|
||||
import {RouterModule, Routes} from '@angular/router';
|
||||
import {DocumentComponent} from './document/document.component';
|
||||
import {BaremetalComponent} from './baremetal/baremetal.component';
|
||||
import {AuthGuard} from 'src/services/auth-guard/auth-guard.service';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
import { BaremetalComponent } from './baremetal/baremetal.component';
|
||||
import { ClusterComponent } from './cluster/cluster.component';
|
||||
import { ConfigComponent } from './config/config.component';
|
||||
import { DocumentComponent } from './document/document.component';
|
||||
import { ImageComponent } from './image/image.component';
|
||||
import { PhaseComponent } from './phase/phase.component';
|
||||
import { SecretComponent } from './secret/secret.component';
|
||||
|
||||
import { AuthGuard } from 'src/services/auth-guard/auth-guard.service';
|
||||
|
||||
const routes: Routes = [{
|
||||
path: 'documents',
|
||||
canActivate: [AuthGuard],
|
||||
component: DocumentComponent,
|
||||
}, {
|
||||
path: 'baremetal',
|
||||
canActivate: [AuthGuard],
|
||||
component: BaremetalComponent
|
||||
path: 'baremetal',
|
||||
canActivate: [AuthGuard],
|
||||
component: BaremetalComponent
|
||||
}, {
|
||||
path: 'cluster',
|
||||
canActivate: [AuthGuard],
|
||||
component: ClusterComponent,
|
||||
}, {
|
||||
path: 'config',
|
||||
canActivate: [AuthGuard],
|
||||
component: ConfigComponent,
|
||||
}, {
|
||||
path: 'documents',
|
||||
canActivate: [AuthGuard],
|
||||
component: DocumentComponent,
|
||||
}, {
|
||||
path: 'image',
|
||||
canActivate: [AuthGuard],
|
||||
component: ImageComponent,
|
||||
}, {
|
||||
path: 'phase',
|
||||
canActivate: [AuthGuard],
|
||||
component: PhaseComponent,
|
||||
}, {
|
||||
path: 'secret',
|
||||
canActivate: [AuthGuard],
|
||||
component: SecretComponent,
|
||||
}];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class CtlRoutingModule {}
|
||||
export class CtlRoutingModule { }
|
||||
|
@ -12,9 +12,9 @@
|
||||
# limitations under the License.
|
||||
*/
|
||||
|
||||
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
import {CtlComponent} from './ctl.component';
|
||||
import {RouterTestingModule} from '@angular/router/testing';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { CtlComponent } from './ctl.component';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
||||
describe('CtlComponent', () => {
|
||||
let component: CtlComponent;
|
||||
@ -27,7 +27,7 @@ describe('CtlComponent', () => {
|
||||
],
|
||||
declarations: [CtlComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
@ -12,7 +12,7 @@
|
||||
# limitations under the License.
|
||||
*/
|
||||
|
||||
import {Component} from '@angular/core';
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-ctl',
|
||||
|
@ -12,12 +12,12 @@
|
||||
# limitations under the License.
|
||||
*/
|
||||
|
||||
import {NgModule} from '@angular/core';
|
||||
import {RouterModule} from '@angular/router';
|
||||
import {CtlComponent} from './ctl.component';
|
||||
import {DocumentModule} from './document/document.module';
|
||||
import {BaremetalModule} from './baremetal/baremetal.module';
|
||||
import {CtlRoutingModule} from './ctl-routing.module';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { CtlComponent } from './ctl.component';
|
||||
import { DocumentModule } from './document/document.module';
|
||||
import { BaremetalModule } from './baremetal/baremetal.module';
|
||||
import { CtlRoutingModule } from './ctl-routing.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@ -27,7 +27,7 @@ import {CtlRoutingModule} from './ctl-routing.module';
|
||||
DocumentModule,
|
||||
BaremetalModule,
|
||||
],
|
||||
declarations: [ CtlComponent ],
|
||||
declarations: [CtlComponent],
|
||||
providers: []
|
||||
})
|
||||
export class CtlModule {}
|
||||
export class CtlModule { }
|
||||
|
@ -166,6 +166,6 @@ export class DocumentComponent implements WSReceiver {
|
||||
}
|
||||
|
||||
documentPull(): void {
|
||||
this.websocketService.sendMessage(new WebsocketMessage(this.type, this.component, 'docPull'));
|
||||
this.websocketService.sendMessage(new WebsocketMessage(this.type, this.component, 'pull'));
|
||||
}
|
||||
}
|
||||
|
1
client/src/app/ctl/image/image.component.html
Normal file
1
client/src/app/ctl/image/image.component.html
Normal file
@ -0,0 +1 @@
|
||||
<button mat-raised-button color="accent" (click)="generateIso()">Generate ISO</button>
|
46
client/src/app/ctl/image/image.component.spec.ts
Normal file
46
client/src/app/ctl/image/image.component.spec.ts
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
# 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.
|
||||
*/
|
||||
|
||||
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', () => {
|
||||
let component: ImageComponent;
|
||||
let fixture: ComponentFixture<ImageComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MatButtonModule,
|
||||
ToastrModule.forRoot()
|
||||
],
|
||||
declarations: [
|
||||
ImageComponent
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ImageComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
48
client/src/app/ctl/image/image.component.ts
Normal file
48
client/src/app/ctl/image/image.component.ts
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
# 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.
|
||||
*/
|
||||
|
||||
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';
|
||||
|
||||
@Component({
|
||||
selector: 'app-bare-metal',
|
||||
templateUrl: './image.component.html',
|
||||
})
|
||||
|
||||
export class ImageComponent implements WSReceiver {
|
||||
className = this.constructor.name;
|
||||
// TODO (aschiefe): extract these strings to constants
|
||||
type = 'ctl';
|
||||
component = 'image';
|
||||
|
||||
constructor(private websocketService: WebsocketService) {
|
||||
this.websocketService.registerFunctions(this);
|
||||
}
|
||||
|
||||
async receiver(message: WebsocketMessage): Promise<void> {
|
||||
if (message.hasOwnProperty('error')) {
|
||||
this.websocketService.printIfToast(message);
|
||||
} else {
|
||||
// TODO (aschiefe): determine what should be notifications and what should be 86ed
|
||||
Log.Debug(new LogMessage('Message received in image', this.className, message));
|
||||
}
|
||||
}
|
||||
|
||||
generateIso(): void {
|
||||
this.websocketService.sendMessage(new WebsocketMessage(this.type, this.component, 'generate'));
|
||||
}
|
||||
}
|
27
client/src/app/ctl/image/image.module.ts
Normal file
27
client/src/app/ctl/image/image.module.ts
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
# 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.
|
||||
*/
|
||||
|
||||
import { NgModule } from '@angular/core';
|
||||
import { ImageComponent } from './image.component';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
MatButtonModule
|
||||
],
|
||||
declarations: [
|
||||
ImageComponent
|
||||
],
|
||||
})
|
||||
export class ImageModule { }
|
1
client/src/app/ctl/phase/phase.component.html
Executable file
1
client/src/app/ctl/phase/phase.component.html
Executable file
@ -0,0 +1 @@
|
||||
<h1>Phase component</h1>
|
44
client/src/app/ctl/phase/phase.component.spec.ts
Executable file
44
client/src/app/ctl/phase/phase.component.spec.ts
Executable file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
# 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.
|
||||
*/
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { PhaseComponent } from './phase.component';
|
||||
import { ToastrModule } from 'ngx-toastr';
|
||||
|
||||
describe('PhaseComponent', () => {
|
||||
let component: PhaseComponent;
|
||||
let fixture: ComponentFixture<PhaseComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
ToastrModule.forRoot()
|
||||
],
|
||||
declarations: [
|
||||
PhaseComponent
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PhaseComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
44
client/src/app/ctl/phase/phase.component.ts
Executable file
44
client/src/app/ctl/phase/phase.component.ts
Executable file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
# 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.
|
||||
*/
|
||||
|
||||
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';
|
||||
|
||||
@Component({
|
||||
selector: 'app-bare-metal',
|
||||
templateUrl: './phase.component.html',
|
||||
})
|
||||
|
||||
export class PhaseComponent implements WSReceiver {
|
||||
className = this.constructor.name;
|
||||
// TODO (aschiefe): extract these strings to constants
|
||||
type = 'ctl';
|
||||
component = 'phase';
|
||||
|
||||
constructor(private websocketService: WebsocketService) {
|
||||
this.websocketService.registerFunctions(this);
|
||||
}
|
||||
|
||||
async receiver(message: WebsocketMessage): Promise<void> {
|
||||
if (message.hasOwnProperty('error')) {
|
||||
this.websocketService.printIfToast(message);
|
||||
} else {
|
||||
// TODO (aschiefe): determine what should be notifications and what should be 86ed
|
||||
Log.Debug(new LogMessage('Message received in image', this.className, message));
|
||||
}
|
||||
}
|
||||
}
|
26
client/src/app/ctl/phase/phase.module.ts
Executable file
26
client/src/app/ctl/phase/phase.module.ts
Executable file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
# 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.
|
||||
*/
|
||||
|
||||
import { NgModule } from '@angular/core';
|
||||
import { PhaseComponent } from './phase.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
],
|
||||
declarations: [
|
||||
PhaseComponent
|
||||
],
|
||||
providers: []
|
||||
})
|
||||
export class PhaseModule { }
|
1
client/src/app/ctl/secret/secret.component.html
Executable file
1
client/src/app/ctl/secret/secret.component.html
Executable file
@ -0,0 +1 @@
|
||||
<h1>Secret component</h1>
|
44
client/src/app/ctl/secret/secret.component.spec.ts
Executable file
44
client/src/app/ctl/secret/secret.component.spec.ts
Executable file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
# 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.
|
||||
*/
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { SecretComponent } from './secret.component';
|
||||
import { ToastrModule } from 'ngx-toastr';
|
||||
|
||||
describe('SecretComponent', () => {
|
||||
let component: SecretComponent;
|
||||
let fixture: ComponentFixture<SecretComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
ToastrModule.forRoot()
|
||||
],
|
||||
declarations: [
|
||||
SecretComponent
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SecretComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
44
client/src/app/ctl/secret/secret.component.ts
Executable file
44
client/src/app/ctl/secret/secret.component.ts
Executable file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
# 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.
|
||||
*/
|
||||
|
||||
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';
|
||||
|
||||
@Component({
|
||||
selector: 'app-bare-metal',
|
||||
templateUrl: './secret.component.html',
|
||||
})
|
||||
|
||||
export class SecretComponent implements WSReceiver {
|
||||
className = this.constructor.name;
|
||||
// TODO (aschiefe): extract these strings to constants
|
||||
type = 'ctl';
|
||||
component = 'secret';
|
||||
|
||||
constructor(private websocketService: WebsocketService) {
|
||||
this.websocketService.registerFunctions(this);
|
||||
}
|
||||
|
||||
async receiver(message: WebsocketMessage): Promise<void> {
|
||||
if (message.hasOwnProperty('error')) {
|
||||
this.websocketService.printIfToast(message);
|
||||
} else {
|
||||
// TODO (aschiefe): determine what should be notifications and what should be 86ed
|
||||
Log.Debug(new LogMessage('Message received in image', this.className, message));
|
||||
}
|
||||
}
|
||||
}
|
26
client/src/app/ctl/secret/secret.module.ts
Executable file
26
client/src/app/ctl/secret/secret.module.ts
Executable file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
# 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.
|
||||
*/
|
||||
|
||||
import { NgModule } from '@angular/core';
|
||||
import { SecretComponent } from './secret.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
],
|
||||
declarations: [
|
||||
SecretComponent
|
||||
],
|
||||
providers: []
|
||||
})
|
||||
export class PhaseModule { }
|
@ -12,10 +12,10 @@
|
||||
# limitations under the License.
|
||||
*/
|
||||
|
||||
import {Component} from '@angular/core';
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-home',
|
||||
templateUrl: './home.component.html',
|
||||
})
|
||||
export class HomeComponent {}
|
||||
export class HomeComponent { }
|
||||
|
@ -12,10 +12,10 @@
|
||||
# limitations under the License.
|
||||
*/
|
||||
|
||||
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
import {RouterTestingModule} from '@angular/router/testing';
|
||||
import {LoginComponent} from './login.component';
|
||||
import {ToastrModule} from 'ngx-toastr';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { LoginComponent } from './login.component';
|
||||
import { ToastrModule } from 'ngx-toastr';
|
||||
|
||||
describe('CtlComponent', () => {
|
||||
let component: LoginComponent;
|
||||
|
@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import {WebsocketService} from 'src/services/websocket/websocket.service';
|
||||
import { WebsocketService } from 'src/services/websocket/websocket.service';
|
||||
import { WSReceiver, WebsocketMessage, Authentication } from 'src/services/websocket/websocket.models';
|
||||
|
||||
@Component({
|
||||
@ -26,7 +26,7 @@ export class LoginComponent implements WSReceiver, OnInit {
|
||||
type = 'ui'; // needed to have the websocket service in the constructor
|
||||
component = 'auth'; // needed to have the websocket service in the constructor
|
||||
|
||||
constructor(private websocketService: WebsocketService) {}
|
||||
constructor(private websocketService: WebsocketService) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
// bind the enter key to the submit button on the page
|
||||
|
@ -12,9 +12,9 @@
|
||||
# limitations under the License.
|
||||
*/
|
||||
|
||||
import {TestBed} from '@angular/core/testing';
|
||||
import {WebsocketService} from './websocket.service';
|
||||
import {ToastrModule} from 'ngx-toastr';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { WebsocketService } from './websocket.service';
|
||||
import { ToastrModule } from 'ngx-toastr';
|
||||
|
||||
describe('WebsocketService', () => {
|
||||
let service: WebsocketService;
|
||||
|
@ -12,9 +12,9 @@
|
||||
# limitations under the License.
|
||||
*/
|
||||
|
||||
import {Injectable, OnDestroy} from '@angular/core';
|
||||
import {WebsocketMessage, WSReceiver, Authentication} from './websocket.models';
|
||||
import {ToastrService} from 'ngx-toastr';
|
||||
import { Injectable, OnDestroy } from '@angular/core';
|
||||
import { WebsocketMessage, WSReceiver, Authentication } from './websocket.models';
|
||||
import { ToastrService } from 'ngx-toastr';
|
||||
import 'reflect-metadata';
|
||||
|
||||
@Injectable({
|
||||
@ -120,7 +120,7 @@ export class WebsocketService implements OnDestroy {
|
||||
break;
|
||||
case 1007:
|
||||
console.log('Web Socket Closed: terminating the connection because it has received data within a message that was not ' +
|
||||
'consistent with the type of the message: ', code);
|
||||
'consistent with the type of the message: ', code);
|
||||
break;
|
||||
case 1008:
|
||||
console.log('Web Socket Closed: terminating the connection because it has received a message that "violates its policy": ', code);
|
||||
@ -131,7 +131,7 @@ export class WebsocketService implements OnDestroy {
|
||||
break;
|
||||
case 1010:
|
||||
console.log('Web Socket Closed: client is terminating the connection because it has expected the server to negotiate ' +
|
||||
'one or more extension, but the server didn\'t return them in the response message of the WebSocket handshake: ', code);
|
||||
'one or more extension, but the server didn\'t return them in the response message of the WebSocket handshake: ', code);
|
||||
break;
|
||||
case 1011:
|
||||
console.log('Web Socket Closed: server is terminating the connection because it encountered an unexpected condition that' +
|
||||
|
@ -88,27 +88,73 @@ const (
|
||||
UI WsRequestType = "ui"
|
||||
Alert WsRequestType = "alert"
|
||||
|
||||
// UI components
|
||||
Authcomplete WsComponentType = "authcomplete"
|
||||
SetConfig WsComponentType = "setConfig"
|
||||
Initialize WsComponentType = "initialize"
|
||||
Keepalive WsComponentType = "keepalive"
|
||||
CTLConfig WsComponentType = "config"
|
||||
Baremetal WsComponentType = "baremetal"
|
||||
Document WsComponentType = "document"
|
||||
Auth WsComponentType = "auth"
|
||||
Log WsComponentType = "log"
|
||||
|
||||
// auth sub components
|
||||
// CTL components
|
||||
Baremetal WsComponentType = "baremetal"
|
||||
Cluster WsComponentType = "cluster"
|
||||
CTLConfig WsComponentType = "config"
|
||||
Document WsComponentType = "document"
|
||||
Image WsComponentType = "image"
|
||||
Phase WsComponentType = "phase"
|
||||
Secret WsComponentType = "secret"
|
||||
|
||||
// auth subcomponets
|
||||
Approved WsSubComponentType = "approved"
|
||||
Authenticate WsSubComponentType = "authenticate"
|
||||
Denied WsSubComponentType = "denied"
|
||||
Refresh WsSubComponentType = "refresh"
|
||||
Validate WsSubComponentType = "validate"
|
||||
|
||||
// ctl components
|
||||
// ctl subcomponets
|
||||
// ctl baremetal subcomponets
|
||||
EjectMedia WsSubComponentType = "ejectMedia"
|
||||
PowerOff WsSubComponentType = "powerOff"
|
||||
PowerOn WsSubComponentType = "powerOn"
|
||||
PowerStatus WsSubComponentType = "powerStatus"
|
||||
Reboot WsSubComponentType = "reboot"
|
||||
RemoteDirect WsSubComponentType = "remoteDirect"
|
||||
|
||||
// ctl cluster subcomponets
|
||||
Move WsSubComponentType = "move"
|
||||
Status WsSubComponentType = "status"
|
||||
|
||||
// ctl config subcomponets
|
||||
GetContext WsSubComponentType = "getContext"
|
||||
GetEncryptionConfig WsSubComponentType = "getEncryptionConfig"
|
||||
GetManagementConfig WsSubComponentType = "getManagementConfig"
|
||||
GetManifest WsSubComponentType = "getManifest"
|
||||
SetContext WsSubComponentType = "setContext"
|
||||
SetEncryptionConfig WsSubComponentType = "setEncryptionConfig"
|
||||
SetManagementConfig WsSubComponentType = "setManagementConfig"
|
||||
SetManifest WsSubComponentType = "setManifest"
|
||||
UseContext WsSubComponentType = "useContext"
|
||||
|
||||
// ctl document subcomponents
|
||||
Plugin WsSubComponentType = "plugin"
|
||||
Pull WsSubComponentType = "pull"
|
||||
|
||||
// ctl image subcomponents
|
||||
Build WsSubComponentType = "build"
|
||||
|
||||
// ctl phase subcomponents
|
||||
Plan WsSubComponentType = "plan"
|
||||
Render WsSubComponentType = "render"
|
||||
Run WsSubComponentType = "run"
|
||||
|
||||
// ctl secret subcomponents
|
||||
Generate WsSubComponentType = "generate"
|
||||
|
||||
// ctl common components
|
||||
Init WsSubComponentType = "init"
|
||||
GetDefaults WsSubComponentType = "getDefaults"
|
||||
GenerateISO WsSubComponentType = "generateISO"
|
||||
DocPull WsSubComponentType = "docPull"
|
||||
Yaml WsSubComponentType = "yaml"
|
||||
YamlWrite WsSubComponentType = "yamlWrite"
|
||||
GetYaml WsSubComponentType = "getYaml"
|
||||
|
@ -33,7 +33,12 @@ var KubeConfigPath *string
|
||||
// CTLFunctionMap is a function map for the CTL functions that is referenced in the webservice
|
||||
var CTLFunctionMap = map[configs.WsComponentType]func(configs.WsMessage) configs.WsMessage{
|
||||
configs.Baremetal: HandleBaremetalRequest,
|
||||
configs.Cluster: HandleClusterRequest,
|
||||
configs.CTLConfig: HandleConfigRequest,
|
||||
configs.Document: HandleDocumentRequest,
|
||||
configs.Image: HandleImageRequest,
|
||||
configs.Phase: HandlePhaseRequest,
|
||||
configs.Secret: HandleSecretRequest,
|
||||
}
|
||||
|
||||
// maintain the state of a potentially long running process
|
||||
|
@ -17,8 +17,6 @@ package ctl
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"opendev.org/airship/airshipctl/pkg/bootstrap/isogen"
|
||||
"opendev.org/airship/airshipctl/pkg/config"
|
||||
"opendev.org/airship/airshipui/pkg/configs"
|
||||
)
|
||||
|
||||
@ -34,21 +32,20 @@ func HandleBaremetalRequest(request configs.WsMessage) configs.WsMessage {
|
||||
var err error
|
||||
var message string
|
||||
|
||||
client, err := NewClient(AirshipConfigPath, KubeConfigPath, request)
|
||||
if err != nil {
|
||||
response.Error = err.Error()
|
||||
return response
|
||||
}
|
||||
|
||||
subComponent := request.SubComponent
|
||||
switch subComponent {
|
||||
case configs.GenerateISO:
|
||||
// since this is long running cache it up
|
||||
// TODO: Test before running the geniso
|
||||
runningRequests[subComponent] = true
|
||||
message, err = client.generateIso()
|
||||
// now that we're done forget we did anything
|
||||
delete(runningRequests, subComponent)
|
||||
case configs.EjectMedia:
|
||||
err = fmt.Errorf("Subcomponent %s not implemented", request.SubComponent)
|
||||
case configs.PowerOff:
|
||||
err = fmt.Errorf("Subcomponent %s not implemented", request.SubComponent)
|
||||
case configs.PowerOn:
|
||||
err = fmt.Errorf("Subcomponent %s not implemented", request.SubComponent)
|
||||
case configs.PowerStatus:
|
||||
err = fmt.Errorf("Subcomponent %s not implemented", request.SubComponent)
|
||||
case configs.Reboot:
|
||||
err = fmt.Errorf("Subcomponent %s not implemented", request.SubComponent)
|
||||
case configs.RemoteDirect:
|
||||
err = fmt.Errorf("Subcomponent %s not implemented", request.SubComponent)
|
||||
default:
|
||||
err = fmt.Errorf("Subcomponent %s not found", request.SubComponent)
|
||||
}
|
||||
@ -61,14 +58,3 @@ func HandleBaremetalRequest(request configs.WsMessage) configs.WsMessage {
|
||||
|
||||
return response
|
||||
}
|
||||
|
||||
func (c *Client) generateIso() (string, error) {
|
||||
var message string
|
||||
cfgFactory := config.CreateFactory(AirshipConfigPath, KubeConfigPath)
|
||||
err := isogen.GenerateBootstrapIso(cfgFactory)
|
||||
if err == nil {
|
||||
message = fmt.Sprintf("Success")
|
||||
}
|
||||
|
||||
return message, err
|
||||
}
|
||||
|
54
pkg/ctl/cluster.go
Normal file
54
pkg/ctl/cluster.go
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
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
|
||||
|
||||
https://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.
|
||||
*/
|
||||
|
||||
package ctl
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"opendev.org/airship/airshipui/pkg/configs"
|
||||
)
|
||||
|
||||
// HandleClusterRequest will flop between requests so we don't have to have them all mapped as function calls
|
||||
// This will wait for the sub component to complete before responding. The assumption is this is an async request
|
||||
func HandleClusterRequest(request configs.WsMessage) configs.WsMessage {
|
||||
response := configs.WsMessage{
|
||||
Type: configs.CTL,
|
||||
Component: configs.Baremetal,
|
||||
SubComponent: request.SubComponent,
|
||||
}
|
||||
|
||||
var err error
|
||||
var message string
|
||||
|
||||
subComponent := request.SubComponent
|
||||
switch subComponent {
|
||||
case configs.Init:
|
||||
err = fmt.Errorf("Subcomponent %s not implemented", request.SubComponent)
|
||||
case configs.Move:
|
||||
err = fmt.Errorf("Subcomponent %s not implemented", request.SubComponent)
|
||||
case configs.Status:
|
||||
err = fmt.Errorf("Subcomponent %s not implemented", request.SubComponent)
|
||||
default:
|
||||
err = fmt.Errorf("Subcomponent %s not found", request.SubComponent)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
response.Error = err.Error()
|
||||
} else {
|
||||
response.Message = message
|
||||
}
|
||||
|
||||
return response
|
||||
}
|
68
pkg/ctl/config.go
Normal file
68
pkg/ctl/config.go
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
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
|
||||
|
||||
https://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.
|
||||
*/
|
||||
|
||||
package ctl
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"opendev.org/airship/airshipui/pkg/configs"
|
||||
)
|
||||
|
||||
// HandleConfigRequest will flop between requests so we don't have to have them all mapped as function calls
|
||||
// This will wait for the sub component to complete before responding. The assumption is this is an async request
|
||||
func HandleConfigRequest(request configs.WsMessage) configs.WsMessage {
|
||||
response := configs.WsMessage{
|
||||
Type: configs.CTL,
|
||||
Component: configs.Baremetal,
|
||||
SubComponent: request.SubComponent,
|
||||
}
|
||||
|
||||
var err error
|
||||
var message string
|
||||
|
||||
subComponent := request.SubComponent
|
||||
switch subComponent {
|
||||
case configs.GetContext:
|
||||
err = fmt.Errorf("Subcomponent %s not implemented", request.SubComponent)
|
||||
case configs.GetEncryptionConfig:
|
||||
err = fmt.Errorf("Subcomponent %s not implemented", request.SubComponent)
|
||||
case configs.GetManagementConfig:
|
||||
err = fmt.Errorf("Subcomponent %s not implemented", request.SubComponent)
|
||||
case configs.GetManifest:
|
||||
err = fmt.Errorf("Subcomponent %s not implemented", request.SubComponent)
|
||||
case configs.Init:
|
||||
err = fmt.Errorf("Subcomponent %s not implemented", request.SubComponent)
|
||||
case configs.SetContext:
|
||||
err = fmt.Errorf("Subcomponent %s not implemented", request.SubComponent)
|
||||
case configs.SetEncryptionConfig:
|
||||
err = fmt.Errorf("Subcomponent %s not implemented", request.SubComponent)
|
||||
case configs.SetManagementConfig:
|
||||
err = fmt.Errorf("Subcomponent %s not implemented", request.SubComponent)
|
||||
case configs.SetManifest:
|
||||
err = fmt.Errorf("Subcomponent %s not implemented", request.SubComponent)
|
||||
case configs.UseContext:
|
||||
err = fmt.Errorf("Subcomponent %s not implemented", request.SubComponent)
|
||||
default:
|
||||
err = fmt.Errorf("Subcomponent %s not found", request.SubComponent)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
response.Error = err.Error()
|
||||
} else {
|
||||
response.Message = message
|
||||
}
|
||||
|
||||
return response
|
||||
}
|
@ -50,8 +50,10 @@ func HandleDocumentRequest(request configs.WsMessage) configs.WsMessage {
|
||||
}
|
||||
|
||||
switch request.SubComponent {
|
||||
case configs.DocPull:
|
||||
case configs.Pull:
|
||||
message, err = client.docPull()
|
||||
case configs.Plugin:
|
||||
err = fmt.Errorf("Subcomponent %s not implemented", request.SubComponent)
|
||||
case configs.YamlWrite:
|
||||
id = request.ID
|
||||
response.Name, response.YAML, err = client.writeYamlFile(id, request.YAML)
|
||||
|
74
pkg/ctl/image.go
Normal file
74
pkg/ctl/image.go
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
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
|
||||
|
||||
https://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.
|
||||
*/
|
||||
|
||||
package ctl
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"opendev.org/airship/airshipctl/pkg/bootstrap/isogen"
|
||||
"opendev.org/airship/airshipctl/pkg/config"
|
||||
"opendev.org/airship/airshipui/pkg/configs"
|
||||
)
|
||||
|
||||
// HandleImageRequest will flop between requests so we don't have to have them all mapped as function calls
|
||||
// This will wait for the sub component to complete before responding. The assumption is this is an async request
|
||||
func HandleImageRequest(request configs.WsMessage) configs.WsMessage {
|
||||
response := configs.WsMessage{
|
||||
Type: configs.CTL,
|
||||
Component: configs.Baremetal,
|
||||
SubComponent: request.SubComponent,
|
||||
}
|
||||
|
||||
var err error
|
||||
var message string
|
||||
|
||||
client, err := NewClient(AirshipConfigPath, KubeConfigPath, request)
|
||||
if err != nil {
|
||||
response.Error = err.Error()
|
||||
return response
|
||||
}
|
||||
|
||||
subComponent := request.SubComponent
|
||||
switch subComponent {
|
||||
case configs.Build:
|
||||
// since this is long running cache it up
|
||||
// TODO: Test before running the geniso
|
||||
runningRequests[subComponent] = true
|
||||
message, err = client.generateIso()
|
||||
// now that we're done forget we did anything
|
||||
delete(runningRequests, subComponent)
|
||||
default:
|
||||
err = fmt.Errorf("Subcomponent %s not found", request.SubComponent)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
response.Error = err.Error()
|
||||
} else {
|
||||
response.Message = message
|
||||
}
|
||||
|
||||
return response
|
||||
}
|
||||
|
||||
func (c *Client) generateIso() (string, error) {
|
||||
var message string
|
||||
cfgFactory := config.CreateFactory(AirshipConfigPath, KubeConfigPath)
|
||||
err := isogen.GenerateBootstrapIso(cfgFactory)
|
||||
if err == nil {
|
||||
message = fmt.Sprintf("Success")
|
||||
}
|
||||
|
||||
return message, err
|
||||
}
|
54
pkg/ctl/phase.go
Normal file
54
pkg/ctl/phase.go
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
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
|
||||
|
||||
https://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.
|
||||
*/
|
||||
|
||||
package ctl
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"opendev.org/airship/airshipui/pkg/configs"
|
||||
)
|
||||
|
||||
// HandlePhaseRequest will flop between requests so we don't have to have them all mapped as function calls
|
||||
// This will wait for the sub component to complete before responding. The assumption is this is an async request
|
||||
func HandlePhaseRequest(request configs.WsMessage) configs.WsMessage {
|
||||
response := configs.WsMessage{
|
||||
Type: configs.CTL,
|
||||
Component: configs.Baremetal,
|
||||
SubComponent: request.SubComponent,
|
||||
}
|
||||
|
||||
var err error
|
||||
var message string
|
||||
|
||||
subComponent := request.SubComponent
|
||||
switch subComponent {
|
||||
case configs.Plan:
|
||||
err = fmt.Errorf("Subcomponent %s not implemented", request.SubComponent)
|
||||
case configs.Render:
|
||||
err = fmt.Errorf("Subcomponent %s not implemented", request.SubComponent)
|
||||
case configs.Run:
|
||||
err = fmt.Errorf("Subcomponent %s not implemented", request.SubComponent)
|
||||
default:
|
||||
err = fmt.Errorf("Subcomponent %s not found", request.SubComponent)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
response.Error = err.Error()
|
||||
} else {
|
||||
response.Message = message
|
||||
}
|
||||
|
||||
return response
|
||||
}
|
50
pkg/ctl/secret.go
Normal file
50
pkg/ctl/secret.go
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
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
|
||||
|
||||
https://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.
|
||||
*/
|
||||
|
||||
package ctl
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"opendev.org/airship/airshipui/pkg/configs"
|
||||
)
|
||||
|
||||
// HandleSecretRequest will flop between requests so we don't have to have them all mapped as function calls
|
||||
// This will wait for the sub component to complete before responding. The assumption is this is an async request
|
||||
func HandleSecretRequest(request configs.WsMessage) configs.WsMessage {
|
||||
response := configs.WsMessage{
|
||||
Type: configs.CTL,
|
||||
Component: configs.Baremetal,
|
||||
SubComponent: request.SubComponent,
|
||||
}
|
||||
|
||||
var err error
|
||||
var message string
|
||||
|
||||
subComponent := request.SubComponent
|
||||
switch subComponent {
|
||||
case configs.Generate:
|
||||
err = fmt.Errorf("Subcomponent %s not implemented", request.SubComponent)
|
||||
default:
|
||||
err = fmt.Errorf("Subcomponent %s not found", request.SubComponent)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
response.Error = err.Error()
|
||||
} else {
|
||||
response.Message = message
|
||||
}
|
||||
|
||||
return response
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user