Skip to content

Commit

Permalink
Merge branch 'feature-workspace-group' into dev
Browse files Browse the repository at this point in the history
Signed-off-by: sulmo <[email protected]>
  • Loading branch information
sulmoJ committed Oct 7, 2024
2 parents 2392c12 + 205e013 commit ad9c987
Show file tree
Hide file tree
Showing 8 changed files with 145 additions and 90 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,7 @@ export const getWidgetBasedOnDate = (granularity: string, end?: string): string
const _dateFormat = getDateFormat(granularity);
if (end) {
if (granularity === 'DAILY') {
const now = dayjs.utc();
const endDate = dayjs.utc(end);

if (now.isSame(endDate, 'month')) {
return now.format(_dateFormat);
}
return endDate.endOf('month').format(_dateFormat);
}
return dayjs.utc(end).format(_dateFormat);
Expand Down
8 changes: 7 additions & 1 deletion apps/web/src/common/modules/widgets/_widgets/table/Table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
defineExpose, reactive, computed, watch, onMounted,
} from 'vue';
import dayjs from 'dayjs';
import { flatMap, map, uniq } from 'lodash';
import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
Expand Down Expand Up @@ -97,7 +98,12 @@ const state = reactive({
if (isDateField(state.tableDataField) || state.groupByField?.some((groupBy) => Object.values(DATE_FIELD).includes(groupBy))) {
if (state.granularity === GRANULARITY.YEARLY) subtract = 3;
if (state.granularity === GRANULARITY.MONTHLY) subtract = 12;
if (state.granularity === GRANULARITY.DAILY) subtract = 30;
if (state.granularity === GRANULARITY.DAILY) {
// if basedOnDate is end of month, need to assign date count of that month
const endOfMonth = dayjs.utc(state.basedOnDate).endOf('month').date();
if (dayjs.utc(state.basedOnDate).date() === endOfMonth) subtract = endOfMonth;
else subtract = 30;
}
}
const [start, end] = getWidgetDateRange(state.granularity, state.basedOnDate, subtract);
return { start, end };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,21 +173,23 @@ watch([() => state.menuIds, () => state.isSelectDropdownVisible], async (menuIds
<div :id="`w-${item.name}`"
class="label"
>
<workspace-logo-icon :text="item?.label || ''"
:theme="item?.tags?.theme"
size="xs"
/>
<p-tooltip v-if="state.isEllipsisMap[`w-${item.name}`]"
position="bottom"
:contents="item.label"
:class="{'label-text': true, 'group-exist': !item?.workspace_group_id}"
>
<span>{{ item.label }}</span>
</p-tooltip>
<span v-else
:class="{'label-text': true, 'group-exist': !item?.workspace_group_id}"
>{{ item.label }}</span>
<span>{{ state.workspaceGroups[item.workspace_group_id]?.label }}</span>
<span class="flex gap-2">
<workspace-logo-icon :text="item?.label || ''"
:theme="item?.tags?.theme"
size="xs"
/>
<p-tooltip v-if="state.isEllipsisMap[`w-${item.name}`]"
position="bottom"
:contents="item.label"
:class="{'label-text': true, 'group-exist': !item?.workspace_group_id}"
>
<span>{{ item.label }}</span>
</p-tooltip>
<span v-else
:class="{'label-text': true, 'group-exist': !item?.workspace_group_id}"
>{{ item.label }}</span>
</span>
<span class="workspace-group-label">{{ state.workspaceGroups[item.workspace_group_id]?.label }}</span>
</div>
</div>
</template>
Expand All @@ -203,19 +205,24 @@ watch([() => state.menuIds, () => state.isSelectDropdownVisible], async (menuIds
<style lang="postcss" scoped>
.workspace-select-dropdown {
.menu-item-wrapper {
@apply flex justify-between;
max-width: 100%;
.label {
@apply flex items-center gap-2;
}
.label-text {
@apply truncate;
max-width: 13.125rem;
}
.label-text.group-exist {
max-width: 36.875rem;
@apply flex items-center gap-2 justify-between;
max-width: 25.875rem;
.label-text {
@apply truncate;
max-width: 12.5rem;
}
.label-text.group-exist {
max-width: 36.875rem;
}
.workspace-group-label {
@apply text-gray-500;
}
}
&.is-dormant {
.label-text {
max-width: 31.25rem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ const {
const resetState = () => {
roleSelectedItems.value = [];
userDropdownState.menuList = [];
userDropdownState.searchText = '';
userDropdownState.selectedItems = [];
};
const handleConfirm = async () => {
Expand All @@ -99,6 +101,7 @@ const handleConfirm = async () => {
const handleCloseModal = () => {
state.proxyVisible = false;
resetState();
};
const handleRemoveUser = (item: string) => {
Expand Down
Loading

0 comments on commit ad9c987

Please sign in to comment.