Skip to content

Commit

Permalink
Merge pull request #5077 from cloudforet-io/feature-datasource-feedback
Browse files Browse the repository at this point in the history
feat: apply datasource feedback
  • Loading branch information
skdud4659 authored Nov 22, 2024
2 parents ad8435c + d559490 commit eca7c1f
Show file tree
Hide file tree
Showing 33 changed files with 1,393 additions and 622 deletions.
2 changes: 1 addition & 1 deletion apps/web/src/common/modules/navigations/gnb/GNBToolbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const state = reactive({
routes.push({
name: i18n.t('MENU.CONSOLE_HOME'),
to: {
name: LANDING_ROUTE._NAME,
name: LANDING_ROUTE.DOMAIN._NAME,
},
});
} else if (!storeState.isAdminMode && storeState.currentWorkspaceId) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import Vue, {
import {
computed, onMounted, reactive, ref, watch,
} from 'vue';
import type { Location } from 'vue-router';
Expand All @@ -8,20 +8,18 @@ import { useRouter } from 'vue-router/composables';
import { clone, sortBy } from 'lodash';
import {
PSelectDropdown, PTooltip, PI, PButton, PDivider, PTextHighlighting, PEmpty,
PSelectDropdown, PTooltip, PI, PButton, PTextHighlighting, PEmpty,
} from '@cloudforet/mirinae';
import type { MenuItem } from '@cloudforet/mirinae/src/controls/context-menu/type';
import { CONTEXT_MENU_TYPE } from '@cloudforet/mirinae/src/controls/context-menu/type';
import type { WorkspaceModel } from '@/schema/identity/workspace/model';
import { store } from '@/store';
import { i18n } from '@/translations';
import { makeAdminRouteName } from '@/router/helpers/route-helper';
import { useAppContextStore } from '@/store/app-context/app-context-store';
import { useUserWorkspaceStore } from '@/store/app-context/workspace/user-workspace-store';
import type { ReferenceData } from '@/lib/helper/config-data-helper';
import { convertWorkspaceConfigToReferenceData } from '@/lib/helper/config-data-helper';
import type { MenuId } from '@/lib/menu/config';
import { MENU_ID } from '@/lib/menu/config';
Expand All @@ -37,7 +35,6 @@ import { RECENT_TYPE } from '@/common/modules/navigations/type';
import { gray, violet } from '@/styles/colors';
import { ADVANCED_ROUTE } from '@/services/advanced/routes/route-constant';
import { LANDING_ROUTE } from '@/services/landing/routes/route-constant';
const PAGE_SIZE = 9;
Expand All @@ -62,18 +59,16 @@ const router = useRouter();
const selectDropdownRef = ref<PSelectDropdown|null>(null);
const storeState = reactive({
isDomainAdmin: computed(() => store.getters['user/isDomainAdmin']),
workspaceList: computed<WorkspaceModel[]>(() => workspaceStoreGetters.workspaceList),
selectedWorkspace: computed<WorkspaceModel|undefined>(() => workspaceStoreGetters.currentWorkspace),
currentWorkspaceId: computed<string|undefined>(() => userWorkspaceStore.getters.currentWorkspaceId),
favoriteItems: computed<FavoriteItem[]>(() => {
favoriteItems: computed<ReferenceData[]>(() => {
const sortedList = sortBy(favoriteGetters.workspaceItems, 'label');
return convertWorkspaceConfigToReferenceData(
sortedList ?? [],
storeState.workspaceList,
);
}),
isRootRoleReadonly: computed<boolean>(() => store.getters['user/isRootRoleReadonly']),
});
const state = reactive({
visibleSelectDropdown: false,
Expand All @@ -91,24 +86,6 @@ const selectWorkspace = (name: string): void => {
userWorkspaceStore.setCurrentWorkspace(workspaceId);
router.push({ name: MENU_INFO_MAP[targetMenuId].routeName, params: { workspaceId } }).catch(() => {});
};
const handleClickButton = (hasNoWorkspace?: string) => {
const selectedWorkspaceId = !hasNoWorkspace && storeState.selectedWorkspace?.workspace_id || '';
appContextStore.enterAdminMode();
router.push({
name: makeAdminRouteName(ADVANCED_ROUTE.WORKSPACES._NAME),
query: {
hasNoWorkspace,
selectedWorkspaceId: !hasNoWorkspace ? selectedWorkspaceId : undefined,
},
});
Vue.notify({
group: 'toastTopCenter',
type: 'info',
title: i18n.t('COMMON.GNB.ADMIN.SWITCH_ADMIN') as string,
duration: 2000,
speed: 1,
});
};
const formatMenuItems = (menuItems: WorkspaceModel[] = []): MenuItem[] => {
const result = menuItems.length > 0 ? [
{ type: CONTEXT_MENU_TYPE.header, name: 'workspace_header', label: `${i18n.t('COMMON.GNB.WORKSPACE.WORKSPACES')} (${storeState.workspaceList.length})` },
Expand Down Expand Up @@ -143,7 +120,7 @@ const filterStarredItems = (menuItems: FavoriteItem[] = []): MenuItem[] => {
};
const handleClickAllWorkspaceButton = () => {
router.push({
name: LANDING_ROUTE._NAME,
name: LANDING_ROUTE.WORKSPACE._NAME,
});
};
const checkFavoriteItem = (id: string) => {
Expand Down Expand Up @@ -197,7 +174,7 @@ onMounted(() => {
</div>
<p-select-dropdown v-if="!props.isAdminMode"
ref="selectDropdownRef"
:class="{'workspace-dropdown': true, 'is-domain-admin': storeState.isDomainAdmin}"
:class="{'workspace-dropdown': true}"
style-type="transparent"
menu-width="20rem"
:visible-menu.sync="state.visibleSelectDropdown"
Expand Down Expand Up @@ -280,28 +257,6 @@ onMounted(() => {
>
{{ $t("COMMON.GNB.WORKSPACE.VIEW_WORKSPACES") }}
</p-button>
<div v-if="storeState.isDomainAdmin && !storeState.isRootRoleReadonly"
class="workspace-toolbox"
>
<p-divider />
<p-button style-type="substitutive"
size="sm"
class="create-new-button tool"
icon-left="ic_plus_bold"
@click="handleClickButton('true')"
>
{{ $t("COMMON.GNB.WORKSPACE.CREATE_WORKSPACE") }}
</p-button>
<p-divider class="tools-divider" />
<p-button style-type="tertiary"
size="sm"
class="manage-button tool"
icon-left="ic_settings"
@click="handleClickButton()"
>
{{ $t("COMMON.GNB.WORKSPACE.MANAGE_WORKSPACE") }}
</p-button>
</div>
</div>
</template>
<template #no-data-area>
Expand Down Expand Up @@ -478,12 +433,6 @@ onMounted(() => {
}
}
&.is-domain-admin {
.workspace-toolbox-wrapper {
padding-bottom: 1rem;
}
}
.selected-workspace {
@apply text-label-lg text-gray-800 inline-block font-medium;
max-width: 16rem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const handleToggleAdminMode = throttle(async () => {
if (state.isAdminMode) {
await userWorkspaceStore.load();
if (state.workspaceList.length === 0) {
await router.push({ name: LANDING_ROUTE._NAME });
await router.push({ name: LANDING_ROUTE.DOMAIN._NAME });
return;
}
appContextStore.exitAdminMode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,7 @@ const handleClickGoToMyPage = () => {
};
const handleClickGoToConsoleHome = () => {
appContextStore.setGlobalGrantLoading(true);
router.push({
name: LANDING_ROUTE.DOMAIN._NAME,
params: {
force: 'true',
},
}).catch(() => {});
router.push({ name: LANDING_ROUTE.DOMAIN._NAME }).catch(() => {});
hideProfileMenu();
};
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/lib/site-initializer/api-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,8 @@ export const initApiClient = async (store, config) => {
token: existingRefreshToken,
scope: 'USER',
};
const reponse = await SpaceConnector.clientV2.identity.token.grant<TokenGrantParameters, TokenGrantModel>(grantRequest);
SpaceConnector.setToken(reponse.access_token);
const response = await SpaceConnector.clientV2.identity.token.grant<TokenGrantParameters, TokenGrantModel>(grantRequest);
SpaceConnector.setToken(response.access_token);
store.commit('user/setCurrentGrantInfo', { scope: 'USER' });
store.commit('user/setCurrentRoleInfo', undefined);
} catch (e) {
Expand Down
3 changes: 3 additions & 0 deletions apps/web/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ export class SpaceRouter {
} else { // Grant Process Not Needed
appContextStore.setGlobalGrantLoading(false);
next();
return;
}

next();
});

SpaceRouter.router.afterEach((to) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export interface CostDataSourceSyncParameters {
data_source_id: string;
start?: string;
no_preload_cache?: boolean;
}
3 changes: 3 additions & 0 deletions apps/web/src/schema/cost-analysis/job/api-verbs/cancel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface CostJobCancelParameters {
job_id: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const state = reactive({
currentWorkspaceId: computed(() => storeState.currentWorkspace?.workspace_id),
refinedUserItems: computed(() => workspacePageState.workspaceUsers.map((user) => ({
...user,
role: workspacePageStore.roleMap[workspacePageStore.roleBindingMap[user.role_binding_info.role_binding_id].role_id],
role: workspacePageStore.roleMap[workspacePageStore.roleBindingMap[user.role_binding_info.role_binding_id]?.role_id],
last_accessed_at: calculateTime(user?.last_accessed_at, workspacePageStore.timezone),
}))),
});
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/services/auth/pages/SignInPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const onSignIn = async (userId:string) => {
if (!lastAccessedWorkspaceId) {
await router.push({
name: LANDING_ROUTE._NAME,
name: LANDING_ROUTE.WORKSPACE._NAME,
});
return;
}
Expand Down
Loading

0 comments on commit eca7c1f

Please sign in to comment.