-
Notifications
You must be signed in to change notification settings - Fork 6
Feat: Settings page #88
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
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
e64b0f1
Feat: settings page
tatevikg1 036d744
Settings page with tabs
tatevikg1 dfd1e6b
Feat: add ConfigClient for configuration management
tatevikg1 bccb908
Feat: admin configs
tatevikg1 507dc0c
RedirectValidationTrait
tatevikg1 53dff31
Feat: enhance dashboard error handling and display
tatevikg1 3670e27
Feat: show statistics only to authorized admins
tatevikg1 0d92119
Feat: admin attributes configs
tatevikg1 f01a01e
After review 0
tatevikg1 62961a9
SettingsSubscriberAttributes
tatevikg1 025d213
Feat: EditSubscriberAttributeModal with options
tatevikg1 a2b819b
Fix: client
tatevikg1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
144 changes: 144 additions & 0 deletions
144
assets/vue/components/settings/CreateAdminAttributeModal.vue
This file contains hidden or 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,144 @@ | ||
| <template> | ||
| <Teleport to="body"> | ||
| <div | ||
| v-if="isOpen" | ||
| class="fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4" | ||
| > | ||
| <div class="w-full max-w-lg rounded-xl bg-white shadow-xl"> | ||
| <div class="border-b border-slate-200 px-6 py-4 flex justify-between items-center"> | ||
| <h2 class="text-lg font-semibold text-slate-900"> | ||
| Create Attribute | ||
| </h2> | ||
|
|
||
| <button | ||
| class="text-slate-400 hover:text-slate-700" | ||
| @click="$emit('close')" | ||
| > | ||
| ✕ | ||
| </button> | ||
| </div> | ||
|
|
||
| <form | ||
| class="p-6 space-y-5" | ||
| @submit.prevent="submit" | ||
| > | ||
| <div> | ||
| <label class="block text-sm font-medium text-slate-700 mb-1"> | ||
| Name | ||
| </label> | ||
|
|
||
| <input | ||
| v-model="form.name" | ||
| class="w-full rounded-lg border border-slate-300 px-3 py-2 focus:outline-none focus:ring-2 focus:ring-ext-wf1" | ||
| required | ||
| > | ||
| </div> | ||
|
|
||
| <div> | ||
| <label class="block text-sm font-medium text-slate-700 mb-1"> | ||
| Type | ||
| </label> | ||
|
|
||
| <select | ||
| v-model="form.type" | ||
| class="w-full rounded-lg border border-slate-300 px-3 py-2" | ||
| > | ||
| <option value="textline">Text</option> | ||
| <option value="hidden">Hidden</option> | ||
|
|
||
| </select> | ||
| </div> | ||
|
|
||
| <label class="flex items-center gap-2"> | ||
| <input | ||
| type="checkbox" | ||
| v-model="form.required" | ||
| > | ||
|
|
||
| <span class="text-sm text-slate-700"> | ||
| Required | ||
| </span> | ||
| </label> | ||
|
|
||
| <div | ||
| v-if="error" | ||
| class="text-sm text-red-600" | ||
| > | ||
| {{ error }} | ||
| </div> | ||
|
|
||
| <div class="flex justify-end gap-3 pt-2"> | ||
| <button | ||
| type="button" | ||
| class="px-4 py-2 rounded-lg border border-slate-300" | ||
| @click="$emit('close')" | ||
| > | ||
| Cancel | ||
| </button> | ||
|
|
||
| <button | ||
| class="px-4 py-2 rounded-lg bg-ext-wf1 text-white" | ||
| :disabled="saving" | ||
| > | ||
| {{ saving ? 'Creating...' : 'Create' }} | ||
| </button> | ||
| </div> | ||
| </form> | ||
| </div> | ||
| </div> | ||
| </Teleport> | ||
| </template> | ||
|
|
||
| <script setup> | ||
| import { reactive, ref, watch } from 'vue' | ||
| import { adminAttributeClient } from '../../api' | ||
|
|
||
| const props = defineProps({ | ||
| isOpen: Boolean | ||
| }) | ||
|
|
||
| const emit = defineEmits([ | ||
| 'close', | ||
| 'created' | ||
| ]) | ||
|
|
||
| const saving = ref(false) | ||
| const error = ref('') | ||
|
|
||
| const form = reactive({ | ||
| name: '', | ||
| type: 'string', | ||
| required: false | ||
| }) | ||
|
|
||
| watch( | ||
| () => props.isOpen, | ||
| (open) => { | ||
| if (!open) return | ||
|
|
||
| form.name = '' | ||
| form.type = 'textline' | ||
| form.required = false | ||
| error.value = '' | ||
| } | ||
| ) | ||
|
|
||
| const submit = async () => { | ||
| saving.value = true | ||
| error.value = '' | ||
|
|
||
| try { | ||
| await adminAttributeClient.createAttributeDefinition({ | ||
| name: form.name, | ||
| type: form.type, | ||
| required: form.required | ||
| }) | ||
|
|
||
| emit('created') | ||
| } catch (e) { | ||
| error.value = e?.message || 'Unable to create attribute.' | ||
| } finally { | ||
| saving.value = false | ||
| } | ||
| } | ||
| </script> | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.