33 * License, v. 2.0. If a copy of the MPL was not distributed with this
44 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
55 *
6- * Copyright © Vincent Bengtsson & Contributors 2022-2023
6+ * Copyright © Vincent Bengtsson & Contributors 2022-2024
77 * https://github.com/Visual-Vincent/GuiStack
88 *@
99
1010@using GuiStack .Models
1111@using GuiStack .Extensions
12- @model SNSTopicInfo
12+ @using GuiStack .Repositories
13+ @model SNSTopicModel
14+
15+ <div id =" sns-subscribe-to-sqs-modal" class =" cssWindow dark backdropblur text-center" >
16+ <div class =" closeWindowButton" ><a no-href onclick =" closeParentWindow(event)" >×</a ></div >
17+
18+ <h2 class =" title" >Subscribe to SQS queue</h2 >
19+ <div class =" queue-selector-container text-left" style =" margin-top : 16px ; margin-bottom : 16px " >
20+ Loading queues...
21+ </div >
22+
23+ <div class =" modal-buttons text-center" >
24+ <button onclick =" sns_CreateSubscription_Click()" >Create subscription</button >
25+ </div >
26+ </div >
1327
1428<table class =" gs-info-table colored" >
1529 <tbody >
1630 <tr >
1731 <td >Type</td >
18- <td >@( Model .FifoTopic ? " FIFO" : " Standard" ) </td >
32+ <td >@( Model .Topic . FifoTopic ? " FIFO" : " Standard" ) </td >
1933 </tr >
2034 <tr >
2135 <td >ARN</td >
22- <td >@Model.TopicARN </td >
36+ <td >@Model.Topic. TopicARN </td >
2337 </tr >
2438 <tr >
2539 <td >Content-based deduplication</td >
26- <td >@( Model .FifoTopic ? (Model .ContentBasedDeduplication ? " Yes" : " No" ) : " N/A" ) </td >
40+ <td >@( Model .Topic . FifoTopic ? (Model . Topic .ContentBasedDeduplication ? " Yes" : " No" ) : " N/A" ) </td >
2741 </tr >
2842 <tr >
2943 <td >Active subscriptions</td >
30- <td >@Model.SubscriptionsConfirmed </td >
44+ <td >@Model.Topic. SubscriptionsConfirmed </td >
3145 </tr >
3246 </tbody >
3347 <tbody class =" additional-info" >
3448 <tr >
3549 <td >Pending subscriptions</td >
36- <td >@Model.SubscriptionsPending </td >
50+ <td >@Model.Topic. SubscriptionsPending </td >
3751 </tr >
3852 <tr >
3953 <td >Deleted subscriptions</td >
40- <td >@Model.SubscriptionsDeleted </td >
54+ <td >@Model.Topic. SubscriptionsDeleted </td >
4155 </tr >
4256 </tbody >
4357 <tbody >
5670 </td >
5771 </tr >
5872 </tbody >
59- </table >
73+ </table >
74+
75+ <div style =" display : flex ; align-items : center " >
76+ <h2 >Subscriptions</h2 >
77+ <div style =" text-align : right ; font-size : 1.5em ; flex-grow : 1 " >
78+ <a no-href onclick =" showWindow('sns-subscribe-to-sqs-modal')" class =" gs-icon-stack initial-white neon-green" >
79+ <i class =" fa-solid fa-list-check" style =" margin-right : 4px " ></i >
80+ <i class =" bi bi-plus-circle-fill gs-icon-overlay stroked" style =" color : #000000 " ></i >
81+ </a >
82+ </div >
83+ </div >
84+
85+ <table class =" gs-list padded autosize-all-cols-but-first" >
86+ <thead >
87+ <tr >
88+ <th >Protocol</th >
89+ <th >Endpoint</th >
90+ <th >Owner</th >
91+ <th >Actions</th >
92+ </tr >
93+ </thead >
94+ <tbody >
95+ @foreach( var subscription in Model .Subscriptions )
96+ {
97+ <tr >
98+ <td >@subscription.Protocol </td >
99+ <td >@subscription.Endpoint </td >
100+ <td >@subscription.Owner </td >
101+ <td >
102+ <div class =" gs-icons" >
103+ <a no-href class =" purple lnk-sns-sub-copyarn" title =" Copy ARN" >
104+ <i class =" fa-solid fa-link" ></i >
105+ </a >
106+ <a no-href class =" red lnk-sns-sub-delete" title =" Delete" >
107+ <i class =" fa-solid fa-trash-can" ></i >
108+ </a >
109+ </div >
110+ </td >
111+ </tr >
112+ }
113+ </tbody >
114+ </table >
115+
116+ <script type =" text/javascript" >
117+ var subscribeToSqsModal = document .getElementById (" sns-subscribe-to-sqs-modal" );
118+ var queueSelectorContainer = $ (" #sns-subscribe-to-sqs-modal .queue-selector-container" );
119+
120+ subscribeToSqsModal .addEventListener (" windowopened" , function () {
121+ $ .ajax ({
122+ type: " GET" ,
123+ url: " @Url.Page(" / SQS / Index " )" ,
124+ data: {
125+ handler: " QueueSelectorPartial"
126+ },
127+ cache: false ,
128+ error: gsevent_AjaxError,
129+ success : function (result ) {
130+ queueSelectorContainer .html (result);
131+ }
132+ });
133+ });
134+
135+ subscribeToSqsModal .addEventListener (" windowclosed" , function () {
136+ queueSelectorContainer .html (" Loading queues..." );
137+ });
138+
139+ function sns_CreateSubscription_Click ()
140+ {
141+ var selectedItem = gs_GetSelectedTableItem (queueSelectorContainer[0 ]);
142+
143+ if (isNull (selectedItem))
144+ {
145+ alert (" No queue selected" );
146+ return ;
147+ }
148+
149+ // TODO: Create subscription
150+ alert (selectedItem .getAttribute (" data-queue-name" ));
151+ }
152+ </script >
0 commit comments