Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(settings): Have a better email input in member settings #2684

Merged
merged 1 commit into from Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/molgenis-components/lib/main.js
Expand Up @@ -192,6 +192,7 @@ export {
InputDate,
InputDateTime,
InputDecimal,
InputEmail,
InputFile,
InputGroup,
InputInt,
Expand Down
2 changes: 1 addition & 1 deletion apps/molgenis-components/src/client/client.ts
Expand Up @@ -272,7 +272,7 @@ const fetchSchemaMetaData = async (
.post(graphqlURL(schemaName), { query: metaDataQuery })
.then((result: AxiosResponse<{ data: { _schema: ISchemaMetaData } }>) => {
const schema = result.data.data._schema;
if(schemaName == null) {
if (schemaName == null) {
schemaCache.set(currentSchemaName, schema);
}
schemaCache.set(schema.name, schema);
Expand Down
10 changes: 5 additions & 5 deletions apps/molgenis-components/src/components/forms/Info.vue
@@ -1,10 +1,8 @@
<template>
<div>
<i
class="fa fa-question-circle text-primary"
@mouseenter="show = true"
@mouseleave="show = false"
></i>
<span @mouseenter="show = true" @mouseleave="show = false">
<i class="fa fa-question-circle text-primary" />
</span>
<div class="tooltip bs-tooltip-top" :class="{ show: show }">
<span class="tooltip-inner">
<span> <slot /></span>
Expand All @@ -17,6 +15,8 @@
<style>
.tooltip {
margin-top: -50px;
pointer-events: none;
white-space: nowrap;
}
</style>

Expand Down
22 changes: 14 additions & 8 deletions apps/molgenis-components/src/components/forms/InputEmail.vue
Expand Up @@ -36,14 +36,20 @@ import FormGroup from "./FormGroup.vue";
import InputGroup from "./InputGroup.vue";
import BaseInputProps from "./baseInputs/BaseInputProps";

interface InputProps extends BaseInputProps {
stringLength?: number;
additionalValidValidationStrings?: string[];
modelValue: string | null;
}
let props = withDefaults(defineProps<InputProps>(), {
additionalValidValidationStrings: () => [],
stringLength: 255,
let props = defineProps({
...BaseInputProps,
modelValue: {
type: String,
default: null,
},
stringLength: {
type: Number,
default: 255,
},
additionalValidValidationStrings: {
type: Array,
default: [],
},
});

const emit = defineEmits(["update:modelValue"]);
Expand Down
@@ -1,14 +1,39 @@
export default interface BaseInputProps {
export default {
/**
* Unique identifier https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
* Has no direct EMX2 implementation but can be constructed by concatenating the table name with the field name
*/
id: string;
name?: string;
label?: string;
placeholder?: string;
description?: string;
required?: boolean;
readonly?: boolean;
errorMessage?: string;
}
id: {
type: String,
required: true,
},
name: {
type: String,
required: false,
},
label: {
type: String,
required: false,
},
placeholder: {
type: String,
required: false,
},
description: {
type: String,
required: false,
},
required: {
type: Boolean,
default: false,
},
readonly: {
type: Boolean,
default: false,
},
errorMessage: {
type: String,
required: false,
default: () => null,
},
};
30 changes: 27 additions & 3 deletions apps/settings/src/components/Members.vue
Expand Up @@ -15,13 +15,21 @@
<h5 class="card-title">Manage members</h5>
<p>Use table below to add, edit or remove members</p>
<form v-if="canEdit" class="form-inline">
<InputString
<InputEmail
id="member-email"
class="mb-2 mr-sm-4"
class="mb-2 mr-2 mr-sm-4 email-input"
v-model="editMember['email']"
placeholder="email address"
label="Email:"
/>
:additionalValidValidationStrings="['user', 'anonymous']"
>
<template v-slot:prepend>
<Info class="mr-1">
Enter valid user email address or use the specials group: 'user'
or 'anonymous'
</Info>
</template>
</InputEmail>
<InputSelect
id="member-role"
class="mb-2 mr-sm-4"
Expand Down Expand Up @@ -56,10 +64,12 @@ import {
ButtonAction,
ButtonAlt,
TableSimple,
Info,
InputCheckbox,
InputFile,
InputSelect,
InputString,
InputEmail,
LayoutCard,
MessageError,
MessageSuccess,
Expand All @@ -77,8 +87,10 @@ export default {
MessageSuccess,
Spinner,
LayoutCard,
Info,
InputCheckbox,
InputString,
InputEmail,
InputSelect,
},
props: {
Expand Down Expand Up @@ -165,3 +177,15 @@ export default {
},
};
</script>

<style>
.email-input input {
min-width: 20rem !important;
}
.email-input .text-danger {
margin-left: 0.5rem;
}
.email-input .input-group {
flex-wrap: nowrap;
}
</style>