Make packages sortable by type not repository

This commit is contained in:
AhyoungRyu 2017-02-23 00:37:39 +09:00
parent 86e1eda3ef
commit 6d7f4fab5b
3 changed files with 35 additions and 150 deletions

View file

@ -6,8 +6,7 @@
* 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.
* distributed under thpackageInfosR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@ -24,28 +23,16 @@ function HeliumCtrl($scope, $rootScope, $sce, baseUrlSrv, ngToast, heliumService
$scope.showVersions = {};
$scope.bundleOrder = [];
$scope.bundleOrderChanged = false;
$scope.npmRegistry = 'http://registry.npmjs.org/'
$scope.mvnCentralRepository = 'http://repo1.maven.org/maven2/'
$scope.vizTypePkg = {}
$scope.spellTypePkg = {}
$scope.intpTypePkg = {}
$scope.appTypePkg = {}
$scope.numberOfEachPackageByType = {}
$scope.npmPackageTypes = [HeliumType.SPELL, HeliumType.VISUALIZATION].join(', ')
$scope.mavenArtifactTypes = [HeliumType.APPLICATION, HeliumType.INTERPRETER].join(', ')
$scope.pkgsRegisteredInNpm = {}
$scope.pkgsRegisteredInMaven = {}
$scope.allPackageTypes = [HeliumType][0]
$scope.pkgListByType = 'VISUALIZATION'
$scope.intpDefaultIcon = $sce.trustAsHtml('<img src="../assets/images/maven_default_icon.png" style="width: 12px"/>');
$(function () {
$('.helium-popover').popover({
trigger: 'focus',
content: 'body',
placement: "bottom",
html: true
})
})
var buildDefaultVersionListToDisplay = function(packageInfos) {
var defaultVersions = {};
@ -95,15 +82,13 @@ function HeliumCtrl($scope, $rootScope, $sce, baseUrlSrv, ngToast, heliumService
appTypePkg[name] = pkgs;
break;
}
}
$scope.vizTypePkg = vizTypePkg
$scope.spellTypePkg = spellTypePkg
_.extend($scope.pkgsRegisteredInNpm, $scope.vizTypePkg, $scope.spellTypePkg)
$scope.appTypePkg = appTypePkg
$scope.intpTypePkg = intpTypePkg
_.extend($scope.pkgsRegisteredInMaven, $scope.appTypePkg, $scope.intpTypePkg)
};
var getAllPackageInfo = function() {

View file

@ -132,36 +132,29 @@
color: #636363;
}
.helium-repo-btn {
.heliumLearnMore {
margin-top:10px;
}
.heliumLearnMore a {
cursor:pointer;
margin-right:10px;
text-decoration:none;
}
.heliumRepoBtn {
margin-right: 8px;
}
.helium-repo-btn:hover, .helium-repo-btn:focus {
.heliumRepoBtn:hover, .heliumRepoBtn:focus {
margin-right: 8px;
outline: 0;
}
.packagePopUp img {
width: 55px;
display: block;
margin: 12px auto;
}
.packagePopUp label {
margin-bottom: 4px;
margin-top: 4px;
font-size: 13px;
}
.packagePopUp span {
font-size: 13px;
}
.localPkgInfo {
margin-top: 10px;
margin: 10px 12px 0 0;
font-size: 11px;
font-style: italic;
color: #aaaaaa;
text-align: right;
}

View file

@ -18,55 +18,22 @@ limitations under the License.
<h3 class="new_h3">
Helium
</h3>
<div class="pull-right" style="margin-top:10px;"
ng-init="content = 'npmPkgs'">
<a style="cursor:pointer;margin-right:10px;text-decoration:none;"
target="_blank"
<div class="pull-right heliumLearnMore">
<a target="_blank"
class="helium-repo-btn"
ng-href="https://zeppelin.apache.org/helium_packages.html"
tooltip-placement="bottom"
tooltip="Learn more">
<i class="icon-question" ng-style="{color: 'black'}"></i>
</a>
<button tabindex="0" class="btn btn-default btn-sm helium-repo-btn helium-popover"
<button tabindex="0" class="btn btn-default btn-sm heliumRepoBtn helium-popover"
role="button"
ng-click="content = 'npmPkgs'"
data-content="
<div class='packagePopUp'>
<img src='../assets/images/npm_logo.png' style='width: 55px;'/>
<div>
<label>Online Registry URL: </label>
<span>{{npmRegistry}}</span>
</div>
<div>
<label>Package Type: </label>
<span>{{npmPackageTypes}}<span>
</div>
<p class='localPkgInfo'>* Local registry packages' name is gray colored.</p>
</div>">
<i class="fa fa-cube" ng-style="{color: 'black'}"></i>
NPM Packages
</button>
<button tabindex="0" class="btn btn-default btn-sm helium-repo-btn helium-popover"
style="margin-right: 12px;"
role="button"
ng-click="content = 'mavenArtifacts'"
data-content="
<div class='packagePopUp'>
<img src='../assets/images/maven_central_logo.png' style='width: 125px;'/>
<div>
<label>Central Repository URL: </label>
<span>{{mvnCentralRepository}}</span>
</div>
<div>
<label>Package Type: </label>
<span>{{mavenArtifactTypes}}</span>
</div>
<p class='localPkgInfo'>* Local registry package's name is gray colored.</p>
</div>">
<i class="fa fa-cube" ng-style="{color: 'black'}"></i>
Maven Artifacts
ng-repeat="pkgTypes in allPackageTypes"
ng-click="$parent.pkgListByType = pkgTypes">
<i class="fa fa-cube"></i>
{{pkgTypes}}
</button>
<p class="localPkgInfo">* Local registry package's name is gray colored.</p>
</div>
</div>
</div>
@ -94,72 +61,9 @@ limitations under the License.
</div>
<div class="box width-full heliumPackageContainer">
<!-- NPM packages -->
<div class="row heliumPackageList"
ng-repeat="(pkgName, pkgInfo) in pkgsRegisteredInNpm"
ng-show="content == 'npmPkgs'">
<div class="col-md-12">
<div class="heliumPackageHead">
<div class="heliumPackageIcon"
ng-bind-html=pkgInfo.pkg.icon></div>
<div class="heliumPackageName">
<span ng-if="hasNpmLink(pkgInfo)">
<a target="_blank" href="https://www.npmjs.com/package/{{pkgName}}">{{pkgName}}</a>
</span>
<span ng-if="!hasNpmLink(pkgInfo)" ng-class="{'heliumLocalPackage': isLocalPackage(pkgInfo)}">
{{pkgName}}
</span>
<span class="heliumType">{{pkgInfo.pkg.type}}</span>
</div>
<div ng-show="!pkgInfo.enabled"
ng-click="enable(pkgName, pkgInfo.pkg.artifact)"
class="btn btn-success btn-xs"
style="float:right">Enable</div>
<div ng-show="pkgInfo.enabled"
ng-click="disable(pkgName)"
class="btn btn-info btn-xs"
style="float:right">Disable</div>
</div>
<div ng-class="{heliumPackageDisabledArtifact: !pkgInfo.enabled, heliumPackageEnabledArtifact: pkgInfo.enabled}">
{{pkgInfo.pkg.artifact}}
<span ng-show="packageInfos[pkgName].length > 0"
ng-click="toggleVersions(pkgName)">
versions
</span>
</div>
<ul class="heliumPackageVersions"
ng-show="showVersions[pkgName]">
<li class="heliumPackageDisabledArtifact"
ng-repeat="pkg in packageInfos[pkgName]">
{{pkg.pkg.artifact}} -
<span ng-click="enable(pkgName, pkg.pkg.artifact)"
style="margin-left:3px;cursor:pointer;text-decoration: underline;color:#3071a9">
enable
</span>
</li>
</ul>
<div class="heliumPackageDescription">
{{pkgInfo.pkg.description}}
</div>
<div ng-if="pkgInfo.pkg.type === 'SPELL' && pkgInfo.pkg.spell"
class="spellInfo">
<div>
<span class="spellInfoDesc">MAGIC</span>
<span class="spellInfoValue">{{pkgInfo.pkg.spell.magic}} </span>
</div>
<div>
<span class="spellInfoDesc">USAGE</span>
<pre class="spellUsage">{{pkgInfo.pkg.spell.usage}} </pre>
</div>
</div>
</div>
</div>
<!-- Maven artifacts -->
<div class="row heliumPackageList"
ng-repeat="(pkgName, pkgInfo) in pkgsRegisteredInMaven"
ng-show="content == 'mavenArtifacts'">
ng-repeat="(pkgName, pkgInfo) in defaultVersions"
ng-show="$parent.pkgListByType == pkgInfo.pkg.type">
<div class="col-md-12">
<div class="heliumPackageHead">
<div class="heliumPackageIcon"
@ -169,13 +73,16 @@ limitations under the License.
ng-if="pkgInfo.pkg.type === 'INTERPRETER'"
ng-bind-html=intpDefaultIcon></div>
<div class="heliumPackageName">
<span ng-if="hasNpmLink(pkgInfo)">
<a target="_blank" href="https://www.npmjs.com/package/{{pkgName}}">{{pkgName}}</a>
</span>
<span ng-if="hasMavenLink(pkgInfo)">
<a target="_blank"
href="http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22{{pkgInfo.pkg.artifact.split('@')[0]}}%22%20AND%20v%3A%22{{pkgInfo.pkg.artifact.split('@')[1]}}%22">
{{pkgName}}
</a>
</span>
<span ng-if="!hasMavenLink(pkgInfo)" ng-class="{'heliumLocalPackage': isLocalPackage(pkgInfo)}">
<span ng-if="!hasNpmLink(pkgInfo) && !hasMavenLink(pkgInfo)" ng-class="{'heliumLocalPackage': isLocalPackage(pkgInfo)}">
{{pkgName}}
</span>
<span class="heliumType">{{pkgInfo.pkg.type}}</span>
@ -204,9 +111,9 @@ limitations under the License.
</span>
</div>
<ul class="heliumPackageVersions"
ng-show="showVersions[pkgName]">
ng-show="showVersions[pkgName]">
<li class="heliumPackageDisabledArtifact"
ng-repeat="pkg in packageInfos[pkgName]">
ng-repeat="pkg in packageInfos[pkgName]">
{{pkg.pkg.artifact}} -
<span ng-click="enable(pkgName, pkg.pkg.artifact)"
ng-if="pkgInfo.pkg.type !== 'INTERPRETER'"