// legacy path part
//-------------------------
+ LegacyArtifactPath=function(path,groupId,artifactId,version,classifier,type){
+ //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);
+
+ //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;
+ }
+
LegacyPathViewModel=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 #legacy-artifact-paths-table [title]").tooltip();
+ }
+ });
+
+
+ editLegacyArtifactPath=function(legacyArtifactPath){
+
+ }
+
+ removeLegacyArtifactPath=function(legacyArtifactPath){
+
+ }
+
+ updateLegacyArtifactPath=function(legacyArtifactPath){
+
+ }
}
- displayLegacySupport=function(){
+ displayLegacyArtifactPathSupport=function(){
clearUserMessages();
var mainContent=$("#main-content");
- mainContent.html($("#legacy-path-main" ).html());
+ mainContent.html($("#legacy-artifact-path-main" ).html());
+
+ $.ajax("restServices/archivaServices/archivaAdministrationService/getLegacyArtifactPaths", {
+ type: "GET",
+ dataType: 'json',
+ success: function(data){
+ var legacyPathViewModel=new LegacyPathViewModel();
+ var legacyPaths=mapLegacyArtifactPaths(data);
+ $.log("legacyPaths:"+legacyPaths.length);
+ legacyPathViewModel.legacyArtifactPaths(legacyPaths);
+ ko.applyBindings(legacyPathViewModel,mainContent.find("#legacy-artifact-paths-view" ).get(0));
+ activateLegacyArtifactPathsGridTab();
+ }
+ });
+
- var legacyPathViewModel=new LegacyPathViewModel();
+ }
+
+
+ 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"));
- ko.applyBindings(legacyPathViewModel,mainContent.find("#legacy-path-screen" ).get(0))
}
+ 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");
+ }
+
+
});
\ No newline at end of file
~ specific language governing permissions and limitations
~ under the License.
-->
-<script id="legacy-path-main" type="text/html">
- <div id="legacy-path-screen" data-bind='template:{name:"legacy-path-div"}'></div>
+<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="network-proxies-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/x-jquery-tmpl'>
+ <thead>
+ <tr>
+ {{each(i, columnDefinition) columns}}
+ <th>${ columnDefinition.headerText }</th>
+ {{/each}}
+ <th>${$.i18n.prop('edit')}</th>
+ <th>${$.i18n.prop('delete')}</th>
+ <th>${$.i18n.prop('modified')}</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(){ editLegacyArtifactPath(row) }">
+ <img src="images/edit-find-22-22.png" title="${$.i18n.prop('edit')}">
+ </a>
+ </td>
+ <td>
+ <a href="#" data-bind="click: function(){ removeLegacyArtifactPath(row) }">
+ <img src="images/edit-cut.png" title="${$.i18n.prop('delete')}"/>
+ </a>
+ </td>
+ {{if row.modified()}}
+ <td>
+ <a href="#" data-bind="click: function(){ updateLegacyArtifactPath(row) }" class="btn btn-warning">${$.i18n.prop('save')}</a>
+ </td>
+ {{else}}
+ <td></td>
+ {{/if}}
+
+ </tr>
+ {{/each}}
+ </tbody>
+
</script>
-<script id="legacy-path-div" type="text/html">
- foo
-</script>
\ No newline at end of file