Commit 6101735f authored by Johannes Zellner's avatar Johannes Zellner

Do not use v-if but v-show to avoid state issues

parent 2a2bdeed
......@@ -30,7 +30,7 @@
</el-menu>
</el-header>
<el-main>
<div v-if="activeView === 'login'">
<div v-show="activeView === 'login'">
<el-row type="flex" justify="center">
<el-col style="max-width: 400px">
<el-form ref="form" :model="login" label-position="top" @submit.native.prevent>
......@@ -41,7 +41,7 @@
</el-col>
</el-row>
</div>
<div v-else-if="activeView === 'projects'">
<div v-show="activeView === 'projects'">
<el-row type="flex" justify="center">
<el-col style="max-width: 1024px">
<center v-show="projects === null"><h1><i class="el-icon-loading"></i></h1></center>
......@@ -71,7 +71,7 @@
</el-col>
</el-row>
</div>
<div v-else-if="activeView === 'profile'">
<div v-show="activeView === 'profile'">
<el-row type="flex" justify="center">
<el-col style="max-width: 600px">
<el-form ref="form" label-width="120px" @submit.native.prevent>
......@@ -85,7 +85,7 @@
</el-col>
</el-row>
</div>
<div v-else-if="activeView === 'projectAdd'">
<div v-show="activeView === 'projectAdd'">
<el-row type="flex" justify="center">
<el-col style="max-width: 600px">
<el-form ref="form" label-width="120px" @submit.native.prevent>
......@@ -102,7 +102,7 @@
</el-col>
</el-row>
</div>
<div v-else-if="activeView === 'welcome'">
<div v-show="activeView === 'welcome'">
<el-row type="flex" justify="center">
<el-col style="max-width: 1024px">
<center v-show="projects === null"><h1><i class="el-icon-loading"></i></h1></center>
......
......@@ -115,20 +115,11 @@ new Vue({
});
},
handleViewSelect: function (key) {
var that = this;
if (!this.profile) this.activeView = 'login';
else this.activeView = key;
if (this.activeView === 'projects' || this.activeView === 'welcome') {
this.projects = null;
superagent.get('/api/v1/projects').query({ username: that.login.username, password: that.login.password }).end(function (error, result) {
if (error) return that.onError(error);
if (result.statusCode !== 200) return that.onError('Unexpected response: ' + result.statusCode + ' ' + result.text);
that.projects = result.body.projects;
});
this.refreshProjects();
} else if (this.activeView === 'login') {
this.login.username = '';
this.login.password = '';
......
......@@ -10,8 +10,8 @@ CREATE TABLE IF NOT EXISTS users(
CREATE TABLE IF NOT EXISTS projects(
id VARCHAR(128) NOT NULL UNIQUE,
userId VARCHAR(128) NOT NULL,
name VARCHAR(512) NOT NULL,
origin VARCHAR(512) NOT NULL DEFAULT "",
name VARCHAR(512) NOT NULL, -- project identifier ie. "username/projectname"
origin VARCHAR(512) NOT NULL DEFAULT "", -- origin for GitLab host
enabled BOOLEAN DEFAULT true,
lastSuccessfulSyncAt BIGINT DEFAULT 0,
type VARCHAR(32) NOT NULL DEFAULT "github",
......
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