From 36dbe35e497bfe6949edd571de174e64b55d835b Mon Sep 17 00:00:00 2001 From: "Schiefelbein, Andrew" Date: Tue, 22 Sep 2020 10:17:59 -0500 Subject: [PATCH] Makefile & build improvements This should do the following: 1. Overwrite the websocket address if defined in the etc/airshipui.json file at build time. 2. Speed up the copyright and whitespace linting 3. Add copyright for .css and .ts files Change-Id: I4155282e4d69bb4e20a71f0c481834c7232d8479 --- Makefile | 18 ++++++++++ client/src/app/app-routing.module.ts | 14 ++++++++ client/src/app/app.component.css | 14 ++++++++ client/src/app/app.component.ts | 14 ++++++++ client/src/app/app.models.ts | 14 ++++++++ client/src/app/app.module.ts | 14 ++++++++ .../ctl/baremetal/baremetal.component.spec.ts | 14 ++++++++ .../app/ctl/baremetal/baremetal.component.ts | 18 ++++++++-- .../src/app/ctl/baremetal/baremetal.module.ts | 14 ++++++++ client/src/app/ctl/ctl-routing.module.ts | 14 ++++++++ client/src/app/ctl/ctl.component.spec.ts | 14 ++++++++ client/src/app/ctl/ctl.component.ts | 14 ++++++++ client/src/app/ctl/ctl.module.ts | 14 ++++++++ .../app/ctl/document/document.component.css | 14 ++++++++ .../ctl/document/document.component.spec.ts | 14 ++++++++ .../app/ctl/document/document.component.ts | 14 ++++++++ .../src/app/ctl/document/document.models.ts | 14 ++++++++ .../src/app/ctl/document/document.module.ts | 14 ++++++++ client/src/app/home/home.component.spec.ts | 14 ++++++++ client/src/app/home/home.component.ts | 14 ++++++++ client/src/app/login/login.component.css | 14 ++++++++ client/src/app/login/login.component.spec.ts | 14 ++++++++ client/src/app/login/login.component.ts | 14 ++++++++ client/src/app/login/login.module.ts | 16 ++++++++- client/src/app/monaco-config.ts | 14 ++++++++ client/src/environments/environment.prod.ts | 14 ++++++++ client/src/environments/environment.ts | 14 ++++++++ client/src/main.ts | 14 ++++++++ client/src/polyfills.ts | 14 ++++++++ .../auth-guard/auth-guard.service.spec.ts | 14 ++++++++ .../services/auth-guard/auth-guard.service.ts | 14 ++++++++ client/src/services/icon/icon.service.spec.ts | 14 ++++++++ client/src/services/icon/icon.service.ts | 14 ++++++++ client/src/services/icon/icons.enum.ts | 14 ++++++++ client/src/services/log/log-message.ts | 14 ++++++++ client/src/services/log/log.enum.ts | 14 ++++++++ client/src/services/log/log.service.spec.ts | 14 ++++++++ client/src/services/log/log.service.ts | 14 ++++++++ .../services/websocket/websocket.models.ts | 14 ++++++++ .../websocket/websocket.service.spec.ts | 14 ++++++++ .../services/websocket/websocket.service.ts | 14 ++++++++ client/src/styles.css | 14 ++++++++ tools/check_copyright | 33 +++++++++---------- tools/whitespace_linter | 14 +++++++- 44 files changed, 623 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index f114078..0251cc0 100755 --- a/Makefile +++ b/Makefile @@ -10,6 +10,8 @@ GIT_VERSION=$(shell git describe --match 'v*' --always) TOOLBINDIR := tools/bin WEBDIR := client +UI_DISTDIR := $(WEBDIR)/dist/airshipui +UI_CONFI_FILE := etc/airshipui.json LINTER := $(TOOLBINDIR)/golangci-lint LINTER_CONFIG := .golangci.yaml NODEJS_BIN := $(realpath tools)/node-v12.16.3/bin @@ -122,6 +124,22 @@ frontend-build: $(YARN) frontend-build: @echo "Executing frontend build steps..." @cd $(WEBDIR) && (PATH="$(PATH):$(NODEJS_BIN)"; $(NG) build) && cd .. + @if [ -f $(UI_CONFI_FILE) ]; then \ + HOST=""; \ + PORT=""; \ + if [ `wc -l $(UI_CONFI_FILE) | cut -d ' ' -f 1` -gt 1 ]; then \ + HOST=`grep -Po "\"host\":\s*\"[a-zA-Z]*\"" $(UI_CONFI_FILE) | cut -d '"' -f4`; \ + PORT=`grep -Po '"port":\s*[0-9]*' $(UI_CONFI_FILE) | cut -d ':' -f 2| sed -e 's?\s??g'`; \ + else \ + HOST=`grep -oP '(?<="host":)[^ ]*' $(UI_CONFI_FILE) | cut -d ',' -f 1 | sed -e 's?"??g'`; \ + PORT=`grep -oP '(?<="port":)[^ ]*' $(UI_CONFI_FILE) | cut -d ',' -f 1`; \ + fi; \ + if [ `echo $$HOST | wc -c` -gt 1 ] && [ `echo $$PORT | wc -c` -gt 1 ]; then \ + echo "Replacing localhost:10443 with $$HOST:$$PORT as the websocket address"; \ + sed -i s?localhost:10443?$$HOST:$$PORT? $(UI_DISTDIR)/main.js; \ + sed -i s?localhost:10443?$$HOST:$$PORT? $(UI_DISTDIR)/main.js.map; \ + fi; \ + fi @echo "Frontend build completed successfully" .PHONY: frontend-unit-test diff --git a/client/src/app/app-routing.module.ts b/client/src/app/app-routing.module.ts index b762870..21f24b5 100644 --- a/client/src/app/app-routing.module.ts +++ b/client/src/app/app-routing.module.ts @@ -1,3 +1,17 @@ +/* +# 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 {RouterModule, Routes} from '@angular/router'; import {HomeComponent} from './home/home.component'; diff --git a/client/src/app/app.component.css b/client/src/app/app.component.css index 9f6abe1..9d58958 100644 --- a/client/src/app/app.component.css +++ b/client/src/app/app.component.css @@ -1,3 +1,17 @@ +/* +# 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. +*/ + .main-container { display: flex; flex-direction: column; diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts index 0e91138..26676a1 100644 --- a/client/src/app/app.component.ts +++ b/client/src/app/app.component.ts @@ -1,3 +1,17 @@ +/* +# 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, OnInit, ViewChild } from '@angular/core'; import { MatAccordion } from '@angular/material/expansion'; import { environment } from 'src/environments/environment'; diff --git a/client/src/app/app.models.ts b/client/src/app/app.models.ts index 48f7252..7feb059 100644 --- a/client/src/app/app.models.ts +++ b/client/src/app/app.models.ts @@ -1,3 +1,17 @@ +/* +# 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. +*/ + export class Nav { displayName: string; disabled?: boolean; diff --git a/client/src/app/app.module.ts b/client/src/app/app.module.ts index 7779af9..35e1a59 100644 --- a/client/src/app/app.module.ts +++ b/client/src/app/app.module.ts @@ -1,3 +1,17 @@ +/* +# 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 {BrowserModule} from '@angular/platform-browser'; import {NgModule} from '@angular/core'; import {AppRoutingModule} from './app-routing.module'; diff --git a/client/src/app/ctl/baremetal/baremetal.component.spec.ts b/client/src/app/ctl/baremetal/baremetal.component.spec.ts index 78eed12..e5a8fa3 100644 --- a/client/src/app/ctl/baremetal/baremetal.component.spec.ts +++ b/client/src/app/ctl/baremetal/baremetal.component.spec.ts @@ -1,3 +1,17 @@ +/* +# 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'; diff --git a/client/src/app/ctl/baremetal/baremetal.component.ts b/client/src/app/ctl/baremetal/baremetal.component.ts index 41cef5d..45e1264 100644 --- a/client/src/app/ctl/baremetal/baremetal.component.ts +++ b/client/src/app/ctl/baremetal/baremetal.component.ts @@ -1,5 +1,19 @@ -import {Component} from '@angular/core'; -import {WebsocketService} from '../../../services/websocket/websocket.service'; +/* +# 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'; diff --git a/client/src/app/ctl/baremetal/baremetal.module.ts b/client/src/app/ctl/baremetal/baremetal.module.ts index 8af5329..ff02797 100644 --- a/client/src/app/ctl/baremetal/baremetal.module.ts +++ b/client/src/app/ctl/baremetal/baremetal.module.ts @@ -1,3 +1,17 @@ +/* +# 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 {BaremetalComponent} from './baremetal.component'; import {MatButtonModule} from '@angular/material/button'; diff --git a/client/src/app/ctl/ctl-routing.module.ts b/client/src/app/ctl/ctl-routing.module.ts index 1b78bfb..861062d 100644 --- a/client/src/app/ctl/ctl-routing.module.ts +++ b/client/src/app/ctl/ctl-routing.module.ts @@ -1,3 +1,17 @@ +/* +# 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 {RouterModule, Routes} from '@angular/router'; import {DocumentComponent} from './document/document.component'; diff --git a/client/src/app/ctl/ctl.component.spec.ts b/client/src/app/ctl/ctl.component.spec.ts index 4a22ba5..eb7bcca 100644 --- a/client/src/app/ctl/ctl.component.spec.ts +++ b/client/src/app/ctl/ctl.component.spec.ts @@ -1,3 +1,17 @@ +/* +# 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 {CtlComponent} from './ctl.component'; import {RouterTestingModule} from '@angular/router/testing'; diff --git a/client/src/app/ctl/ctl.component.ts b/client/src/app/ctl/ctl.component.ts index 58ac327..3497ec4 100644 --- a/client/src/app/ctl/ctl.component.ts +++ b/client/src/app/ctl/ctl.component.ts @@ -1,3 +1,17 @@ +/* +# 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'; @Component({ diff --git a/client/src/app/ctl/ctl.module.ts b/client/src/app/ctl/ctl.module.ts index 6ce7bc5..4f5022d 100644 --- a/client/src/app/ctl/ctl.module.ts +++ b/client/src/app/ctl/ctl.module.ts @@ -1,3 +1,17 @@ +/* +# 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 {RouterModule} from '@angular/router'; import {CtlComponent} from './ctl.component'; diff --git a/client/src/app/ctl/document/document.component.css b/client/src/app/ctl/document/document.component.css index 5c55609..2869f96 100644 --- a/client/src/app/ctl/document/document.component.css +++ b/client/src/app/ctl/document/document.component.css @@ -1,3 +1,17 @@ +/* +# 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. +*/ + .explorer-container { display: flex; flex-direction: row; diff --git a/client/src/app/ctl/document/document.component.spec.ts b/client/src/app/ctl/document/document.component.spec.ts index eabf149..268f7df 100644 --- a/client/src/app/ctl/document/document.component.spec.ts +++ b/client/src/app/ctl/document/document.component.spec.ts @@ -1,3 +1,17 @@ +/* +# 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 {DocumentComponent} from './document.component'; import {MatTabsModule} from '@angular/material/tabs'; diff --git a/client/src/app/ctl/document/document.component.ts b/client/src/app/ctl/document/document.component.ts index e28d63b..1e6610e 100644 --- a/client/src/app/ctl/document/document.component.ts +++ b/client/src/app/ctl/document/document.component.ts @@ -1,3 +1,17 @@ +/* +# 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'; diff --git a/client/src/app/ctl/document/document.models.ts b/client/src/app/ctl/document/document.models.ts index 6a152f5..faa1270 100644 --- a/client/src/app/ctl/document/document.models.ts +++ b/client/src/app/ctl/document/document.models.ts @@ -1,3 +1,17 @@ +/* +# 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. +*/ + export class KustomNode { id: string; phaseid: { name: string, namespace: string}; diff --git a/client/src/app/ctl/document/document.module.ts b/client/src/app/ctl/document/document.module.ts index b5c2ca8..d2a11a5 100644 --- a/client/src/app/ctl/document/document.module.ts +++ b/client/src/app/ctl/document/document.module.ts @@ -1,3 +1,17 @@ +/* +# 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, CUSTOM_ELEMENTS_SCHEMA} from '@angular/core'; import {MatTabsModule} from '@angular/material/tabs'; import {DocumentComponent} from './document.component'; diff --git a/client/src/app/home/home.component.spec.ts b/client/src/app/home/home.component.spec.ts index 490e81b..689da8c 100644 --- a/client/src/app/home/home.component.spec.ts +++ b/client/src/app/home/home.component.spec.ts @@ -1,3 +1,17 @@ +/* +# 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 { HomeComponent } from './home.component'; diff --git a/client/src/app/home/home.component.ts b/client/src/app/home/home.component.ts index 8127a81..c19ac41 100644 --- a/client/src/app/home/home.component.ts +++ b/client/src/app/home/home.component.ts @@ -1,3 +1,17 @@ +/* +# 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'; @Component({ diff --git a/client/src/app/login/login.component.css b/client/src/app/login/login.component.css index da5ecb6..65e6c56 100755 --- a/client/src/app/login/login.component.css +++ b/client/src/app/login/login.component.css @@ -1,3 +1,17 @@ +/* +# 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. +*/ + /* Bordered form */ form { border: 3px solid #f1f1f1; diff --git a/client/src/app/login/login.component.spec.ts b/client/src/app/login/login.component.spec.ts index b0c41f7..f6b0a51 100755 --- a/client/src/app/login/login.component.spec.ts +++ b/client/src/app/login/login.component.spec.ts @@ -1,3 +1,17 @@ +/* +# 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 {RouterTestingModule} from '@angular/router/testing'; import {LoginComponent} from './login.component'; diff --git a/client/src/app/login/login.component.ts b/client/src/app/login/login.component.ts index c7b2280..605a821 100755 --- a/client/src/app/login/login.component.ts +++ b/client/src/app/login/login.component.ts @@ -1,3 +1,17 @@ +/* +# 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, OnInit } from '@angular/core'; import {WebsocketService} from 'src/services/websocket/websocket.service'; import { WSReceiver, WebsocketMessage, Authentication } from 'src/services/websocket/websocket.models'; diff --git a/client/src/app/login/login.module.ts b/client/src/app/login/login.module.ts index affca77..6b6855a 100755 --- a/client/src/app/login/login.module.ts +++ b/client/src/app/login/login.module.ts @@ -1,6 +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 { NgModule } from '@angular/core'; import { LoginComponent } from './login.component'; -import {ToastrModule} from 'ngx-toastr'; +import { ToastrModule } from 'ngx-toastr'; @NgModule({ imports: [ diff --git a/client/src/app/monaco-config.ts b/client/src/app/monaco-config.ts index c34b5a5..e0391c7 100644 --- a/client/src/app/monaco-config.ts +++ b/client/src/app/monaco-config.ts @@ -1,3 +1,17 @@ +/* +# 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 { NgxMonacoEditorConfig } from 'ngx-monaco-editor'; const monacoConfig: NgxMonacoEditorConfig = { diff --git a/client/src/environments/environment.prod.ts b/client/src/environments/environment.prod.ts index d4c4dc0..c526a75 100644 --- a/client/src/environments/environment.prod.ts +++ b/client/src/environments/environment.prod.ts @@ -1,3 +1,17 @@ +/* +# 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. +*/ + export const environment = { production: true, version: 'Development' diff --git a/client/src/environments/environment.ts b/client/src/environments/environment.ts index c3d082e..15e80c9 100644 --- a/client/src/environments/environment.ts +++ b/client/src/environments/environment.ts @@ -1,3 +1,17 @@ +/* +# 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. +*/ + // This file can be replaced during build by using the `fileReplacements` array. // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. // The list of file replacements can be found in `angular.json`. diff --git a/client/src/main.ts b/client/src/main.ts index c7b673c..4e74034 100644 --- a/client/src/main.ts +++ b/client/src/main.ts @@ -1,3 +1,17 @@ +/* +# 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 { enableProdMode } from '@angular/core'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; diff --git a/client/src/polyfills.ts b/client/src/polyfills.ts index 03711e5..43a24c2 100644 --- a/client/src/polyfills.ts +++ b/client/src/polyfills.ts @@ -1,3 +1,17 @@ +/* +# 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. +*/ + /** * This file includes polyfills needed by Angular and is loaded before the app. * You can add your own extra polyfills to this file. diff --git a/client/src/services/auth-guard/auth-guard.service.spec.ts b/client/src/services/auth-guard/auth-guard.service.spec.ts index d423b19..72caa92 100755 --- a/client/src/services/auth-guard/auth-guard.service.spec.ts +++ b/client/src/services/auth-guard/auth-guard.service.spec.ts @@ -1,3 +1,17 @@ +/* +# 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, TestBed } from '@angular/core/testing'; import { AuthGuard } from './auth-guard.service'; import { RouterTestingModule } from '@angular/router/testing'; diff --git a/client/src/services/auth-guard/auth-guard.service.ts b/client/src/services/auth-guard/auth-guard.service.ts index 9ce2c96..b91711e 100755 --- a/client/src/services/auth-guard/auth-guard.service.ts +++ b/client/src/services/auth-guard/auth-guard.service.ts @@ -1,3 +1,17 @@ +/* +# 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 { Injectable } from '@angular/core'; import { Router, CanActivate, Event as RouterEvent, NavigationStart, NavigationEnd, NavigationCancel, NavigationError } from '@angular/router'; import { Log } from 'src/services/log/log.service'; diff --git a/client/src/services/icon/icon.service.spec.ts b/client/src/services/icon/icon.service.spec.ts index 2f53531..542f337 100644 --- a/client/src/services/icon/icon.service.spec.ts +++ b/client/src/services/icon/icon.service.spec.ts @@ -1,3 +1,17 @@ +/* +# 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 { TestBed } from '@angular/core/testing'; import { IconService } from './icon.service'; diff --git a/client/src/services/icon/icon.service.ts b/client/src/services/icon/icon.service.ts index 1d424fc..5ee4c5b 100644 --- a/client/src/services/icon/icon.service.ts +++ b/client/src/services/icon/icon.service.ts @@ -1,3 +1,17 @@ +/* +# 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 { Injectable } from '@angular/core'; import { MatIconRegistry } from '@angular/material/icon'; import { DomSanitizer } from '@angular/platform-browser'; diff --git a/client/src/services/icon/icons.enum.ts b/client/src/services/icon/icons.enum.ts index 15021d3..7e0ccc2 100644 --- a/client/src/services/icon/icons.enum.ts +++ b/client/src/services/icon/icons.enum.ts @@ -1,3 +1,17 @@ +/* +# 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. +*/ + export enum Icons { account = 'account', airplane = 'airplane', diff --git a/client/src/services/log/log-message.ts b/client/src/services/log/log-message.ts index 74f67a5..c4d06dd 100755 --- a/client/src/services/log/log-message.ts +++ b/client/src/services/log/log-message.ts @@ -1,3 +1,17 @@ +/* +# 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 { WebsocketMessage } from '../websocket/websocket.models'; export class LogMessage { diff --git a/client/src/services/log/log.enum.ts b/client/src/services/log/log.enum.ts index 9cf3cb3..0f185cf 100755 --- a/client/src/services/log/log.enum.ts +++ b/client/src/services/log/log.enum.ts @@ -1,3 +1,17 @@ +/* +# 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. +*/ + export enum LogLevel { Trace = 6, Debug = 5, diff --git a/client/src/services/log/log.service.spec.ts b/client/src/services/log/log.service.spec.ts index 1b31592..1d12c0a 100755 --- a/client/src/services/log/log.service.spec.ts +++ b/client/src/services/log/log.service.spec.ts @@ -1,3 +1,17 @@ +/* +# 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 { TestBed } from '@angular/core/testing'; import { Log } from './log.service'; diff --git a/client/src/services/log/log.service.ts b/client/src/services/log/log.service.ts index a8774ef..f42603c 100755 --- a/client/src/services/log/log.service.ts +++ b/client/src/services/log/log.service.ts @@ -1,3 +1,17 @@ +/* +# 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 { Injectable } from '@angular/core'; import { LogLevel } from 'src/services/log/log.enum'; import { LogMessage } from 'src/services/log/log-message'; diff --git a/client/src/services/websocket/websocket.models.ts b/client/src/services/websocket/websocket.models.ts index 464dfa8..de6e5b8 100755 --- a/client/src/services/websocket/websocket.models.ts +++ b/client/src/services/websocket/websocket.models.ts @@ -1,3 +1,17 @@ +/* +# 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. +*/ + export interface WSReceiver { // the holy trinity of the websocket messages, a triumvirate if you will, which is how all are routed type: string; diff --git a/client/src/services/websocket/websocket.service.spec.ts b/client/src/services/websocket/websocket.service.spec.ts index 2792acf..4ea6b8c 100644 --- a/client/src/services/websocket/websocket.service.spec.ts +++ b/client/src/services/websocket/websocket.service.spec.ts @@ -1,3 +1,17 @@ +/* +# 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 {TestBed} from '@angular/core/testing'; import {WebsocketService} from './websocket.service'; import {ToastrModule} from 'ngx-toastr'; diff --git a/client/src/services/websocket/websocket.service.ts b/client/src/services/websocket/websocket.service.ts index f517088..f3ecacf 100644 --- a/client/src/services/websocket/websocket.service.ts +++ b/client/src/services/websocket/websocket.service.ts @@ -1,3 +1,17 @@ +/* +# 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 {Injectable, OnDestroy} from '@angular/core'; import {WebsocketMessage, WSReceiver, Authentication} from './websocket.models'; import {ToastrService} from 'ngx-toastr'; diff --git a/client/src/styles.css b/client/src/styles.css index 2ea1eae..dd9842f 100644 --- a/client/src/styles.css +++ b/client/src/styles.css @@ -1,3 +1,17 @@ +/* +# 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 '~@angular/material/prebuilt-themes/indigo-pink.css'; body { diff --git a/tools/check_copyright b/tools/check_copyright index 36f345b..4ea3588 100755 --- a/tools/check_copyright +++ b/tools/check_copyright @@ -15,28 +15,25 @@ declare FILES_MISSING_COPYRIGHT=() # Find all files of given format and add license if missing -check_license() { - ext=$1 - # skipping license for testdata and manifests folders - FILES=$(find -L . -name "*.${ext}" | grep -v "testdata" | grep -v "manifests" | grep -v "tools/*node*" | grep -v "client/node_modules" | grep -v "client/dist") +FILES=$(find -L . -type f \( -iname \*.go -o -iname \*.yaml -o -iname \*.yml -o -iname \*.sh -o -iname \*.ts -o -iname \*.css \) \ + -not -path "./etc" \ + -not -path "./client/dist/*" \ + -not -path "./client/node_modules/*" \ + -not -path "./tools/*node*" \ + | grep -v "testdata" \ + | grep -v "manifests") - for each in $FILES - do - if ! grep -Eq 'Apache License|License-Identifier: Apache' $each - then - FILES_MISSING_COPYRIGHT+=($each) - fi - done -} - -check_license 'go' -check_license 'yaml' -check_license 'yml' -check_license 'sh' +for each in $FILES +do + if ! grep -Eq 'Apache License|License-Identifier: Apache' $each + then + FILES_MISSING_COPYRIGHT+=($each) + fi +done if [ ${#FILES_MISSING_COPYRIGHT[@]} -gt 0 ] then - echo "Copyright header missing for these files: ${FILES_MISSING_COPYRIGHT[@]}" + printf "Copyright header missing for: %s\n" "${FILES_MISSING_COPYRIGHT[@]}" echo "please run make add-copyright" exit 1 else diff --git a/tools/whitespace_linter b/tools/whitespace_linter index fe16711..9097bb0 100755 --- a/tools/whitespace_linter +++ b/tools/whitespace_linter @@ -1,8 +1,20 @@ #!/usr/bin/env bash +# 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. + # git 1.9.0+ allows for exclusions in pathspecs via ':!foo' syntax. # However, until git 2.13.0 there must be at least one "inclusive" pathspec, hence the './*' -trailing_whitespace=$(git grep -E -n -- ' +$' -- './*' ':!*.png' ':!*.jpg') +trailing_whitespace=$(git grep -E -n -- ' +$' -- './*' ':!*.png' ':!*.jpg' ':!client/dist/*' ':!client/node_modules/*') if [[ -n "$trailing_whitespace" ]]; then printf "ERROR: Trailing whitespaces:\n"