Browse Source

Merge branch 'master' into feat/i18n

pull/256/head
աɨռɢӄաօռɢ 3 years ago committed by GitHub
parent
commit
eef4c6be7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 38
      packages/nc-gui/components/project/spreadsheet/editColumn/editColumn.vue
  2. 26
      packages/nc-gui/layouts/default.vue
  3. 138
      packages/nc-gui/pages/projects/index.vue
  4. 2
      packages/nc-lib-gui/package.json
  5. 12
      packages/nocodb/package-lock.json
  6. 12
      packages/nocodb/package.json
  7. 27
      packages/nocodb/src/lib/noco/meta/NcMetaMgr.ts
  8. 2
      packages/nocodb/src/lib/sqlMgr/SqlMgr.ts

38
packages/nc-gui/components/project/spreadsheet/editColumn/editColumn.vue

@ -22,7 +22,9 @@
</v-col>
<div :class="{
editDisabled : !isEditable
}">
<v-col cols="12" v-if="relation">
<div class="caption">
@ -268,6 +270,15 @@
</v-col>
</template>
</template>
<div class="disabled-info" :class="{'d-none':isEditable}">
<v-alert dense type="warning" icon="info" class="caption mx-2" outlined>
This spreadsheet is connected to an SQLite DB.<br>
For production please see <a href="https://github.com/nocodb/nocodb#production-setup"
target="_blank">here</a>.
</v-alert>
</div>
</div>
</v-row>
</v-container>
@ -288,6 +299,7 @@ import CustomSelectOptions from "@/components/project/spreadsheet/editColumn/cus
import RelationOptions from "@/components/project/spreadsheet/editColumn/relationOptions";
import DlgLabelSubmitCancel from "@/components/utils/dlgLabelSubmitCancel";
import LinkedToAnotherOptions from "@/components/project/spreadsheet/editColumn/linkedToAnotherOptions";
import {SqliteUi} from "@/helpers/SqliteUi";
export default {
name: "editColumn",
@ -476,6 +488,9 @@ export default {
this.focusInput()
},
computed: {
isEditable() {
return !this.editColumn && this.sqlUi === SqliteUi;
},
dataTypes() {
return this.sqlUi.getDataTypeListForUiType(this.newColumn)
},
@ -542,4 +557,25 @@ export default {
border-radius: 4px;
}
.editDisabled {
position: relative;
.disabled-info {
display: flex;
align-items: center;
justify-content: center;
position: absolute;
width: 100%;
height: 100%;
top: 0;
bottom: 0;
background: var(--v-backgroundColor-base);
opacity: .9;
& > * {
opacity: 1;
}
}
}
</style>

26
packages/nc-gui/layouts/default.vue

@ -25,7 +25,10 @@
</v-btn>
</template>
Home
<span class="caption ml-1 font-weight-light">(v{{$store.state.project.projectInfo && $store.state.project.projectInfo.version}})</span>
<span
class="caption ml-1 font-weight-light">(v{{
$store.state.project.projectInfo && $store.state.project.projectInfo.version
}})</span>
</v-tooltip>
<template><span class="title"> {{ brandName }}</span>
</template>
@ -235,7 +238,7 @@
<v-tooltip bottom>
<template v-slot:activator="{ on }">
<v-icon @dblclick="showAppStore=true" @click="changeTheme" v-on="on" size="20"
class="ml-3"> {{$vuetify.theme.dark ? 'mdi-weather-sunny':'mdi-weather-night'}}
class="ml-3"> {{ $vuetify.theme.dark ? 'mdi-weather-sunny' : 'mdi-weather-night' }}
</v-icon>
</template>
<span class="caption">
@ -645,6 +648,13 @@
</v-list-item>
<v-list-item v-if="isDashboard" dense @click="copyProjectInfo" v-ge="['Sign Out','']">
<v-list-item-title>
<v-icon small>info</v-icon>&nbsp; <span class="font-weight-regular">Copy Project info</span>
</v-list-item-title>
</v-list-item>
<v-list-item dense @click="MtdSignOut" v-ge="['Sign Out','']">
<v-list-item-title>
@ -824,6 +834,7 @@ import 'splitpanes/dist/splitpanes.css'
import XBtn from "../components/global/xBtn";
import ChangeEnv from "../components/changeEnv";
import Discord from "@/components/discord";
import {copyTextToClipboard} from "@/helpers/xutils";
export default {
components: {
@ -1296,6 +1307,15 @@ export default {
},
changeTheme() {
this.$store.dispatch('windows/ActToggleDarkMode', !this.$store.state.windows.darkTheme);
},
async copyProjectInfo() {
try {
const data = await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'ncProjectInfo'])
copyTextToClipboard(Object.entries(data).map(([k, v]) => `${k}: **${v}**`).join('\n'));
this.$toast.info('Copied project info to clipboard').goAway(3000);
} catch (e) {
this.$toast.error(e.message).goAway(3000);
}
}
},
@ -1344,7 +1364,7 @@ a {
animation-iteration-count: infinite;
}
/deep/ .v-toolbar__items{
/deep/ .v-toolbar__items {
align-items: center;
}

138
packages/nc-gui/pages/projects/index.vue

@ -36,7 +36,8 @@
@click="projectsLoad"
v-bind:tooltip="$t('projects.reload_projects_tooltip')"
>
mdi-refresh </x-icon
mdi-refresh
</x-icon
>&nbsp;
<!-- </x-btn>-->
</h1>
@ -132,7 +133,8 @@
<v-tooltip right>
<template v-slot:activator="{ on }">
<v-icon v-on="on" x-small color="grey" class="ml-4"
>mdi-information-outline</v-icon
>mdi-information-outline
</v-icon
>
</template>
<!-- Create a new project -->
@ -163,7 +165,8 @@
<v-tooltip right>
<template v-slot:activator="{ on }">
<v-icon v-on="on" x-small color="grey" class="ml-4"
>mdi-information-outline</v-icon
>mdi-information-outline
</v-icon
>
</template>
<!-- Supports MySQL, PostgreSQL, SQL Server & SQLite -->
@ -313,7 +316,8 @@
<v-menu offset-y>
<template v-slot:activator="{ on }">
<x-icon v-on="on" color="grey"
>mdi-dots-vertical</x-icon
>mdi-dots-vertical
</x-icon
>
</template>
<v-list dense>
@ -344,7 +348,7 @@
<v-list-item-title>
<!-- Export Metadata -->
<span class="caption font-weight-regular">{{
$t('projects.verticial_option_2')
$t('home.project_verticial_option_2')
}}</span>
</v-list-item-title>
</v-list-item>
@ -435,7 +439,8 @@
@click="onCreateProject"
>
<v-icon color="white" class="blink_me">
mdi-lightbulb-on </v-icon
mdi-lightbulb-on
</v-icon
>&nbsp;
<!-- New Project -->
{{ $t('projects.create_new_project_button.text') }}
@ -454,7 +459,7 @@
align-start
"
>
<sponsor-mini />
<sponsor-mini/>
</v-col>
</v-row>
<!-- <dlgLabelSubmitCancel-->
@ -507,7 +512,8 @@
>
<v-list-item-icon>
<v-icon class="ml-2" :color="textColors[3]"
>mdi-calendar-month</v-icon
>mdi-calendar-month
</v-icon
>
</v-list-item-icon>
<!-- Book a Free DEMO -->
@ -558,15 +564,15 @@
</template>
<script>
import dlgLabelSubmitCancel from '../../components/utils/dlgLabelSubmitCancel.vue';
import DlgProjectCreate from '@/components/utils/dlgProjectCreate';
import colors from '~/mixins/colors';
import dlgLabelSubmitCancel from '../../components/utils/dlgLabelSubmitCancel.vue';
import DlgProjectCreate from '@/components/utils/dlgProjectCreate';
import colors from '~/mixins/colors';
import { mapState } from 'vuex';
import SponsorOverlay from '@/components/sponsorOverlay';
import SponsorMini from '@/components/sponsorMini';
import {mapState} from 'vuex';
import SponsorOverlay from '@/components/sponsorOverlay';
import SponsorMini from '@/components/sponsorMini';
export default {
export default {
components: {
SponsorMini,
SponsorOverlay,
@ -664,13 +670,21 @@
},
methods: {
async stopProject(project) {
this.dialogShow = true;
this.confirmMessage =
'Do you want to stop the project?';
this.confirmAction = async act => {
if (act === 'hideDialog') {
this.dialogShow = false;
} else {
this.$set(project, 'status', 'stopping');
const project_id = project.id;
this.statusUpdatingProjectId = project_id;
this.projectStatusUpdating = true;
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [
{ project_id },
{project_id},
'projectStop',
]);
this.$toast
@ -683,15 +697,26 @@
}
await this.projectsLoad();
this.projectStatusUpdating = false;
this.dialogShow = false;
}
}
},
async startProject(project) {
this.dialogShow = true;
this.confirmMessage =
'Do you want to start the project?';
this.confirmAction = async act => {
if (act === 'hideDialog') {
this.dialogShow = false;
} else {
this.$set(project, 'status', 'starting');
const project_id = project.id;
this.statusUpdatingProjectId = project_id;
this.projectStatusUpdating = true;
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [
{ project_id },
{project_id},
'projectStart',
]);
this.$toast
@ -704,15 +729,25 @@
}
await this.projectsLoad();
this.projectStatusUpdating = false;
this.dialogShow = false;
}
}
},
async restartProject(project) {
this.dialogShow = true;
this.confirmMessage =
'Do you want to restart the project?';
this.confirmAction = async act => {
if (act === 'hideDialog') {
this.dialogShow = false;
} else {
this.$set(project, 'status', 'restarting');
const project_id = project.id;
this.statusUpdatingProjectId = project_id;
this.projectStatusUpdating = true;
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [
{ project_id },
{project_id},
'projectRestart',
]);
this.$toast
@ -725,15 +760,25 @@
}
await this.projectsLoad();
this.projectStatusUpdating = false;
this.dialogShow = false
}
}
},
async deleteProject(project) {
this.dialogShow = true;
this.confirmMessage =
'Do you want to delete the project?';
this.confirmAction = async act => {
if (act === 'hideDialog') {
this.dialogShow = false;
} else {
this.$set(project, 'status', 'deleting');
const project_id = project.id;
this.statusUpdatingProjectId = project_id;
this.projectStatusUpdating = true;
try {
await this.$store.dispatch('sqlMgr/ActSqlOp', [
{ project_id },
{project_id},
'projectDelete',
]);
this.$toast
@ -746,6 +791,10 @@
}
await this.projectsLoad();
this.projectStatusUpdating = false;
this.dialogShow = false;
}
}
},
onCreateProject(xcdb) {
if (xcdb === 'xcdb') {
@ -754,7 +803,8 @@
this.$router.push('/project/0');
}
},
async importProjectFromJSON() {},
async importProjectFromJSON() {
},
onTourCompletion() {
// this.$store.commit('windows/MutShowTour', {page: 'home'})
},
@ -820,13 +870,6 @@
});
}
},
async projectRemove(project) {
this._project = project;
this.deleteBtnClicked = true;
this.dialog.title =
'Project will drop all databases and remove all migrations files in your local directory. Click submit to delete';
this.dialog.show = true;
},
async projectEdit(project) {
console.log('projectEdit');
this.$router.push({
@ -836,18 +879,7 @@
async projectOpenFolder(project) {
console.log('projectEdit');
},
async _projectRemove(action) {
if (action === 'hideDialog') {
this.deleteBtnClicked = false;
this.dialog.show = false;
} else {
this.deleteBtnClicked = true;
await this.sqlMgr.projectRemove(this._project);
this.deleteBtnClicked = false;
this.projectsLoad();
this.dialog.show = false;
}
},
async exportMetaZip(project_id) {
this.dialogShow = true;
@ -874,7 +906,7 @@
},
]);
const url = window.URL.createObjectURL(
new Blob([data], { type: 'application/zip' })
new Blob([data], {type: 'application/zip'})
);
const link = document.createElement('a');
link.href = url;
@ -997,40 +1029,40 @@
await this.projectsLoad();
// await this.openProjectIfQueryParamFound()
},
};
};
</script>
<style scoped>
.action-icons {
.action-icons {
opacity: 0;
transition: 0.2s opacity;
}
}
tr:hover .action-icons {
tr:hover .action-icons {
opacity: 1;
}
}
@media screen and (max-width: 1240px) {
@media screen and (max-width: 1240px) {
.community-card {
display: none;
}
}
}
.community-card {
.community-card {
position: absolute;
right: -300px;
bottom: 60px;
opacity: 0;
transition: 2s right, 2s opacity;
}
}
.community-card.active {
.community-card.active {
right: 0px;
opacity: 1;
}
}
.nc-container {
.nc-container {
position: relative;
}
}
</style>
<!--

