How to create a nested storybook structure in react-native? - react-native

We are working with Storybook in our React Native project and were wondering how to organize our components since nested structures are not supported. From the web application, we are used to creating individual components and building our "pages" from them. We have been aiming for a similar workflow for the React Native application, but are having trouble implementing it. Target is a structure like that:
Components
--Buttons
----Button 1
----Button 2
--Input Fields
----Input Field 1
----Input Field 2
Pages
-- Page 1
----Sub Page 1
----Sub Page 2
-- Page 2
...

as you mentioned this feature isn't yet implemented. However you can to some degree group things together by making them part of the same story.
For example if you used
storiesOf("Buttons").add("button1")
You can also do
storiesOf("Buttons").add("button2")
In another file and since the stories of is the same they will be grouped under Buttons.
However having a third level of nesting is not really doable currently. You could Start all page stories like
storiesOf("Pages/Page1").add("SubPage1")
storiesOf("Pages/Page2").add("SubPage1")
And then they should be appear together whenever you search Page for example.
I realise its not ideal but I have it in the backlog to add this feature to the project. Once 6.0 is ready the aim is to introduce the grouping feature as an enhancement for the first milestone after the initial release. So 6.1 probably is what I'm hoping for.

Related

react+flux - one API call vs call for every component strategy

Let's say I have this blog app. There are posts, pages, menu, and user login.
One way to load the entire application state is to have one api call which will include posts, total number of pages for pagination, menu items and current user state.
The second way would be to have multiple API called, one for each component. So one call for posts and pages, one for menu and one for current user.
Which would be best strategy given the fact react is built around components?
I'll add my 2 cents as answer but still wanting to close as primarily opinion based.
The way I structure my React apps is to have a top level components called Screens or URLs, ie., /list-users should map against the ListUsersScreen component.
In said screen I declare a static method called fetchData, this method returns an object which values are Promises.
{
users: fetchUsersAction(),
someOtherApiData: fetchSomeOtherAPIData()
}
This lends well to both pure client apps and universal apps, as well.
On your server side you'd have to wait until all Promises resolves until you can render something.
Furthermore you can easily cache the values in your application state object and decide if you want to fetch new data or render stale data, also it saves on bandwidth for your user since the user might or might not decide to continue browsing your site.

Request for Existing Source Code on Defect Trend App

