Merge "Document cleanup & remove authguard token error message"

This commit is contained in:
Zuul 2020-10-26 17:16:02 +00:00 committed by Gerrit Code Review
commit b443f72924
8 changed files with 34 additions and 21 deletions

View File

@ -102,6 +102,9 @@ export class AppComponent implements OnInit, WSReceiver {
this.updateDashboards(message.dashboards);
}
break;
case 'keepalive':
Log.Debug(new LogMessage('Keepalive message received in app', this.className, message));
break;
default:
Log.Debug(new LogMessage('Uncategorized message received in app', this.className, message));
break;

View File

@ -12,3 +12,20 @@
# limitations under the License.
*/
/* add border & center the table */
.documentBorder {
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: 100%;
}
.container {
padding-left: 10px;
padding-right: 10px;
}

View File

@ -1,7 +1,6 @@
<mat-tab-group>
<mat-tab label="Document Pull">
<br>
<button type="button" class="btn btn-info" id="DocPullBtn" (click)="documentPull()" style="width: 150px;">Document Pull</button>
<p>Response to Pull: {{statusMsg}}</p>
</mat-tab>
</mat-tab-group>
<h1>Airship Document Operations</h1>
<div class="container">
<div class="documentBorder">
<button type="button" class="btn btn-info" id="DocPullBtn" (click)="documentPull()">Document Pull</button>&nbsp;&nbsp;Response: {{statusMsg}}
</div>
</div>

View File

@ -14,10 +14,7 @@
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import {DocumentComponent} from './document.component';
import {MatTabsModule} from '@angular/material/tabs';
import {MatButtonModule} from '@angular/material/button';
import { ToastrModule } from 'ngx-toastr';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
describe('DocumentComponent', () => {
let component: DocumentComponent;
@ -26,10 +23,7 @@ describe('DocumentComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
MatTabsModule,
MatButtonModule,
ToastrModule.forRoot(),
BrowserAnimationsModule
],
declarations: [DocumentComponent]
})

View File

@ -41,8 +41,10 @@ export class DocumentComponent implements WSReceiver {
this.websocketService.printIfToast(message);
} else {
switch (message.subComponent) {
case 'docPull':
this.statusMsg = 'Message pull was a ' + message.message;
case 'pull':
this.statusMsg = 'Document pull was a ' + message.message;
const button = (document.getElementById('DocPullBtn') as HTMLInputElement);
button.removeAttribute('disabled');
break;
default:
Log.Error(new LogMessage('Document message sub component not handled', this.className, message));
@ -52,6 +54,9 @@ export class DocumentComponent implements WSReceiver {
}
documentPull(): void {
this.statusMsg = '';
this.websocketService.sendMessage(new WebsocketMessage(this.type, this.component, 'pull'));
const button = (document.getElementById('DocPullBtn') as HTMLInputElement);
button.setAttribute('disabled', 'disabled');
}
}

View File

@ -13,17 +13,13 @@
*/
import {NgModule} from '@angular/core';
import {MatTabsModule} from '@angular/material/tabs';
import {DocumentComponent} from './document.component';
import {MatButtonModule} from '@angular/material/button';
@NgModule({
declarations: [
DocumentComponent,
],
imports: [
MatTabsModule,
MatButtonModule,
],
providers: [],
})

View File

@ -73,7 +73,6 @@ export class AuthGuard implements WSReceiver, CanActivate {
async receiver(message: WebsocketMessage): Promise<void> {
if (message.hasOwnProperty('error')) {
Log.Error(new LogMessage('Error received in AuthGuard', this.className, message));
this.websocketService.printIfToast(message);
AuthGuard.logout();
} else {
switch (message.subComponent) {

View File

@ -67,7 +67,7 @@ func (c *Client) docPull() (*string, error) {
// so setting to false
err := pull.Pull(cfgFactory, false)
if err == nil {
s := fmt.Sprintf("Success")
s := "Success"
message = &s
}