mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
188 lines
5.4 KiB
188 lines
5.4 KiB
4 years ago
|
<template>
|
||
2 years ago
|
<div class="main justify-center d-flex" style="min-height: 600px; overflow: auto">
|
||
4 years ago
|
<!-- <v-toolbar>-->
|
||
|
<!-- <v-spacer></v-spacer>-->
|
||
|
<!-- <v-spacer></v-spacer>-->
|
||
|
<!-- </v-toolbar>-->
|
||
|
|
||
3 years ago
|
<v-form ref="form" v-model="valid" @submit.prevent="createProject">
|
||
2 years ago
|
<v-card style="width: 530px; margin-top: 100px" class="mx-auto">
|
||
4 years ago
|
<div
|
||
2 years ago
|
style="
|
||
|
position: absolute;
|
||
|
top: -33px;
|
||
|
left: -moz-calc(50% - 33px);
|
||
|
left: -webkit-calc(50% - 33px);
|
||
|
left: calc(50% - 33px);
|
||
|
border-radius: 15px;
|
||
|
"
|
||
4 years ago
|
class="primary"
|
||
|
>
|
||
2 years ago
|
<v-img class="mx-auto" width="66" height="66" :src="require('~/assets/img/icons/512x512-trans.png')" />
|
||
4 years ago
|
</div>
|
||
|
|
||
3 years ago
|
<!-- Create Project -->
|
||
2 years ago
|
<v-container fluid class="pb-10 px-12" style="padding-top: 43px !important">
|
||
4 years ago
|
<h1 class="mt-4 mb-4 text-center">
|
||
3 years ago
|
{{ $t('activity.createProject') }}
|
||
3 years ago
|
</h1>
|
||
2 years ago
|
<div class="mx-auto" style="width: 350px">
|
||
3 years ago
|
<!-- label="Enter Project Name" -->
|
||
|
<!-- rule text: Required -->
|
||
4 years ago
|
<v-text-field
|
||
|
ref="name"
|
||
3 years ago
|
v-model="name"
|
||
4 years ago
|
autofocus
|
||
|
:full-width="false"
|
||
3 years ago
|
class="nc-metadb-project-name"
|
||
3 years ago
|
:label="$t('placeholder.projName')"
|
||
2 years ago
|
:rules="form.titleValidationRule"
|
||
3 years ago
|
/>
|
||
4 years ago
|
|
||
3 years ago
|
<!-- <div class="wrapper mb-5 mt-5">
|
||
4 years ago
|
<v-container fluid>
|
||
3 years ago
|
<!– Access Project Via –>
|
||
|
<label class="grey--text ml-1 d-block my-2">{{ $t('msg.info.apiOptions') }}</label>
|
||
4 years ago
|
|
||
3 years ago
|
<v-radio-group v-model="projectType" hide-details dense class="mb-0 mt-0">
|
||
|
<v-radio
|
||
|
v-for="(type,i) in projectTypes"
|
||
|
:key="type.value"
|
||
|
:color="type.iconColor"
|
||
|
:value="type.value"
|
||
|
>
|
||
|
<template #label>
|
||
4 years ago
|
<v-chip :color="i ? colors[3] : colors[7]">
|
||
3 years ago
|
<v-icon small class="mr-1">
|
||
|
{{ type.icon }}
|
||
|
</v-icon>
|
||
4 years ago
|
<span class="caption">{{ type.text }}</span>
|
||
|
</v-chip>
|
||
|
</template>
|
||
|
</v-radio>
|
||
|
</v-radio-group>
|
||
|
</v-container>
|
||
3 years ago
|
</div>-->
|
||
4 years ago
|
</div>
|
||
|
<div class="text-center">
|
||
|
<v-btn
|
||
3 years ago
|
v-t="['a:project:create:xcdb']"
|
||
4 years ago
|
class="mt-3"
|
||
|
large
|
||
|
:loading="loading"
|
||
3 years ago
|
color="primary"
|
||
4 years ago
|
@click="createProject"
|
||
3 years ago
|
>
|
||
2 years ago
|
<v-icon class="mr-1 mt-n1"> mdi-rocket-launch-outline </v-icon>
|
||
3 years ago
|
<!-- Create -->
|
||
|
<span class="mr-1">{{ $t('general.create') }}</span>
|
||
4 years ago
|
</v-btn>
|
||
|
</div>
|
||
|
</v-container>
|
||
|
</v-card>
|
||
|
</v-form>
|
||
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
2 years ago
|
import colors from '@/mixins/colors';
|
||
4 years ago
|
|
||
|
export default {
|
||
3 years ago
|
name: 'Name',
|
||
4 years ago
|
mixins: [colors],
|
||
|
data: () => ({
|
||
|
valid: null,
|
||
|
name: '',
|
||
|
loading: false,
|
||
|
projectType: 'rest',
|
||
|
projectTypes: [
|
||
3 years ago
|
{ text: 'REST APIs', value: 'rest', icon: 'mdi-code-json', iconColor: 'green' },
|
||
2 years ago
|
{ text: 'GRAPHQL APIs', value: 'graphql', icon: 'mdi-graphql', iconColor: 'pink' },
|
||
4 years ago
|
/* {
|
||
|
text: 'Automatic gRPC APIs on database',
|
||
|
value: 'grpc',
|
||
|
icon: require('@/assets/img/grpc-icon-color.png'),
|
||
|
type: 'img'
|
||
3 years ago
|
}, */
|
||
2 years ago
|
],
|
||
|
form: {
|
||
|
titleValidationRule: [
|
||
|
v => !!v || 'Title is required',
|
||
|
v => v.length <= 50 || 'Project name exceeds 50 characters',
|
||
|
],
|
||
|
},
|
||
4 years ago
|
}),
|
||
3 years ago
|
computed: {
|
||
3 years ago
|
typeIcon() {
|
||
3 years ago
|
if (this.projectType) {
|
||
2 years ago
|
return this.projectTypes.find(({ value }) => value === this.projectType);
|
||
3 years ago
|
} else {
|
||
2 years ago
|
return { icon: 'mdi-server', iconColor: 'primary' };
|
||
3 years ago
|
}
|
||
2 years ago
|
},
|
||
3 years ago
|
},
|
||
3 years ago
|
mounted() {
|
||
4 years ago
|
setTimeout(() => {
|
||
2 years ago
|
this.$refs.name.$el.querySelector('input').focus();
|
||
|
}, 100);
|
||
4 years ago
|
},
|
||
|
methods: {
|
||
3 years ago
|
async createProject() {
|
||
4 years ago
|
if (this.$refs.form.validate()) {
|
||
2 years ago
|
this.loading = true;
|
||
4 years ago
|
try {
|
||
3 years ago
|
// const result = await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'projectCreateByWebWithXCDB', {
|
||
|
// title: this.name,
|
||
|
// projectType: this.projectType
|
||
|
// }])
|
||
|
|
||
2 years ago
|
const result = await this.$api.project.create({
|
||
|
title: this.name,
|
||
|
});
|
||
4 years ago
|
|
||
2 years ago
|
await this.$store.dispatch('project/ActLoadProjectInfo');
|
||
4 years ago
|
|
||
2 years ago
|
this.projectReloading = false;
|
||
4 years ago
|
|
||
2 years ago
|
if (
|
||
|
this.$store.state.project.appInfo.firstUser ||
|
||
|
this.$store.state.project.appInfo.authType === 'masterKey'
|
||
|
) {
|
||
4 years ago
|
return this.$router.push({
|
||
2 years ago
|
path: '/user/authentication/signup',
|
||
|
});
|
||
4 years ago
|
}
|
||
|
|
||
|
this.$router.push({
|
||
|
path: `/nc/${result.id}`,
|
||
|
query: {
|
||
2 years ago
|
new: 1,
|
||
|
},
|
||
|
});
|
||
4 years ago
|
} catch (e) {
|
||
2 years ago
|
this.$toast.error(await this._extractSdkResponseErrorMsg(e)).goAway(3000);
|
||
4 years ago
|
}
|
||
2 years ago
|
this.loading = false;
|
||
4 years ago
|
} else {
|
||
|
// this.$toast.
|
||
|
}
|
||
2 years ago
|
},
|
||
|
},
|
||
|
};
|
||
4 years ago
|
</script>
|
||
|
|
||
|
<style scoped>
|
||
|
/deep/ label {
|
||
2 years ago
|
font-size: 0.75rem;
|
||
4 years ago
|
}
|
||
|
|
||
|
.wrapper {
|
||
|
border: 2px solid var(--v-backgroundColor-base);
|
||
|
border-radius: 4px;
|
||
|
}
|
||
|
|
||
|
.main {
|
||
2 years ago
|
height: calc(100vh - 48px);
|
||
4 years ago
|
}
|
||
|
</style>
|