I started modifying/developing Rally apps about a week ago using the existing Rally apps provided on the Github repository so far. However, for one of my final tasks I've been asked to recreate a tailored Defect Trend Report App and unfortunately, the source code is not available for the App. I tried to start from scratch but I've ran into numerous errors and am a bit overwhelmed.
I was wondering if anyone had the src code for the app or knew of a way to extract the src code from the existing app. Of course if there is custom code that an individual has worked on that could also help me progress in this process and wouldn't mind sharing it, that'd also help a ton.
I saw that there were a few snippets that could be used from the Hackathon repo, but they're not quite on the mark of what I want to do with the app. I'm just trying to have the existing app filtered by delivery versions (currently filtered by iteration/release).
All help is greatly appreciated.
Thanks fellas!
There is an example of a 'bare metal' chart app in the App SDK 2.0 docs. It should give you the basics on how to do a chart.To get to it, go to the help pages (click on avatar in top right corner) and search for "Rally App SDK"
After that, you need to work out how to select defects from the various releases and do a count of each. There are two ways to do this:
Get all defects in the project you are in (don't forget whether you need to scope down to child projects too) and then do something like _.uniq() on the release field to find the list of releases (or do another request to get all the releases into a different store and use that for names and a count).
Get the releases and then for each release request the related defects.
If you do ask for child projects, you will need to handle all the scenarios of different releases for different projects - can get complicated!
#1 is effectively one big fetch, #2 may be many smaller ones.
You may want to decide whether to count all defects, sum the estimates, ignore those not finished, etc., etc.

Using the Rally API to re-rank multiple stories

I'd been looking at using the Rally API to create an app to do some simple auto-ranking stories based on specific criteria (at the request of / to help out a couple of our Product Owners) in a drag&drop workspace.
I did this by adjusting the "Rank" properties of the sequence of stories (I made sure to keep the rank values within the same overall min / max range as prior to the auto-reorder). I made a call to the API to update each story's rank individually (in quick succession).
Testing the app, I found that sometimes after running the auto-ranking app, some screens (such as the kanban board) would tell me that "drag and drop re-ranking is disabled for manual rank workspaces" (and the kanban would no longer let me drag & drop, although other screens such as the backlog would still let me drag & drop, and the workspace settings were still set to drag & drop). Deleting the stories, or reordering them on the backlog screen would return things back to normal.
After trying a few ideas to solve this, I figured perhaps if I was updating the Rank on a number of stories in quick succession, the back-end might be getting confused with these (potentially several / concurrent) requests. Introducing a delay between each story's API call has seemed to avoid the problem, and to speed things up, I now update a story's rank in the API only after the previous story's rank update has invoked the "updateComplete" function.
Do the assumptions in the last paragraph above make sense based on the backend ranking? Is there any Javascript API call to update multiple stories at once? (Otherwise I'm quite happy with the solution of only calling the API "update rank" after the prior API "rank update" call has returned ok).
That sounds like you discovered a possible issue with the backend ranking. The warning you were getting stems from the board trying to figure out which type of workspace you are in (manual or dnd rank). Since that setting is not currently available via WSAPI the board tries to figure it out based on its data and sometimes gets it wrong.
Currently there is no fully supported/documented way to adjust the ranks of items via WSAPI. The Card Board component in the App SDK uses special rankAbove and rankBelow query string parameters during update calls (which you can see in Firebug or the Chrome dev tools).
How are you currently setting the Rank values?

Structured data in Joomla

I'm currently developing a back-end for chefs at various restaurants to report their daily menues in a structured format. Of pragmatic reasons have I chosen to use a web CMS and use many of the features already include including a flexible rights-management module
I want to utilise the existing functions in Joomla for access control, editing and navigation, but I need to replace the textfield with five field (each representing one day of the working week) and save this in a structured way into the database. I was planning to create a editor plugin which displays the field for the chef-users and parse the in-data into a structured data-format e.g. XML. For each week I will need to create empty templates for all the restaurants displaying the week number and dates.
I was also hoping for third-party developers to access this data through RESTful methods in the URL where the structure could be something like: http://domain.no/restaurant-name/menu for a text-menu http://domain.no/restaurant-name/json for json etc.
I guess my question is how I can start developing such features. Has there been developed anything similar and are there modules developed for Joomla which I can utilise? Does my approach sounds sensible or are there any other good way of solving my problem?
For a custom content management i would use Zoo component from Yootheme (not free!). You can define your fields,
But for developers access, i have no idea, sorry!

How to decide whether to split up a VB.Net application and, if so, how to split it up?

I have 2 1/2 years experience of VB.Net, mostly self taught, so please bear with me if I seem rather noobish still and do not know some of the basics. I would recommend you grab a cup of tea before starting on this, as it appears to have got quite long...
I currently have a rather large application (VB.Net website) of over 15000 lines of code at the last count. It does not do retail or anything particularly complex like that - it is literally just a wholesale viewing website with admin frontend, catalogue / catalogue management system and pageview system.
I don't really know much about how .Net applications work in the background - whether they are all loaded on the same thread or if each has its own thread... I just know how to code them, or at least like to think I do... :-)
Basically my application is set up as follows:
There are two different areas - the customer area and the administration frontend.
The main part of the customer frontend is the Catalogue. The MasterPage will load a list of products but that's all, and this is common to all the customer frontend pages.
I tend to work on only one or several parts of the application at a time before uploading the changes. So, for example, I may alter the hierarchy of the Catalogue and change the Catalogue page to match the hierarchy change whilst leaving everything else alone.
The pageview database is getting really quite large and so it is getting rather slow when the application is first requested due to the way it works.
The application timeout is set to 5 minutes - don't know how to change it, I have even tried asking this question on here and seem to remember the solution was quite complex and I was recommended not to change it, but if a customer requests the application 5 minutes after the last page view then it will reload the application from scratch. This means there is a very slow page load whenever it exceeds 5 minutes of inactivity.
I am not sure if this needs consideration to determine how best to split the application up, if at all, but each part of the catalogue system is set up as follows:
A Manager class at the top level, which is used by the admin frontend to add, edit and remove items of the specified type and the customer frontend to retrieve a list of items of the specified type. For example the "RangeManager" will contain a list of product "Ranges" and will be used to interact with these from the customer frontend.
An Item class, for example Range, which contains a list of Attributes. For example Name, Description, Visible, Created, CreatedBy and so on. The form for adding / editing loops through these to display relevant controls for the administrator. For example a Checkbox for BooleanAttribute.
An Attribute class, which can be of type StringAttribute, BooleanAttribute, IntegerAttribute and so on. There are also custom Attributes (not just datatypes) such as RangeAttribute, UserAttribute and so on. These are given a data field which is used to get a piece of data specific to the item it is contained in when it is first requested. Basically the Item is given a DataRow which is stored and accessed by Attributes only when they are first requested.
When one item is requested from a specific manager is requested, the manager will loop through all the items in the database and create a new instance of the item class. For example when a Range is requested from the RangeManager, the RangeManager will loop through all of the DataRows in the Ranges table and create a new instance of Range for each one. As stated above it simply creates a new instance with the DataRow, rather than loading all the data into it there and then. The Attributes themselves fetch the relevant data from the DataRow as and when they're first requested.
It just seems a tad stupid, in my mind, to recompile and upload the entire application every time I fix a minor bug or a spelling mistake for a word which is in the code behind (for example if I set the text of a Label dynamically). A fix / change to the Catalogue page, the way it is now, may mean a customer trying to view the Contact page, which is in no way related to the Catalogue page apart from by having the same MasterPage, cannot do so because the DLL is being uploaded.
Basically my question is, given my current situation, how would people suggest I change the architecture of the application by way of splitting it into multiple applications? I mean would it be just customer / admin, or customer / admin and pageviews, or some other way? Or not at all? Are there any other alternatives which I have not mentioned here? Could web services come in handy here? Like split the catalogue itself into a different application and just have the masterpage for all the other pages use a web service to get the names of the products to list on the left hand side? Am I just way WAY over-complicating things? Judging by the length of this question I probably am, and it wouldn't be the first time... I have tried to keep it short, but I always fail... :-)
Many thanks in advance, and sorry if I have just totally confused you!
Regards,
Richard
15000 LOC is not really all that big.
It sounds like you are not pre-compiling your site for publishing. You may want to read this: http://msdn.microsoft.com/en-us/library/1y1404zt(v=vs.80).aspx
Recompiling and uploading the application is the best way to do it. If all you are changing is your markup, that can be uploaded individually (e.g. changing some html layout in an aspx page).
I don't know what you mean here by application timeout, but if your app domain recycles every 5 minutes, then that doesn't seem right at all. You should look into this.
Also, if you find yourself working on various different parts of the site (i.e. many different changes), but need to deploy only some items in isolation, then you should look into how you are using your source control tools (you are using one, aren't you?). Look into something like GIT and branching/merging.
Start by reading:
Application Architecture Guide