Skip to content

Commit

Permalink
feat: add colum.defaultValue in 'insert' form and csv/excel upsert (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mswertz authored Oct 6, 2023
1 parent 6437fd7 commit def6275
Show file tree
Hide file tree
Showing 47 changed files with 965 additions and 753 deletions.
33 changes: 17 additions & 16 deletions apps/cranio-provider/index.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="/favicon.ico">
<link rel="stylesheet" href="theme.css">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<link rel="icon" href="/favicon.ico" />
<link rel="stylesheet" href="theme.css" />
<title>ERN CRANIO</title>
</head>
<body>
<noscript>
<strong>We're sorry but cranio-provider app doesn't work properly without JavaScript enabled.
Please enable it to continue.</strong>
</noscript>
<div id="app">
</div>
<script type="module" src="/src/main.js"></script>
</body>
</head>
<body>
<noscript>
<strong
>We're sorry but cranio-provider app doesn't work properly without
JavaScript enabled. Please enable it to continue.</strong
>
</noscript>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion apps/cranio-provider/src/styles/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
grid-template-columns: 1fr;
align-items: flex-start;
justify-content: flex-start;

@media screen and (min-width: 924px) {
grid-template-columns: 350px 1fr;
}
Expand Down
20 changes: 10 additions & 10 deletions apps/cranio-provider/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import vue from "@vitejs/plugin-vue";

const host = "https://cranio-demo.molgeniscloud.org";
const schema = "NL1";
const opts = { changeOrigin: true, secure: false, logLevel: "debug" }
const opts = { changeOrigin: true, secure: false, logLevel: "debug" };

export default defineConfig(() => {
return {
Expand All @@ -15,35 +15,35 @@ export default defineConfig(() => {
@import "../molgenis-viz/src/styles/variables.scss";
@import "../molgenis-viz/src/styles/mixins.scss";
@import "src/styles/variables.scss";
`
}
}
`,
},
},
},
plugins: [vue()],
base: "",
server: {
proxy: {
"/api/graphql": {
target: `${host}/${schema}`,
...opts
...opts,
},
"^/[a-zA-Z0-9_.%-]+/api/graphql": {
target: host,
...opts,
},
"/api": {
target: `${host}/api`,
...opts
...opts,
},
"/apps": {
target: host,
...opts
...opts,
},
"/theme.css": {
target: `${host}/apps/central`,
...opts
...opts,
},
}
},
},
}
};
});
19 changes: 10 additions & 9 deletions apps/cranio-public/index.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="/favicon.ico">
<link rel="stylesheet" href="theme.css">
<title>ERN CRANIO</title>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<link rel="icon" href="/favicon.ico" />
<link rel="stylesheet" href="theme.css" />
<title>ERN CRANIO</title>
</head>
<body>
<noscript>
<strong>
We're sorry but cranio-public app doesn't work properly without JavaScript enabled. Please enable it to continue.
</strong>
<strong>
We're sorry but cranio-public app doesn't work properly without
JavaScript enabled. Please enable it to continue.
</strong>
</noscript>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
Expand Down
22 changes: 11 additions & 11 deletions apps/cranio-public/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import vue from "@vitejs/plugin-vue";

const host = "https://cranio-demo.molgeniscloud.org";
const schema = "CranioStats";
const opts = { changeOrigin: true, secure: false, logLevel: "debug" }
const opts = { changeOrigin: true, secure: false, logLevel: "debug" };

export default defineConfig(() => {
return {
Expand All @@ -15,39 +15,39 @@ export default defineConfig(() => {
@import "../molgenis-viz/src/styles/variables.scss";
@import "../molgenis-viz/src/styles/mixins.scss";
@import "src/styles/variables.scss";
`
}
}
`,
},
},
},
plugins: [vue()],
base: "",
server: {
proxy: {
"/api/graphql": {
target: `${host}/${schema}`,
...opts
...opts,
},
"^/[a-zA-Z0-9_.%-]+/api/graphql": {
target: host,
...opts,
},
"/api": {
target: `${host}/api`,
...opts
...opts,
},
"/graphql": {
target: `${host}/api/graphql`,
...opts
...opts,
},
"/apps": {
target: host,
...opts
...opts,
},
"/theme.css": {
target: `${host}/apps/central`,
...opts
...opts,
},
}
},
},
}
};
});
4 changes: 2 additions & 2 deletions apps/ern-ithaca/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<body>
<noscript>
<strong>
We're sorry but ern-ithaca app doesn't work properly without
JavaScript enabled. Please enable it to continue.
We're sorry but ern-ithaca app doesn't work properly without JavaScript
enabled. Please enable it to continue.
</strong>
</noscript>
<div id="app"></div>
Expand Down
1 change: 1 addition & 0 deletions apps/molgenis-components/src/Interfaces/IColumn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface IColumn {
labels?: ILocale[];
position?: number;
readonly?: string;
defaultValue?: string;
refBack?: string;
refLabel?: string;
refLabelDefault?: string;
Expand Down
1 change: 1 addition & 0 deletions apps/molgenis-components/src/client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ _schema {
refLabelDefault,
refBack,
required,
defaultValue,
readonly,
semantics,
descriptions{
Expand Down
4 changes: 4 additions & 0 deletions apps/molgenis-components/src/components/forms/EditModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
:clone="clone"
:locale="locale"
:errorPerColumn="rowErrors"
:applyDefaultValues="applyDefaultValues"
@update:model-value="checkForErrors"
/>
</div>
Expand Down Expand Up @@ -183,6 +184,9 @@ export default {
type: Boolean,
default: () => null,
},
applyDefaultValues: {
type: Boolean,
},
},
computed: {
title() {
Expand Down
14 changes: 14 additions & 0 deletions apps/molgenis-components/src/components/forms/RowEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ export default {
type: Object,
default: () => ({}),
},
applyDefaultValues: {
type: Boolean,
default: () => false,
},
},
emits: ["update:modelValue"],
components: {
Expand Down Expand Up @@ -194,6 +198,16 @@ export default {
} catch (error) {
this.errorPerColumn[column.id] = "Computation failed: " + error;
}
} else if (this.applyDefaultValues && column.defaultValue) {
if (column.defaultValue.startsWith("=")) {
this.internalValues[column.id] = executeExpression(
column.defaultValue.substr(1),
this.internalValues,
this.tableMetaData as ITableMetaData
);
} else {
this.internalValues[column.id] = column.defaultValue;
}
}
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
:schemaName="schemaName"
:defaultValue="defaultValue"
:visibleColumns="visibleColumns"
:applyDefaultValues="true"
@close="handleClose"
/>
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@
:schemaName="schemaName"
@close="handleModalClose"
:locale="locale"
:apply-default-values="editMode === 'add'"
/>

<ConfirmModal
Expand Down
Loading

0 comments on commit def6275

Please sign in to comment.