How detect form submission within Jira Issue Collector? - iframe

I have integrated jira issue collector into my Angular application. I need a way to detect when a user submit the feedback so I can send a notification to my team and user regarding the newly created ticket, however since the issue collector is loading inside an iframe I am not able to detect the form submission.
Is there any way to detect from submission inside a cross-origin iframe?

You can use the notification settings of Jira to notify your team when the ticket is created. This is most likely the best way to handle it.
While it might be possible to get the info inside your angular app, this would be pretty messy and hard to maintain.

Related

what should I update first, Redux store or Backend API

I got confused with the right data flow when I have a backend API and a redux state that passing the data to the components.
The question is: What is the right methodology to handle 2 data resources, API and Redux?
should I update the state and then fire a send request to the API with the update?
or, let the redux send that request for me every time the state changes?
or, should I update the API directly and then fire a get request to update the Redux store?
I'm really confused and do not know what is right approach should I take with less error in the future use
Appreciate any help, even sending me an article that talks about this issue and I'm gonna read it
Thank you
should I update the state and then fire a send request to the API with the update?
That's called "optimistic update", the advantage is that your app feels fast and responsive, since the network delay is hidden from the user. The downside is that the request might fail and you have to undo what the user did and inform them that it failed. For simple operations (for example marking a product as a favorite in an ecommerce website) this works great in my opinion.
To explain how it works with the example in mind:
User action triggers update of redux state (product is immediately shown as favourite on the page)
At the same time, an API request is fired to favourite the product on the backend side.
You fetch the product data again from the API and render it
Now either the request has successfully changed the product, so visually nothing changes on the page for the user - to them it looks like the operation happened without network delay - Or the request failed and you show the old state where the product is not a favourite and and error message appears.
or, let the redux send that request for me every time the state changes?
Parts of redux-toolkit embrace this approach if I'm not mistaken. If you decide to go down this road, I'd recommend to not implement it yourself but instead rely on existing libraries/middlewares.
or, should I update the API directly and then fire a get request to update the Redux store?
This is the classic, safe, and simple approach.
My advice is:
If you have lots and lots of CRUD operations against your API, and you want to not write lots of boilerplate code, look into redux-toolkit (specifically https://redux-toolkit.js.org/rtk-query/overview ).
If you care about perceived performance of your app, try optimistic update.
If you want to keep it simple and just get things to work, follow the classic approach.

meteor- should I create new collection or extend the user profile?

So I have an application that allows users to invite each other to different events. Previously I had a separate collection called Invites that contained an entry for each user and an array of events they were invited to. Since I'm building a prototype, I have insecure on, and I would simply update Invites from the client side.
Recently I changed this so that when a user invites another to an event, it calls a meteor method and updates both the inviter and the invitee's profiles on the client side.
Now my app is running very slowly and I'm not sure why. Even just loading the first page of the app (the login button for example, which uses accounts UI takes forever to load). Since the changes to invitations are the only changes I've made, I'm guessing this is the issue. Is storing invitations on each user's profile the wrong way to go about this? Any ideas about how to debug this slowness? I'm new to meteor/ web dev in general and I'm not sure what the best practices are for writing efficient code.

ASP.NET: How to limit access to a page to just one user?

How to restrict the page by accessing only one user at a time. Using asp.net can i use global.asax, is there any other way to restrict, if one user accessing the page, another user not able to access that page. we have to give message that one user is accessing the page. is it possible. can you help me or give some reference.
Although there are probably many better ways of dealing with this sort of problem, I'm going to assume that you do actually need this.
What I would do:
Make your application so that when the page is loaded(when it isn't "locked"), it logs to a database that the page was loaded and "lock" it. In the actual page, I'd have some kind of AJAX to constantly poll the web server every 5-15 seconds to tell your application the user is still on the page. And then make it so that the page becomes unlocked after 5-15 seconds from the time saved to the database by the last AJAX call.
Again, I really suspect that there is a better way around an issue like this, but this is a direct answer to your question
Based on this:
yeah sure, jupaol, it is depend on accounts, in my web application, one report has to approve only one user, but the approve authority having two users. if both of them accessing the same page and approve at a time, it will big mess. here i an not using database.
The problem is related with concurrency, there are several ways to face an issue like this, for example the easiest one is to use optimistic concurrency. Even when you are not using a database for this, you can emulate it.
You should be storing the result of the approvers somewhere, in order to mark the report as approved, with this in mind you should be able to do something like this:
Before render the page get the latest report status
If the report has not been approved, render normally
If the report was approved seconds before, render it in read-only mode reporting who approved it (or similar approach)
Add a validation to your ChangeStatus method, in this method do the following:
Get the latest status of the current report
If the report is still not validated, then block the thread (you could use a Mutex or similar) and mark the report as validate it
If the report was already validate it, raise a domain exception and handle it in your page correctly (perhaps render the page in read-only mode explaining that the report was already validate it)
If you want a more responsive application, (RIA), you might want to consider the following approaches:
Perhaps this would be the worst approach but it's still an option, you could keep a log tracking when a user request your page, then in subsequent requests check if the log is still valid, if it is not, then redirect to another page indicating the page is in use, otherwise allow access to the page. I believe this is an error-prone approach because you would be relying on this simple validation in order to prevent an inconsistency in your system, besides you would have the polling problem described in the following approach
Using AJAX to poll data from a service checking if the report has been approved. Perhaps this is the easiest way to accomplish this but it is not recommended it, because you would be polling your server constantly, and eventually you would have scalability problems
You could use Comet to get notified to the browser (client) whenever a server event has occurred, in this case when your report has been approved. The problem with this approach is that you have to keep an opened connection with the server in order to get notified.
The last approach and the most recommended these days is to use Web Sockets, this is the technology used in StackOverflow to get notifications in real time.

How to implement "other users viewing this object"

For example Zendesk has a feature called Agent Collision Notification - when you edit a ticket you get a note if somebody else its editing this ticket.
What is the Infrastructure to support a feature like this? This question seems to aim at the same thing but at a much lower level.
For the system to be completely dynamic (also notifying the first viewer) and reasonable fast, probably some comet or websocket like stuff is needed. But unlike in chat systems (a prime comet example) in a Ticket system users are constantly switching pages.
What would be the program flow and the server infrastructure for a thing like this?
If you want to allow realtime collaboration then this question that also mentions Operational Transforms will be of interest to you. And there's also a question about operational transformation libraries.
What would be the program flow and the server infrastructure for a thing like this?
I work for Pusher so I can tell you one solution using our technology.
User A opens page where there could be a 'collision'. Within the page subscribe to a channel for the page.
User A starts editing the page. Send an AJAX request to the server so there is some persisted state about the fact the page is being edited. Trigger an event on the channel stating that the user is editing the page.
User B opens the page. The page loads and can display the information from the persisted state that the page is being edited.
User A finishes editing and a request is made to the server to update the page state. Trigger an event indicating that nobody is editing the page. This event will be distributed to User B (the updated page can also be distributed via within the event or via an AJAX request when the event is received).
User B now knows he/she can edit the page. They begin editing (see step 2.) and User A is notified that User B is now editing the page.
It would also be quite cool to use presence so you could see who else was viewing the page and to allow the users to discuss changes as they happen.

How can I pass FormsAuthentication.SetAuthCookie from Data Access Layer Class to WebService to Javascript?

I am using DotNetOpenAuth in my ASP.Net Website. I have modified it to work with Facebook Connect as well, using the same methods and database structures. Now I have come across a problem.
I have added a Facebook Connect button to a login page. From that HTML button, I have to somehow pull information from the Facebook Connect connection and pass it into a method to authenticate the user. The way I am currently doing this is by:
Calling a Javascript Function on the onlogin function of the FBML/HTML Facebook Connect button.
The javascript function calls a Web service to login, which it does correctly.
The web service calls my data access layer to login.
And here is the problem: FormsAuthentication.SetAuthCookie is set at the data access layer. The Cookie is beyond the scope of the user's page and therefore is not set in the browser.
This means that the user is authenticated, but the user's browser is never notified.
So, I need to figure out if this is a bad way of doing what I need or if there is a better way to accomplish what I need. I am just not sure and have been trying to find answers for hours. Any help you have would be great.
Yes, it sounds like you are having a design crisis brought on by trying to do too much at one time/in one place.
If you break this operation up in to two calls from the client you will find your options opening up quite a bit. It might take some more work but ultimately the code will be less complex. <-- a good thing.
And in my opinion, the first clue pointing to a crisis of design would be when I said to myself "Self, having an authentication method buried two calls deep in my DAL is not working the way I would like...." lol.... I am joking and serious same time.
Good luck.

Resources