Skip to content

Commit

Permalink
template form
Browse files Browse the repository at this point in the history
  • Loading branch information
harmbrugge committed Dec 9, 2024
1 parent 0f96503 commit 06a0d0b
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 5 deletions.
Empty file.
48 changes: 43 additions & 5 deletions apps/central/src/components/admin/ManageTemplates.vue
Original file line number Diff line number Diff line change
@@ -1,24 +1,62 @@
<template>
<div>Manage scripts</div>
<RoutedTableExplorer
v-if="session"
<InputSelect :options="schemas"></InputSelect>
<TableExplorer
tableId="Templates"
schemaId="_SYSTEM_"
:canEdit="true"
:canManage="false"
>
</RoutedTableExplorer>
<template v-slot:rowheader="slotProps">
<TemplateEditButton :taskId="slotProps.row.id" />
</template>
</TableExplorer>
</template>

<script>
import { RoutedTableExplorer } from "molgenis-components";
import { TableExplorer, InputSelect } from "molgenis-components";
import TemplateEditButton from "./TemplateEditButton.vue";
import { request } from "graphql-request";
export default {
components: {
RoutedTableExplorer,
TemplateEditButton,
TableExplorer,
InputSelect,
},
props: {
session: Object,
},
data: function () {
return {
schemas: [],
loading: false,
graphqlError: null,
};
},
created() {
this.getSchemaList();
},
methods: {
getSchemaList() {
this.loading = true;
const schemaFragment = "_schemas{id,label,description}";
const lastUpdateFragment =

This comment has been minimized.

Copy link
@connoratrug

connoratrug Dec 9, 2024

Contributor

do you need the lastUpdate here ?

This comment has been minimized.

Copy link
@harmbrugge

harmbrugge Dec 9, 2024

Author Member

No

"_lastUpdate{schemaName, tableName, stamp, userId, operation}";
request(
"graphql",
`{${schemaFragment} ${this.showChangeColumn ? lastUpdateFragment : ""}}`
)
.then((data) => {
this.schemas = data._schemas;
this.loading = false;
})
.catch((error) => {
console.error("internal server error", error);
this.graphqlError = "internal server error" + error;
this.loading = false;
});
},
},
};
</script>
54 changes: 54 additions & 0 deletions apps/central/src/components/admin/TemplateEditButton.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<template>

This comment has been minimized.

Copy link
@connoratrug

connoratrug Dec 9, 2024

Contributor

maybe keep it simple and 'just' inline this, instead of having a public component

<div>
<IconAction v-if="!isModalShown" icon="search" @click="open" />
<LayoutModal v-else title="Job details" :show="isModalShown" @close="close">
<template #body>
<Task v-if="taskId" :taskId="taskId" />
</template>
<template #footer>
<ButtonAlt @click="close">Close</ButtonAlt>
</template>
</LayoutModal>
</div>
</template>
<script>
import {
ButtonAction,
ButtonAlt,
IconAction,
LayoutModal,
Task,
} from "molgenis-components";
export default {
components: {
IconAction,
LayoutModal,
ButtonAction,
ButtonAlt,
Task,
},
props: {
taskId: {
type: String,
required: true,
},
},
data() {
return {
error: null,
success: null,
loading: false,
isModalShown: false,
};
},
methods: {
open() {
this.isModalShown = true;
},
close() {
this.isModalShown = false;
},
},
};
</script>

0 comments on commit 06a0d0b

Please sign in to comment.