Commit e511e3d9 authored by zhiyan's avatar zhiyan

init

parent 40f2242a
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
################################################ /.idea
############### .gitignore ################## /node_modules
################################################
#
# This file is only relevant if you are using git.
#
# Files which match the splat patterns below will
# be ignored by git. This keeps random crap and
# sensitive credentials from being uploaded to
# your repository. It allows you to configure your
# app for your machine without accidentally
# committing settings which will smash the local
# settings of other developers on your team.
#
# Some reasonable defaults are included below,
# but, of course, you should modify/extend/prune
# to fit your needs!
################################################
################################################
# Local Configuration
#
# Explicitly ignore files which contain:
#
# 1. Sensitive information you'd rather not push to
# your git repository.
# e.g., your personal API keys or passwords.
#
# 2. Environment-specific configuration
# Basically, anything that would be annoying
# to have to change every time you do a
# `git pull`
# e.g., your local development database, or
# the S3 bucket you're using for file uploads
# development.
#
################################################
config/local.js
################################################
# Dependencies
#
# When releasing a production app, you may
# consider including your node_modules and
# bower_components directory in your git repo,
# but during development, its best to exclude it,
# since different developers may be working on
# different kernels, where dependencies would
# need to be recompiled anyway.
#
# More on that here about node_modules dir:
# http://www.futurealoof.com/posts/nodemodules-in-git.html
# (credit Mikeal Rogers, @mikeal)
#
# About bower_components dir, you can see this:
# http://addyosmani.com/blog/checking-in-front-end-dependencies/
# (credit Addy Osmani, @addyosmani)
#
################################################
node_modules
bower_components
################################################
# Sails.js / Waterline / Grunt
#
# Files generated by Sails and Grunt, or related
# tasks and adapters.
################################################
.tmp
dump.rdb
################################################
# Node.js / NPM
#
# Common files generated by Node, NPM, and the
# related ecosystem.
################################################
lib-cov
*.seed
*.log
*.out
*.pid
npm-debug.log npm-debug.log
.DS_Store
/dist
/mock/test
/release
.devconfig
################################################ /src/test
# Miscellaneous /src/test.m
# /Web
# Common files generated by text editors, /MWeb
# operating systems, file systems, etc. yarn-error.log
################################################
*~
*#
.DS_STORE
.netbeans
nbproject
.idea .idea
.node_history *.map
...@@ -8,6 +8,10 @@ const app = express() ...@@ -8,6 +8,10 @@ const app = express()
app.use(bodyParser.json()) app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: true })) app.use(bodyParser.urlencoded({ extended: true }))
app.get('/usepage', function (req, res) {
res.sendFile('./usepage.html', {root: __dirname})
})
app.get('/', function (req, res) { app.get('/', function (req, res) {
res.sendFile('./index.html', {root: __dirname}) res.sendFile('./index.html', {root: __dirname})
}) })
......
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="zh-CN">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>静态资源开发机占用系统</title> <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link href="//cdn.bootcss.com/pure/0.6.2/pure-min.css" rel="stylesheet"> <link rel="stylesheet" href="//cdn.bootcss.com/sweetalert/1.1.3/sweetalert.min.css">
<link rel="stylesheet" href="//cdn.bootcss.com/sweetalert/1.1.3/sweetalert.min.css">
<style>
h1{
text-align: center;
color:#333;
padding:20px 0;
font-size:30px;
}
form,table{
width: 800px;
margin:0 auto;
}
.inline{
display: inline !important;
}
.pure-g > div{
margin-bottom: 10px;
}
table p{
padding:0;
margin:0;
}
.button-error {
background: rgb(202, 60, 60);
color:#fff;
}
.button-secondary {
background: rgb(66, 184, 221);
color:#fff;
}
</style>
</head> </head>
<body> <body>
<h1>前端测试机占用系统</h1>
<form class="pure-form pure-form-stacked">
<fieldset>
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-3">
<label for="branch">分支</label>
<input id="branch" class="pure-u-23-24" type="text" placeholder="master">
</div>
<div class="pure-u-1 pure-u-md-1-3"> <div id="app"></div>
<label for="project">编译项目</label>
<input id="project" class="pure-u-23-24" type="text" placeholder="common+xinche">
</div>
<div class="pure-u-1 pure-u-md-1-3">
<label>测试机</label>
<label for="dev1" class="inline">
<input id="dev1" type="checkbox" name="dev1" class="machine"> dev1
</label>
<label for="dev2" class="inline">
<input id="dev2" type="checkbox" name="dev2" class="machine"> dev2
</label>
<label for="beta1" class="inline">
<input id="beta1" type="checkbox" name="beta1" class="machine"> beta1
</label>
<label for="beta2" class="inline">
<input id="beta2" type="checkbox" name="beta2" class="machine"> beta2
</label>
</div>
</div>
<br>
<button type="submit" class="pure-button pure-button-primary" id="submit">提交</button>
<button class="button-error pure-button" id="cancel">不再使用</button>
</fieldset>
</form>
<table class="pure-table">
<thead>
<tr>
<th width="100">测试机</th>
<th width="200">分支</th>
<th>项目</th>
</tr>
</thead>
<tbody id="list">
</tbody>
</table>
<script src="//cdn.bootcss.com/ramda/0.23.0/ramda.min.js"></script>
<script src="//cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script src="//cdn.bootcss.com/sweetalert/1.1.3/sweetalert.min.js"></script> <script src="//cdn.bootcss.com/sweetalert/1.1.3/sweetalert.min.js"></script>
<script> <script src="{{htmlWebpackPlugin.options.dll.vue}}"></script>
const getList = () => { <script src="{{htmlWebpackPlugin.options.script}}"></script>
$.getJSON('/usage', res => {
let html = ''
const format = R.reduce((res, value) => `${res}<p>${value}</p>`, '')
const getBranches = R.pipe(
R.map(item => item.branch),
format
)
const getProjects = R.pipe(
R.map(item => item.project),
R.reduce((res, value) => res.concat(value),[]),
R.uniq,
format
)
res.machine.map((item, key) => {
html += `
<tr class="${key%2 === 0 ? 'pure-table-odd' : ''}">
<td>${item.name}</td>
<td>${getBranches(item.inUse)}</td>
<td>${getProjects(item.inUse)}</td>
</tr>
`
})
$('#list').html(html)
})
}
getList()
const getParams = () => {
return {
branch : $('#branch').val(),
project: ($('#project').val() || '').split('+'),
machine: R.reduce((res, input) => res.concat(input.name),[])($('.machine:checked'))
}
}
$('#submit').on('click', () => {
const params = getParams()
if(!params.branch || !params.project.length || !params.machine.length){
return false
}
$.post('/register', params, res=>{
if(res.ret){
swal('注册使用成功', `分支: ${params.branch}\n项目: ${$('#project').val() || ''}`)
getList()
}
})
return false
})
$('#cancel').on('click', () => {
const params = getParams()
if(!params.branch){
return false
}
$.post('/unregister', params, res=>{
if(res.ret){
swal('解除使用成功', `分支: ${params.branch}`)
getList()
}
})
return false
})
</script>
</body> </body>
</html> </html>
\ No newline at end of file
{ {
"name": "resource-usage", "name": "dashboard",
"version": "1.0.0", "version": "1.0.0",
"description": "", "description": "",
"main": "app.js", "main": "app.js",
......
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>静态资源开发机占用系统</title>
<link href="//cdn.bootcss.com/pure/0.6.2/pure-min.css" rel="stylesheet">
<link rel="stylesheet" href="//cdn.bootcss.com/sweetalert/1.1.3/sweetalert.min.css">
<style>
h1{
text-align: center;
color:#333;
padding:20px 0;
font-size:30px;
}
form,table{
width: 800px;
margin:0 auto;
}
.inline{
display: inline !important;
}
.pure-g > div{
margin-bottom: 10px;
}
table p{
padding:0;
margin:0;
}
.button-error {
background: rgb(202, 60, 60);
color:#fff;
}
.button-secondary {
background: rgb(66, 184, 221);
color:#fff;
}
</style>
</head>
<body>
<form class="pure-form pure-form-stacked">
<fieldset>
<div class="pure-g">
<div class="pure-u-1 pure-u-md-1-3">
<label for="branch">分支</label>
<input id="branch" class="pure-u-23-24" type="text" placeholder="master">
</div>
<div class="pure-u-1 pure-u-md-1-3">
<label for="project">编译项目</label>
<input id="project" class="pure-u-23-24" type="text" placeholder="common+xinche">
</div>
<div class="pure-u-1 pure-u-md-1-3">
<label>测试机</label>
<label for="dev1" class="inline">
<input id="dev1" type="checkbox" name="dev1" class="machine"> dev1
</label>
<label for="dev2" class="inline">
<input id="dev2" type="checkbox" name="dev2" class="machine"> dev2
</label>
<label for="beta1" class="inline">
<input id="beta1" type="checkbox" name="beta1" class="machine"> beta1
</label>
<label for="beta2" class="inline">
<input id="beta2" type="checkbox" name="beta2" class="machine"> beta2
</label>
</div>
</div>
<br>
<button type="submit" class="pure-button pure-button-primary" id="submit">提交</button>
<button class="button-error pure-button" id="cancel">不再使用</button>
</fieldset>
</form>
<table class="pure-table">
<thead>
<tr>
<th width="100">测试机</th>
<th width="200">分支</th>
<th>项目</th>
</tr>
</thead>
<tbody id="list">
</tbody>
</table>
<script src="//cdn.bootcss.com/ramda/0.23.0/ramda.min.js"></script>
<script src="//cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script src="//cdn.bootcss.com/sweetalert/1.1.3/sweetalert.min.js"></script>
<script>
const getList = () => {
$.getJSON('/usage', res => {
let html = ''
const format = R.reduce((res, value) => `${res}<p>${value}</p>`, '')
const getBranches = R.pipe(
R.map(item => item.branch),
format
)
const getProjects = R.pipe(
R.map(item => item.project),
R.reduce((res, value) => res.concat(value),[]),
R.uniq,
format
)
res.machine.map((item, key) => {
html += `
<tr class="${key%2 === 0 ? 'pure-table-odd' : ''}">
<td>${item.name}</td>
<td>${getBranches(item.inUse)}</td>
<td>${getProjects(item.inUse)}</td>
</tr>
`
})
$('#list').html(html)
})
}
getList()
const getParams = () => {
return {
branch : $('#branch').val(),
project: ($('#project').val() || '').split('+'),
machine: R.reduce((res, input) => res.concat(input.name),[])($('.machine:checked'))
}
}
$('#submit').on('click', () => {
const params = getParams()
if(!params.branch || !params.project.length || !params.machine.length){
return false
}
$.post('/register', params, res=>{
if(res.ret){
swal('注册使用成功', `分支: ${params.branch}\n项目: ${$('#project').val() || ''}`)
getList()
}
})
return false
})
$('#cancel').on('click', () => {
const params = getParams()
if(!params.branch){
return false
}
$.post('/unregister', params, res=>{
if(res.ret){
swal('解除使用成功', `分支: ${params.branch}`)
getList()
}
})
return false
})
</script>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment