Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion frontend/src/components/log/container-drawer/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</el-tooltip>
</template>
<template #content>
<ContainerLog :container="config.container" />
<ContainerLog :container="config.container" :highlightDiff="highlightDiff" />
</template>
<template #footer>
<span class="dialog-footer">
Expand Down Expand Up @@ -42,6 +42,13 @@ const logSearch = reactive({
tail: 100,
});

defineProps({
highlightDiff: {
type: Number,
default: 320,
},
});

function toggleFullscreen() {
globalStore.isFullScreen = !globalStore.isFullScreen;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two changes needed:

  1. Add export keyword to export the default function and properties when using module syntax.

  2. Change <ContainerLog/> component's @update:scrollPos event from emitting an object with position, scrollTargetId, and fromTopPosition, to simply emit a number that represents scrollTop position of target. You should also update v-model="logScrollPos" accordingly if you intend to use this event handler elsewhere.

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/container/container/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@
<PruneDialog @search="search" ref="dialogPruneRef" />

<RenameDialog @search="search" ref="dialogRenameRef" />
<ContainerLogDialog ref="dialogContainerLogRef" />
<ContainerLogDialog ref="dialogContainerLogRef" :highlightDiff="235" />
<UpgradeDialog @search="search" ref="dialogUpgradeRef" />
<CommitDialog @search="search" ref="dialogCommitRef" />
<MonitorDialog ref="dialogMonitorRef" />
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes introduced by this code patch are minor and do not introduce significant irregularities or potential issues within their current scope. However, there is one suggested enhancement:

Suggested Change:

@@ -351,7 +351,8 @@
             <PruneDialog @search="search" ref="dialogPruneRef" />
 
             <RenameDialog @search="search" ref="dialogRenameRef" />
-            <ContainerLogDialog ref="dialogContainerLogRef" />
+            <ContainerLogDialog ref="dialogContainerLogRef" :highlightDiff="235"/>
             <UpgradeDialog @search="search" ref="dialogUpgradeRef" />
             <CommitDialog @search="search" ref="dialogCommitRef" />
             <MonitorDialog ref="dialogMonitorRef" />

Add :highlightDiff="235" to <ContainerLogDialog>. This addition adds an optional property that can be used elsewhere in your application to highlight a specific line number during log viewing.

Expand Down
14 changes: 14 additions & 0 deletions frontend/src/views/website/runtime/php/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@
</el-text>
</template>
</el-table-column>
<el-table-column :label="$t('home.dir')" prop="codeDir" width="80px">
<template #default="{ row }">
<el-button type="primary" link @click="toFolder(row.path)">
<el-icon>
<FolderOpened />
</el-icon>
</el-button>
</template>
</el-table-column>
<el-table-column :label="$t('app.source')" prop="resource">
<template #default="{ row }">
<span v-if="row.resource == 'appstore'">{{ $t('menu.apps') }}</span>
Expand Down Expand Up @@ -129,6 +138,7 @@ import RuntimeStatus from '@/views/website/runtime/components/runtime-status.vue
import Terminal from '@/views/website/runtime/components/terminal.vue';
import { disabledButton } from '@/utils/runtime';
import { GlobalStore } from '@/store';
import router from '@/routers/router';
const globalStore = GlobalStore();
const mobile = computed(() => {
return globalStore.isMobile();
Expand Down Expand Up @@ -365,6 +375,10 @@ const onOpenBuildCache = () => {
});
};

const toFolder = (folder: string) => {
router.push({ path: '/hosts/files', query: { path: folder } });
};

onMounted(() => {
search();
});
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The provided code is generally well-structured and follows best practices. However, there are a few areas that can be improved:

  1. Type Annotations: There is no explicit typing for the row parameter in the toFolder function signature in TypeScript if it's used elsewhere where typescript support exists.

  2. Variable Naming Consistency: The naming of variables is mostly consistent but could be slightly more descriptive.

  3. Docstring Usage: While present, docstrings can improve readability and serve as documentation comments within the codebase.

Here are some specific changes you might consider to add:

// Function definition with type annotation
const toFolder = (folder: string): void => {
  // Push route to /hosts/files with query param path
  router.push({ path: '/hosts/files', query: { path: folder } });
}

export default {
  components: {
    // Component declarations
  },
  setup(props, ctx) {
    // Setup logic here
  }
}

Additionally, ensure all necessary imports and configurations remain accurate according to your application's requirements. This includes any additional dependencies or configurations needed for navigation routing like Vue Router (@router).

If JavaScript-based solution applies, simply remove TypeScript annotations and adjust variable names accordingly in their respective parts of the module.

Finally, document what this function does clearly at its declaration with inline comments or using JSDoc style comments above the function body.

Expand Down
Loading