This repository has been archived by the owner on Oct 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add automatic closing for the success notification (#937)
* Channel overview component - frontend * Switch to the current api endpoint * Fixed right panel scroll off screen Signed-off-by: Robert Gogete <gogeterobert@yahoo.com> * Now ignores itself when checking for unique name Signed-off-by: Robert Gogete <gogeterobert@yahoo.com> * automatic closing for the success notification * Improve styling and remove hardcoded values Co-authored-by: Stefan Nedelcu <nedelcu.stefan17@yahoo.com> Co-authored-by: Stefan Nedelcu <60442811+StefanNedelcu@users.noreply.github.com> Co-authored-by: Robert Gogete <gogeterobert@yahoo.com>
- Loading branch information
1 parent
0368557
commit b0a77c9
Showing
7 changed files
with
98 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 1 addition & 8 deletions
9
src/Web/ClientApp/src/app/components/environment-variable/list/list.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/Web/ClientApp/src/app/components/helpers/success/success.component.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.success-margins { | ||
margin-left: -0.75rem; | ||
margin-right: -0.75rem; | ||
margin-top: -0.75rem; | ||
margin-bottom: 1rem; | ||
} | ||
|
||
.is-x-small { | ||
height: 0.25rem; | ||
} |
9 changes: 9 additions & 0 deletions
9
src/Web/ClientApp/src/app/components/helpers/success/success.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<article *ngIf="visible" class="message is-success success-margins"> | ||
<div class="message-header"> | ||
<p>Success</p> | ||
</div> | ||
<div class="message-body"> | ||
Environment Variables Saved | ||
</div> | ||
<progress *ngIf="counter" class="progress is-x-small is-success" [attr.value]="counter" [attr.max]="intervalResetTime"></progress> | ||
</article> |
23 changes: 23 additions & 0 deletions
23
src/Web/ClientApp/src/app/components/helpers/success/success.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { SuccessComponent } from './success.component'; | ||
|
||
describe('SuccessComponent', () => { | ||
let component: SuccessComponent; | ||
let fixture: ComponentFixture<SuccessComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ SuccessComponent ] | ||
}) | ||
.compileComponents(); | ||
|
||
fixture = TestBed.createComponent(SuccessComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
48 changes: 48 additions & 0 deletions
48
src/Web/ClientApp/src/app/components/helpers/success/success.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { | ||
Component, | ||
Injectable, | ||
} from '@angular/core'; | ||
|
||
@Injectable({ | ||
providedIn: 'root', | ||
}) | ||
@Component({ | ||
selector: 'app-success', | ||
templateUrl: './success.component.html', | ||
styleUrls: ['./success.component.css'] | ||
}) | ||
export class SuccessComponent { | ||
visible: boolean = false; | ||
counter: number = 0; | ||
interval: any = null; | ||
intervalResetTime: number = 3000; | ||
incrementInterval: number = 10; | ||
|
||
constructor() {} | ||
|
||
show(): void { | ||
clearInterval(this.interval); | ||
this.visible = true; | ||
this.startTimer(); | ||
} | ||
|
||
hide(): void { | ||
clearInterval(this.interval); | ||
this.visible = false; | ||
this.counter = 0; | ||
} | ||
|
||
startTimer(): void { | ||
this.counter = 0; | ||
|
||
this.interval = setInterval(() => { | ||
if (this.counter === this.intervalResetTime) { | ||
clearInterval(this.interval); | ||
this.visible = false; | ||
this.counter = 0; | ||
} else { | ||
this.counter += this.incrementInterval ; | ||
} | ||
}, this.incrementInterval); | ||
} | ||
} |