Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9362


Ignore:
Timestamp:
04/16/13 08:57:22 (10 years ago)
Author:
fschoepp
Message:

#1888:

  • Added IVisualExtensionDao to the backend representing js extension that create new viewable elements of an algorithm.
  • Started to upgrade the frontend to render those new javascript UI extensions.
Location:
branches/OaaS
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/Azure/DAL.cs

    r9324 r9362  
    1717    public static readonly string EXPERIMENT_TABLE = "Experiment";
    1818    public static readonly string EXPERIMENT_BLOB_CONTAINER = "experiment";
     19    public static readonly string VISUAL_BLOB_CONTAINER = "visualextensions";
    1920    public static readonly string CLOUD_SETTINGS_KEY = "Cloudia.WindowsAzure.Storage";
    2021
     
    289290      return AlgorithmConverter.ConvertJsonToExperiment(blob.DownloadText());
    290291    }
    291 
     292  }
     293
     294  public class VisualExtensionDao : IVisualExtensionDao {
     295    public CloudBlobClient BlobClient { get; set; }
     296
     297    public bool Add(string algorithmId, string script) {
     298      CloudBlobContainer container = BlobClient.GetContainerReference(AzureConstants.VISUAL_BLOB_CONTAINER);
     299      container.CreateIfNotExist();
     300      var blob = container.GetBlobReference(algorithmId);
     301      blob.UploadText(script);
     302      return true;
     303    }
     304
     305    public bool DeleteById(string algorithmId) {
     306      CloudBlobContainer container = BlobClient.GetContainerReference(AzureConstants.VISUAL_BLOB_CONTAINER);
     307      container.CreateIfNotExist();
     308      var blob = container.GetBlobReference(algorithmId);
     309      return blob.DeleteIfExists();
     310    }
     311
     312    public string FindById(string algorithmId) {
     313      CloudBlobContainer container = BlobClient.GetContainerReference(AzureConstants.VISUAL_BLOB_CONTAINER);
     314      container.CreateIfNotExist();
     315      var blob = container.GetBlobReference(algorithmId);
     316      return blob.DownloadText();
     317    }
    292318  }
    293319
     
    296322    private IBlobDao blobDao;
    297323    private IExperimentDao expDao;
     324    private IVisualExtensionDao visualDao;
    298325
    299326    private CloudStorageAccount storageAccount;
     
    340367      }
    341368    }
     369
     370
     371    public IVisualExtensionDao VisualExtensionDao {
     372      get {
     373        if (visualDao == null) {
     374          visualDao = new VisualExtensionDao() { BlobClient = StorageAccount.CreateCloudBlobClient() };
     375        }
     376        return visualDao;
     377      }
     378    }
    342379  }
    343380}
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/HL/HiveScenarioManager.cs

    r9350 r9362  
    294294            Model.Run taskRun = new Model.Run();
    295295            taskRun.Id = taskRun.Name = run.Name;
     296            taskRun.AlgorithmName = run.Algorithm.Name;
    296297            IList<Parameter> resultValues = new List<Model.Parameter>();
    297298            foreach (var key in run.Results.Keys) {
     
    611612      return dal.ExperimentDao.GetExperimentById(user, nodeId);
    612613    }
     614
     615
     616    public string GetVisualExtension(string algorithmId) {
     617      return dal.VisualExtensionDao.FindById(algorithmId);
     618    }
    613619  }
    614620}
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/Interfaces/DAL.cs

    r9350 r9362  
    3636  }
    3737
     38
     39  public interface IVisualExtensionDao {
     40    bool Add(string algorithmId, string script);
     41    bool DeleteById(string algorithmId);
     42    string FindById(string algorithmId);
     43  }
     44
    3845  public interface IDataAccessLayer {
    3946    IScenarioDao ScenarioDao { get; }
    4047    IBlobDao BlobDao { get; }
    4148    IExperimentDao ExperimentDao { get; }
     49    IVisualExtensionDao VisualExtensionDao { get; }
    4250  }
     51
    4352
    4453  public static class DataAccessLayerProvider {   
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/Interfaces/IControllerService.cs

    r9324 r9362  
    6666    [OperationContract]
    6767    Experiment GetExperimentById(User u, string nodeId);
     68
     69    [OperationContract]
     70    string GetVisualExtension(string algorithmId);
     71
     72    [OperationContract]
     73    bool AddVisualExtension(string algorithmId, string script);
     74
     75    [OperationContract]
     76    bool DeleteVisualExtension(string algorithmId);
    6877  }
    6978}
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/Interfaces/IScenarioManager.cs

    r9324 r9362  
    2828   
    2929    bool DispatchExperiment(User user, Experiment exp, JobExecutionDetails details);
     30
     31    string GetVisualExtension(string algorithmId);
    3032  }
    3133}
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/Interfaces/Model/ControllerModel.cs

    r9350 r9362  
    483483    [DataMember]
    484484    public IList<Parameter> InputParameters { get; set; }
     485
     486    public string AlgorithmName { get; set; }
    485487  }
    486488
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/Mockup/MockupDAL.cs

    r9350 r9362  
    253253      }     
    254254    }
     255
     256
     257    public IVisualExtensionDao VisualExtensionDao {
     258      get { throw new NotImplementedException(); }
     259    }
    255260  }
    256261}
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/Mockup/MockupScenarioManager.cs

    r9324 r9362  
    286286      throw new NotImplementedException();
    287287    }
     288
     289
     290    public string GetVisualExtension(string algorithmId) {
     291      throw new NotImplementedException();
     292    }
    288293  }
    289294}
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/Parsers/AlgorithmConverter.cs

    r9350 r9362  
    190190      jrun["results"] = ConvertParametersToJson(run.Results);
    191191      jrun["params"] = ConvertParametersToJson(run.InputParameters);
     192      jrun["algorithmName"] = run.AlgorithmName;
    192193      return jrun;
    193194    }
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/PlaceholderControllerService.cs

    r9324 r9362  
    192192      return hiveManager.GetExperimentById(u, nodeId);
    193193    }
     194
     195
     196    public string GetVisualExtension(string algorithmId) {
     197      return hiveManager.GetVisualExtension(algorithmId);
     198    }
     199
     200
     201    public bool AddVisualExtension(string algorithmId, string script) {
     202      return hiveManager.AddVisualExtension(algorithmId, script);
     203    }
     204
     205    public bool DeleteVisualExtension(string algorithmId) {
     206      return hiveManager.DeleteVisualExtension(algorithmId);
     207    }
    194208  }
    195209}
  • branches/OaaS/HeuristicLab.Services.Optimization.Web/Content/job.model.js

    r9350 r9362  
    6161            id: null,
    6262            name: null,
    63             results: null
     63            results: null,
     64            inputs: null,
     65            algorithmName: null
    6466        }
    6567    });
  • branches/OaaS/HeuristicLab.Services.Optimization.Web/Controllers/JobController.cs

    r9324 r9362  
    5757        return Content(AlgorithmConverter.ConvertRunsToJson(runs).ToString(), "application/json", System.Text.Encoding.UTF8);
    5858      }
     59
     60      [HttpGet]
     61      public ActionResult VisualExtension(string algorithmId) {
     62        var script = ControllerService.withControllerService<string>((service) => {
     63          User u = new User() { Username = Membership.GetUser().UserName, Password = Session["pw"] as string };
     64          return service.GetVisualExtension(algorithmId);
     65        });
     66        return Content(script, "text/javascript", System.Text.Encoding.UTF8);
     67      }
    5968    }
    6069}
  • branches/OaaS/HeuristicLab.Services.Optimization.Web/Models/AdminModels.cs

    r8958 r9362  
    2323    }
    2424
     25    private HttpPostedFileBase scenarioJs;
     26
     27    public HttpPostedFileBase ScenarioJs {
     28      get { return scenarioJs; }
     29      set { scenarioJs = value; }
     30    }
     31
    2532  }
    2633}
  • branches/OaaS/HeuristicLab.Services.Optimization.Web/Views/Admin/Index.cshtml

    r8958 r9362  
    1313    <label for="scenarioMapper">Scenario XML</label>
    1414    <input type="file" name="scenarioXml" id="scenarioXml" />
    15     <input type="submit" value="Upload scenario" />
     15    <label for="scenarioMapper">Visual extension (JavaScript) for Scenario</label>
     16    <input type="file" name="scenarioJs" id="scenarioJs" />
     17    <input type="submit" value="Upload scenario" />   
    1618  </fieldset>
    1719}
Note: See TracChangeset for help on using the changeset viewer.