Skip to content

Commit

Permalink
chore: Upgrade to Web SDK v1021.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
c8y-ui-release[bot] committed Nov 7, 2024
1 parent 52dd49f commit 69803ad
Show file tree
Hide file tree
Showing 6 changed files with 144 additions and 38 deletions.
7 changes: 7 additions & 0 deletions cumulocity.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,13 @@ export default {
path: './src/typeahead/typeahead-example.module.ts',
description: 'This is an example for the typeahead component.',
scope: 'self'
},
{
name: 'Countdown',
module: 'CountdownExampleModule',
path: './src/countdown/countdown-example.module.ts',
description: 'This is an example for the countdown component.',
scope: 'self'
}
]
},
Expand Down
62 changes: 31 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tutorial",
"version": "1021.0.12",
"version": "1021.1.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
Expand All @@ -19,10 +19,10 @@
"@angular/platform-browser": "^18.2.0",
"@angular/platform-browser-dynamic": "^18.2.0",
"@angular/router": "^18.2.0",
"@c8y/bootstrap": "1021.0.12",
"@c8y/client": "1021.0.12",
"@c8y/ngx-components": "1021.0.12",
"@c8y/style": "1021.0.12",
"@c8y/bootstrap": "1021.1.0",
"@c8y/client": "1021.1.0",
"@c8y/ngx-components": "1021.1.0",
"@c8y/style": "1021.1.0",
"leaflet": "1.9.4",
"ngx-bootstrap": "18.0.0",
"rxjs": "^7.8.1",
Expand All @@ -33,8 +33,8 @@
"@angular-devkit/build-angular": "^18.2.10",
"@angular/cli": "^18.2.10",
"@angular/compiler-cli": "^18.2.0",
"@c8y/devkit": "1021.0.12",
"@c8y/options": "1021.0.12",
"@c8y/devkit": "1021.1.0",
"@c8y/options": "1021.1.0",
"@types/jasmine": "~5.1.0",
"jasmine-core": "~5.2.0",
"karma": "~6.4.0",
Expand Down
35 changes: 35 additions & 0 deletions src/countdown/countdown-example.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<div class="time-elapsed">
<!-- important -->
<c8y-countdown-interval
[countdownInterval]="10000"
(countdownEnded)="onCountdownEnded()"
></c8y-countdown-interval>
<!-- /important -->
</div>
<div class="container-fluid p-24 text-center">
<button
class="btn btn-default"
(click)="startCountdown()"
>
Start
</button>
<button
class="btn btn-default"
(click)="stopCountdown()"
>
Stop
</button>
<button
class="btn btn-default"
(click)="stopCountdownAtZero()"
>
Stop at 0
</button>
<button
class="btn btn-default"
(click)="resetCountdown()"
>
Reset
</button>
</div>
`
43 changes: 43 additions & 0 deletions src/countdown/countdown-example.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { AfterViewInit, Component, ViewChild } from '@angular/core';
import {
CommonModule,
CountdownIntervalComponent,
CountdownIntervalModule
} from '@c8y/ngx-components';

@Component({
selector: 'tut-countdown-example',
templateUrl: './countdown-example.component.html',
standalone: true,
imports: [CommonModule, CountdownIntervalModule]
})
export class CountdownExampleComponent implements AfterViewInit {
@ViewChild(CountdownIntervalComponent)
countdownIntervalComponent: CountdownIntervalComponent;

ngAfterViewInit(): void {
this.startCountdown(); // We need to start the countdown at some point, for example, in AfterViewInit
}

startCountdown(): void {
this.countdownIntervalComponent.start();
}

stopCountdown(): void {
this.countdownIntervalComponent.stop();
}

stopCountdownAtZero(): void {
this.countdownIntervalComponent.stop(true);
}

resetCountdown(): void {
this.countdownIntervalComponent.reset();
}

onCountdownEnded(): void {
console.log('Countdown Ended!');

this.resetCountdown();
}
}
21 changes: 21 additions & 0 deletions src/countdown/countdown-example.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { NgModule } from '@angular/core';
import { NavigatorNode, hookNavigator, hookRoute } from '@c8y/ngx-components';

@NgModule({
providers: [
hookRoute({
path: 'help',
loadComponent: () =>
import('./countdown-example.component').then(m => m.CountdownExampleComponent)
}),
hookNavigator(
new NavigatorNode({
path: '/countdown',
label: 'Countdown',
icon: 'hand-o-right',
priority: 110
})
)
]
})
export class CountdownExampleModule {}

0 comments on commit 69803ad

Please sign in to comment.