mirror of https://github.com/apache/archiva.git
[MRM-1359] remove maven1 ui part
This commit is contained in:
parent
aac7bb95c0
commit
bcbe7db70c
|
@ -1,318 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
define("archiva/admin/repository/legacy/main", ["jquery", 'i18n','knockout'],
|
||||
function(jquery,i18n,ko) {
|
||||
|
||||
showMenu = function(administrationMenuItems) {
|
||||
administrationMenuItems.push(
|
||||
{
|
||||
text: $.i18n.prop('menu.legacy-artifact-support'),
|
||||
order:600,
|
||||
id: "menu-legacy-support-list-a",
|
||||
href: "#legacy",
|
||||
redback: "{permissions: ['archiva-manage-configuration']}",
|
||||
func: function() {
|
||||
displayLegacyArtifactPathSupport();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
//-------------------------
|
||||
// legacy path part
|
||||
//-------------------------
|
||||
|
||||
LegacyArtifactPath = function(path, groupId, artifactId, version, classifier, type, update) {
|
||||
//private String path;
|
||||
this.path = ko.observable(path);
|
||||
|
||||
/**
|
||||
* The artifact reference, as " [groupId] :
|
||||
* [artifactId] : [version] : [classifier] : [type] ".
|
||||
*/
|
||||
//private String artifact;
|
||||
//this.artifact=ko.observable(artifact);
|
||||
this.update = update;
|
||||
//private String groupId;
|
||||
this.groupId = ko.observable(groupId);
|
||||
|
||||
//private String artifactId;
|
||||
this.artifactId = ko.observable(artifactId);
|
||||
|
||||
//private String version;
|
||||
this.version = ko.observable(version);
|
||||
|
||||
//private String classifier;
|
||||
this.classifier = ko.observable(classifier);
|
||||
|
||||
//private String type;
|
||||
this.type = ko.observable(type);
|
||||
|
||||
this.modified = ko.observable();
|
||||
|
||||
this.artifact = ko.computed(function() {
|
||||
var artifactValue = "";
|
||||
if (this.groupId()) {
|
||||
artifactValue += this.groupId();
|
||||
}
|
||||
if (this.artifactId()) {
|
||||
artifactValue += ":" + this.artifactId();
|
||||
}
|
||||
if (this.version()) {
|
||||
artifactValue += ":" + this.version();
|
||||
}
|
||||
if (this.classifier()) {
|
||||
artifactValue += ":" + this.classifier();
|
||||
}
|
||||
if (this.type()) {
|
||||
artifactValue += ":" + this.type();
|
||||
}
|
||||
return artifactValue;
|
||||
}, this);
|
||||
};
|
||||
|
||||
mapLegacyArtifactPaths = function(data) {
|
||||
if (data) {
|
||||
return $.isArray(data) ? $.map(data, function(item) {
|
||||
return mapLegacyArtifactPath(item);
|
||||
}) : [mapLegacyArtifactPath(data)];
|
||||
}
|
||||
return [];
|
||||
};
|
||||
|
||||
mapLegacyArtifactPath = function(data) {
|
||||
return data ? new LegacyArtifactPath(data.path, data.groupId, data.artifactId, data.version, data.classifier, data.type) : null;
|
||||
};
|
||||
|
||||
activateLegacyArtifactPathFormValidation = function() {
|
||||
var theForm = $("#main-content").find("#legacy-artifact-paths-edit-form");
|
||||
var validator = theForm.validate({
|
||||
showErrors: function(validator, errorMap, errorList) {
|
||||
customShowError("#main-content #legacy-artifact-paths-edit-form", validator, errorMap, errorMap);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
LegacyArtifactPathViewModel = function(legacyArtifactPath, update, legacyArtifactPathsViewModel) {
|
||||
var self = this;
|
||||
this.update = update;
|
||||
this.legacyArtifactPath = legacyArtifactPath;
|
||||
this.legacyArtifactPathsViewModel = legacyArtifactPathsViewModel;
|
||||
|
||||
this.display = function() {
|
||||
var mainContent = $("#main-content");
|
||||
ko.applyBindings(self, mainContent.find("#legacy-artifact-paths-edit").get(0));
|
||||
mainContent.find("#legacy-artifact-paths-view-tabs-li-edit a").html($.i18n.prop("edit"));
|
||||
activateLegacyArtifactPathFormValidation();
|
||||
activateLegacyArtifactPathsEditTab();
|
||||
};
|
||||
|
||||
displayGrid = function() {
|
||||
activateLegacyArtifactPathsGridTab();
|
||||
};
|
||||
|
||||
calculatePath = function() {
|
||||
var path = "";
|
||||
if (self.legacyArtifactPath.groupId()) {
|
||||
path += self.legacyArtifactPath.groupId() + "/jars/";
|
||||
}
|
||||
if (self.legacyArtifactPath.artifactId()) {
|
||||
path += self.legacyArtifactPath.artifactId();
|
||||
}
|
||||
if (self.legacyArtifactPath.version()) {
|
||||
path += "-" + self.legacyArtifactPath.version();
|
||||
}
|
||||
if (self.legacyArtifactPath.classifier()) {
|
||||
path += "-" + self.legacyArtifactPath.classifier();
|
||||
}
|
||||
if (self.legacyArtifactPath.type()) {
|
||||
path += "." + self.legacyArtifactPath.type();
|
||||
}
|
||||
self.legacyArtifactPath.path(path);
|
||||
};
|
||||
|
||||
this.save = function() {
|
||||
var theForm = $("#main-content").find("#legacy-artifact-paths-edit-form");
|
||||
if (!theForm.valid()) {
|
||||
return;
|
||||
}
|
||||
// do that on server side
|
||||
/*if (theForm.find("#artifact" ).val()
|
||||
!=theForm.find("#path" ).val()){
|
||||
var errorList=[{
|
||||
message: $.i18n.prop("path must match artifact"),
|
||||
element: theForm.find("#path" ).get(0)
|
||||
}];
|
||||
customShowError("#main-content #legacy-artifact-paths-edit-form", null, null, errorList);
|
||||
return;
|
||||
}*/
|
||||
// TODO call id exists if add ?
|
||||
clearUserMessages();
|
||||
$.log("save ok");
|
||||
if (self.update) {
|
||||
$.log("update");
|
||||
} else {
|
||||
$.ajax("restServices/archivaServices/archivaAdministrationService/addLegacyArtifactPath",
|
||||
{
|
||||
type: "POST",
|
||||
contentType: 'application/json',
|
||||
data: ko.toJSON(self.legacyArtifactPath),
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
self.legacyArtifactPath.modified(false);
|
||||
self.legacyArtifactPathsViewModel.legacyArtifactPaths.push(self.legacyArtifactPath);
|
||||
displaySuccessMessage($.i18n.prop('legacy-artifact-path.added', self.legacyArtifactPath.path()));
|
||||
activateLegacyArtifactPathsGridTab();
|
||||
},
|
||||
error: function(data) {
|
||||
var res = $.parseJSON(data.responseText);
|
||||
displayRestError(res);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
LegacyArtifactPathsViewModel = function() {
|
||||
var self = this;
|
||||
this.legacyArtifactPaths = ko.observableArray([]);
|
||||
|
||||
this.gridViewModel = new ko.simpleGrid.viewModel({
|
||||
data: self.legacyArtifactPaths,
|
||||
columns: [
|
||||
{
|
||||
headerText: $.i18n.prop('legacy-artifact-paths.path'),
|
||||
rowText: "path"
|
||||
},
|
||||
{
|
||||
headerText: $.i18n.prop('legacy-artifact-paths.artifact'),
|
||||
rowText: "artifact"
|
||||
}
|
||||
],
|
||||
pageSize: 5,
|
||||
gridUpdateCallBack: function(networkProxy) {
|
||||
$("#main-content").find("#legacy-artifact-paths-table").find("[title]").tooltip();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
editLegacyArtifactPath = function(legacyArtifactPath) {
|
||||
var legacyArtifactPathViewModel = new LegacyArtifactPathViewModel(legacyArtifactPath, true);
|
||||
legacyArtifactPathViewModel.display();
|
||||
};
|
||||
|
||||
removeLegacyArtifactPath = function(legacyArtifactPath) {
|
||||
|
||||
openDialogConfirm(
|
||||
function() {
|
||||
|
||||
$.ajax("restServices/archivaServices/archivaAdministrationService/deleteLegacyArtifactPath?path=" + encodeURIComponent(legacyArtifactPath.path()),
|
||||
{
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
self.legacyArtifactPaths.remove(legacyArtifactPath);
|
||||
displaySuccessMessage($.i18n.prop('legacy-artifact-path.removed', legacyArtifactPath.path()));
|
||||
activateLegacyArtifactPathsGridTab();
|
||||
},
|
||||
error: function(data) {
|
||||
var res = $.parseJSON(data.responseText);
|
||||
displayRestError(res);
|
||||
},
|
||||
complete: function() {
|
||||
closeDialogConfirm();
|
||||
}
|
||||
}
|
||||
);
|
||||
}, $.i18n.prop('ok'), $.i18n.prop('cancel'), $.i18n.prop('legacy-artifact-path.delete.confirm', legacyArtifactPath.path()),
|
||||
$("#legacy-artifact-path-delete-warning-tmpl").tmpl(legacyArtifactPath));
|
||||
|
||||
};
|
||||
|
||||
updateLegacyArtifactPath = function(legacyArtifactPath) {
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
displayLegacyArtifactPathSupport = function() {
|
||||
screenChange();
|
||||
var mainContent = $("#main-content");
|
||||
mainContent.html(mediumSpinnerImg());
|
||||
|
||||
$.ajax("restServices/archivaServices/archivaAdministrationService/getLegacyArtifactPaths", {
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
mainContent.html($("#legacy-artifact-path-main").tmpl());
|
||||
var legacyArtifactPathsViewModel = new LegacyArtifactPathsViewModel();
|
||||
var legacyPaths = mapLegacyArtifactPaths(data);
|
||||
$.log("legacyPaths:" + legacyPaths.length);
|
||||
legacyArtifactPathsViewModel.legacyArtifactPaths(legacyPaths);
|
||||
ko.applyBindings(legacyArtifactPathsViewModel, mainContent.find("#legacy-artifact-paths-view").get(0));
|
||||
|
||||
mainContent.find("#legacy-artifact-paths-view-tabs").on('show', function(e) {
|
||||
if ($(e.target).attr("href") == "#legacy-artifact-paths-edit") {
|
||||
var viewModel = new LegacyArtifactPathViewModel(new LegacyArtifactPath(), false, legacyArtifactPathsViewModel);
|
||||
viewModel.display();
|
||||
activateLegacyArtifactPathFormValidation();
|
||||
clearUserMessages();
|
||||
}
|
||||
if ($(e.target).attr("href") == "#legacy-artifact-paths-view") {
|
||||
mainContent.find("#legacy-artifact-paths-view-tabs-li-edit a").html($.i18n.prop("add"));
|
||||
clearUserMessages();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
activateLegacyArtifactPathsGridTab();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
activateLegacyArtifactPathsGridTab = function() {
|
||||
var mainContent = $("#main-content");
|
||||
mainContent.find("#legacy-artifact-paths-view-tabs-li-edit").removeClass("active");
|
||||
mainContent.find("#legacy-artifact-paths-edit").removeClass("active");
|
||||
|
||||
mainContent.find("#legacy-artifact-paths-view-tabs-li-grid").addClass("active");
|
||||
mainContent.find("#legacy-artifact-paths-view").addClass("active");
|
||||
mainContent.find("#legacy-artifact-paths-view-tabs-li-edit a").html($.i18n.prop("add"));
|
||||
|
||||
};
|
||||
|
||||
activateLegacyArtifactPathsEditTab = function() {
|
||||
var mainContent = $("#main-content");
|
||||
mainContent.find("#legacy-artifact-paths-view-tabs-li-grid").removeClass("active");
|
||||
mainContent.find("#legacy-artifact-paths-view").removeClass("active");
|
||||
|
||||
mainContent.find("#legacy-artifact-paths-view-tabs-li-edit").addClass("active");
|
||||
mainContent.find("#legacy-artifact-paths-edit").addClass("active");
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
);
|
|
@ -28,8 +28,7 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,ko) {
|
|||
}
|
||||
|
||||
window.managedRepositoryTypes = [
|
||||
new ManagedRepositoryType("default","Maven 2.x Repository"),
|
||||
new ManagedRepositoryType("legacy", "Maven 1.x Repository")
|
||||
new ManagedRepositoryType("default","Maven 2.x Repository")
|
||||
];
|
||||
|
||||
ManagedRepository=function(id,name,layout,indexDirectory,location,snapshots,releases,blockRedeployments,cronExpression,
|
||||
|
|
|
@ -16,128 +16,6 @@
|
|||
~ specific language governing permissions and limitations
|
||||
~ under the License.
|
||||
-->
|
||||
<script id="legacy-artifact-path-main" type="text/html">
|
||||
<div id="legacy-artifact-path-screen">
|
||||
<div class="page-header">
|
||||
<h2>${$.i18n.prop('legacy-artifact-paths.list')}</h2>
|
||||
</div>
|
||||
|
||||
<ul id="legacy-artifact-paths-view-tabs" class="nav nav-tabs">
|
||||
<li id="legacy-artifact-paths-view-tabs-li-grid">
|
||||
<a data-toggle="tab" href="#legacy-artifact-paths-view" id="legacy-artifact-paths-view-tabs-a-grid">${$.i18n.prop('legacy-artifact-paths.grid.tab.title')}</a>
|
||||
</li>
|
||||
<li id="legacy-artifact-paths-view-tabs-li-edit">
|
||||
<a data-toggle="tab" href="#legacy-artifact-paths-edit">${$.i18n.prop('add')}</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div id="legacy-artifact-paths-view-tabs-content" class="tab-content">
|
||||
<div id="legacy-artifact-paths-view" class="tab-pane">
|
||||
<table class="table table-striped table-bordered" id="legacy-artifact-paths-table"
|
||||
data-bind="simpleGrid: gridViewModel,simpleGridTemplate:'ko-legacy-artifact-paths-grid',pageLinksId:'legacy-artifact-pathsPagination'">
|
||||
</table>
|
||||
<div id="legacy-artifact-pathsPagination"></div>
|
||||
</div>
|
||||
<div id="legacy-artifact-paths-edit" class="tab-pane" data-bind='template: {name:"legacy-artifact-paths-edit-tmpl"}'></div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script id='ko-legacy-artifact-paths-grid' type='text/html'>
|
||||
<thead>
|
||||
<tr>
|
||||
{{each(i, columnDefinition) columns}}
|
||||
<th>${ columnDefinition.headerText }</th>
|
||||
{{/each}}
|
||||
<th>${$.i18n.prop('delete')}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{each(i, row) itemsOnCurrentPage()}}
|
||||
<tr data-bind="css:{ 'modified': row.modified()}">
|
||||
{{each(j, columnDefinition) columns}}
|
||||
{{var val = (typeof columnDefinition.rowText == 'function' ? columnDefinition.rowText(row) : row[columnDefinition.rowText])}}
|
||||
<td>
|
||||
${val}
|
||||
</td>
|
||||
{{/each}}
|
||||
<td>
|
||||
<a href="#" data-bind="click: function(){ removeLegacyArtifactPath(row) }">
|
||||
<span class="btn btn-danger">
|
||||
<i class="icon-trash icon-white"/>
|
||||
</span>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
|
||||
</script>
|
||||
|
||||
<script id="legacy-artifact-paths-edit-tmpl" type="text/html">
|
||||
<form id="legacy-artifact-paths-edit-form" class="well form-horizontal">
|
||||
<fieldset id="legacy-artifact-paths-edit-fieldset">
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="groupId">${$.i18n.prop('legacy-artifact-paths.groupId')}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="xlarge required" id="groupId" name="groupId" size="8"
|
||||
data-bind="value: legacyArtifactPath.groupId"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="artifactId">${$.i18n.prop('legacy-artifact-paths.artifactId')}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="xlarge required" id="artifactId" name="artifactId" size="8"
|
||||
data-bind="value: legacyArtifactPath.artifactId"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="version">${$.i18n.prop('legacy-artifact-paths.version')}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="xlarge required" id="version" name="version" size="8"
|
||||
data-bind="value: legacyArtifactPath.version"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="classifier">${$.i18n.prop('legacy-artifact-paths.classifier')}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="xlarge" id="classifier" name="classifier" size="8"
|
||||
data-bind="value: legacyArtifactPath.classifier"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="type">${$.i18n.prop('legacy-artifact-paths.type')}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="xlarge required" id="type" name="type" size="8"
|
||||
data-bind="value: legacyArtifactPath.type"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="path">${$.i18n.prop('legacy-artifact-paths.path')}</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="xlarge required" id="path" name="path" size="8"
|
||||
data-bind="value: legacyArtifactPath.path"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="artifact">${$.i18n.prop('legacy-artifact-paths.artifact')}</label>
|
||||
<div class="controls">
|
||||
<span title="calculated from values" class="uneditable-input"
|
||||
id="artifact" data-bind="text: legacyArtifactPath.artifact"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
<button id="network-proxy-btn-save" data-bind="click: save" class="btn">${$.i18n.prop('save')}</button>
|
||||
<button id="network-proxy-btn-cancel" data-bind="click: displayGrid" class="btn">${$.i18n.prop('cancel')}</button>
|
||||
<button id="network-proxy-btn-calculate-path" data-bind="click: calculatePath" class="btn btn-success">${$.i18n.prop('legacy-artifact-paths.calculatePath')}</button>
|
||||
</form>
|
||||
</script>
|
||||
|
||||
<script id="legacy-artifact-path-delete-warning-tmpl" type="text/html">
|
||||
<div>
|
||||
<span class="label label-warning">${$.i18n.prop('warning.not.undone.operation')}</span>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script id="repository-scanning-main" type="text/html">
|
||||
<div id="repository-scanning-screen">
|
||||
|
|
Loading…
Reference in New Issue