Skip to content

Commit

Permalink
[Improve] app start-modal minor improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfboys committed Sep 16, 2024
1 parent 5d9f5fb commit 33249e6
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
checkedChildren: 'ON',
unCheckedChildren: 'OFF',
},
defaultValue: receiveData.historySavePoint && receiveData.historySavePoint.length > 0,
defaultValue: receiveData.selected != null,
afterItem: () => h('span', { class: 'pop-tip' }, t('flink.app.view.savepointTip')),
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ export const useAppTableAction = (
/* Operation button list */
function getActionList(record: AppListRecord, currentPageNo: number): ActionItem[] {
return [
{
tooltip: { title: t('flink.app.operation.detail') },
auth: 'app:detail',
icon: 'carbon:data-view-alt',
onClick: handleDetail.bind(null, record),
},
{
tooltip: { title: t('flink.app.operation.release') },
ifShow:
Expand Down Expand Up @@ -210,6 +216,13 @@ export const useAppTableAction = (
}),
};
}

/* Click for details */
function handleDetail(app: AppListRecord) {
flinkAppStore.setApplicationId(app.id);
router.push({ path: '/flink/app/detail', query: { appId: app.id } });
}

/* Click to edit */
function handleEdit(app: AppListRecord, currentPageNo: number) {
// Record the current page number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ object KubernetesNativeSessionClient extends KubernetesNativeClientTrait with Lo

val flinkConfig = getFlinkK8sConfig(deployRequest)

replaceConfig(flinkConfig, "\\$\\{job(Name|name)}|\\$job(Name|name)", deployRequest.clusterName)
FlinkSessionSubmitHelper.doReplaceJobName(flinkConfig, deployRequest.clusterName)

val kubeClient = FlinkKubeClientFactory.getInstance.fromConfiguration(flinkConfig, "client")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package org.apache.streampark.flink.client.impl
import org.apache.streampark.common.util.Utils
import org.apache.streampark.flink.client.`trait`.YarnClientTrait
import org.apache.streampark.flink.client.bean._
import org.apache.streampark.flink.client.tool.FlinkSessionSubmitHelper

import org.apache.commons.lang3.StringUtils
import org.apache.flink.client.deployment.ClusterSpecification
Expand Down Expand Up @@ -77,7 +78,7 @@ object YarnSessionClient extends YarnClientTrait {
// app name
.safeSet(YarnConfigOptions.APPLICATION_NAME, deployRequest.clusterName)

replaceConfig(flinkConfig, "\\$\\{job(Name|name)}|\\$job(Name|name)", deployRequest.clusterName)
FlinkSessionSubmitHelper.doReplaceJobName(flinkConfig, deployRequest.clusterName)

logInfo(s"""
|------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import org.json4s.jackson.Serialization
import java.io.File
import java.nio.charset.StandardCharsets

import scala.collection.JavaConversions._
import scala.util.{Failure, Success, Try}

object FlinkSessionSubmitHelper extends Logger {
Expand Down Expand Up @@ -102,6 +103,20 @@ object FlinkSessionSubmitHelper extends Logger {
}
}

private[client] def doReplaceJobName(flinkConfig: Configuration, replacement: String): Unit = {
flinkConfig
.keySet()
.foreach(
k => {
val v = flinkConfig.getString(k, null)
if (v != null) {
val result = v
.replaceAll("\\$\\{job(Name|name)}|\\$job(Name|name)", replacement)
flinkConfig.setString(k, result)
}
})
}

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,18 +496,4 @@ trait FlinkClientTrait extends Logger {
})
}

def replaceConfig(flinkConfig: Configuration, regexp: String, replacement: String): Unit = {
flinkConfig
.keySet()
.foreach(
k => {
val v = flinkConfig.getString(k, null)
if (v != null) {
val result = v
.replaceAll(regexp, replacement)
flinkConfig.setString(k, result)
}
})
}

}

0 comments on commit 33249e6

Please sign in to comment.