Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/02/16 12:35:30 (8 years ago)
Author:
jlodewyc
Message:

#2582 final commit / end of internship

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/WebJobManager/HeuristicLab.Clients.Hive.WebJobManager/Scripts/Hubs/OkbManagerHubber.js

    r13862 r13871  
    2222    var vm = $scope;
    2323    var hubber = $.connection.okbManagerHub;
    24     vm.currentData = {'name' : '', 'data' : null}
     24   $("#success-alert").hide();
     25
     26    vm.currentData = {'name' : '','type': '' , 'data' : null}
    2527
    2628    vm.init = function () {
     
    2931        $.connection.hub.qs = { 'userid': uid };
    3032        //Connection string set to identify the unique session ID for the user
    31         $.connection.hub.start().done(function () {
    32            // hubber.server.requestInfo();//initial data request
    33         });
    34         hubber.client.processData = function (filters) {
    35 
     33        $.connection.hub.start().done();
     34        hubber.client.deleteComplete = function (text) {
     35            vm.notify(text);
     36            $scope.$apply();
    3637        };
     38        hubber.client.saveComplete = function (text) {
     39            vm.notify(text);
     40            $scope.$apply();
     41        }
     42        hubber.client.refreshData = function ( name, json) {
     43            vm.initData(JSON.parse(json), name);
     44            vm.selectDataCat(name);
     45            $scope.$apply();
     46        }
    3747
    3848    }
     
    4151        switch (name) {
    4252            case "platforms":
    43                 vm.platforms = {'selected' : null, 'arr' : coll}
     53                vm.platforms = { 'selected': null, 'new': { 'Id': -1 }, 'arr': coll }
     54                vm.platforms.selected = vm.platforms.new;
    4455                break;
    4556            case "algoclass":
    46                 vm.algoclass = { 'selected': null, 'arr': coll }
     57                vm.algoclass = { 'selected': null, 'new': { 'Id': -1 }, 'arr': coll }
     58                vm.algoclass.selected = vm.algoclass.new;
    4759                break;
    4860            case "algos":
    49                 vm.algos = { 'selected': null, 'arr': coll }
     61                vm.algos = { 'selected': null, 'new': { 'Id': -1 }, 'arr': coll }
     62                vm.algos.selected = vm.algos.new;
    5063                break;
    5164            case "probclass":
    52                 vm.probclass = { 'selected': null, 'arr': coll }
     65                vm.probclass = { 'selected': null, 'new': { 'Id': -1 }, 'arr': coll }
     66                vm.probclass.selected = vm.probclass.new;
    5367                break;
    5468            case "problems":
    55                 vm.problems = { 'selected': null, 'arr': coll }
     69                vm.problems = { 'selected': null, 'new': { 'Id': -1 }, 'arr': coll }
     70                vm.problems.selected = vm.problems.new;
    5671                break;
    5772
     
    6378             case "platforms":
    6479                 vm.currentData.name = "Platforms";
     80                 vm.currentData.type = "ND";
    6581                 vm.currentData.data = vm.platforms;
    6682                 break;
    6783             case "algoclass":
    6884                 vm.currentData.name = "Algorithm classes";
     85                 vm.currentData.type = "ND";
    6986                 vm.currentData.data = vm.algoclass;
    7087                 break;
    7188             case "algos":
    7289                 vm.currentData.name = "Algorithms";
     90                 vm.currentData.type = "ALG";
    7391                 vm.currentData.data = vm.algos;
    7492                 break;
    7593             case "probclass":
    7694                 vm.currentData.name = "Problem classes";
     95                 vm.currentData.type = "ND";
    7796                 vm.currentData.data = vm.probclass;
    7897                 break;
    7998             case "problems":
    8099                 vm.currentData.name = "Problems";
     100                 vm.currentData.type = "PROB"
    81101                 vm.currentData.data = vm.problems;
    82102                 break;
     
    84104         }
    85105     }
     106     vm.selectDataMember = function (index) {
     107         if (index === null)
     108             vm.currentData.data.selected = vm.currentData.data.new;
     109         else {
     110             vm.currentData.data.selected = vm.currentData.data.arr[index];
     111         }
     112     }
     113     vm.saveCurrent = function () {
     114         hubber.server.save(JSON.stringify(vm.currentData.data.selected), vm.currentData.name);
     115     }
     116     vm.deleteCurrent = function () {
     117         hubber.server.delete(vm.currentData.data.selected.Id, vm.currentData.name);
     118     }
     119     vm.notify = function (text) {
     120         $("#succText").html(text);
     121         $("#success-alert").alert();
     122         $("#success-alert").fadeTo(2000, 500).slideUp(500, function () {
     123             $("#success-alert").hide();
     124         });
     125     }
    86126});
Note: See TracChangeset for help on using the changeset viewer.