Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dinky
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangpeng
dinky
Commits
f6b63765
Unverified
Commit
f6b63765
authored
Dec 11, 2022
by
aiwenmo
Committed by
GitHub
Dec 11, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Fix-1418] [web] Fix users without tenants are not prompted when logging in (#1419)
Co-authored-by:
wenmo
<
32723967+wenmo@users.noreply.github.com
>
parent
c2795d67
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
23 deletions
+17
-23
ExtractionUtils.java
.../apache/flink/table/types/extraction/ExtractionUtils.java
+13
-23
index.tsx
dlink-web/src/pages/user/Login/index.tsx
+4
-0
No files found.
dlink-client/dlink-client-1.14/src/main/java/org/apache/flink/table/types/extraction/ExtractionUtils.java
View file @
f6b63765
...
@@ -110,8 +110,7 @@ public final class ExtractionUtils {
...
@@ -110,8 +110,7 @@ public final class ExtractionUtils {
final
Class
<?>
param
=
executable
.
getParameterTypes
()[
currentParam
];
final
Class
<?>
param
=
executable
.
getParameterTypes
()[
currentParam
];
// last parameter is a vararg that needs to consume remaining classes
// last parameter is a vararg that needs to consume remaining classes
if
(
currentParam
==
paramCount
-
1
&&
executable
.
isVarArgs
())
{
if
(
currentParam
==
paramCount
-
1
&&
executable
.
isVarArgs
())
{
final
Class
<?>
paramComponent
=
final
Class
<?>
paramComponent
=
executable
.
getParameterTypes
()[
currentParam
].
getComponentType
();
executable
.
getParameterTypes
()[
currentParam
].
getComponentType
();
// we have more than 1 classes left so the vararg needs to consume them all
// we have more than 1 classes left so the vararg needs to consume them all
if
(
classCount
-
currentClass
>
1
)
{
if
(
classCount
-
currentClass
>
1
)
{
while
(
currentClass
<
classCount
while
(
currentClass
<
classCount
...
@@ -214,8 +213,7 @@ public final class ExtractionUtils {
...
@@ -214,8 +213,7 @@ public final class ExtractionUtils {
// is<Name>()
// is<Name>()
// <Name>() for Scala
// <Name>() for Scala
final
String
normalizedMethodName
=
normalizeAccessorName
(
method
.
getName
());
final
String
normalizedMethodName
=
normalizeAccessorName
(
method
.
getName
());
final
boolean
hasName
=
final
boolean
hasName
=
normalizedMethodName
.
equals
(
"GET"
+
normalizedFieldName
)
normalizedMethodName
.
equals
(
"GET"
+
normalizedFieldName
)
||
normalizedMethodName
.
equals
(
"IS"
+
normalizedFieldName
)
||
normalizedMethodName
.
equals
(
"IS"
+
normalizedFieldName
)
||
normalizedMethodName
.
equals
(
normalizedFieldName
);
||
normalizedMethodName
.
equals
(
normalizedFieldName
);
if
(!
hasName
)
{
if
(!
hasName
)
{
...
@@ -260,8 +258,7 @@ public final class ExtractionUtils {
...
@@ -260,8 +258,7 @@ public final class ExtractionUtils {
// <Name>(type)
// <Name>(type)
// <Name>_$eq(type) for Scala
// <Name>_$eq(type) for Scala
final
String
normalizedMethodName
=
normalizeAccessorName
(
method
.
getName
());
final
String
normalizedMethodName
=
normalizeAccessorName
(
method
.
getName
());
final
boolean
hasName
=
final
boolean
hasName
=
normalizedMethodName
.
equals
(
"SET"
+
normalizedFieldName
)
normalizedMethodName
.
equals
(
"SET"
+
normalizedFieldName
)
||
normalizedMethodName
.
equals
(
normalizedFieldName
)
||
normalizedMethodName
.
equals
(
normalizedFieldName
)
||
normalizedMethodName
.
equals
(
normalizedFieldName
+
"$EQ"
);
||
normalizedMethodName
.
equals
(
normalizedFieldName
+
"$EQ"
);
if
(!
hasName
)
{
if
(!
hasName
)
{
...
@@ -278,8 +275,7 @@ public final class ExtractionUtils {
...
@@ -278,8 +275,7 @@ public final class ExtractionUtils {
// check parameters:
// check parameters:
// one parameter that has the same (or primitive) type of the field
// one parameter that has the same (or primitive) type of the field
final
boolean
hasParameter
=
final
boolean
hasParameter
=
method
.
getParameterCount
()
==
1
method
.
getParameterCount
()
==
1
&&
(
method
.
getGenericParameterTypes
()[
0
].
equals
(
field
.
getGenericType
())
&&
(
method
.
getGenericParameterTypes
()[
0
].
equals
(
field
.
getGenericType
())
||
primitiveToWrapper
(
method
.
getGenericParameterTypes
()[
0
])
||
primitiveToWrapper
(
method
.
getGenericParameterTypes
()[
0
])
.
equals
(
field
.
getGenericType
()));
.
equals
(
field
.
getGenericType
()));
...
@@ -351,8 +347,7 @@ public final class ExtractionUtils {
...
@@ -351,8 +347,7 @@ public final class ExtractionUtils {
if
(
clazz
.
getSuperclass
()
!=
baseClass
)
{
if
(
clazz
.
getSuperclass
()
!=
baseClass
)
{
return
Optional
.
empty
();
return
Optional
.
empty
();
}
}
final
Type
t
=
final
Type
t
=
((
ParameterizedType
)
clazz
.
getGenericSuperclass
())
((
ParameterizedType
)
clazz
.
getGenericSuperclass
())
.
getActualTypeArguments
()[
pos
];
.
getActualTypeArguments
()[
pos
];
return
Optional
.
ofNullable
(
toClass
(
t
));
return
Optional
.
ofNullable
(
toClass
(
t
));
}
catch
(
Exception
unused
)
{
}
catch
(
Exception
unused
)
{
...
@@ -462,8 +457,7 @@ public final class ExtractionUtils {
...
@@ -462,8 +457,7 @@ public final class ExtractionUtils {
final
Type
currentType
=
typeHierarchy
.
get
(
i
);
final
Type
currentType
=
typeHierarchy
.
get
(
i
);
if
(
currentType
instanceof
ParameterizedType
)
{
if
(
currentType
instanceof
ParameterizedType
)
{
final
Type
resolvedType
=
final
Type
resolvedType
=
resolveVariableInParameterizedType
(
resolveVariableInParameterizedType
(
variable
,
(
ParameterizedType
)
currentType
);
variable
,
(
ParameterizedType
)
currentType
);
if
(
resolvedType
instanceof
TypeVariable
)
{
if
(
resolvedType
instanceof
TypeVariable
)
{
// follow type variables transitively
// follow type variables transitively
...
@@ -646,6 +640,7 @@ public final class ExtractionUtils {
...
@@ -646,6 +640,7 @@ public final class ExtractionUtils {
* Result of the extraction in {@link #extractAssigningConstructor(Class, List)}.
* Result of the extraction in {@link #extractAssigningConstructor(Class, List)}.
*/
*/
public
static
class
AssigningConstructor
{
public
static
class
AssigningConstructor
{
public
final
Constructor
<?>
constructor
;
public
final
Constructor
<?>
constructor
;
public
final
List
<
String
>
parameterNames
;
public
final
List
<
String
>
parameterNames
;
...
@@ -663,14 +658,12 @@ public final class ExtractionUtils {
...
@@ -663,14 +658,12 @@ public final class ExtractionUtils {
Class
<?>
clazz
,
List
<
Field
>
fields
)
{
Class
<?>
clazz
,
List
<
Field
>
fields
)
{
AssigningConstructor
foundConstructor
=
null
;
AssigningConstructor
foundConstructor
=
null
;
for
(
Constructor
<?>
constructor
:
clazz
.
getDeclaredConstructors
())
{
for
(
Constructor
<?>
constructor
:
clazz
.
getDeclaredConstructors
())
{
final
boolean
qualifyingConstructor
=
final
boolean
qualifyingConstructor
=
Modifier
.
isPublic
(
constructor
.
getModifiers
())
Modifier
.
isPublic
(
constructor
.
getModifiers
())
&&
constructor
.
getParameterTypes
().
length
==
fields
.
size
();
&&
constructor
.
getParameterTypes
().
length
==
fields
.
size
();
if
(!
qualifyingConstructor
)
{
if
(!
qualifyingConstructor
)
{
continue
;
continue
;
}
}
final
List
<
String
>
parameterNames
=
final
List
<
String
>
parameterNames
=
extractConstructorParameterNames
(
constructor
,
fields
);
extractConstructorParameterNames
(
constructor
,
fields
);
if
(
parameterNames
!=
null
)
{
if
(
parameterNames
!=
null
)
{
if
(
foundConstructor
!=
null
)
{
if
(
foundConstructor
!=
null
)
{
throw
extractionError
(
throw
extractionError
(
...
@@ -703,8 +696,7 @@ public final class ExtractionUtils {
...
@@ -703,8 +696,7 @@ public final class ExtractionUtils {
return
null
;
return
null
;
}
}
final
Map
<
String
,
Field
>
fieldMap
=
final
Map
<
String
,
Field
>
fieldMap
=
fields
.
stream
()
fields
.
stream
()
.
collect
(
.
collect
(
Collectors
.
toMap
(
Collectors
.
toMap
(
f
->
normalizeAccessorName
(
f
.
getName
()),
f
->
normalizeAccessorName
(
f
.
getName
()),
...
@@ -741,8 +733,7 @@ public final class ExtractionUtils {
...
@@ -741,8 +733,7 @@ public final class ExtractionUtils {
}
}
// by default parameter names are "arg0, arg1, arg2, ..." if compiler flag is not set
// by default parameter names are "arg0, arg1, arg2, ..." if compiler flag is not set
// so we need to extract them manually if possible
// so we need to extract them manually if possible
List
<
String
>
parameterNames
=
List
<
String
>
parameterNames
=
Stream
.
of
(
executable
.
getParameters
())
Stream
.
of
(
executable
.
getParameters
())
.
map
(
Parameter:
:
getName
)
.
map
(
Parameter:
:
getName
)
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
if
(
parameterNames
.
stream
().
allMatch
(
n
->
n
.
startsWith
(
"arg"
)))
{
if
(
parameterNames
.
stream
().
allMatch
(
n
->
n
.
startsWith
(
"arg"
)))
{
...
@@ -752,7 +743,6 @@ public final class ExtractionUtils {
...
@@ -752,7 +743,6 @@ public final class ExtractionUtils {
}
else
{
}
else
{
extractor
=
new
ParameterExtractor
((
Method
)
executable
);
extractor
=
new
ParameterExtractor
((
Method
)
executable
);
}
}
// getClassReader(executable.getDeclaringClass()).accept(extractor, 0);
final
List
<
String
>
extractedNames
=
extractor
.
getParameterNames
();
final
List
<
String
>
extractedNames
=
extractor
.
getParameterNames
();
if
(
extractedNames
.
size
()
==
0
)
{
if
(
extractedNames
.
size
()
==
0
)
{
...
@@ -760,8 +750,7 @@ public final class ExtractionUtils {
...
@@ -760,8 +750,7 @@ public final class ExtractionUtils {
}
}
// remove "this" and additional local variables
// remove "this" and additional local variables
// select less names if class file has not the required information
// select less names if class file has not the required information
parameterNames
=
parameterNames
=
extractedNames
.
subList
(
extractedNames
.
subList
(
offset
,
offset
,
Math
.
min
(
Math
.
min
(
executable
.
getParameterCount
()
+
offset
,
executable
.
getParameterCount
()
+
offset
,
...
@@ -830,6 +819,7 @@ public final class ExtractionUtils {
...
@@ -830,6 +819,7 @@ public final class ExtractionUtils {
int
access
,
String
name
,
String
descriptor
,
String
signature
,
String
[]
exceptions
)
{
int
access
,
String
name
,
String
descriptor
,
String
signature
,
String
[]
exceptions
)
{
if
(
descriptor
.
equals
(
methodDescriptor
))
{
if
(
descriptor
.
equals
(
methodDescriptor
))
{
return
new
MethodVisitor
(
OPCODE
)
{
return
new
MethodVisitor
(
OPCODE
)
{
@Override
@Override
public
void
visitLocalVariable
(
public
void
visitLocalVariable
(
String
name
,
String
name
,
...
...
dlink-web/src/pages/user/Login/index.tsx
View file @
f6b63765
...
@@ -211,6 +211,10 @@ const Login: React.FC = () => {
...
@@ -211,6 +211,10 @@ const Login: React.FC = () => {
onFinish=
{
async
(
values
:
API
.
LoginParams
)
=>
{
onFinish=
{
async
(
values
:
API
.
LoginParams
)
=>
{
setType
(
"password"
)
setType
(
"password"
)
let
res
:
TenantTableListItem
[]
=
await
getData
(
"/api/geTenants"
,
{
username
:
values
.
username
}).
then
(
result
=>
{
let
res
:
TenantTableListItem
[]
=
await
getData
(
"/api/geTenants"
,
{
username
:
values
.
username
}).
then
(
result
=>
{
if
(
!
result
?.
datas
){
message
.
error
(
result
?.
msg
);
return
;
}
setTenant
(
result
?.
datas
);
setTenant
(
result
?.
datas
);
return
result
?.
datas
return
result
?.
datas
})
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment