Skip to content
This repository was archived by the owner on Apr 22, 2022. It is now read-only.

Commit 6604507

Browse files
committed
use one modal
1 parent c761bc4 commit 6604507

File tree

7 files changed

+73
-134
lines changed

7 files changed

+73
-134
lines changed

src/main/webapp/js/settings/data-sources/data-sources.html

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
2+
<div id="datasource-endpoint">
33
<h4>SPARQL Endpoint</h4>
44
<!-- EndpointCtrl Controller -->
55
<div ng-if="isUserAuthenticated()" ng-controller="EndpointCtrl">
@@ -31,8 +31,10 @@ <h4>SPARQL Endpoint</h4>
3131
</tbody>
3232
</table>
3333
</div>
34+
</div>
3435

3536

37+
<div id="datasource-rdb">
3638
<h4>Relational Databases</h4>
3739
<!-- DatabaseCtrl Controller -->
3840
<div ng-if="isUserAuthenticated()" ng-controller="DatabaseCtrl">
@@ -67,19 +69,22 @@ <h4>Relational Databases</h4>
6769
</tr>
6870
</tbody>
6971
</table>
72+
</div>
73+
</div>
7074

7175

7276

7377
<!-- LicenseSourceCtrl -->
78+
<div id="datasource-license">
7479
<h4>Licences</h4>
75-
<div ng-if="isUserAuthenticated()" class="col-xs-12" ng-controller="LicenseSourceCtrl">
76-
80+
<div ng-if="isUserAuthenticated()" ng-controller="LicenseSourceCtrl">
81+
<button type="button" class="btn btn-success btn-large"
82+
ng-click="new()">Add Licence</button>
7783
<p ng-if="licenses.length<=0">No licences found</p>
78-
<button type="button" class="btn btn-primary btn-large"
79-
ng-click="new()">Add Licence</button>
8084

81-
<div class="col-xs-12">
82-
<table class="table toowide" ng-if="licenses.length>0">
85+
86+
87+
<table class="table table-striped" ng-if="licenses.length>0">
8388
<thead>
8489
<tr>
8590
<th>Actions</th>
@@ -101,7 +106,7 @@ <h4>Licences</h4>
101106
</tr>
102107
</tbody>
103108
</table>
104-
</div>
105109

106110
</div>
111+
</div>
107112

src/main/webapp/js/workbench/extraction-and-loading/import-rdf-controller.js

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,26 @@ var ImportFormCtrl = function($scope, $http, $q, $timeout, ConfigurationService,
3737

3838
// source can be : file, url, endpoint or graph
3939
$scope.importRdf = {
40-
source : "" };
40+
source : "",
41+
files : []
42+
};
4143

4244
//scope variables used in the target-graph direcitve
4345
$scope.target = {
4446
label : "Target Graph",
45-
graph : "" };
46-
$scope.newTarget ={
47-
prefix : "RdfImport" ,
48-
label : "",
49-
description : ""
47+
graph : "",
48+
isNew : {
49+
prefix : "RdfImport" ,
50+
label : "",
51+
description : ""
52+
}
5053
};
54+
5155
//scope variable is for the source-graph direcitve
52-
$scope.source = {
56+
$scope.source = {
5357
label : "Source Graph",
54-
graph : "" };
58+
graph : ""
59+
};
5560

5661
$scope.importEndpoint = {sparqlQuery : "CONSTRUCT { ?s ?p ?o } WHERE { ?s ?p ?o } "};
5762
$scope.importLocal = { action : "ADD", sparqlQuery : "ADD"};
@@ -76,30 +81,31 @@ var ImportFormCtrl = function($scope, $http, $q, $timeout, ConfigurationService,
7681
};
7782

