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([]),

0 commit comments

Comments
 (0)