Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
liyaoting
/
jk-ut-plugin
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit c47c9093
authored
2023-04-08 15:44:28 +0800
by
liyaoting
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化
1 parent
11781dc7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
93 additions
and
10 deletions
index.html
index.html
View file @
c47c909
...
@@ -21,7 +21,12 @@
...
@@ -21,7 +21,12 @@
<div
class=
"container-fluid"
>
<div
class=
"container-fluid"
>
<!-- Brand and toggle get grouped for better mobile display -->
<!-- Brand and toggle get grouped for better mobile display -->
<div
class=
"navbar-header"
>
<div
class=
"navbar-header"
>
<button
type=
"button"
class=
"btn btn-danger navbar-btn"
@
click=
"cleanInput"
>
清除输入
</button>
<a
class=
"navbar-brand"
href=
""
>
happy~happy~happy~
</a>
<a
class=
"navbar-brand"
href=
""
>
happy~happy~happy~
</a>
<div
class=
"btn-group navbar-btn"
role=
"group"
aria-label=
"..."
>
<button
type=
"button"
class=
"btn btn-default"
@
click=
"selectAll(1)"
>
全选
</button>
<button
type=
"button"
class=
"btn btn-default"
@
click=
"selectAll(2)"
>
全不选
</button>
</div>
<button
type=
"button"
class=
"btn btn-default navbar-btn"
@
click=
"copyNew"
>
复制出来
</button>
<button
type=
"button"
class=
"btn btn-default navbar-btn"
@
click=
"copyNew"
>
复制出来
</button>
</div>
</div>
</div>
</div>
...
@@ -46,7 +51,7 @@
...
@@ -46,7 +51,7 @@
<tbody>
<tbody>
<tr
v-for=
"(item,i) in serviceList"
>
<tr
v-for=
"(item,i) in serviceList"
>
<td>
{{i+1}}
</td>
<td>
{{i+1}}
</td>
<td>
<td
@
click=
"selectService(i)"
>
<h3
v-if=
"!item.isWebService"
>
{{item.serviceName}}
</h3>
<h3
v-if=
"!item.isWebService"
>
{{item.serviceName}}
</h3>
<h4
v-else
>
{{item.serviceName}}
</h4>
<h4
v-else
>
{{item.serviceName}}
</h4>
</td>
</td>
...
@@ -71,6 +76,7 @@
...
@@ -71,6 +76,7 @@
source
:
''
,
//复制过来的
source
:
''
,
//复制过来的
sourceArr
:
[],
//按行分割的
sourceArr
:
[],
//按行分割的
serviceList
:
[],
//服务列表
serviceList
:
[],
//服务列表
sleepList
:
[],
//sleep列表
},
},
created
:
function
()
{
created
:
function
()
{
...
@@ -82,24 +88,44 @@
...
@@ -82,24 +88,44 @@
if
(
sysPayload
)
{
if
(
sysPayload
)
{
let
source
=
""
let
source
=
""
if
(
sysPayload
.
indexOf
(
"node"
)
==
-
1
)
{
if
(
sysPayload
.
indexOf
(
"node"
)
==
-
1
)
{
source
=
"请手动粘贴吧"
source
=
"请手动粘贴吧"
}
else
{
}
else
{
source
=
sysPayload
;
source
=
sysPayload
;
}
}
this
.
source
=
source
;
this
.
source
=
source
;
this
.
analyseSource
();
this
.
analyseSource
();
}
else
{
}
else
{
this
.
source
=
"请手动粘贴吧"
;
this
.
source
=
"请手动粘贴吧"
;
}
}
},
500
);
},
500
);
},
},
methods
:
{
methods
:
{
//清除输入
cleanInput
:
function
()
{
this
.
source
=
""
;
},
//选择服务
selectService
:
function
(
index
)
{
this
.
serviceList
[
index
].
isOpen
=
!
this
.
serviceList
[
index
].
isOpen
;
},
//全选
selectAll
:
function
(
type
)
{
let
serviceList
=
this
.
serviceList
;
let
isOpen
=
true
;
if
(
type
==
2
)
{
isOpen
=
false
;
}
serviceList
.
forEach
((
item
)
=>
{
item
.
isOpen
=
isOpen
;
});
this
.
serviceList
=
serviceList
;
},
//分析source
//分析source
analyseSource
:
function
()
{
analyseSource
:
function
()
{
let
serviceMap
=
{};
let
serviceMap
=
{};
let
serviceList
=
[];
let
serviceList
=
[];
let
sleepList
=
[];
let
source
=
this
.
source
;
let
source
=
this
.
source
;
console
.
log
(
source
)
//将source按行分割
//将source按行分割
let
sourceArr
=
source
.
split
(
"\n"
);
let
sourceArr
=
source
.
split
(
"\n"
);
...
@@ -120,7 +146,6 @@
...
@@ -120,7 +146,6 @@
}
}
//upload的开始行
//upload的开始行
if
(
row
==
"stage('upload') {"
)
{
if
(
row
==
"stage('upload') {"
)
{
console
.
log
(
"uploadStartRow:"
+
i
)
uploadStartRow
=
i
+
1
;
uploadStartRow
=
i
+
1
;
}
}
//upload的结束行和imageBuild的开始行
//upload的结束行和imageBuild的开始行
...
@@ -132,6 +157,15 @@
...
@@ -132,6 +157,15 @@
if
(
row
==
"}"
&&
uploadEndRow
!=
0
&&
imageBuildEnd
==
0
&&
i
!=
uploadEndRow
)
{
if
(
row
==
"}"
&&
uploadEndRow
!=
0
&&
imageBuildEnd
==
0
&&
i
!=
uploadEndRow
)
{
imageBuildEnd
=
i
;
imageBuildEnd
=
i
;
}
}
if
(
row
.
indexOf
(
"sleep"
)
!=
-
1
)
{
row
=
row
.
trim
();
row
=
this
.
dealStr
(
row
);
let
rowObj
=
{
rowNo
:
i
,
row
:
row
,
}
sleepList
.
push
(
rowObj
);
}
}
}
let
uploadRow
=
0
;
let
uploadRow
=
0
;
...
@@ -142,6 +176,9 @@
...
@@ -142,6 +176,9 @@
return
;
return
;
}
}
let
isOpen
=
!!
(
row
&&
!
row
.
startsWith
(
"//"
));
let
isOpen
=
!!
(
row
&&
!
row
.
startsWith
(
"//"
));
if
(
!
isOpen
)
{
row
=
this
.
dealStr
(
row
);
}
let
strings
=
item
.
split
(
"*.jar"
)[
0
].
split
(
"/"
);
let
strings
=
item
.
split
(
"*.jar"
)[
0
].
split
(
"/"
);
let
serviceName
=
strings
[
strings
.
length
-
1
].
substring
(
0
,
strings
[
strings
.
length
-
1
].
length
-
1
);
let
serviceName
=
strings
[
strings
.
length
-
1
].
substring
(
0
,
strings
[
strings
.
length
-
1
].
length
-
1
);
let
service
=
{
let
service
=
{
...
@@ -175,18 +212,24 @@
...
@@ -175,18 +212,24 @@
service
.
buildRow
=
"//"
+
trimItem
;
service
.
buildRow
=
"//"
+
trimItem
;
}
}
}
}
if
(
!
service
.
isOpen
)
{
service
.
buildRow
=
this
.
dealStr
(
service
.
buildRow
);
}
}
}
})
});
//serviceMap转为数组
//serviceMap转为数组
for
(
let
key
in
serviceMap
)
{
for
(
let
key
in
serviceMap
)
{
serviceList
.
push
(
serviceMap
[
key
]);
serviceList
.
push
(
serviceMap
[
key
]);
}
}
this
.
sourceArr
=
sourceArr
;
this
.
sourceArr
=
sourceArr
;
this
.
serviceList
=
serviceList
;
this
.
serviceList
=
serviceList
;
this
.
sleepList
=
sleepList
;
},
},
//复制出来
//复制出来
copyNew
:
function
()
{
copyNew
:
function
()
{
let
{
serviceList
,
sourceArr
}
=
this
;
let
{
serviceList
,
sourceArr
,
sleepList
}
=
this
;
if
(
!
serviceList
.
length
)
{
if
(
!
serviceList
.
length
)
{
alert
(
"你输入的内容不对"
);
alert
(
"你输入的内容不对"
);
}
else
{
}
else
{
...
@@ -202,6 +245,14 @@
...
@@ -202,6 +245,14 @@
if
(
buildRow
.
startsWith
(
"//"
))
{
if
(
buildRow
.
startsWith
(
"//"
))
{
buildRow
=
buildRow
.
split
(
"//"
)[
1
];
buildRow
=
buildRow
.
split
(
"//"
)[
1
];
}
}
let
sleepRow
=
item
.
buildRowNo
+
1
;
sleepList
.
forEach
(
item
=>
{
if
(
item
.
rowNo
==
sleepRow
)
{
if
(
item
.
row
.
startsWith
(
"//"
))
{
item
.
row
=
item
.
row
.
split
(
"//"
)[
1
];
}
}
});
}
else
{
}
else
{
//如果是关闭的 还没有注释的话,就注释掉
//如果是关闭的 还没有注释的话,就注释掉
if
(
!
uploadRow
.
startsWith
(
"//"
))
{
if
(
!
uploadRow
.
startsWith
(
"//"
))
{
...
@@ -210,11 +261,27 @@
...
@@ -210,11 +261,27 @@
if
(
!
buildRow
.
startsWith
(
"//"
))
{
if
(
!
buildRow
.
startsWith
(
"//"
))
{
buildRow
=
"//"
+
buildRow
;
buildRow
=
"//"
+
buildRow
;
}
}
let
sleepRow
=
item
.
buildRowNo
+
1
;
sleepList
.
forEach
(
item
=>
{
if
(
item
.
rowNo
==
sleepRow
)
{
if
(
!
item
.
row
.
startsWith
(
"//"
))
{
item
.
row
=
"//"
+
item
.
row
;
}
}
});
}
}
//格式
//格式
sourceArr
[
item
.
uploadRowNo
]
=
"\t\t"
+
uploadRow
;
sourceArr
[
item
.
uploadRowNo
]
=
"\t\t"
+
uploadRow
;
sourceArr
[
item
.
buildRowNo
]
=
"\t\t"
+
buildRow
;
sourceArr
[
item
.
buildRowNo
]
=
"\t\t"
+
buildRow
;
});
});
sleepList
.
forEach
(
item
=>
{
item
.
row
=
"\t\t"
+
item
.
row
;
sourceArr
[
item
.
rowNo
]
=
item
.
row
;
})
//去掉sourceArr的空行
sourceArr
=
sourceArr
.
filter
(
item
=>
{
return
item
.
trim
();
})
//组合成原来的字符串
//组合成原来的字符串
let
newSource
=
""
;
let
newSource
=
""
;
sourceArr
.
forEach
(
item
=>
{
sourceArr
.
forEach
(
item
=>
{
...
@@ -229,6 +296,22 @@
...
@@ -229,6 +296,22 @@
document
.
body
.
removeChild
(
txa
)
document
.
body
.
removeChild
(
txa
)
alert
(
"复制成功"
);
alert
(
"复制成功"
);
}
}
},
//dealStr
dealStr
:
function
(
str
)
{
//如果是注释的
if
(
str
.
startsWith
(
"//"
))
{
if
(
str
[
2
]
===
" "
)
{
//去除第三位的空格
str
=
str
.
substring
(
0
,
2
)
+
str
.
substring
(
3
).
trim
();
return
this
.
dealStr
(
str
);
}
else
{
return
str
;
}
}
else
{
return
str
;
}
}
}
}
}
})
})
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment