@* * Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0 * See accompanying LICENSE file. *@ @import scalaz.{\/} @import kafka.manager.model.ActorModel._ @import kafka.manager.{BrokerListExtended} @import kafka.manager.utils._ @import helper._ @import models.form._ @(cluster: String, topic: String, assignForm: List[(String, List[(Int,List[Int])])], brokers: BrokerListExtended, brokersViews: Map[Int, BVView], formErrors: Seq[FormError] )(implicit af: features.ApplicationFeatures, cf: kafka.manager.features.ClusterFeatures, messages: play.api.i18n.Messages, menus: models.navigation.Menus, request:RequestHeader) @implicitFieldConstructor = @{ b4.vertical.fieldConstructor() } @theMenu = { @views.html.navigation.clusterMenu(cluster,"Topic","Manual Partition Assignments",menus.clusterMenus(cluster)) } @color(brokerId: Int) = @{ java.security.MessageDigest.getInstance("MD5").digest("" + brokerId).map("%02X".format(_)).mkString.substring(0,6) } @toColor(brokerId: Int) = { #@color(brokerId) } @reverseColor(originalColor: String) = { #@originalColor.map({x => if(x == '#') x else "%X".format(0xf - Integer.parseInt(x.toString,16)).head}) } @replicaSelection(topicIdx: Int, assignIdx: Int, brokerIndex: Int, brokerId: Int) = { @if(brokers.list.filter({broker => broker.id == brokerId}).size > 0) {     } else { Broker Down! } } @topHeading = {

Manual Partition Assignments

} @middleHeading = {
} @mainBody = {
@assignForm.zipWithIndex.map { case (partitionAssignment, topicIdx) =>

@partitionAssignment._1

@partitionAssignment._2.zipWithIndex.map { case (assignment, assgnIndex) =>
@assignment._2.zipWithIndex.map { case (broker, brokerIndex) => @if(brokerIndex == 0) { } }
Partition
Replica @brokerIndex: @replicaSelection(topicIdx, assgnIndex, brokerIndex, broker)
}
}
} @partitionsAssignmentsPane = {
@topHeading
@middleHeading @mainBody
} @brokersInfoPane = { @brokersViews.map { case (idx, bv) =>

Broker @idx

@views.html.common.expandedBrokerMetrics(bv.metrics)
} } @main( "Manual Multiple Assignment", menu = theMenu, breadcrumbs=views.html.navigation.breadCrumbs(models.navigation.BreadCrumbs.withViewAndCluster("Topics",cluster))) {
@if(true) { @helper.form(action = routes.ReassignPartitions.handleManualAssignment(cluster, topic)) { @partitionsAssignmentsPane } } else { @assignForm.toString




@formErrors.toString }
@if(brokers != null) { @brokersInfoPane }
}