Skip to content
Snippets Groups Projects
Commit 0cbc95ba authored by Jacob Poul Richardt's avatar Jacob Poul Richardt
Browse files

Fixed circular dependency.

parent 138a7047
No related branches found
No related tags found
No related merge requests found
......@@ -27,6 +27,18 @@ define(["require", "exports", "knockout", "CockpitPortal", "Managers/Navigation"
}
});
this.CloseExperimentEnabled = knockout.computed(function () { return _this.CompletedUrl() != null; });
Navigation.ExperimentId.subscribe(function (id) {
if (id != null)
_this.Load(id);
});
Navigation.ExperimentListId.subscribe(function (id) {
if (id != null)
_this.LoadNext(id);
});
if (Navigation.ExperimentId() != null)
this.Load(Navigation.ExperimentId());
else if (Navigation.ExperimentListId() != null)
this.LoadNext(Navigation.ExperimentListId());
}
Experiment.prototype.ExperimentCompleted = function () {
this.IsExperimentCompleted(true);
......
......@@ -45,6 +45,19 @@ class Experiment
});
this.CloseExperimentEnabled = knockout.computed(() => this.CompletedUrl() != null);
Navigation.ExperimentId.subscribe(id =>
{
if(id != null) this.Load(id);
});
Navigation.ExperimentListId.subscribe(id =>
{
if (id != null) this.LoadNext(id);
});
if (Navigation.ExperimentId() != null)
this.Load(Navigation.ExperimentId());
else if (Navigation.ExperimentListId() != null)
this.LoadNext(Navigation.ExperimentListId());
}
public ExperimentCompleted():void
......
define(["require", "exports", "knockout", "routie", "Managers/NavigationPage", "Managers/Experiment"], function (require, exports, knockout, Routie, NavigationPage, ExperimentManager) {
define(["require", "exports", "knockout", "routie", "Managers/NavigationPage"], function (require, exports, knockout, Routie, NavigationPage) {
var Navigation = (function () {
function Navigation() {
var _this = this;
this.CurrentPage = knockout.observable();
this.ExperimentId = knockout.observable(null);
this.ExperimentListId = knockout.observable(null);
Routie({
"": function () {
_this.LoadPage("Welcome");
......@@ -37,12 +39,13 @@ define(["require", "exports", "knockout", "routie", "Managers/NavigationPage", "
this.CurrentPage(new NavigationPage(name, data));
};
Navigation.prototype.LoadSlide = function (id) {
ExperimentManager.Load(id);
this.ExperimentId(id);
if (this.CurrentPage() == null || this.CurrentPage().Name() !== "SlideShell")
this.CurrentPage(new NavigationPage("SlideShell"));
};
Navigation.prototype.LoadExperimentFromList = function (id) {
ExperimentManager.LoadNext(id);
this.ExperimentId(null);
this.ExperimentListId(id);
};
return Navigation;
})();
......
import knockout = require("knockout");
import Routie = require("routie");
import NavigationPage = require("Managers/NavigationPage");
import ExperimentManager = require("Managers/Experiment");
import CockpitPortal = require("CockpitPortal");
class Navigation
{
public CurrentPage: KnockoutObservable<NavigationPage> = knockout.observable<NavigationPage>();
public ExperimentId:KnockoutObservable<string> = knockout.observable(null);
public ExperimentListId:KnockoutObservable<string> = knockout.observable(null);
constructor()
{
......@@ -34,7 +34,7 @@ class Navigation
private LoadSlide(id: string): void
{
ExperimentManager.Load(id);
this.ExperimentId(id);
if (this.CurrentPage() == null || this.CurrentPage().Name() !== "SlideShell")
this.CurrentPage(new NavigationPage("SlideShell"));
......@@ -42,7 +42,8 @@ class Navigation
private LoadExperimentFromList(id:string):void
{
ExperimentManager.LoadNext(id);
this.ExperimentId(null);
this.ExperimentListId(id);
}
}
......
......@@ -5,7 +5,7 @@
<meta charset="utf-8" />
<title>Cockpit Experiments</title>
<script type="text/javascript">
var CacheBuster = 18;
var CacheBuster = 19;
</script>
</head>
<body>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment