You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampark.apache.org by be...@apache.org on 2023/08/22 01:18:26 UTC

[incubator-streampark] branch resources created (now e9725940e)

This is an automated email from the ASF dual-hosted git repository.

benjobs pushed a change to branch resources
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git


      at e9725940e license header improvement

This branch includes the following new commits:

     new e9725940e license header improvement

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[incubator-streampark] 01/01: license header improvement

Posted by be...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

benjobs pushed a commit to branch resources
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git

commit e9725940e928df956222a4372ed4ca8f7d77cfe7
Author: benjobs <be...@apache.org>
AuthorDate: Tue Aug 22 09:18:11 2023 +0800

    license header improvement
---
 .../src/locales/lang/en/flink/app.ts               |   4 +-
 .../src/locales/lang/zh-CN/flink/app.ts            |   4 +-
 .../flink/app/hooks/useCreateAndEditSchema.ts      |   2 +-
 .../src/views/flink/app/hooks/useFlinkRender.tsx   |   4 +-
 .../scala/org/apache/commons/cli/CommandLine.java  | 197 ++++++++++++++++++++-
 5 files changed, 202 insertions(+), 9 deletions(-)

diff --git a/streampark-console/streampark-console-webapp/src/locales/lang/en/flink/app.ts b/streampark-console/streampark-console-webapp/src/locales/lang/en/flink/app.ts
index 3dfd8ade7..df9ee4a81 100644
--- a/streampark-console/streampark-console-webapp/src/locales/lang/en/flink/app.ts
+++ b/streampark-console/streampark-console-webapp/src/locales/lang/en/flink/app.ts
@@ -29,8 +29,8 @@ export default {
   developmentMode: 'Development Mode',
   executionMode: 'Execution Mode',
   historyVersion: 'History Version',
-  teamResource: 'Team Resource',
-  teamResourcePlaceHolder: 'choose resource from team library',
+  resource: 'Resource',
+  resourcePlaceHolder: 'please choose resource',
   selectAppPlaceHolder: 'choose app jar',
   dependency: 'Dependency',
   appConf: 'Application Conf',
diff --git a/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/flink/app.ts b/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/flink/app.ts
index d1b94b5b9..bedd7fbb6 100644
--- a/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/flink/app.ts
+++ b/streampark-console/streampark-console-webapp/src/locales/lang/zh-CN/flink/app.ts
@@ -29,8 +29,8 @@ export default {
   developmentMode: '作业模式',
   executionMode: '执行模式',
   historyVersion: '历史版本',
-  teamResource: '团队资源库',
-  teamResourcePlaceHolder: '从团队资源库中选择资源',
+  resource: '资源',
+  resourcePlaceHolder: '从选择资源',
   selectAppPlaceHolder: '选择作业',
   dependency: '作业依赖',
   appConf: '作业配置',
diff --git a/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useCreateAndEditSchema.ts b/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useCreateAndEditSchema.ts
index e47222d0f..a6fbd022f 100644
--- a/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useCreateAndEditSchema.ts
+++ b/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useCreateAndEditSchema.ts
@@ -124,7 +124,7 @@ export const useCreateAndEditSchema = (
       },
       {
         field: 'teamResource',
-        label: t('flink.app.teamResource'),
+        label: t('flink.app.resource'),
         component: 'Select',
         render: ({ model }) => renderStreamParkResource({ model, resources: unref(teamResource) }),
         ifShow: ({ values }) => {
diff --git a/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useFlinkRender.tsx b/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useFlinkRender.tsx
index 0158d0f67..4075a89bf 100644
--- a/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useFlinkRender.tsx
+++ b/streampark-console/streampark-console-webapp/src/views/flink/app/hooks/useFlinkRender.tsx
@@ -531,7 +531,6 @@ export const renderResourceFrom = (model: Recordable) => {
 
 export const renderStreamParkResource = ({ model, resources }) => {
   const renderOptions = () => {
-    console.log('resources', resources);
     return (resources || [])
       .filter((item) => item.resourceType !== ResourceTypeEnum.FLINK_APP)
       .map((resource) => {
@@ -561,8 +560,7 @@ export const renderStreamParkResource = ({ model, resources }) => {
         max-tag-count={3}
         onChange={(value) => (model.teamResource = value)}
         value={model.teamResource}
-        placeholder={t('flink.app.teamResourcePlaceHolder')}
-        style="width: calc(100% - 60px)"
+        placeholder={t('flink.app.resourcePlaceHolder')}
       >
         {renderOptions()}
       </Select>
diff --git a/streampark-flink/streampark-flink-client/streampark-flink-client-core/src/main/scala/org/apache/commons/cli/CommandLine.java b/streampark-flink/streampark-flink-client/streampark-flink-client-core/src/main/scala/org/apache/commons/cli/CommandLine.java
index 7b8c1db94..f1380fd9a 100644
--- a/streampark-flink/streampark-flink-client/streampark-flink-client-core/src/main/scala/org/apache/commons/cli/CommandLine.java
+++ b/streampark-flink/streampark-flink-client/streampark-flink-client-core/src/main/scala/org/apache/commons/cli/CommandLine.java
@@ -1,2 +1,197 @@
-package org.apache.commons.cli;public class CommandLine {
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.cli;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Properties;
+
+public class CommandLine implements Serializable {
+
+    /** The serial version UID. */
+    private static final long serialVersionUID = 1L;
+
+    /** The unrecognized options/arguments */
+    private final List<String> args = new LinkedList<>();
+
+    /** The processed options */
+    private final List<Option> options = new ArrayList<>();
+
+    /**
+     * Creates a command line.
+     */
+    protected CommandLine() {
+        // nothing to do
+    }
+
+    /**
+     * Retrieve the map of values associated to the option. This is convenient for options specifying Java properties like
+     * <code>-Dparam1=value1
+     * -Dparam2=value2</code>. The first argument of the option is the key, and the 2nd argument is the value. If the option
+     * has only one argument ({@code -Dfoo}) it is considered as a boolean flag and the value is {@code "true"}.
+     *
+     * @param option name of the option.
+     * @return The Properties mapped by the option, never {@code null} even if the option doesn't exists.
+     * @since 1.5.0
+     */
+    public Properties getOptionProperties(final Option option) {
+        final Properties props = new Properties();
+
+        for (final Option processedOption : options) {
+            if (processedOption.equals(option)) {
+                final List<String> values = processedOption.getValuesList();
+                if (values.size() >= 2) {
+                    // use the first 2 arguments as the key/value pair
+                    props.put(values.get(0), values.get(1));
+                } else if (values.size() == 1) {
+                    // no explicit value, handle it as a boolean
+                    props.put(values.get(0), "true");
+                }
+            }
+        }
+
+        return props;
+    }
+
+    /**
+     * Retrieve the first argument, if any, of this option.
+     *
+     * @param option the name of the option.
+     * @return Value of the argument if option is set, and has an argument, otherwise null.
+     * @since 1.5.0
+     */
+    public String getOptionValue(final Option option) {
+        if (option == null) {
+            return null;
+        }
+        final String[] values = getOptionValues(option);
+        return values == null ? null : values[0];
+    }
+
+    /**
+     * Retrieve the first argument, if any, of an option.
+     *
+     * @param option name of the option.
+     * @param defaultValue is the default value to be returned if the option is not specified.
+     * @return Value of the argument if option is set, and has an argument, otherwise {@code defaultValue}.
+     * @since 1.5.0
+     */
+    public String getOptionValue(final Option option, final String defaultValue) {
+        final String answer = getOptionValue(option);
+        return answer != null ? answer : defaultValue;
+    }
+
+    /**
+     * Retrieves the array of values, if any, of an option.
+     *
+     * @param option string name of the option.
+     * @return Values of the argument if option is set, and has an argument, otherwise null.
+     * @since 1.5.0
+     */
+    public String[] getOptionValues(final Option option) {
+        final List<String> values = new ArrayList<>();
+
+        for (final Option processedOption : options) {
+            if (processedOption.equals(option)) {
+                values.addAll(processedOption.getValuesList());
+            }
+        }
+
+        return values.isEmpty() ? null : values.toArray(new String[values.size()]);
+    }
+
+    /**
+     * Return a version of this {@code Option} converted to a particular type.
+     *
+     * @param opt the name of the option.
+     * @return the value parsed into a particular object.
+     * @throws ParseException if there are problems turning the option value into the desired type
+     * @see PatternOptionBuilder
+     * @since 1.5.0
+     */
+    public Object getParsedOptionValue(final char opt) throws ParseException {
+        return getParsedOptionValue(String.valueOf(opt));
+    }
+
+    /**
+     * Return a version of this {@code Option} converted to a particular type.
+     *
+     * @param option the name of the option.
+     * @return the value parsed into a particular object.
+     * @throws ParseException if there are problems turning the option value into the desired type
+     * @see PatternOptionBuilder
+     * @since 1.5.0
+     */
+    public Object getParsedOptionValue(final Option option) throws ParseException {
+        if (option == null) {
+            return null;
+        }
+        final String res = getOptionValue(option);
+        if (res == null) {
+            return null;
+        }
+        return TypeHandler.createValue(res, option.getType());
+    }
+
+
+    /**
+     * Tests to see if an option has been set.
+     *
+     * @param opt the option to check.
+     * @return true if set, false if not.
+     * @since 1.5.0
+     */
+    public boolean hasOption(final Option opt) {
+        return options.contains(opt);
+    }
+
+
+    /**
+     * Return a version of this {@code Option} converted to a particular type.
+     *
+     * @param opt the name of the option.
+     * @return the value parsed into a particular object.
+     * @throws ParseException if there are problems turning the option value into the desired type
+     * @see PatternOptionBuilder
+     * @since 1.2
+     */
+    public Object getParsedOptionValue(final String opt) throws ParseException {
+        return getParsedOptionValue(resolveOption(opt));
+    }
+
+
+    /**
+     * Retrieves the option object given the long or short option as a String
+     *
+     * @param opt short or long name of the option.
+     * @return Canonicalized option.
+     */
+    private Option resolveOption(String opt) {
+        opt = Util.stripLeadingHyphens(opt);
+        for (final Option option : options) {
+            if (opt.equals(option.getOpt()) || opt.equals(option.getLongOpt())) {
+                return option;
+            }
+
+        }
+        return null;
+    }
+
 }