Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.

Commit bd57aac

Browse files
oodamienghillert
authored andcommitted
Loader component
Resolves #728
1 parent 5f72cd4 commit bd57aac

22 files changed

+95
-34
lines changed

ui/src/app/runtime/runtime-app/runtime-app.component.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,6 @@ <h4 class="modal-title pull-left">Instances for app <strong>{{ runtimeApp.deploy
3333
</div>
3434
</div>
3535

36-
<ng-template #loading><div>Loading...</div></ng-template>
36+
<ng-template #loading>
37+
<app-loader></app-loader>
38+
</ng-template>

ui/src/app/runtime/runtime-app/runtime-app.component.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {RuntimeApp} from '../model/runtime-app';
1313
import {KeyValuePipe} from '../../shared/pipes/key-value-filter.pipe';
1414
import {RuntimeAppInstance} from '../model/runtime-app-instance';
1515
import {NgBusyModule} from 'ng-busy';
16+
import { LoaderComponent } from '../../shared/components/loader/loader.component';
1617

1718
describe('RuntimeAppComponent', () => {
1819
let component: RuntimeAppComponent;
@@ -27,7 +28,8 @@ describe('RuntimeAppComponent', () => {
2728
declarations: [
2829
RuntimeAppComponent,
2930
KeyValuePipe,
30-
RuntimeAppStateComponent
31+
RuntimeAppStateComponent,
32+
LoaderComponent
3133
],
3234
imports: [
3335
NgBusyModule,

ui/src/app/runtime/runtime-apps/runtime-apps.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ <h1>Runtime applications</h1>
7171
</div>
7272

7373
<ng-template #loading>
74-
<div>Loading...</div>
74+
<app-loader></app-loader>
7575
</ng-template>
7676

7777
</div>

ui/src/app/runtime/runtime-apps/runtime-apps.component.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {RuntimeAppStateComponent} from '../components/runtime-app-state/runtime-
1414
import {RuntimeAppComponent} from '../runtime-app/runtime-app.component';
1515
import {NgBusyModule} from 'ng-busy';
1616
import {MockModalService} from '../../tests/mocks/modal';
17+
import { LoaderComponent } from '../../shared/components/loader/loader.component';
1718

1819
describe('RuntimeAppsComponent', () => {
1920
let component: RuntimeAppsComponent;
@@ -27,7 +28,8 @@ describe('RuntimeAppsComponent', () => {
2728
declarations: [
2829
RuntimeAppsComponent,
2930
KeyValuePipe,
30-
RuntimeAppStateComponent
31+
RuntimeAppStateComponent,
32+
LoaderComponent
3133
],
3234
imports: [
3335
NgBusyModule,
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
2+
3+
/**
4+
* Loader component
5+
* <app-loader></app-loader>
6+
* <app-loader text="Loading in progress…"></app-loader>
7+
*
8+
* @author Damien Vitrac
9+
*/
10+
@Component({
11+
selector: 'app-loader',
12+
styleUrls: ['styles.scss'],
13+
template: `
14+
<div class="app-loader">
15+
<div class="icon icon-middle spinner" style="font-size: 16px;">
16+
<svg class="icon-spinner-sm" height="100px" width="100px" viewBox="0 0 101 101">
17+
<circle class="ring" cx="50%" cy="50%" fill="none" r="45%" stroke-linecap="butt" stroke-width="10%"></circle>
18+
<circle class="path" cx="50%" cy="50%" fill="none" r="45%" stroke-linecap="butt" stroke-width="10%"></circle>
19+
</svg>
20+
</div>
21+
<span>
22+
{{ text }}
23+
</span>
24+
</div>`,
25+
changeDetection: ChangeDetectionStrategy.OnPush
26+
})
27+
export class LoaderComponent {
28+
29+
/**
30+
* Text display
31+
*/
32+
@Input() text: string = 'Loading…';
33+
34+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
:host {
3+
padding: 1rem 0;
4+
color: #939da2;
5+
>div {
6+
padding-left: 30px;
7+
position: relative;
8+
.icon {
9+
position: absolute;
10+
top: 4px;
11+
left: 2px;
12+
}
13+
}
14+
}

ui/src/app/shared/shared.module.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,23 @@
11
import { NgModule } from '@angular/core';
22
import { CommonModule } from '@angular/common';
33
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
4-
54
import { HttpModule } from '@angular/http';
6-
75
import { ToastyModule } from 'ng2-toasty';
8-
96
import { NgBusyModule, BusyConfig, BUSY_CONFIG_DEFAULTS } from 'ng-busy';
107
import { ErrorHandler } from './model/error-handler';
118
import { CapitalizePipe } from './pipes/capitalize.pipe';
129
import { TriStateCheckboxComponent } from './components/tri-state-checkbox.component';
1310
import { TriStateButtonComponent } from './components/tri-state-button.component';
1411
import { ClickOutsideDirective } from './directives/click-outside.directive';
1512
import { SearchfilterPipe } from './pipes/search-filter.pipe';
16-
1713
import { KeyValuePipe } from './pipes/key-value-filter.pipe';
18-
1914
import { NgxPaginationModule } from 'ngx-pagination';
2015
import { PropertyTableComponent } from './components/property-table/property-table.component';
21-
2216
import { ProgressbarModule } from 'ngx-bootstrap/progressbar';
2317
import { ModalModule } from 'ngx-bootstrap/modal';
2418
import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
2519
import { TooltipModule } from 'ngx-bootstrap/tooltip';
26-
2720
import { TabComponent, TabsComponent } from './components/tabs.component';
28-
2921
import { ParserService } from './services/parser.service';
3022
import { SharedAppsService } from './services/shared-apps.service';
3123
import { DataflowDateTimePipe } from './pipes/dataflow-date-time.pipe';
@@ -46,6 +38,7 @@ import { ConfirmComponent } from './components/confirm/confirm.component';
4638
import { BusyService } from './services/busy.service';
4739
import { AutoResizeDirective } from './directives/auto-resize.directive';
4840
import { StreamDslComponent } from './components/dsl/dsl.component';
41+
import { LoaderComponent } from './components/loader/loader.component';
4942

5043
const busyConfig: BusyConfig = {
5144
message: 'Processing..',
@@ -100,7 +93,8 @@ const busyConfig: BusyConfig = {
10093
StreamDslComponent,
10194
TruncatePipe,
10295
OrderByPipe,
103-
ConfirmComponent
96+
ConfirmComponent,
97+
LoaderComponent
10498
],
10599
entryComponents: [
106100
ConfirmComponent
@@ -140,7 +134,8 @@ const busyConfig: BusyConfig = {
140134
TruncatePipe,
141135
OrderByPipe,
142136
ConfirmComponent,
143-
AutoResizeDirective
137+
AutoResizeDirective,
138+
LoaderComponent
144139
]
145140
})
146141
export class SharedModule {

ui/src/app/streams/stream-deploy/builder/builder.component.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,5 @@
363363
</form>
364364
</div>
365365
<ng-template #loading>
366-
<div>
367-
Loading ...
368-
</div>
366+
<app-loader></app-loader>
369367
</ng-template>

ui/src/app/streams/stream-deploy/stream-deploy.component.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,5 @@ <h1 style="margin-bottom: 10px">Deploy Stream Definition {{ config.id }}</h1>
4444
</div>
4545

4646
<ng-template #loading>
47-
<div>
48-
Loading ...
49-
</div>
47+
<app-loader></app-loader>
5048
</ng-template>

ui/src/app/streams/stream/graph/stream-graph.component.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { RenderService } from '../../components/flo/render.service';
1313
import { MockSharedAppService } from '../../../tests/mocks/shared-app';
1414
import { BusyService } from '../../../shared/services/busy.service';
1515
import { StreamGraphComponent } from './stream-graph.component';
16+
import { LoaderComponent } from '../../../shared/components/loader/loader.component';
1617

1718

1819
/**
@@ -38,7 +39,8 @@ describe('StreamGraphComponent', () => {
3839
TestBed.configureTestingModule({
3940
declarations: [
4041
StreamGraphComponent,
41-
GraphViewComponent
42+
GraphViewComponent,
43+
LoaderComponent
4244
],
4345
imports: [
4446
RouterTestingModule.withRoutes([]),

ui/src/app/streams/stream/summary/stream-summary.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,5 @@
8181
</div>
8282
</div>
8383
<ng-template #loading>
84-
<div>Loading...</div>
84+
<app-loader></app-loader>
8585
</ng-template>

ui/src/app/streams/stream/summary/stream-summary.component.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { MockAuthService } from '../../../tests/mocks/auth';
1919
import { AuthService } from '../../../auth/auth.service';
2020
import { MocksSharedAboutService } from '../../../tests/mocks/shared-about';
2121
import { SharedAboutService } from '../../../shared/services/shared-about.service';
22+
import { LoaderComponent } from '../../../shared/components/loader/loader.component';
2223

2324
/**
2425
* Test {@link StreamSummaryComponent}.
@@ -45,7 +46,8 @@ describe('StreamSummaryComponent', () => {
4546
StreamStatusComponent,
4647
AppTypeComponent,
4748
StreamDslComponent,
48-
RolesDirective
49+
RolesDirective,
50+
LoaderComponent
4951
],
5052
imports: [
5153
RouterTestingModule.withRoutes([]),

ui/src/app/streams/streams/deployment-properties-info/deployment-properties-info.component.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@
1111
</div>
1212
</div>
1313
</div>
14-
<ng-template #loading><div>Loading...</div></ng-template>
14+
<ng-template #loading>
15+
<app-loader></app-loader>
16+
</ng-template>

ui/src/app/streams/streams/deployment-properties-info/deployment-properties-info.component.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
33
import { MockStreamsService } from '../../../tests/mocks/streams';
44
import { StreamsService } from '../../streams.service';
55
import { StreamDefinition } from '../../model/stream-definition';
6+
import { LoaderComponent } from '../../../shared/components/loader/loader.component';
67

78
/**
89
* Test {@link DeploymentPropertiesInfoComponent}.
@@ -31,7 +32,8 @@ describe('DeploymentPropertiesInfoComponent', () => {
3132
beforeEach(async(() => {
3233
TestBed.configureTestingModule({
3334
declarations: [
34-
DeploymentPropertiesInfoComponent
35+
DeploymentPropertiesInfoComponent,
36+
LoaderComponent
3537
],
3638
imports: [],
3739
providers: [

ui/src/app/streams/streams/streams.component.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import { BusyService } from '../../shared/services/busy.service';
3737
import { MockModalService } from '../../tests/mocks/modal';
3838
import { AppsService } from '../../apps/apps.service';
3939
import { MockAppsService } from '../../tests/mocks/apps';
40+
import { LoaderComponent } from '../../shared/components/loader/loader.component';
4041

4142
/**
4243
* Test {@link StreamsComponent}.
@@ -74,7 +75,8 @@ describe('StreamsComponent', () => {
7475
StreamDslComponent,
7576
MasterCheckboxComponent,
7677
StreamGraphDefinitionComponent,
77-
TruncatePipe
78+
TruncatePipe,
79+
LoaderComponent
7880
],
7981
imports: [
8082
NgxPaginationModule,

ui/src/app/tasks/task-definition/graph/task-graph.component.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
</app-graph-view>
66

77
</div>
8-
98
<ng-template #loading>
10-
<div>Loading...</div>
9+
<app-loader></app-loader>
1110
</ng-template>

ui/src/app/tasks/task-definition/summary/task-summary.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,5 @@
7171
</div>
7272
</div>
7373
<ng-template #loading>
74-
<div>Loading...</div>
74+
<app-loader></app-loader>
7575
</ng-template>

ui/src/app/tasks/task-definition/summary/task-summary.component.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { RolesDirective } from '../../../auth/directives/roles.directive';
2323
import { AuthService } from '../../../auth/auth.service';
2424
import { MockModalService } from '../../../tests/mocks/modal';
2525
import { BsModalService } from 'ngx-bootstrap';
26+
import { LoaderComponent } from '../../../shared/components/loader/loader.component';
2627

2728
/**
2829
* Test {@link TaskSummaryComponent}.
@@ -51,7 +52,8 @@ describe('TaskSummaryComponent', () => {
5152
DataflowDurationPipe,
5253
AppTypeComponent,
5354
TaskStatusComponent,
54-
StreamDslComponent
55+
StreamDslComponent,
56+
LoaderComponent
5557
],
5658
imports: [
5759
NgBusyModule,

ui/src/app/tasks/task-execution/task-execution.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,5 @@ <h1>Task Execution Details - Execution ID: {{ taskExecution.executionId }}</h1>
8888

8989
</div>
9090
<ng-template #loading>
91-
<div>Loading...</div>
91+
<app-loader></app-loader>
9292
</ng-template>

ui/src/app/tasks/task-execution/task-execution.component.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { DataflowDateTimePipe } from '../../shared/pipes/dataflow-date-time.pipe
1414
import { DataflowDurationPipe } from '../../shared/pipes/dataflow-duration.pipe';
1515
import * as moment from 'moment';
1616
import { TaskExecutionComponent } from './task-execution.component';
17+
import { LoaderComponent } from '../../shared/components/loader/loader.component';
1718

1819
describe('TaskExecutionsDetailsComponent', () => {
1920
let component: TaskExecutionComponent;
@@ -57,7 +58,8 @@ describe('TaskExecutionsDetailsComponent', () => {
5758
declarations: [
5859
TaskExecutionComponent,
5960
DataflowDateTimePipe,
60-
DataflowDurationPipe
61+
DataflowDurationPipe,
62+
LoaderComponent
6163
],
6264
imports: [
6365
NgBusyModule,

ui/src/app/tasks/task-launch/task-launch.component.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,5 +117,6 @@ <h2>Task Properties</h2>
117117
</form>
118118
</div>
119119
<ng-template #loading>
120-
<div>Loading...</div>
120+
<app-loader></app-loader>
121121
</ng-template>
122+

ui/src/app/tasks/task-launch/task-launch.component.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { BusyService } from '../../shared/services/busy.service';
1313
import { MockTasksService } from '../../tests/mocks/tasks';
1414
import { TASK_DEFINITIONS } from '../../tests/mocks/mock-data';
1515
import { TaskLaunchComponent } from './task-launch.component';
16+
import { LoaderComponent } from '../../shared/components/loader/loader.component';
1617

1718
/**
1819
* Test {@link TaskLaunchComponent}.
@@ -34,7 +35,8 @@ describe('TaskLaunchComponent', () => {
3435
declarations: [
3536
TaskLaunchComponent,
3637
DataflowDateTimePipe,
37-
DataflowDurationPipe
38+
DataflowDurationPipe,
39+
LoaderComponent
3840
],
3941
imports: [
4042
NgBusyModule,

0 commit comments

Comments
 (0)