2
packages/nc-lib-gui/package.json

@ -1,6 +1,6 @@
{
"name": "nc-lib-gui",
"version": "0.1.216",
"version": "0.1.217",
"description": "> TODO: description",
"author": "“pranavxc” <pranavxc@gmail.com>",
"homepage": "https://gitlab.com/xgenecloud-ts/xgenecloud-ts#readme",

12
packages/nocodb/package-lock.json generated

@ -11126,9 +11126,9 @@
"integrity": "sha512-3AryS9uwa5NfISLxMciUonrH7YfXp+nlahB9T7girXIsLQrmwX4MdnuKs32akduCOGpKmjTJSWmATULbuMkbfw=="
},
"nc-help": {
"version": "0.1.104",
"resolved": "https://registry.npmjs.org/nc-help/-/nc-help-0.1.104.tgz",
"integrity": "sha512-Tbn+RrRg8ELwXZtu+Lu0cunNKyB8fj7d91JAd5U2sjV3r+02PExpZ0PWT7bFwkNcEVDItQtAvzNl7uoLgchzzw==",
"version": "0.1.107",
"resolved": "https://registry.npmjs.org/nc-help/-/nc-help-0.1.107.tgz",
"integrity": "sha512-Lgqx9i1Oxt4WGTU+D35KyhKpwWgmHKzI7P1yPcqhsWNrLjnR7XHEumjKT1UovyJo5zkkiMCFnaxOGbWCnM9waA==",
"requires": {
"axios": "^0.21.1",
"boxen": "^4.2.0",
@ -11203,9 +11203,9 @@
}
},
"nc-lib-gui": {
"version": "0.1.216",
"resolved": "https://registry.npmjs.org/nc-lib-gui/-/nc-lib-gui-0.1.216.tgz",
"integrity": "sha512-zVQlsjK0fCZnlX8k0Rky8RKCfdMYmcVDwn1Kjff1JdXMduuFunjGAz7zFDBJNBY8DflmJSrLyDvZ9GR9i+kMUw==",
"version": "0.1.217",
"resolved": "https://registry.npmjs.org/nc-lib-gui/-/nc-lib-gui-0.1.217.tgz",
"integrity": "sha512-SA2RuY8g62qa9d9FwGsxd+lk5eE11EzKDQMSQyCcJhMgDeMrNUsbpoVPCB/zxo71kR3MqQa1tNYO5uIgwx6vtg==",
"requires": {
"axios": "^0.19.2",
"body-parser": "^1.19.0",

12
packages/nocodb/package.json

@ -1,6 +1,6 @@
{
"name": "nocodb",
"version": "0.9.25",
"version": "0.9.26",
"description": "xc-cli",
"main": "dist/bundle.js",
"repository": "https://github.com/nocodb/nocodb/nc-cli",
@ -54,8 +54,9 @@
"postbuild": "npm run copy-files",
"copy-files": "copyfiles -u 1 \"src/**/*.ejs\" build/main && copyfiles -u 1 \"src/**/*.ejs\" build/module && copyfiles -u 1 \"src/**/*.ejs\" docker",
"docker:build": "EE=\"true-xc-test\" webpack --config docker/webpack.config.js",
"docker:image:build": "docker build . -t nocodb/nocodb:latest -t nocodb/nocodb:0.9.25 --no-cache",
"docker:image:deploy": "docker push nocodb/nocodb:latest && docker push nocodb/nocodb:0.9.25",
"docker:image:build": "docker build . -t nocodb/nocodb:latest -t nocodb/nocodb:0.9.26 --no-cache",
"docker:image:buildx": "docker buildx build . --platform linux/arm64 -t nocodb/nocodb:arm64 --no-cache",
"docker:image:deploy": "docker push nocodb/nocodb:latest && docker push nocodb/nocodb:0.9.26",
"docker:build:publish:image": "npm run build && npm run docker:build && npm run docker:image:build && npm run docker:image:deploy",
"docker:s3:image:build": "docker build . --file litestream/Dockerfile -t xgenecloud/xc-s3:latest -t xgenecloud/xc-s3:0.0.1 --no-cache",
"docker:s3:image:deploy": "docker push xgenecloud/xc-s3:latest && docker push xgenecloud/xc-s3:0.0.1",
@ -123,6 +124,7 @@
"handlebars": "^4.7.6",
"import-fresh": "^3.2.1",
"inflection": "^1.12.0",
"is-docker": "^2.2.1",
"js-beautify": "^1.11.0",
"json2csv": "^5.0.6",
"jsonfile": "^6.1.0",
@ -140,8 +142,8 @@
"mysql2": "^2.2.5",
"nanoid": "^3.1.20",
"nc-common": "0.0.6",
"nc-help": "^0.1.104",
"nc-lib-gui": "^0.1.216",
"nc-help": "^0.1.107",
"nc-lib-gui": "^0.1.217",
"nc-plugin": "^0.1.1",
"nodemailer": "^6.4.10",
"ora": "^4.0.4",

27
packages/nocodb/src/lib/noco/meta/NcMetaMgr.ts

@ -38,17 +38,18 @@ import ExpressXcTsRoutesHm from "../../sqlMgr/code/routes/xc-ts/ExpressXcTsRoute
import ExpressXcTsRoutesBt from "../../sqlMgr/code/routes/xc-ts/ExpressXcTsRoutesBt";
import ExpressXcTsRoutes from "../../sqlMgr/code/routes/xc-ts/ExpressXcTsRoutes";
import NcPluginMgr from "../plugins/NcPluginMgr";
import isDocker from 'is-docker';
// import packageInfo from '../../../../package.json'
// require('pkginfo')(module, 'version');
const XC_PLUGIN_DET = 'XC_PLUGIN_DET';
let packageInfo:any = {};
try{
packageInfo = JSON.parse(fs.readFileSync('package.json','utf8'));
}catch (_e) {}
let packageInfo: any = {};
try {
packageInfo = JSON.parse(fs.readFileSync('package.json', 'utf8'));
} catch (_e) {
}
export default class NcMetaMgr {
public projectConfigs = {};
@ -1083,6 +1084,9 @@ export default class NcMetaMgr {
case 'xcVirtualTableUpdate':
result = await this.xcVirtualTableUpdate(args);
break;
case 'ncProjectInfo':
result = await this.ncProjectInfo(args);
break;
case 'xcVirtualTableDelete':
result = await this.xcVirtualTableDelete(args, req);
break;
@ -3106,6 +3110,19 @@ export default class NcMetaMgr {
}
protected async ncProjectInfo(args) {
const config = this.projectConfigs[this.getProjectId(args)];
return {
node: process.version,
arch: process.arch,
platform: process.platform,
docker: isDocker(),
database: config.envs?.[process.env.NODE_ENV || 'dev']?.db?.[0]?.client,
packageVersion: packageInfo?.version
}
}
protected async xcVirtualTableList(args): Promise<any> {
return (await this.xcMeta.metaList(this.getProjectId(args), this.getDbAlias(args), 'nc_models', {
xcCondition: {

2
packages/nocodb/src/lib/sqlMgr/SqlMgr.ts

@ -820,7 +820,7 @@ export default class SqlMgr {
migrationSteps: 9999,
folder: this.currentProjectFolder
};
console.log(`Migration up args for '${op}'`, migrationArgs);
// console.log(`Migration up args for '${op}'`, migrationArgs);
await this.migrator().migrationsUp(migrationArgs);
}

Loading…
Cancel
Save