对于仪表板应用程序非分层URL方案 [英] Non-hierarchical url scheme for a dashboard application

查看:130
本文介绍了对于仪表板应用程序非分层URL方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是保持在下列情况下一个URL方案的角方式:


  • 的应用程序包含一个侧边栏,用户可以选择一些数据集,后来就修改选择。

  • 有一个仪表板画布上,其中用户可以动态地添加一个数字,包含不同类型的数字窗口。这些数字是根据某些变量绘制。

该URL方案我想,让我跟踪选定的数据集,当前活动窗口,其参数以及它们各自的顺序。例如,一个有效的URL可能是

<$p$p><$c$c>/ds?set=dataset1,dataset2,dataset3/type1?var=alb&f=0.05-0.15/type3?var=alb,crea/type1?var=alb,crea,ch2&f=0.10-0.20/

这意味着三种命名数据集当前选定,进而,三个窗口是在与所定义的查询参数的定义的顺序活性

什么状态/视图结构将允许所描述的架构?问题是,我还没有看到这样的情况的例子,用户界面​​路由器的实例是其中用户浏览一个给定的路径上的所有简单的分级情况。


解决方案

我不是您想要的URL方案完全清楚,但是这可能在路线查询参数来完成。与此限制是他们必须要声明的状态时的状态定义例如:

  .STATE(仪表盘,{
    网址:'/仪表板DS&放大器;类型和放大器;富和放大器;酒吧?
})

这将使 $ stateParams.ds $ stateParams.type $ stateParams包含.foo 等可用。被要求的参数的一些任意设定的问题(即你不知道他们所有的时间提前)可以通过以某种方式与已知命名参数序列化PARAMS得到解决。

例如,我使用的查询参数做国家之间的一些重定向其状态的查询参数抓获重定向= profile.details和放大器;我提供ProfileID = 987234 ?可以反序列化这个东西我直接传递给 $ state.go()。在这种情况下,我有一组有限的,可以被传递,所以我让他们宣称INT状态定义的ID。为了解决这个问题,你可以不喜欢重定向= state.name&安培; ATTRS = {someId:3,otherValue:'ABC',andAntoher:324} <?/ code>。 (查询参数应urlen codeD)和这样的状态的网​​址可以声明如下:<?code> /仪表板redrect和放大器; ATTRS

What is the angular way for maintaining a URL scheme in the following context:

  • the app contains a sidebar where the user can select a number of datasets, and modify the selection later on.
  • there's a dashboard canvas onto which a user can dynamically add a number of windows that contain different types of figures. These figures are plotted based on certain variables.

The URL scheme I'm thinking would allow me to keep track of the selected datasets, current active windows, their parameters and their respective order. For example, a valid url could be

/ds?set=dataset1,dataset2,dataset3/type1?var=alb&f=0.05-0.15/type3?var=alb,crea/type1?var=alb,crea,ch2&f=0.10-0.20/

which would mean the three named datasets are currently selected, and further, three windows are active in the defined order with the defined query parameters.

What state/view structure would allow the described schema? The problem is that I have not seen any examples of such a situation, the ui-router examples are all simple hierarchical cases where user navigates on a given path.

解决方案

I'm not entirely clear on your desired url scheme, but this could be accomplished with query parameters in the route. The limitation with this is they have to be declared to the state when the state is defined ex:

.state('dashboard', {
    url: '/dashboard?ds&type&foo&bar'
})

This would make $stateParams.ds, $stateParams.type, $stateParams.foo etc available. The issue of some arbitrary set of parameters being required (i.e. you don't know them all ahead of time) can be resolved by serializing the params in some way to the known named parameters.

For example, I use query params for doing some redirects between states where the state is captured in the query params ?redirect=profile.details&profileId=987234 and I can deserialize this to something I pass straight to $state.go(). In this case I have a limited set of ids that could be passed so I have them declared int the state definition. To get around this you could do something like ?redirect=state.name&attrs={someId:3,otherValue:'abc',andAntoher:324}. (the query parameters should be urlencoded) and this way the state's url could be declared like this: /dashboard?redrect&attrs

这篇关于对于仪表板应用程序非分层URL方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