-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Columns group in project page
- Loading branch information
Showing
37 changed files
with
498 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
frontend/src/components/debiai/project/projectColumns/Columns.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
Oops, something went wrong.