Skip to content

Commit 6a440bf

Browse files
committed
save viewstate on some controllers
1 parent fd71562 commit 6a440bf

1 file changed

Lines changed: 75 additions & 0 deletions

File tree

OpenFlow/src/public/Controllers.ts

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,11 +730,27 @@ module openflow {
730730
this.collection = "users";
731731
this.searchfields = ["name", "username"];
732732
this.postloadData = this.processData;
733+
if (this.userdata.data.UsersCtrl) {
734+
this.basequery = this.userdata.data.UsersCtrl.basequery;
735+
this.collection = this.userdata.data.UsersCtrl.collection;
736+
this.baseprojection = this.userdata.data.UsersCtrl.baseprojection;
737+
this.orderby = this.userdata.data.UsersCtrl.orderby;
738+
this.searchstring = this.userdata.data.UsersCtrl.searchstring;
739+
this.basequeryas = this.userdata.data.UsersCtrl.basequeryas;
740+
}
741+
733742
WebSocketClient.onSignedin((user: TokenUser) => {
734743
this.loadData();
735744
});
736745
}
737746
async processData(): Promise<void> {
747+
if (!this.userdata.data.UsersCtrl) this.userdata.data.UsersCtrl = {};
748+
this.userdata.data.UsersCtrl.basequery = this.basequery;
749+
this.userdata.data.UsersCtrl.collection = this.collection;
750+
this.userdata.data.UsersCtrl.baseprojection = this.baseprojection;
751+
this.userdata.data.UsersCtrl.orderby = this.orderby;
752+
this.userdata.data.UsersCtrl.searchstring = this.searchstring;
753+
this.userdata.data.UsersCtrl.basequeryas = this.basequeryas;
738754
var chart: chartset = null;
739755
// for (var i = 0; i < this.models.length; i++) {
740756
// var user = this.models[i] as any;
@@ -924,10 +940,29 @@ module openflow {
924940
console.debug("RolesCtrl");
925941
this.basequery = { _type: "role" };
926942
this.collection = "users";
943+
this.postloadData = this.processdata;
944+
if (this.userdata.data.RolesCtrl) {
945+
this.basequery = this.userdata.data.RolesCtrl.basequery;
946+
this.collection = this.userdata.data.RolesCtrl.collection;
947+
this.baseprojection = this.userdata.data.RolesCtrl.baseprojection;
948+
this.orderby = this.userdata.data.RolesCtrl.orderby;
949+
this.searchstring = this.userdata.data.RolesCtrl.searchstring;
950+
this.basequeryas = this.userdata.data.RolesCtrl.basequeryas;
951+
}
927952
WebSocketClient.onSignedin((user: TokenUser) => {
928953
this.loadData();
929954
});
930955
}
956+
processdata() {
957+
if (!this.userdata.data.RolesCtrl) this.userdata.data.RolesCtrl = {};
958+
this.userdata.data.RolesCtrl.basequery = this.basequery;
959+
this.userdata.data.RolesCtrl.collection = this.collection;
960+
this.userdata.data.RolesCtrl.baseprojection = this.baseprojection;
961+
this.userdata.data.RolesCtrl.orderby = this.orderby;
962+
this.userdata.data.RolesCtrl.searchstring = this.searchstring;
963+
this.userdata.data.RolesCtrl.basequeryas = this.basequeryas;
964+
if (!this.$scope.$$phase) { this.$scope.$apply(); }
965+
}
931966
async DeleteOne(model: any): Promise<any> {
932967
this.loading = true;
933968
await this.api.Delete(this.collection, model);
@@ -1301,12 +1336,32 @@ module openflow {
13011336
this.basequery = {};
13021337
this.collection = $routeParams.collection;
13031338
this.baseprojection = { _type: 1, type: 1, name: 1, _created: 1, _createdby: 1, _modified: 1 };
1339+
this.postloadData = this.processdata;
1340+
if (this.userdata.data.EntitiesCtrl) {
1341+
this.basequery = this.userdata.data.EntitiesCtrl.basequery;
1342+
this.collection = this.userdata.data.EntitiesCtrl.collection;
1343+
this.baseprojection = this.userdata.data.EntitiesCtrl.baseprojection;
1344+
this.orderby = this.userdata.data.EntitiesCtrl.orderby;
1345+
this.searchstring = this.userdata.data.EntitiesCtrl.searchstring;
1346+
this.basequeryas = this.userdata.data.EntitiesCtrl.basequeryas;
1347+
}
13041348
WebSocketClient.onSignedin(async (user: TokenUser) => {
13051349
this.collections = await api.ListCollections();
13061350
this.loadData();
13071351
});
13081352
}
1353+
processdata() {
1354+
if (!this.userdata.data.EntitiesCtrl) this.userdata.data.EntitiesCtrl = {};
1355+
this.userdata.data.EntitiesCtrl.basequery = this.basequery;
1356+
this.userdata.data.EntitiesCtrl.collection = this.collection;
1357+
this.userdata.data.EntitiesCtrl.baseprojection = this.baseprojection;
1358+
this.userdata.data.EntitiesCtrl.orderby = this.orderby;
1359+
this.userdata.data.EntitiesCtrl.searchstring = this.searchstring;
1360+
this.userdata.data.EntitiesCtrl.basequeryas = this.basequeryas;
1361+
if (!this.$scope.$$phase) { this.$scope.$apply(); }
1362+
}
13091363
SelectCollection() {
1364+
this.userdata.data.EntitiesCtrl.collection = this.collection;
13101365
this.$location.path("/Entities/" + this.collection);
13111366
//this.$location.hash("#/Entities/" + this.collection);
13121367
if (!this.$scope.$$phase) { this.$scope.$apply(); }
@@ -2584,11 +2639,31 @@ module openflow {
25842639
this.basequery = { _rpaheartbeat: { "$gte": dt } };
25852640
}
25862641
};
2642+
if (this.userdata.data.RobotsCtrl) {
2643+
this.basequery = this.userdata.data.RobotsCtrl.basequery;
2644+
this.collection = this.userdata.data.RobotsCtrl.collection;
2645+
this.baseprojection = this.userdata.data.RobotsCtrl.baseprojection;
2646+
this.orderby = this.userdata.data.RobotsCtrl.orderby;
2647+
this.searchstring = this.userdata.data.RobotsCtrl.searchstring;
2648+
this.basequeryas = this.userdata.data.RobotsCtrl.basequeryas;
2649+
this.showinactive = this.userdata.data.RobotsCtrl.showinactive;
2650+
this.showall = this.userdata.data.RobotsCtrl.showall;
2651+
}
25872652
WebSocketClient.onSignedin((user: TokenUser) => {
25882653
this.loadData();
25892654
});
25902655
}
25912656
processdata() {
2657+
if (!this.userdata.data.RobotsCtrl) this.userdata.data.RobotsCtrl = {};
2658+
this.userdata.data.RobotsCtrl.basequery = this.basequery;
2659+
this.userdata.data.RobotsCtrl.collection = this.collection;
2660+
this.userdata.data.RobotsCtrl.baseprojection = this.baseprojection;
2661+
this.userdata.data.RobotsCtrl.orderby = this.orderby;
2662+
this.userdata.data.RobotsCtrl.searchstring = this.searchstring;
2663+
this.userdata.data.RobotsCtrl.basequeryas = this.basequeryas;
2664+
this.userdata.data.RobotsCtrl.showinactive = this.showinactive;
2665+
this.userdata.data.RobotsCtrl.showall = this.showall;
2666+
25922667
for (var i = 0; i < this.models.length; i++) {
25932668
var model: any = this.models[i];
25942669
(model as any).hasnodered = false;

0 commit comments

Comments
 (0)