Skip to content

Commit

Permalink
feat: change re-sync scenario (#5070)
Browse files Browse the repository at this point in the history
* feat: change re-sync scenario

Signed-off-by: NaYeong,Kim <[email protected]>

* feat: change re-sync scenario

Signed-off-by: NaYeong,Kim <[email protected]>

* chore: changed css

Signed-off-by: NaYeong,Kim <[email protected]>

---------

Signed-off-by: NaYeong,Kim <[email protected]>
  • Loading branch information
skdud4659 authored Nov 21, 2024
1 parent 2c8d968 commit c9b8486
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
PButtonModal, PTextEditor, PFieldTitle, PToggleButton, PTextInput, PDatetimePicker, PScopedNotification,
} from '@cloudforet/mirinae';
import { store } from '@/store';
import { i18n } from '@/translations';
import { useProxyValue } from '@/common/composables/proxy-state';
Expand Down Expand Up @@ -43,7 +42,6 @@ const emit = defineEmits<{(e: 'update:modal-visible'): void,
const storeState = reactive({
selectedDataSourceItem: computed<DataSourceItem>(() => dataSourcesPageGetters.selectedDataSourceItem),
jobList: computed<CostJobItem[]>(() => dataSourcesPageGetters.jobList),
timezone: computed<string>(() => store.state.user.timezone),
});
const state = reactive({
proxyVisible: useProxyValue('modalVisible', props, emit),
Expand Down Expand Up @@ -80,12 +78,6 @@ const state = reactive({
}
return false;
}),
diffInMinutes: computed<number>(() => {
const recentJobItem = storeState.jobList.filter((i) => i.status === 'IN_PROGRESS')[0];
const createdDate = dayjs.tz(recentJobItem.created_at, storeState.timezone);
const now = dayjs().tz(storeState.timezone);
return now.diff(createdDate, 'minute');
}),
hasInProgressItem: computed<boolean>(() => storeState.jobList.some((item) => item.status === 'IN_PROGRESS')),
});
Expand All @@ -108,7 +100,7 @@ const handleConfirmButton = async () => {
case 'RE-SYNC':
case 'RESTART':
if (state.hasInProgressItem && state.diffInMinutes <= 10) return;
if (state.hasInProgressItem) return;
await dataSourcesPageStore.fetchSyncDatasource({
start: state.toggleValue ? undefined : dayjs(state.startDates[0]).format('YYYY-MM'),
data_source_id: storeState.selectedDataSourceItem.data_source_id,
Expand Down Expand Up @@ -143,7 +135,7 @@ const handleConfirmButton = async () => {
backdrop
:loading="state.loading"
:disabled="state.modalValidation"
:hide-footer-close-button="props.modalType === 'RESTART' && state.hasInProgressItem && state.diffInMinutes <= 10"
:hide-footer-close-button="(props.modalType === 'RESTART' && state.hasInProgressItem) || props.modalType === 'ERROR'"
:theme-color="props.modalType === 'CANCEL' || props.modalType === 'RESTART' ? 'alert' : 'primary'"
:visible.sync="state.proxyVisible"
class="data-source-management-tab-data-collection-history-modal"
Expand All @@ -164,13 +156,7 @@ const handleConfirmButton = async () => {
<div v-else
class="content-inner"
>
<div v-if="state.diffInMinutes > 10">
<b class="desc-title">{{ $t('BILLING.COST_MANAGEMENT.DATA_SOURCES.RESTART_MODAL_DESC_1') }}</b>
<p>{{ $t('BILLING.COST_MANAGEMENT.DATA_SOURCES.RESTART_MODAL_DESC_2') }}</p>
</div>
<div v-else>
<p>{{ $t('BILLING.COST_MANAGEMENT.DATA_SOURCES.RESTART_MODAL_CANCEL_DESC') }}</p>
</div>
<p>{{ $t('BILLING.COST_MANAGEMENT.DATA_SOURCES.RESTART_MODAL_CANCEL_DESC') }}</p>
</div>
</p-scoped-notification>
</div>
Expand Down Expand Up @@ -234,8 +220,7 @@ const handleConfirmButton = async () => {
<span v-if="props.modalType === 'ERROR'">{{ $t('BILLING.COST_MANAGEMENT.DATA_SOURCES.ERROR_FOUND_OK') }}</span>
<span v-else-if="props.modalType === 'CANCEL'">{{ $t('BILLING.COST_MANAGEMENT.DATA_SOURCES.CANCEL_BUTTON') }}</span>
<span v-else-if="props.modalType === 'RESTART'
&& state.hasInProgressItem
&& state.diffInMinutes > 10"
&& !state.hasInProgressItem"
>
{{ $t('BILLING.COST_MANAGEMENT.DATA_SOURCES.RESTART_MODAL_BUTTON') }}
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,13 @@ const routerToWorkspaceUser = (isOpenModal: boolean) => {
}
}
/* custom design-system component - p-heading-layout */
:deep(.p-heading-layout) {
.extra-container {
margin-top: 0;
}
}
@screen mobile {
.invite-user-button, .create-app-button {
@apply hidden;
Expand Down

0 comments on commit c9b8486

Please sign in to comment.