7883
$scope.updateNewTargetInfo = function(){
84+
console.log($scope.source.graph);
7985
if($scope.sourceType.value == 'file'){
80-
$scope.newTarget ={
86+
$scope.target.isNew ={
8187
prefix : "RdfImport" ,
82-
label : "Import form " + $scope.importRdf.source.length +" files",
83-
description : "Import from file "+$scope.importRdf.source,
88+
label : $scope.importRdf.files,
89+
description : "Import from file(s) "+ $scope.importRdf.files,
8490
};
8591
}
8692
else if($scope.sourceType.value == 'url'){
87-
$scope.newTarget ={
93+
$scope.target.isNew ={
8894
prefix : "RdfImport" ,
8995
label : "Import from url",
9096
description : "Import from url "+$scope.importRdf.source,
9197
};
9298
}
9399
else if($scope.sourceType.value == 'externalQuery'){
94-
$scope.newTarget ={
100+
$scope.target.isNew ={
95101
prefix : "RdfImport" ,
96102
label : "Import from endpoint",
97103
description : "Import from endpoint "+$scope.importRdf.source,
98104
};
99105
}
100106
else if($scope.sourceType.value == 'localQuery'){
101107
$scope.importRdf.source = $scope.source.graph;
102-
$scope.newTarget ={
108+
$scope.target.isNew ={
103109
prefix : "RdfImport" ,
104110
label : "Import from graph",
105111
description : "Import from graph "+$scope.importRdf.source,
@@ -109,6 +115,7 @@ var ImportFormCtrl = function($scope, $http, $q, $timeout, ConfigurationService,
109115
}
110116

111117
$scope.updateForm = function() {
118+
112119
if($scope.sourceType.value == 'file'){
113120
$scope.fileElements = true;
114121
$scope.urlElements = false;
@@ -141,7 +148,7 @@ var ImportFormCtrl = function($scope, $http, $q, $timeout, ConfigurationService,
141148
**/
142149
$scope.uploadSuceed = function(){
143150

144-
return ($scope.sourceType.value == 'file' && $scope.importRdf.source!=null)
151+
return ($scope.sourceType.value === 'file' && $scope.importRdf.files.length>0)
145152
}
146153

147154
$scope.uploadFiles = function(files, errFiles) {
@@ -178,7 +185,7 @@ var ImportFormCtrl = function($scope, $http, $q, $timeout, ConfigurationService,
178185
// results: an array of data objects from each deferred.resolve(data) call
179186
function(results) {
180187
flash.success='Uploaded: ' + results ;
181-
$scope.importRdf.source = results;
188+
$scope.importRdf.files = results;
182189
$scope.updateNewTargetInfo();
183190
},
184191
// error
@@ -197,7 +204,7 @@ var ImportFormCtrl = function($scope, $http, $q, $timeout, ConfigurationService,
197204
$scope.isInvalid = function(){
198205
var invalid =true;
199206
if(!$scope.fileForm.$invalid){
200-
if($scope.importRdf.source!= null){
207+
if($scope.importRdf.files.length>0){
201208
invalid = false;
202209
}
203210
}
@@ -213,14 +220,19 @@ var ImportFormCtrl = function($scope, $http, $q, $timeout, ConfigurationService,
213220
var source;
214221

215222
if($scope.sourceType.value == 'file')
216-
importPromise = ImportRdfService.importFromFile($scope.importRdf.source, $scope.target.graph);
223+
importPromise = ImportRdfService.importFromFile($scope.importRdf.files, $scope.target.graph);
217224
else if($scope.sourceType.value == 'url')
218225
importPromise = ImportRdfService.importFromUrl($scope.importRdf.source, $scope.target.graph);
219226
else if($scope.sourceType.value == 'externalQuery')
220227
importPromise = ImportRdfService.importFromEndpoint(scope.importEndpoint.sparqlQuery, $scope.importRdf.source, $scope.target.graph);
221228
else if($scope.sourceType.value == 'localQuery')
222229
importPromise = ImportRdfService.importFromLocal($scope.importRdf.source, $scope.target.graph, $scope.importLocal.sparqlQuery);
223230

231+
if($scope.sourceType.value == 'file')
232+
source = $scope.importRdf.files;
233+
else
234+
source = [ Ns.lengthen($scope.importRdf.source) ];
235+
224236
importPromise.then(
225237
//success
226238
function (response){
@@ -229,7 +241,7 @@ var ImportFormCtrl = function($scope, $http, $q, $timeout, ConfigurationService,
229241

230242
var meta = {
231243
namedGraph : imported.targetGraph,
232-
source: $scope.importRdf.source,
244+
source: source,
233245
contributor : Ns.lengthen(currentAccount.getAccountURI()),
234246
date: Helpers.getCurrentDate()
235247
};

src/main/webapp/js/workbench/extraction-and-loading/triplegeo-controller.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -560,10 +560,11 @@ var TripleGeoCtrl = function($scope, $http, $q, ConfigurationService, Components
560560
controller: 'ModalJobCtrl',
561561
size: 'lg',
562562
resolve : {
563-
mConf : function(){
563+
modalConfiguration : function(){
564564
var p = {
565-
title: "New Triple-Geo Job",
566-
prefix: "tripleGeo"};
565+
title: "Triple-Geo Job",
566+
service: "tripleGeo"
567+
};
567568
return p;
568569
}
569570
}

src/main/webapp/js/workbench/linking-and-fusing/limes-controller.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,18 @@ var LimesCtrl = function($scope, $http, ConfigurationService, ComponentsService,
252252

253253
// ask the user for a job name and description
254254
var modalInstance = $modal.open({
255-
templateUrl: 'modal-forms/workbench/modal-limes-job.html',
256-
controller: 'ModalLimesJobCtrl',
257-
size: 'lg'
255+
templateUrl: 'modal-forms/workbench/modal-job.html',
256+
controller: 'ModalJobCtrl',
257+
size: 'lg',
258+
resolve : {
259+
modalConfiguration : function(){
260+
var p = {
261+
title : "Limes Job",
262+
service: "limes"
263+
};
264+
return p;
265+
}
266+
}
258267
});
259268

260269
// reads user's answer
Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
'use strict';
22

3-
function ModalJobCtrl($scope, $modalInstance, GraphService, Ns, mConf) {
3+
function ModalJobCtrl($scope, $modalInstance, GraphService, Ns, modalConfiguration) {
44

5-
$scope.modaltitle ="New Job";
6-
var mprefix ="job";
7-
if(mConf.title!=undefined)
8-
$scope.modaltitle = mConf.title;
9-
if(mConf.prefix!=undefined)
10-
mprefix = mConf.prefix;
5+
6+
$scope.modaltitle=modalConfiguration.title;
117

128
$scope.job = {
139
name : "",
@@ -18,14 +14,16 @@ function ModalJobCtrl($scope, $modalInstance, GraphService, Ns, mConf) {
1814
additionalSources: true,
1915
};
2016

21-
//scope variables used in the target-graph direcitve
22-
$scope.target = { graph : ""};
23-
$scope.newTarget ={
24-
prefix : mprefix,
17+
//scope variables used in the target-graph direcitve
18+
$scope.target = {
2519
label : "",
26-
description : ""
20+
graph : "",
21+
isNew : {
22+
prefix : modalConfiguration.service ,
23+
label : "",
24+
description : ""
25+
}
2726
};
28-
2927

3028
$scope.ok = function () {
3129

@@ -42,11 +40,11 @@ function ModalJobCtrl($scope, $modalInstance, GraphService, Ns, mConf) {
4240
};
4341

4442
$scope.updateNewTargetLabel = function () {
45-
$scope.newTarget.label = "Job from " + $scope.job.label;
43+
$scope.target.isNew.label = modalConfiguration.service+ " from " + $scope.job.label;
4644
};
4745

4846
$scope.updateNewTargetDescription = function () {
49-
$scope.newTarget.description = "Job from " + $scope.job.description;
47+
$scope.target.isNew.description = "Resulct of "+ modalConfiguration.service+ " : " + $scope.job.description;
5048
};
5149

5250
}

src/main/webapp/modal-forms/workbench/modal-limes-job-controller.js

Lines changed: 0 additions & 48 deletions
This file was deleted.

src/main/webapp/modal-forms/workbench/modal-limes-job.html

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)