diff --git a/src/components/VariableCreateModal.vue b/src/components/VariableCreateModal.vue index be962b172..f7d8654c7 100644 --- a/src/components/VariableCreateModal.vue +++ b/src/components/VariableCreateModal.vue @@ -18,12 +18,12 @@ @@ -36,7 +36,7 @@ import { computed, ref } from 'vue' import { useWorkspaceApi } from '@/compositions' import { localization } from '@/localization' - import { VariableCreate } from '@/models' + import { Variable, VariableCreate } from '@/models' import { isRequired, isString } from '@/utilities' const props = defineProps<{ @@ -45,6 +45,7 @@ const emit = defineEmits<{ (event: 'update:showModal', value: boolean): void, + (event: 'create', value: Variable): void, }>() const internalValue = computed({ @@ -102,10 +103,11 @@ tags: tags.value, } - await api.variables.createVariable(values) + const variable = await api.variables.createVariable(values) showToast(localization.success.createVariable, 'success') internalValue.value = false + emit('create', variable) } catch (error) { console.error(error) showToast(localization.error.createVariable, 'error') diff --git a/src/components/VariableEditModal.vue b/src/components/VariableEditModal.vue new file mode 100644 index 000000000..08b593063 --- /dev/null +++ b/src/components/VariableEditModal.vue @@ -0,0 +1,124 @@ + + + \ No newline at end of file diff --git a/src/components/VariableMenu.vue b/src/components/VariableMenu.vue new file mode 100755 index 000000000..c495504e7 --- /dev/null +++ b/src/components/VariableMenu.vue @@ -0,0 +1,67 @@ + + + + + \ No newline at end of file diff --git a/src/components/index.ts b/src/components/index.ts index 660a449fb..5ee061d10 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -165,6 +165,7 @@ export { default as PageHeadingNotificationCreate } from './PageHeadingNotificat export { default as PageHeadingNotificationEdit } from './PageHeadingNotificationEdit.vue' export { default as PageHeadingNotifications } from './PageHeadingNotifications.vue' export { default as PageHeadingTaskRun } from './PageHeadingTaskRun.vue' +export { default as PageHeadingVariables } from './PageHeadingVariables.vue' export { default as PageHeadingWorkPool } from './PageHeadingWorkPool.vue' export { default as PageHeadingWorkPoolCreate } from './PageHeadingWorkPoolCreate.vue' export { default as PageHeadingWorkPoolEdit } from './PageHeadingWorkPoolEdit.vue' @@ -222,6 +223,9 @@ export { default as TaskRunLogs } from './TaskRunLogs.vue' export { default as TaskRunsSort } from './TaskRunsSort.vue' export { default as TimezoneSelect } from './TimezoneSelect.vue' export { default as ToastFlowRunCreate } from './ToastFlowRunCreate.vue' +export { default as VariableMenu } from './VariableMenu.vue' +export { default as VariableCreateModal } from './VariableCreateModal.vue' +export { default as VariableEditModal } from './VariableEditModal.vue' export { default as ViewModeButtonGroup } from './ViewModeButtonGroup.vue' export { default as WorkersLateIndicator } from './WorkersLateIndicator.vue' export { default as WorkersTable } from './WorkersTable.vue' diff --git a/src/localization/locale/en.ts b/src/localization/locale/en.ts index 397b8f40d..369659ffa 100644 --- a/src/localization/locale/en.ts +++ b/src/localization/locale/en.ts @@ -34,6 +34,7 @@ export const en = { createWorkQueue: 'Failed to create work queue', delete: (type: string) => `Failed to delete ${type}`, deleteSavedSearch: 'Failed to delete saved filter', + editVariable: 'Failed to updated variable', pauseDeployment: 'Failed to pause deployment', pauseFlowRun: 'Failed to pause flow run', pauseNotification: 'Failed to pause notification', @@ -73,6 +74,7 @@ export const en = { createWorkQueue: 'Work queue created', delete: (type: string) => `${type} deleted`, deleteSavedSearch: 'Saved filter deleted', + editVariable: 'Variable updated', pauseDeployment: 'Deployment paused', pauseFlowRun: 'Flow run paused', pauseNotification: 'Notification paused', @@ -98,18 +100,27 @@ export const en = { artifactTypeChanged: (type: string) => `Changed to \`${type}\` artifact`, newVariable: 'New variable', editVariable: (name: string) => `Edit \`${name}\``, + close: 'Close', + save: 'Save', name: 'Name', value: 'Value', latest: 'Latest', item: 'Item', noData: 'No data', + copyId: 'Copy ID', + copyName: 'Copy name', + copyValue: 'Copy value', + edit: 'Edit', + delete: 'Delete', tags: 'Tags', invalidData: (docsUrl: string) => `Invalid data, see [documentation](${docsUrl}) for more information`, noResults: 'No tracked results, enable [result persistence](https://docs.prefect.io/concepts/results/#persisting-results) to track results.', flowRun: 'Flow run', taskRun: 'Task run', taskRuns: 'Task runs', + variable: 'Variable', created: 'Created', + create: 'Create', lastUpdated: 'Last Updated', deprecatedWorkQueue: 'This work queue uses a deprecated tag-based approach to matching flow runs; it will continue to work but you can\'t modify it', deploymentMissingWorkQueue: 'This deployment doesn\'t have an associated work queue; runs will be scheduled but won\'t be picked up by your agents', diff --git a/src/services/can.ts b/src/services/can.ts index 4b7284504..d60953124 100644 --- a/src/services/can.ts +++ b/src/services/can.ts @@ -35,6 +35,7 @@ export const workspacePermissions = [ 'delete:work_pool', 'delete:workspace_bot_access', 'delete:workspace_user_access', + 'delete:variable', 'read:automation', 'read:block', 'read:concurrency_limit',