-
-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from h3poteto/iss-3
closes #3 Fix login page design
- Loading branch information
Showing
11 changed files
with
237 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,47 @@ | ||
<template> | ||
<div id="login"> | ||
<el-form ref="instanceForm" label-width="120px" label-position="top"> | ||
<el-form-item label="Domain name"> | ||
<el-input v-model="instanceForm.domain"></el-input> | ||
</el-form-item> | ||
<el-form-item class="submit"> | ||
<el-button type="primary" @click="search">Search</el-button> | ||
</el-form-item> | ||
</el-form> | ||
<el-form ref="loginForm" v-if="instances.length > 0" label-width="120px" label-position="top"> | ||
<el-form-item label="Select instance"> | ||
<el-radio-group v-model="loginForm.selectInstance" @change="changeInstance"> | ||
<el-radio class="instance-list" v-for="instance in instances" v-bind:key="instance.id" :label="instance.name" border></el-radio> | ||
</el-radio-group> | ||
</el-form-item> | ||
<el-form-item class="submit"> | ||
<el-button type="primary" @click="login" v-if="selectedInstance !== null">Login</el-button> | ||
</el-form-item> | ||
</el-form> | ||
<instance-form v-if="page == 1"></instance-form> | ||
<login-form v-if="page == 2"></login-form> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import InstanceForm from './Login/InstanceForm' | ||
import LoginForm from './Login/LoginForm' | ||
import { mapState } from 'vuex' | ||
export default { | ||
name: 'login', | ||
data () { | ||
return { | ||
instanceForm: { | ||
domain: '' | ||
}, | ||
loginForm: { | ||
selectInstance: '' | ||
} | ||
} | ||
}, | ||
computed: { | ||
...mapState({ | ||
instances: state => state.Login.instances, | ||
selectedInstance: state => state.Login.selectedInstance | ||
page: state => state.Login.page | ||
}) | ||
}, | ||
created () { | ||
}, | ||
methods: { | ||
login () { | ||
this.$store.dispatch('Login/fetchLogin', this.selectedInstance) | ||
.then((url) => { | ||
this.$router.push({ path: '/authorize' }) | ||
}) | ||
}, | ||
search () { | ||
this.$store.dispatch('Login/searchInstance', this.instanceForm.domain) | ||
}, | ||
changeInstance (value) { | ||
this.$store.dispatch('Login/changeInstance', value) | ||
} | ||
} | ||
components: { InstanceForm, LoginForm } | ||
} | ||
</script> | ||
|
||
<style lang="scss"> | ||
body { font-family: 'Source Sans Pro', sans-serif; } | ||
html, body, #app, #login { | ||
height: 100%; | ||
margin: 0; | ||
} | ||
#login { | ||
background-color: #292f3f; | ||
color: #ffffff; | ||
text-align: center; | ||
.instance-list { | ||
display: block; | ||
.el-form-item__label { | ||
color: #f0f3f9; | ||
} | ||
.el-input__inner { | ||
background-color: #373d48; | ||
color: #ffffff; | ||
border: 0; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<template> | ||
<div id="instance_form"> | ||
<el-form ref="instanceForm" label-width="120px" label-position="top" class="instance-form"> | ||
<el-form-item label="Domain name"> | ||
<el-input v-model="instanceForm.domain" class="input"></el-input> | ||
</el-form-item> | ||
<el-form-item class="submit"> | ||
<el-button type="primary" @click="search">Search</el-button> | ||
</el-form-item> | ||
</el-form> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'instance-form', | ||
data () { | ||
return { | ||
instanceForm: { | ||
domain: '' | ||
} | ||
} | ||
}, | ||
methods: { | ||
search () { | ||
const loading = this.$loading({ | ||
lock: true, | ||
text: 'Loading', | ||
spinner: 'el-icon-loading', | ||
background: 'rgba(0, 0, 0, 0.7)' | ||
}) | ||
this.$store.dispatch('Login/searchInstance', this.instanceForm.domain) | ||
.then(() => { | ||
loading.close() | ||
this.$store.commit('Login/changePage', 2) | ||
}) | ||
.catch(() => { | ||
this.$message({ | ||
message: 'Could not search instance', | ||
type: 'error' | ||
}) | ||
}) | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.instance-form { | ||
width: 400px; | ||
margin: 0 auto; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<template> | ||
<div id="login_form"> | ||
<el-form ref="loginForm" label-width="120px" label-position="top"> | ||
<el-form-item label="Select instance"> | ||
<el-radio-group v-model="loginForm.selectInstance" @change="changeInstance" class="instance-group"> | ||
<el-radio class="instance-list" v-for="instance in instances" v-bind:key="instance.id" :label="instance.name" border></el-radio> | ||
</el-radio-group> | ||
</el-form-item> | ||
<p v-if="instances.length === 0">Could not find instance</p> | ||
<el-form-item class="submit"> | ||
<el-button type="text" class="back" @click="back"><icon name="chevron-left"></icon></el-button> | ||
<el-button type="primary" class="login" @click="login" v-if="selectedInstance !== null">Login</el-button> | ||
</el-form-item> | ||
</el-form> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { mapState } from 'vuex' | ||
export default { | ||
name: 'login-form', | ||
data () { | ||
return { | ||
loginForm: { | ||
selectInstance: '' | ||
} | ||
} | ||
}, | ||
computed: { | ||
...mapState({ | ||
instances: state => state.Login.instances, | ||
selectedInstance: state => state.Login.selectedInstance | ||
}) | ||
}, | ||
methods: { | ||
login () { | ||
this.$store.dispatch('Login/fetchLogin', this.selectedInstance) | ||
.then((url) => { | ||
this.$router.push({ path: '/authorize' }) | ||
}) | ||
}, | ||
changeInstance (value) { | ||
this.$store.dispatch('Login/changeInstance', value) | ||
}, | ||
back () { | ||
this.$store.dispatch('Login/pageBack') | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.instance-group { | ||
width: 300px; | ||
text-align: left; | ||
margin: 0 auto; | ||
} | ||
.instance-list { | ||
display: block; | ||
width: 300px; | ||
margin-left: 0 !important; | ||
border-color: #606266; | ||
color: #dcdfe6; | ||
margin-bottom: 10px; | ||
} | ||
.back { | ||
margin-right: 20px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.