Skip to content

Commit

Permalink
chore: merge master into develop after 2.0.dev323 version tagging
Browse files Browse the repository at this point in the history
  • Loading branch information
admin-cloudforet committed Feb 24, 2025
2 parents 3dec916 + 91d45d3 commit c36bbd8
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 13 deletions.
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "web",
"version": "2.0.0-dev322",
"version": "2.0.0-dev323",
"private": true,
"description": "Cloudforet Console Web Application",
"author": "Cloudforet",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ onMounted(async () => {
/>
<p-button icon-left="ic_refresh"
style-type="secondary"
:loading="displayState.loading"
:disabled="storeState.allDataTableInvalid"
@click="handleClickAllApply"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const storeState = reactive({
/* Query */
const {
dashboard,
widgetList,
keys,
fetcher,
queryClient,
Expand Down Expand Up @@ -129,6 +130,10 @@ const state = reactive({
varsSnapshot: {} as DashboardVars,
dashboardOptionsSnapshot: {} as DashboardOptions,
isSharedDashboard: computed<boolean>(() => !!dashboard.value?.shared && !storeState.isAdminMode),
isDashboardLayoutChanged: computed(() => {
const _layouts = dashboard.value?.layouts || [];
return !isEqual(_layouts?.[0]?.widgets, widgetList.value.map((w) => w.widget_id));
}),
});
const {
Expand Down Expand Up @@ -168,7 +173,8 @@ const updateWidget = async () => {
if (result) {
state.fieldManager.updateOriginData(cloneDeep(result.options));
}
if (_isCreating) {
if (_isCreating || state.isDashboardLayoutChanged) {
const _layouts = cloneDeep(dashboard.value?.layouts || []);
if (_layouts.length) {
const _targetLayout = _layouts[0];
Expand All @@ -193,9 +199,10 @@ const updateWidget = async () => {
const { mutate: updateDashboard } = useMutation(
{
mutationFn: fetcher.updateDashboardFn,
onSuccess: () => {
onSuccess: (data) => {
const dashboardQueryKey = state.isPrivate ? keys.privateDashboardQueryKey : keys.publicDashboardQueryKey;
queryClient.invalidateQueries({ queryKey: dashboardQueryKey.value });
// queryClient.invalidateQueries({ queryKey: dashboardQueryKey.value });
queryClient.setQueryData(dashboardQueryKey.value, () => data);
},
},
);
Expand Down Expand Up @@ -257,7 +264,7 @@ watch(() => widget.value?.size, (widgetSize) => {
}, { immediate: true });
watch(() => state.mounted, async (mounted) => {
if (mounted) {
if (widget.value?.state === 'CREATING') {
if (widget.value?.state === 'CREATING' || state.isDashboardLayoutChanged) {
await updateWidget();
}
// await loadOverlayWidget();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ const handleSelectItem = (item: MenuItem) => {
style-type="tertiary-icon-button"
button-icon="ic_ellipsis-horizontal"
size="sm"
:menu="getControlMenuItems(props.dashboardId).value"
:menu="getControlMenuItems(props.dashboardId)"
:selected="[]"
use-fixed-menu-style
reset-selection-on-menu-close
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { toValue } from '@vueuse/core';
import type { ComputedRef } from 'vue';
import { reactive, computed } from 'vue';

Expand Down Expand Up @@ -73,6 +74,7 @@ export const useDashboardControlMenuItems = ({

const _isDeprecated = _dashboard.version === '1.0';
const _isDashboardManageable = _getDashboardManageable(_dashboard);

if (!_isDashboardManageable) {
if (_isDeprecated) return [];
return computed(() => ([
Expand Down Expand Up @@ -159,8 +161,8 @@ export const useDashboardControlMenuItems = ({
]));
};
const getControlMenuItems = (id: string): ComputedRef<MenuItem[]>|MenuItem[] => {
if (id.includes('folder')) return _getFolderControlMenuItems(id);
return _getDashboardControlMenuItems(id);
if (id.includes('folder')) return toValue(_getFolderControlMenuItems(id));
return toValue(_getDashboardControlMenuItems(id));
};

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ import WorkspaceVariableModel from '@/lib/variable-models/managed-model/resource

import { MANAGED_DASHBOARD_VARIABLES_SCHEMA } from '@/services/dashboards/constants/dashboard-managed-variables-schema';

const DEFAULT_REFRESH_INTERVAL = '5m';
// const DEFAULT_REFRESH_INTERVAL = '5m';
const DEFAULT_REFRESH_INTERVAL = 'off';
export const DASHBOARD_DEFAULT = Object.freeze<{ options: DashboardOptions }>({
options: {
date_range: {
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cloudforet-console",
"version": "2.0.0-dev322",
"version": "2.0.0-dev323",
"private": true,
"workspaces": [
"apps/*",
Expand Down

0 comments on commit c36bbd8

Please sign in to comment.