1) The Slug is unique. You can use that.

2) For seemless Javascript apps, the page shouldn't need to refresh. The
amount of work should be trivial. You refresh the cluster, and then you use
the same code that you had before to get the JSON data, and just have it do
that part again.


On Fri, Aug 9, 2013 at 3:30 AM, Pranjal Mittal <notifications@github.com>wrote:

> In ganeti_web/ganetiviz/views.py:
>
> > +
> > +class ClusterGraphView(TemplateView):
> > +    """
> > +    View that dispatches the appropriate template file responsible for visual
> > +    mapping of the Cluster Graph.
> > +    """
> > +    template_name = 'graph.html'
> > +
> > +    def get_context_data(self, **kwargs):
> > +        context = super(ClusterGraphView, self).get_context_data(**kwargs)
> > +        cluster_hostname=self.kwargs['cluster_hostname']
> > +        context['cluster_hostname'] = cluster_hostname
> > +        return context
> > +
> > +
> > +class ClusterRefreshView(View,LoginRequiredMixin):
>
> Hi @ecnahc515 <https://github.com/ecnahc515>,
>
> I liked the idea you mentioned that - I do not have to worry about
> redirects with AJAX calls; and saw it now.
>
> (1)
> I was suggested to use complete FQDN's to refer to clusters, nodes,etc in
> a feedback from ganeti community, but GWM: clusters/views.py uses a
> cluster slug in urls to filter a cluster?
> Should I switch to using slugs instead? Are slugs unique for each cluster
> for sure? (I had also noticed before that using slugs causes problems when
> I use IP addresses for cluster names.)
>
> (2)
> About simply re-loading the page. (after data at backend is updated)-
> I am not sure, but I think this shouldn't cause any performance issues?
> Acc. to me most js/css files should be cached; so its only the cluster data
> which will be re-fetched (including syncing with ganeti at the backend)
> that takes the greatest share of the 'refresh' time.
>
> But if I switch to using the refresh() in 'clusters/views.py` I may have
> no option of reloading this page via a redirect (since I cannot alter the
> original view's redirect which is used at other places within GWM) So I
> will have to adopt the idea you suggested ie. 'redrawing of the graph'
> after the refresh at back-end is performed. Now, this will take up more
> hooks & code on the front-end side.
>
> To summarize (2) - I feel, its like removing some code from back-end, to
> add more code on the front end without changing the total run time
> appreciably. (perhaps a very small improvement)
>
> What is your opinion about this? Should I switch to the solution you
> mentioned?
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/osuosl/ganeti_webmgr/pull/5/files#r5680068>
> .
>