Skip to content

Commit

Permalink
#27 collection/File template & icon to display
Browse files Browse the repository at this point in the history
  • Loading branch information
Hetal Patel committed Jan 19, 2018
1 parent 470f9a2 commit 4c841cb
Show file tree
Hide file tree
Showing 5 changed files with 200 additions and 50 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.emc.metalnx.services.interfaces;

public interface IconService {

String getIconToDisplayFile(String mimeType);
String getIconToDisplayCollection();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.emc.metalnx.services.irods;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.emc.metalnx.services.interfaces.IconService;

@Service
@Transactional
public class IconServiceImpl implements IconService {

@Override
public String getIconToDisplayFile(String mimeType) {

String icon = "";

switch (mimeType) {

case "application/pdf":
icon = "fa fa-file-pdf-o";
break;

case "image/jpg":
case "image/jpeg":
case "image/png":
case "image/gif":
icon = "fa fa-file-image-o";
break;

default:
icon = "fa fa-file";
break;
}

return icon;

}

@Override
public String getIconToDisplayCollection() {
// TODO Auto-generated method stub
return "fa fa-folder";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.emc.metalnx.core.domain.exceptions.DataGridException;
import com.emc.metalnx.services.interfaces.CollectionService;
import com.emc.metalnx.services.interfaces.IRODSServices;
import com.emc.metalnx.services.interfaces.IconService;
import com.emc.metalnx.services.interfaces.PermissionsService;

@Controller
Expand All @@ -50,6 +51,9 @@ public class CollectionInfoController {

@Autowired
IRODSServices irodsServices;

@Autowired
IconService iconService;

@Autowired
DataProfilerSettings dataProfilerSettings;
Expand All @@ -67,8 +71,18 @@ public String getTestCollectionInfo(final Model model, HttpServletRequest reques

@SuppressWarnings("rawtypes")
DataProfile dataProfile = getCollectionDataProfile(path);


String iconToDisplay = "";


if(dataProfile!= null && dataProfile.isFile())
iconToDisplay = iconService.getIconToDisplayFile(dataProfile.getDataType().getMimeType());
if(dataProfile!= null && !dataProfile.isFile())
iconToDisplay = iconService.getIconToDisplayCollection();

model.addAttribute("iconToDisplay", iconToDisplay);
model.addAttribute("dataProfile", dataProfile);

return "collections/info"; //:: mainPage(page='collections/collectionInfo', fragment='collectionInfo')";

//"main :: mainPage(page='some-page', fragment='somePage')";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,61 +14,143 @@
~ limitations under the License.
-->

<th:block th:fragment="treeView">
<!-- <div class="col-md-12" th:fragment="treeView" xmlns:th="http://www.w3.org/1999/xhtml"> -->
<th:block th:fragment="treeView">
<!-- <div class="col-md-12" th:fragment="treeView" xmlns:th="http://www.w3.org/1999/xhtml"> -->




<div class="col-md-12" th:unless="${dataProfile == null}">

<div th:unless="${dataProfile.file}" th:fragment="collectionInfoView">
<span>this is collection Info</span>
<div class="panel property">
<div class="row">
<h4 class="property-title" th:text="#{text.info}">
<i class="fa fa-info-circle"></i>
</h4>
<div class="col-md-12 col-sm-12">
<div class="col-md-12 col-sm-12 collLesserInfo divider"></div>
</div>
</div>
<div class="panel-info">
<div class="name">
<i th:class="${ iconToDisplay }"></i> <span><b
th:text="${ dataProfile.getDomainObject().getCollectionName() }"></b></span>
<!-- <span class="resulting-permission" th:text="${ '[' + collectionAndDataObject.getMostPermissiveAccessForCurrentUser() + ' access]'}"></span> -->
<a id="breadcrumbStar" class="btn-favorite" href="#"
data-toggle="popover" data-placement="left" data-trigger="manual"
data-content=""
th:title="${dataProfile.starred}?#{collections.favorite.unmark.button.tooltip}:#{collections.favorite.button.tooltip}">
<i
th:class="true? 'fa fa-star bm-checked' : 'fa fa-star bm-unchecked'"
aria-hidden="true"></i>
</a>
</div>


<div class="col-md-12" th:unless="${dataProfile == null}" th:fragment="collectionInfo">
<div class="panel property">
<div class="row">
<h4 class="property-title" th:text="#{text.info}"><i class="fa fa-info-circle"></i></h4>
<div class="col-md-12 col-sm-12"><div class="col-md-12 col-sm-12 collLesserInfo divider"></div></div>
</div>
<div class="panel-info">
<div class="name">
<i th:unless="${dataProfile.file}" class="fa fa-folder folder-icon"></i>
<i th:if="${dataProfile.file}"
th:class="${ dataProfile.getIconToDisplay()}"></i>
<span><b th:text="${ dataProfile.getDomainObject().getCollectionName() }"></b></span>
<!-- <span class="resulting-permission" th:text="${ '[' + collectionAndDataObject.getMostPermissiveAccessForCurrentUser() + ' access]'}"></span> -->
<a id="breadcrumbStar" class="btn-favorite" href="#"
data-toggle="popover" data-placement="left" data-trigger="manual" data-content="" th:title="${dataProfile.starred}?#{collections.favorite.unmark.button.tooltip}:#{collections.favorite.button.tooltip}" >
<i th:class="true? 'fa fa-star bm-checked' : 'fa fa-star bm-unchecked'" aria-hidden="true"></i>
</a>
</div>


<div class="row">
<div class="text-right col-md-1 col-sm-4 col-xs-4"><label th:text="#{collections.management.table.owner.label}"></label></div>
<!-- <div class="col-md-9 col-sm-8 col-xs-8"><span th:text="${ currentCollection.getOwner() }"></span></div> -->
</div>
<div class="row">
<div class="text-right col-md-1 col-sm-4 col-xs-4"><label th:text="#{collections.management.table.created.label}"></label></div>
<div class="col-md-9 col-sm-8 col-xs-8"><span th:text="${ dataProfile.getDomainObject().getCreatedAt() }"></span></div>
</div>
<!-- collection has different name, keep same name?? <div class="row">
<div class="text-right col-md-1 col-sm-4 col-xs-4"><label th:text="#{collections.management.table.modified.label}"></label></div>
<div class="col-md-9 col-sm-8 col-xs-8"><span th:text="${ dataProfile.getDomainObject().getModifiedAt() }"></span></div>
</div> -->
<!-- Will we have checksum on collection??? <div class="row">
<div class="row">
<div class="text-right col-md-1 col-sm-4 col-xs-4">
<label th:text="#{collections.management.table.owner.label}"></label>
</div>
<!-- <div class="col-md-9 col-sm-8 col-xs-8"><span th:text="${ currentCollection.getOwner() }"></span></div> -->
</div>
<div class="row">
<div class="text-right col-md-1 col-sm-4 col-xs-4">
<label th:text="#{collections.management.table.created.label}"></label>
</div>
<div class="col-md-9 col-sm-8 col-xs-8">
<span th:text="${ dataProfile.getDomainObject().getCreatedAt() }"></span>
</div>
</div>
<div class="row">
<div class="text-right col-md-1 col-sm-4 col-xs-4">
<label th:text="#{collections.management.table.modified.label}"></label>
</div>
<div class="col-md-9 col-sm-8 col-xs-8">
<span
th:text="${ dataProfile.getDomainObject().getModifiedAt() }"></span>
</div>
</div>
<!-- Will we have checksum on collection??? <div class="row">
<div class="text-right col-md-1 col-sm-4 col-xs-4"><label th:text="#{collections.management.checksum.label}"></label></div>
<div class="col-md-9 col-sm-8 col-xs-8"><span th:text="${ dataProfile.getChecksum() }"></span></div>
</div> -->
</div>
</div>
</div>

<script>

$(document).ready(function(){
</div>
</div>
</div>


<div th:if="${dataProfile.file}" th:fragment="FileInfoView">
<span>this is File Info</span>
<div class="panel property">
<div class="row">
<h4 class="property-title" th:text="#{text.info}">
<i class="fa fa-info-circle"></i>
</h4>
<div class="col-md-12 col-sm-12">
<div class="col-md-12 col-sm-12 collLesserInfo divider"></div>
</div>
</div>
<div class="panel-info">
<div class="name">
<i th:class="${ iconToDisplay }"></i> <span><b
th:text="${ dataProfile.getDomainObject().getCollectionName() }"></b></span>
<!-- <span class="resulting-permission" th:text="${ '[' + collectionAndDataObject.getMostPermissiveAccessForCurrentUser() + ' access]'}"></span> -->
<a id="breadcrumbStar" class="btn-favorite" href="#"
data-toggle="popover" data-placement="left" data-trigger="manual"
data-content=""
th:title="${dataProfile.starred}?#{collections.favorite.unmark.button.tooltip}:#{collections.favorite.button.tooltip}">
<i
th:class="true? 'fa fa-star bm-checked' : 'fa fa-star bm-unchecked'"
aria-hidden="true"></i>
</a>
</div>


<div class="row">
<div class="text-right col-md-1 col-sm-4 col-xs-4">
<label th:text="#{collections.management.table.owner.label}"></label>
</div>
<!-- <div class="col-md-9 col-sm-8 col-xs-8"><span th:text="${ currentCollection.getOwner() }"></span></div> -->
</div>
<div class="row">
<div class="text-right col-md-1 col-sm-4 col-xs-4">
<label th:text="#{collections.management.table.created.label}"></label>
</div>
<div class="col-md-9 col-sm-8 col-xs-8">
<span th:text="${ dataProfile.getDomainObject().getCreatedAt() }"></span>
</div>
</div>
<div class="row">
<div class="text-right col-md-1 col-sm-4 col-xs-4">
<label th:text="#{collections.management.table.modified.label}"></label>
</div>
<div class="col-md-9 col-sm-8 col-xs-8">
<span th:text="${ dataProfile.getDomainObject().getUpdatedAt() }"></span>
</div>
</div>
<div class="row">
<div class="text-right col-md-1 col-sm-4 col-xs-4">
<label th:text="#{collections.management.checksum.label}"></label>
</div>
<div class="col-md-9 col-sm-8 col-xs-8">
<span th:text="${ dataProfile.getDomainObject().getChecksum() }"></span>
</div>
</div>
</div>
</div>

</div>

</div>



<script>
$(document).ready(function() {
console.log("CollectionInfo");
$("#collection-content").removeClass("collections-table");
$("#collection-content").addClass("property");
});
</script>
$("#collection-content").removeClass("collections-table");
$("#collection-content").addClass("property");
});
</script>
</th:block>
<!-- </div> -->
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@

<div class="content_menu">
<div id="info">
<th:block th:include="collections/collectionInfo :: collectionInfo"></th:block>
<th:block th:include="collections/collectionInfo :: treeView"></th:block>
<!-- <th:block th:unless="${dataProfile.file}" th:include="collections/collectionInfo :: collectionInfoView"></th:block> -->
</div>

<div id="metadata"></div>
Expand Down

0 comments on commit 4c841cb

Please sign in to comment.