Skip to content

Commit

Permalink
修复前端多处bug
Browse files Browse the repository at this point in the history
  • Loading branch information
aiwenmo committed Jan 19, 2022
1 parent 053967f commit 8161560
Show file tree
Hide file tree
Showing 10 changed files with 110 additions and 84 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import cn.hutool.json.JSONUtil;
import com.dlink.assertion.Asserts;
import com.dlink.context.SpringContextUtils;
import com.dlink.gateway.GatewayType;
import com.dlink.model.Cluster;
import com.dlink.model.History;
import com.dlink.service.ClusterService;
Expand Down Expand Up @@ -66,7 +67,7 @@ public boolean success() {
Job job = JobContextHolder.getJob();
History history = new History();
history.setId(job.getId());
if(Asserts.isNullString(job.getJobId())){
if(job.isUseGateway()&&Asserts.isNullString(job.getJobId())){
job.setJobId("unknown-"+LocalDateTime.now().toString());
}
history.setJobId(job.getJobId());
Expand Down
22 changes: 22 additions & 0 deletions dlink-gateway/src/main/java/com/dlink/gateway/GatewayType.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,26 @@ public boolean equalsValue(String type){
}
return false;
}

public static boolean isDeployCluster(String type){
switch (get(type)){
case YARN_APPLICATION:
case YARN_PER_JOB:
case KUBERNETES_APPLICATION:
return true;
default:
return false;
}
}

public boolean isDeployCluster(){
switch (value){
case "ya":
case "ypj":
case "ka":
return true;
default:
return false;
}
}
}
2 changes: 1 addition & 1 deletion dlink-web/config/defaultSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const Settings: LayoutSettings & {
fixedHeader: false,
fixSiderbar: true,
colorWeak: false,
title: 'Dinky',
title: 'Dinky 实时计算平台',
pwa: false,
logo: 'dinky.svg',
iconfontUrl: '',
Expand Down
6 changes: 3 additions & 3 deletions dlink-web/config/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ export default [
component: './Settings',
},
{
path: '/welcome',
name: 'home',
icon: 'home',
path: '/about',
name: 'about',
icon: 'smile',
component: './Welcome',
},
{
Expand Down
29 changes: 19 additions & 10 deletions dlink-web/src/components/Chart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const {Option} = Select;
const Chart = (props:any) => {

const {current,result,height,dispatch} = props;
const [config, setConfig] = useState({});
const [config, setConfig] = useState(undefined);
const [type, setType] = useState<string>(CHART.LINE);
const [form] = Form.useForm();

Expand All @@ -34,6 +34,7 @@ const Chart = (props:any) => {

const onValuesChange = (change: any, all: any) => {
if(change.type){
setConfig(undefined);
setType(change.type);
props.saveChart({type:change.type});
}
Expand Down Expand Up @@ -73,15 +74,23 @@ const Chart = (props:any) => {
}
switch (current.console.chart.type){
case CHART.LINE:
return <Line data={current.console.result.result.rowData} {...config} />;
case CHART.BAR:
return <Bar data={current.console.result.result.rowData} {...config} />;
case CHART.PIE:
if(config.angleField){
return <Pie data={current.console.result.result.rowData} {...config} />;
} else {
return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />;
}
if(config){
return <Line data={current.console.result.result.rowData} {...config} />;
} else {
return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />;
}
case CHART.BAR:
if(config){
return <Bar data={current.console.result.result.rowData} {...config} />;
} else {
return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />;
}
case CHART.PIE:
if(config && config.angleField){
return <Pie data={current.console.result.result.rowData} {...config} />;
} else {
return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />;
}
default:
return <Line data={current.console.result.result.rowData} {...config} />;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const StudioTable = (props: any) => {

const getColumns=(columns: [])=>{
let datas: any=[];
columns.map((item) => {
columns?.map((item) => {
datas.push({
field: item,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ const StudioConnector = (props: any) => {
const getColumns = () => {
let columns: any = [{
title: "表名",
dataIndex: "tablename",
key: "tablename",
dataIndex: "table name",
key: "table name",
sorter: true,
...getColumnSearchProps("tablename"),
...getColumnSearchProps("table name"),
}, {
title: '操作',
dataIndex: 'option',
Expand Down
2 changes: 1 addition & 1 deletion dlink-web/src/locales/zh-CN/menu.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export default {
'menu.welcome': '欢迎',
'menu.more-blocks': '更多区块',
'menu.home': '更新历史',
'menu.about': '关于',
'menu.admin': '管理页',
'menu.admin.sub-page': '二级管理页',
'menu.login': '登录',
Expand Down
103 changes: 43 additions & 60 deletions dlink-web/src/pages/FlinkSqlStudio/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,8 @@ const Model: ModelType = {
}
return {
...state,
current: {
...newCurrent
},
tabs: {
...tabs
},
current: newCurrent,
tabs,
};
},
saveCurrentPath(state, {payload}) {
Expand Down Expand Up @@ -299,24 +295,22 @@ const Model: ModelType = {
}
return {
...state,
current: {...newCurrent},
tabs: {...newTabs},
current: newCurrent,
tabs: newTabs,
};
},
saveTabs(state, {payload}) {
let newCurrent = state.current;
for (let i = 0; i < payload.panes.length; i++) {
if (payload.panes[i].key == payload.activeKey) {
newCurrent = {...payload.panes[i]};
newCurrent = payload.panes[i];
}
}
if(payload.panes.length === 0){
if(payload.panes.length == 0){
return {
...state,
current: undefined,
tabs: {
...payload,
},
tabs: payload,
currentPath: ['引导页'],
};
}
Expand All @@ -326,9 +320,7 @@ const Model: ModelType = {
...newCurrent,
isModified:false,
},
tabs: {
...payload,
},
tabs: payload,
currentPath: newCurrent.path,
};
},
Expand All @@ -340,28 +332,27 @@ const Model: ModelType = {
break;
}
}
const newCurrent = newTabs.panes[newTabs.panes.length - 1];
const newCurrent = undefined;
if(newTabs.panes.length > 0){
newCurrent = newTabs.panes[newTabs.panes.length - 1];
}
if (newTabs.activeKey == payload) {
newTabs.activeKey = newCurrent.key;
}
return {
...state,
current: {
...newCurrent,
},
tabs: {
...newTabs,
},
current: newCurrent,
tabs: newTabs,
};
},
closeTabs(state, {payload}) {
const {deleteType, current} = payload;
const newTabs = state.tabs;
const firstKey = newTabs.panes[0].key;
let newCurrent = newTabs.panes[0];
if (deleteType === 'CLOSE_OTHER') {
const newCurrent = newTabs.panes[0];
if (deleteType == 'CLOSE_OTHER') {
const keys = [firstKey, current.key];
newCurrent = {...current};
newCurrent = current;
newTabs.activeKey = current.key;
newTabs.panes = newTabs.panes.filter(item => keys.includes(item.key));
} else {
Expand All @@ -371,56 +362,48 @@ const Model: ModelType = {

return {
...state,
current: {
...newCurrent
},
tabs: {
...newTabs,
}
current: newCurrent,
tabs: newTabs
};
},
changeActiveKey(state, {payload}) {
const {tabs} = state;
tabs.activeKey = payload;
const newTabs = state.tabs;
let newCurrent = state.current;
for (let i = 0; i < tabs.panes.length; i++) {
if (tabs.panes[i].key == tabs.activeKey) {
newCurrent = {...tabs.panes[i]};
newTabs.activeKey = payload;
for (let i = 0; i < newTabs.panes.length; i++) {
if (newTabs.panes[i].key == payload) {
newCurrent = newTabs.panes[i];
}
}
return {
...state,
current: {
...newCurrent,
},
tabs: {
...tabs,
},
current: newCurrent,
tabs: newTabs,
currentPath: newCurrent.path,
};
},
saveTaskData(state, {payload}) {
const newTabs = state.tabs;
const newCurrent = state.current;
for (let i = 0; i < newTabs.panes.length; i++) {
if (newTabs.panes[i].key === payload.key) {
newTabs.panes[i].task = {...payload};
if (newTabs.panes[i].key == payload.key) {
newTabs.panes[i].task = payload;
newTabs.panes[i].isModified = false;
if(newCurrent.key === payload.key){
newCurrent = {...newTabs.panes[i]};
if(newCurrent.key == payload.key){
newCurrent = newTabs.panes[i];
}
}
}
return {
...state,
current: {...newCurrent},
tabs: {...newTabs},
current: newCurrent,
tabs: newTabs,
};
},
saveSession(state, {payload}) {
return {
...state,
session: [...payload],
session: payload,
};
},
showRightClickMenu(state, {payload}) {
Expand Down Expand Up @@ -450,16 +433,16 @@ const Model: ModelType = {
const newTabs = state?.tabs;
let newCurrent = state?.current;
for (let i = 0; i < newTabs.panes.length; i++) {
if (newTabs.panes[i].key === newTabs.activeKey) {
newTabs.panes[i].console.result.result = {...payload};
newCurrent = {...newTabs.panes[i]};
if (newTabs.panes[i].key == newTabs.activeKey) {
newTabs.panes[i].console.result.result = payload;
newCurrent = newTabs.panes[i];
break;
}
}
return {
...state,
current: {...newCurrent},
tabs: {...newTabs},
current: newCurrent,
tabs: newTabs,
};
},
saveCluster(state, {payload}) {
Expand Down Expand Up @@ -491,16 +474,16 @@ const Model: ModelType = {
let newTabs = state?.tabs;
let newCurrent = state?.current;
for (let i = 0; i < newTabs.panes.length; i++) {
if (newTabs.panes[i].key === newTabs.activeKey) {
newTabs.panes[i].console.chart = {...payload};
newCurrent = {...newTabs.panes[i]};
if (newTabs.panes[i].key == newTabs.activeKey) {
newTabs.panes[i].console.chart = payload;
newCurrent = newTabs.panes[i];
break;
}
}
return {
...state,
current: {...newCurrent},
tabs: {...newTabs},
current: newCurrent,
tabs: newTabs,
};
},
},
Expand Down
Loading

0 comments on commit 8161560

Please sign in to comment.