-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
149 additions
and
27 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
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
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
File renamed without changes.
File renamed without changes.
29 changes: 29 additions & 0 deletions
29
analytics-ui/src/component/confirmation-modal.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,29 @@ | ||
<!-- | ||
~ Copyright (c) 2022 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, | ||
~ and/or its subsidiaries and/or its affiliates and/or their licensors. | ||
~ | ||
~ SPDX-License-Identifier: Apache-2.0 | ||
~ | ||
~ 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. | ||
~ | ||
~ @authors Christof Strack | ||
--> | ||
|
||
<c8y-confirm-modal | ||
[title]="title" | ||
[status]="status" | ||
[labels]="labels" | ||
#modalRef | ||
> | ||
<span>{{ messageTranslated }}</span> | ||
</c8y-confirm-modal> |
74 changes: 74 additions & 0 deletions
74
analytics-ui/src/component/confirmation-modal.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,74 @@ | ||
/* | ||
* Copyright (c) 2022 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, | ||
* and/or its subsidiaries and/or its affiliates and/or their licensors. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* 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. | ||
* | ||
* @authors Christof Strack | ||
*/ | ||
import { Component, Input, OnInit, ViewChild } from "@angular/core"; | ||
import { | ||
ConfirmModalComponent, | ||
gettext, | ||
ModalLabels, | ||
Status, | ||
StatusType, | ||
} from "@c8y/ngx-components"; | ||
import { TranslateService } from "@ngx-translate/core"; | ||
import { Subject } from "rxjs"; | ||
|
||
@Component({ | ||
selector: "confirmation-modal", | ||
templateUrl: "confirmation-modal.component.html", | ||
}) | ||
export class ConfirmationModalComponent implements OnInit { | ||
@Input() title: string; | ||
@Input() message: string; | ||
@ViewChild("modalRef", { static: false }) modalRef: ConfirmModalComponent; | ||
messageTranslated: string; | ||
closeSubject: Subject<boolean> = new Subject(); | ||
@Input() labels: ModalLabels = { | ||
ok: gettext("Disconnect"), | ||
cancel: gettext("Cancel"), | ||
}; | ||
status: StatusType = Status.WARNING; | ||
|
||
constructor(private translateService: TranslateService) {} | ||
|
||
ngOnInit() { | ||
this.messageTranslated = this.translateService.instant( | ||
gettext(this.message) | ||
); | ||
} | ||
|
||
async ngAfterViewInit() { | ||
try { | ||
await this.modalRef.result; | ||
this.onClose(); | ||
} catch (error) { | ||
this.onDismiss(); | ||
} | ||
} | ||
|
||
onClose() { | ||
this.closeSubject.next(true); | ||
this.closeSubject.complete(); | ||
} | ||
|
||
onDismiss() { | ||
this.closeSubject.next(false); | ||
this.closeSubject.complete(); | ||
} | ||
} |
File renamed without changes.
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