Skip to content

Commit

Permalink
Columns group in project page
Browse files Browse the repository at this point in the history
Columns group in project page
  • Loading branch information
upnico9 authored Jul 11, 2023
2 parents 9659639 + b435b8c commit 552c13c
Show file tree
Hide file tree
Showing 37 changed files with 498 additions and 198 deletions.
5 changes: 4 additions & 1 deletion backend/swagger.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
swagger: "2.0"
info:
version: 0.24.2
version: 0.24.3
title: DebiAI_BACKEND_API
description: DebiAI backend api
contact:
Expand Down Expand Up @@ -327,6 +327,9 @@ paths:
- number
- string
- boolean
group:
type: string
description: Optional group name, used to group the results columns in the UI
required: true
responses:
200:
Expand Down
4 changes: 2 additions & 2 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "debiai_frontend",
"version": "0.24.2",
"version": "0.24.3",
"description": "Frontend for Debiai, made with Vuejs",
"license": "Apache-2.0",
"scripts": {
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/assets/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
/* Data Type */
--number: #92cee6;
--class: #ffc107;
/* Categorys */
/* Categories */
--undefined: #dc3545;
--other: #6e6e83;
--context: #e85d04;
Expand Down Expand Up @@ -58,7 +58,7 @@ transition-group {
padding: 0px;
}

/* === BUTON === */
/* === BUTTON === */

button {
position: relative;
Expand Down Expand Up @@ -167,7 +167,7 @@ button .badge {
color: white;
}

/* === RADIO BUTON === */
/* === RADIO BUTTON === */

.radioBtn {
padding: 5px;
Expand Down Expand Up @@ -308,7 +308,7 @@ button .badge {
padding: 6px;
}

.unselectable {
.unelectable {
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
Expand Down
108 changes: 108 additions & 0 deletions frontend/src/components/common/Collapsible.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<template>
<div :class="collapsibleClass">
<div
:class="headerClass"
@click="isOpen = !isOpen"
>
<slot name="header"></slot>
</div>
<transition name="fade">
<div
class="body"
v-show="isOpen"
>
<slot name="body"></slot>
</div>
</transition>
</div>
</template>

<script>
export default {
name: "Collapsible",
components: {},
data: () => {
return {
isOpen: false,
};
},
created() {},
methods: {},
computed: {
collapsibleClass() {
return {
collapsible: true,
open: this.isOpen,
};
},
headerClass() {
return {
header: true,
open: this.isOpen,
};
},
},
watch: {
isOpen() {
// Scroll to the bottom of the collapsible when it is opened
if (this.isOpen) {
this.$nextTick(() => {
this.$el.scrollIntoView({ behavior: "smooth", block: "center" });
});
}
},
},
};
</script>

<style lang="scss" scoped>
.collapsible {
border: 1px solid #00000027;
border-radius: 4px;
.header {
padding: 7px 12px;
border-bottom: 1px solid #00000027;
cursor: pointer;
background-color: #0000000d;
color: #0000008a;
display: flex;
justify-content: space-between;
* {
display: flex;
align-items: center;
margin: 0;
gap: 10px;
}
// Harrow at the right of the header
&:after {
content: "";
}
&.open:after {
content: "";
}
// Number of items in the collapsible
.nbItem {
background-color: #eee;
border-radius: 6px;
padding: 2px 4px;
border: 2px solid #ccc;
font-size: 0.9em;
color: #888;
&.blue {
background-color: #cfe2ff;
border-color: #4f89ca;
color: #3b6595;
}
}
}
.body {
border-bottom: 1px solid #00000027;
border-radius: 0 0 4px 4px;
}
}
</style>
3 changes: 2 additions & 1 deletion frontend/src/components/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ InlineSvg.name = "inline-svg";
import Modal from "./Modal.vue";
import DocumentationBlock from "./DocumentationBlock .vue";
import AvailableTag from "./AvailableTag.vue";
import Collapsible from "./Collapsible.vue";

export default [Modal, DocumentationBlock, InlineSvg, AvailableTag];
export default [Modal, DocumentationBlock, InlineSvg, AvailableTag, Collapsible];
67 changes: 67 additions & 0 deletions frontend/src/components/debiai/project/projectColumns/Columns.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<template>
<div class="columns">
<div
class="column"
v-for="column in columns"
:key="column.name"
>
<div class="columnName">
{{ column.name }}
</div>
<div class="columnType">
{{ column.type !== undefined ? column.type : "auto" }}
</div>
</div>
</div>
</template>

<script>
export default {
name: "Columns",
components: {},
props: { columns: { type: Array, required: true } },
// Expected project columns example :
// [
// { "name": "storage", "category": "other" },
// { "name": "age", "category": "context" },
// { "name": "path", "category": "input" },
// { "name": "label", "category": "groundtruth" },
// { "name": "type" }, # category is not specified, it will be "other"
// ]
// Expected project results columns example :
// [
// { name: "Model prediction", type: "number" },
// { name: "Model error", type: "number" },
// ];
data: () => {
return {};
},
created() {},
methods: {},
computed: {},
};
</script>

<style scoped lang="scss">
.columns {
display: flex;
flex-direction: column;
.column {
display: flex;
flex-direction: row;
justify-content: space-between;
padding: 10px;
margin: 3px;
border: 1px solid #00000027;
border-radius: 10px;
}
.columnType {
width: 50px;
text-align: right;
opacity: 0.5;
}
}
</style>
Loading

0 comments on commit 552c13c

Please sign in to comment.