Skip to content

Commit

Permalink
refactor: replace p-text-editor with p-code-editor for code display
Browse files Browse the repository at this point in the history
- Replaced `p-text-editor` with `p-code-editor` across multiple components.
- Ensured consistent use of `p-code-editor` for displaying and editing code snippets.

Signed-off-by: sulmo <[email protected]>
  • Loading branch information
sulmoJ committed Nov 29, 2024
1 parent 4f9c8c4 commit 4c5a27a
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions apps/web/src/common/components/modals/UserAPIKeyModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { reactive, watch } from 'vue';
import yaml from 'js-yaml';
import {
PIconModal, PI, PPaneLayout, PDivider, PCollapsibleToggle, PButton, PLink, PTextEditor,
PIconModal, PI, PPaneLayout, PDivider, PCollapsibleToggle, PButton, PLink, PCodeEditor,
} from '@cloudforet/mirinae';
import { ACTION_ICON } from '@cloudforet/mirinae/src/navigation/link/type';
Expand Down Expand Up @@ -124,7 +124,7 @@ watch(() => props.visible, async (visible) => {
>
{{ state.isAPICollapsed ? $t('IDENTITY.USER.API_KEY.SHOW') : $t('IDENTITY.USER.API_KEY.HIDE') }}
</p-collapsible-toggle>
<p-text-editor v-if="!state.isAPICollapsed"
<p-code-editor v-if="!state.isAPICollapsed"
class="m-4"
:code="state.clientSecretCode"
folded
Expand Down Expand Up @@ -168,7 +168,7 @@ watch(() => props.visible, async (visible) => {
>
{{ state.isSpacectlCollapsed ? $t('IDENTITY.USER.API_KEY.SHOW') : $t('IDENTITY.USER.API_KEY.HIDE') }}
</p-collapsible-toggle>
<p-text-editor v-if="!state.isSpacectlCollapsed"
<p-code-editor v-if="!state.isSpacectlCollapsed"
class="m-4"
:code="state.yamlItem"
folded
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { QueryHelper } from '@cloudforet/core-lib/query';
import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
import { ApiQueryHelper } from '@cloudforet/core-lib/space-connector/helper';
import {
PButton, PButtonModal, PI, PTextEditor, PToolbox, PEmpty,
PButton, PButtonModal, PI, PCodeEditor, PToolbox, PEmpty,
} from '@cloudforet/mirinae';
import type { ListResponse } from '@/schema/_common/api-verbs/list';
Expand Down Expand Up @@ -154,7 +154,7 @@ const onCopyClick = () => {
>
<template #body>
<div class="content-wrapper">
<p-text-editor :code="state.selectedItem"
<p-code-editor :code="state.selectedItem"
class="code-block"
read-only
folded
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useRoute, useRouter } from 'vue-router/composables';
import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
import {
PFieldGroup, PTextInput, PTextEditor, PButton, POverlayLayout,
PFieldGroup, PTextInput, PCodeEditor, PButton, POverlayLayout,
} from '@cloudforet/mirinae';
Expand Down Expand Up @@ -229,7 +229,7 @@ watch(() => metricExplorerPageState.showMetricQueryFormSidebar, (visible) => {
:label="$t('INVENTORY.METRIC_EXPLORER.CUSTOM_METRIC.QUERY_OPTION')"
required
>
<p-text-editor :code="code"
<p-code-editor :code="code"
:read-only="metricExplorerPageState.metricQueryFormMode === 'VIEW'"
@update:code="setForm('code', $event)"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { reactive } from 'vue';
import type { TranslateResult } from 'vue-i18n';
import { PButton, PTextEditor, PTextHighlighting } from '@cloudforet/mirinae';
import { PButton, PCodeEditor, PTextHighlighting } from '@cloudforet/mirinae';
import { copyAnyData } from '@/lib/helper/copy-helper';
Expand Down Expand Up @@ -64,7 +64,7 @@ const handleClickCopyButton = (script: any) => {
<div class="script-wrapper"
:style="{'height': props.scriptHeight}"
>
<p-text-editor read-only
<p-code-editor read-only
:code="props.script"
:options="state.options"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
PButton,
PI,
PButtonModal,
PTextEditor,
PCodeEditor,
PTooltip,
PStatus,
PDivider,
Expand Down Expand Up @@ -384,7 +384,7 @@ watch(() => state.trustedAccountId, async (ta) => {
@confirm="handleCloseErrorModal"
>
<template #body>
<p-text-editor :code="state.lastSyncJob?.error_message" />
<p-code-editor :code="state.lastSyncJob?.error_message" />
</template>
<template #footer-extra>
{{ $t('MANAGEMENT.COLLECTOR_HISTORY.JOB.FINISHED') }}: {{ dayjs(state.lastSyncJob.finished_at).tz(state.timezone).format('YYYY-MM-DD HH:mm:ss') }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { isEmpty } from 'lodash';
import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
import { ApiQueryHelper } from '@cloudforet/core-lib/space-connector/helper';
import {
PFieldGroup, PRadio, PTextEditor, PSelectDropdown, PLink, PCopyButton, PI, PTab, PJsonSchemaForm,
PFieldGroup, PRadio, PCodeEditor, PSelectDropdown, PLink, PCopyButton, PI, PTab, PJsonSchemaForm,
} from '@cloudforet/mirinae';
import { ACTION_ICON } from '@cloudforet/mirinae/src/navigation/link/type';
import type { SelectDropdownMenuItem } from '@cloudforet/mirinae/types/controls/dropdown/select-dropdown/type';
Expand Down Expand Up @@ -383,7 +383,7 @@ watch([() => storeState.secretSchema, () => state.isTrustedAccount], () => {
:invalid="!checkJsonStringAvailable(formState.credentialJson)"
:invalid-text="$t('IDENTITY.SERVICE_ACCOUNT.ADD.JSON_INVALID')"
>
<p-text-editor :code.sync="formState.credentialJson"
<p-code-editor :code.sync="formState.credentialJson"
:disable-auto-reformat="true"
/>
</p-field-group>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { TranslateResult } from 'vue-i18n';
import dayjs from 'dayjs';
import {
PButtonModal, PTextEditor, PFieldTitle, PToggleButton, PTextInput, PDatetimePicker, PScopedNotification,
PButtonModal, PCodeEditor, PFieldTitle, PToggleButton, PTextInput, PDatetimePicker, PScopedNotification,
} from '@cloudforet/mirinae';
import { i18n } from '@/translations';
Expand Down Expand Up @@ -208,7 +208,7 @@ const handleConfirmButton = async () => {
{{ props.selectedJobItem.error_code }}
</span>
</p>
<p-text-editor read-only
<p-code-editor read-only
:code="props.selectedJobItem.error_message"
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { computed, reactive, watch } from 'vue';
import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
import {
PButtonModal, PTextEditor, PButton,
PButtonModal, PCodeEditor, PButton,
} from '@cloudforet/mirinae';
import type { ListResponse } from '@/schema/_common/api-verbs/list';
Expand Down Expand Up @@ -120,7 +120,7 @@ watch(() => props.visible, async (visible) => {
>
<template #body>
<div class="code-wrapper">
<p-text-editor :code="state.sharedDashboard"
<p-code-editor :code="state.sharedDashboard"
readonly
folded
:loading="state.loading"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { find } from 'lodash';
import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
import {
PHeading, PI, PTextEditor, PEmpty, PDataTable,
PHeading, PI, PCodeEditor, PEmpty, PDataTable,
} from '@cloudforet/mirinae';
import type { DataTableField } from '@cloudforet/mirinae/types/data-display/tables/data-table/type';
Expand Down Expand Up @@ -262,7 +262,7 @@ watch(() => state.selectedRole.role_id, async (roleId) => {
</span>
</div>
<div v-else>
<p-text-editor :code="state.permissionsCode"
<p-code-editor :code="state.permissionsCode"
class="content-wrapper"
read-only
/>
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/services/iam/components/RoleUpdateFormPolicy.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { computed, reactive, watch } from 'vue';
import type { TranslateResult } from 'vue-i18n';
import {
PHeading, PI, PRadioGroup, PRadio, PTextEditor,
PHeading, PI, PRadioGroup, PRadio, PCodeEditor,
} from '@cloudforet/mirinae';
import { ROLE_TYPE } from '@/schema/identity/role/constant';
Expand Down Expand Up @@ -97,7 +97,7 @@ watch(() => props.initialPermissions, (value) => {
{{ $t('IAM.ROLE.FORM.DEFAULT_API_POLICY_HELP_TEXT') }}
</span>
</div>
<p-text-editor v-else
<p-code-editor v-else
:code="state.code"
class="content-wrapper"
@update:code="handleCodeUpdate"
Expand Down

0 comments on commit 4c5a27a

Please sign in to comment.