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
6 changes: 3 additions & 3 deletions agent/app/service/container_compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ func recreateCompose(content, path string) error {

func loadEnv(list []dto.ComposeInfo) []dto.ComposeInfo {
for i := 0; i < len(list); i++ {
envFilePath := path.Join(path.Dir(list[i].Path), "1panel.env")
envFilePath := path.Join(path.Dir(list[i].Path), ".env")
file, err := os.ReadFile(envFilePath)
if err != nil {
continue
Expand All @@ -424,7 +424,7 @@ func newComposeEnv(pathItem string, env []string) error {
if len(env) == 0 {
return nil
}
envFilePath := path.Join(path.Dir(pathItem), "1panel.env")
envFilePath := path.Join(path.Dir(pathItem), ".env")
file, err := os.OpenFile(envFilePath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, constant.FilePerm)
if err != nil {
global.LOG.Errorf("failed to create env file: %v", err)
Expand All @@ -438,6 +438,6 @@ func newComposeEnv(pathItem string, env []string) error {
return err
}
}
global.LOG.Infof("1panel.env file successfully created or updated with env variables in %s", envFilePath)
global.LOG.Infof(".env file successfully created or updated with env variables in %s", envFilePath)
return nil
}
79 changes: 79 additions & 0 deletions frontend/src/components/label/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<template>
<div>
<el-space wrap>
<div v-for="(env, index) in tmpLabels" :key="index">
<fu-read-write-switch write-trigger="onDblclick">
<template #read>
<el-button plain>
{{ env }}
<el-button
circle
plain
size="small"
type="danger"
class="float-right -mr-6 -mt-8"
icon="Close"
@click="remove(index)"
/>
</el-button>
</template>
<template #default="{ read }">
<el-input class="p-w-300" v-model="tmpLabels[index]" @blur="read" />
</template>
</fu-read-write-switch>
</div>
<el-input v-if="showAdd" v-model="labelItem">
<template #append>
<el-button icon="Check" @click="save()" />
<el-button icon="Close" @click="cancel()" />
</template>
</el-input>
<el-button plain icon="Plus" @click="add()" />
</el-space>
</div>
</template>

<script lang="ts" setup>
import { ref, onMounted } from 'vue';
const em = defineEmits(['update:labels']);

const tmpLabels = ref([]);
const labelItem = ref('');
const showAdd = ref(false);

const props = defineProps({
labels: { type: Array<string>, default: [] },
});
watch(
() => props.labels,
(newVal) => {
tmpLabels.value = newVal || [];
},
);
const add = () => {
showAdd.value = true;
labelItem.value = '';
};
const cancel = () => {
showAdd.value = false;
labelItem.value = '';
};
const save = () => {
if (labelItem.value && tmpLabels.value.indexOf(labelItem.value) === -1) {

Check warning on line 62 in frontend/src/components/label/index.vue

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use `.includes()`, rather than `.indexOf()`, when checking for existence.

See more on https://sonarcloud.io/project/issues?id=1Panel-dev_1Panel&issues=AZsB3KAVPnam5FEFghwz&open=AZsB3KAVPnam5FEFghwz&pullRequest=11274
tmpLabels.value.push(labelItem.value);
}
showAdd.value = false;
labelItem.value = '';
handleUpdate();
};
const remove = (index: number) => {
tmpLabels.value.splice(index, 1);
handleUpdate();
};
const handleUpdate = () => {
em('update:labels', tmpLabels.value);
};
onMounted(() => {
tmpLabels.value = props.labels || [];
});
</script>
5 changes: 3 additions & 2 deletions frontend/src/lang/modules/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -852,8 +852,6 @@ const message = {
privileged: 'Privileged',
privilegedHelper:
'Allow the container to perform certain privileged operations on the host, which may increase container risks. Use with caution!',
editComposeHelper:
'Note: Environment variables are saved to the 1panel.env file and need to be referenced via env_file in compose.\nVariables only take effect inside the container and do not participate in ${VAR} substitution in the compose file.',

upgradeHelper: 'Repository Name/Image Name: Image Version',
upgradeWarning2:
Expand Down Expand Up @@ -1008,6 +1006,9 @@ const message = {
composeOperatorHelper: '{1} operation will be performed on {0}. Do you want to continue?',
composeDownHelper:
'This will stop and remove all containers and networks under the {0} compose. Do you want to continue?',
composeEnvHelper1: 'Double-click to edit existing environment variables.',
composeEnvHelper2:
'This orchestration was created by the 1Panel App Store. Please modify environment variables in the installed applications.',

setting: 'Setting | Settings',
goSetting: 'Go to edit',
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/lang/modules/es-es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -856,8 +856,6 @@ const message = {
privileged: 'Privilegiado',
privilegedHelper:
'Permite que el contenedor realice ciertas operaciones privilegiadas en el host, lo que puede aumentar los riesgos. ¡Úselo con precaución!',
editComposeHelper:
'Nota: Las variables de entorno se guardan en el archivo 1panel.env y deben ser referenciadas mediante env_file en compose.\nLas variables solo tienen efecto dentro del contenedor y no participan en la sustitución ${VAR} en el archivo compose.',
upgradeHelper: 'Nombre de repositorio/imagen: versión de la imagen',
upgradeWarning2:
'La operación de actualización requiere reconstruir el contenedor, cualquier dato no persistente se perderá. ¿Desea continuar?',
Expand Down Expand Up @@ -1012,6 +1010,10 @@ const message = {
composeOperatorHelper: 'La operación {1} se realizará en {0}. ¿Desea continuar?',
composeDownHelper:
'Esto detendrá y eliminará todos los contenedores y redes bajo la composición {0}. ¿Desea continuar?',
composeEnvHelper1: 'Haga doble clic para editar las variables de entorno existentes.',
composeEnvHelper2:
'Esta orquestación fue creada por la Tienda de Aplicaciones 1Panel. Modifique las variables de entorno en las aplicaciones instaladas.',

setting: 'Configuración | Configuraciones',
goSetting: 'Ir a editar',
operatorStatusHelper: 'Esto "{0}" el servicio Docker. ¿Desea continuar?',
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/lang/modules/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,9 @@ const message = {
composeOperatorHelper: '{1}操作は{0}で実行されます。続けたいですか?',
composeDownHelper:
'これにより、{0}構成の下のすべてのコンテナとネットワークが停止して削除されます。続けたいですか?',
composeEnvHelper1: '既存の環境変数を編集するにはダブルクリックしてください。',
composeEnvHelper2:
'このオーケストレーションは1Panelアプリストアで作成されました。インストール済みアプリケーションで環境変数を変更してください。',

setting: '設定|設定',
operatorStatusHelper: 'これは「{0}」Dockerサービスになります。続けたいですか?',
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/lang/modules/ko.ts
Original file line number Diff line number Diff line change
Expand Up @@ -827,8 +827,6 @@ const message = {
privileged: '특권 모드',
privilegedHelper:
'컨테이너가 호스트에서 특정 특권 작업을 수행할 수 있도록 허용합니다. 이는 보안 위험을 초래할 수 있으므로 주의해서 사용하십시오.',
editComposeHelper:
'참고: 환경 변수는 1panel.env 파일에 저장되며 compose에서 env_file을 통해 참조해야 합니다.\n변수는 컨테이너 내부에서만 유효하며 compose 파일의 ${VAR} 치환에 참여하지 않습니다.',
upgradeHelper: '레포지토리 이름/이미지 이름: 이미지 버전',
upgradeWarning2:
'업그레이드 작업은 컨테이너를 재빌드해야 하며, 비지속적인 데이터가 손실됩니다. 계속하시겠습니까?',
Expand Down Expand Up @@ -974,6 +972,9 @@ const message = {
composeOperatorHelper: '{1} 작업이 {0}에서 수행됩니다. 계속 하시겠습니까?',
composeDownHelper:
'이 작업은 {0} 컴포즈 아래의 모든 컨테이너와 네트워크를 중지하고 제거합니다. 계속 하시겠습니까?',
composeEnvHelper1: '기존 환경 변수를 편집하려면 더블 클릭하세요.',
composeEnvHelper2:
'이 오케스트레이션은 1Panel 앱 스토어에서 생성되었습니다. 설치된 애플리케이션에서 환경 변수를 수정하세요.',

setting: '설정 | 설정들',
operatorStatusHelper: '이 작업은 Docker 서비스를 "{0}" 합니다. 계속 하시겠습니까?',
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/lang/modules/ms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -846,8 +846,6 @@ const message = {
privileged: 'Privileged',
privilegedHelper:
'Benarkan kontena menjalankan operasi teristimewa tertentu pada hos, yang boleh meningkatkan risiko kontena. Gunakan dengan berhati-hati!',
editComposeHelper:
'Nota: Pembolehubah persekitaran disimpan ke fail 1panel.env dan perlu dirujuk melalui env_file dalam compose.\nPembolehubah hanya berkesan di dalam bekas dan tidak mengambil bahagian dalam penggantian ${VAR} dalam fail compose.',

upgradeHelper: 'Nama Repository/Nama Imej: Versi Imej',
upgradeWarning2:
Expand Down Expand Up @@ -1002,6 +1000,9 @@ const message = {
composeOperatorHelper: 'Operasi {1} akan dilakukan pada {0}. Adakah anda mahu meneruskan?',
composeDownHelper:
'Ini akan menghentikan dan menghapuskan semua kontena dan rangkaian di bawah komposisi {0}. Adakah anda mahu meneruskan?',
composeEnvHelper1: 'Klik dua kali untuk mengedit pembolehubah persekitaran sedia ada.',
composeEnvHelper2:
'Penyelarasan ini dibuat oleh Kedai Apl 1Panel. Sila ubah pembolehubah persekitaran dalam aplikasi yang dipasang.',

setting: 'Tetapan | Tetapan',
operatorStatusHelper: 'Ini akan "{0}" perkhidmatan Docker. Adakah anda mahu meneruskan?',
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/lang/modules/pt-br.ts
Original file line number Diff line number Diff line change
Expand Up @@ -844,8 +844,6 @@ const message = {
privileged: 'Privilegiado',
privilegedHelper:
'Permite que o contêiner execute determinadas operações privilegiadas no host, o que pode aumentar os riscos do contêiner. Use com cautela!',
editComposeHelper:
'Nota: As variáveis de ambiente são salvas no arquivo 1panel.env e precisam ser referenciadas via env_file no compose.\nAs variáveis só têm efeito dentro do contêiner e não participam da substituição ${VAR} no arquivo compose.',
upgradeHelper: 'Nome do Repositório/Nome da Imagem: Versão da Imagem',
upgradeWarning2:
'A operação de upgrade requer a reconstrução do contêiner, e qualquer dado não persistente será perdido. Deseja continuar?',
Expand Down Expand Up @@ -999,6 +997,9 @@ const message = {
composeOperatorHelper: 'A operação {1} será realizada no {0}. Deseja continuar?',
composeDownHelper:
'Isso irá parar e remover todos os containers e redes sob a composição {0}. Deseja continuar?',
composeEnvHelper1: 'Clique duas vezes para editar variáveis de ambiente existentes.',
composeEnvHelper2:
'Esta orquestração foi criada pela Loja de Aplicativos 1Panel. Modifique as variáveis de ambiente nos aplicativos instalados.',

setting: 'Configuração | Configurações',
operatorStatusHelper: 'Isso irá "{0}" o serviço Docker. Deseja continuar?',
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/lang/modules/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -840,8 +840,6 @@ const message = {
privileged: 'Привилегированный',
privilegedHelper:
'Разрешить контейнеру выполнять определенные привилегированные операции на хосте, что может повысить риски контейнера. Используйте с осторожностью!',
editComposeHelper:
'Примечание: Переменные среды сохраняются в файл 1panel.env и должны быть указаны через env_file в compose.\nПеременные действуют только внутри контейнера и не участвуют в замене ${VAR} в файле compose.',

upgradeHelper: 'Имя репозитория/Имя образа: Версия образа',
upgradeWarning2:
Expand Down Expand Up @@ -996,6 +994,9 @@ const message = {
composeDetailHelper: 'Compose создан вне 1Panel. Операции запуска и остановки не поддерживаются.',
composeOperatorHelper: 'Операция {1} будет выполнена для {0}. Хотите продолжить?',
composeDownHelper: 'Это остановит и удалит все контейнеры и сети под compose {0}. Хотите продолжить?',
composeEnvHelper1: 'Дважды щелкните, чтобы редактировать существующие переменные среды.',
composeEnvHelper2:
'Эта оркестрация создана Магазином приложений 1Panel. Измените переменные среды в установленных приложениях.',

setting: 'Настройка | Настройки',
operatorStatusHelper: 'Это выполнит "{0}" службы Docker. Хотите продолжить?',
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/lang/modules/tr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -860,8 +860,6 @@ const message = {
privileged: 'Ayrıcalıklı',
privilegedHelper:
'Konteynerin ana bilgisayarda belirli ayrıcalıklı işlemler gerçekleştirmesine izin verir, bu da konteyner risklerini artırabilir. Dikkatli kullanın!',
editComposeHelper:
'Not: Ortam değişkenleri 1panel.env dosyasına kaydedilir ve compose içinde env_file aracılığıyla referans alınmalıdır.\nDeğişkenler yalnızca konteyner içinde geçerlidir ve compose dosyasındaki ${VAR} değiştirmesine katılmaz.',

upgradeHelper: 'Depo Adı/İmaj Adı: İmaj Sürümü',
upgradeWarning2:
Expand Down Expand Up @@ -1019,6 +1017,9 @@ const message = {
composeOperatorHelper: '{0} üzerinde {1} işlemi gerçekleştirilecek. Devam etmek istiyor musunuz?',
composeDownHelper:
'Bu, {0} compose altındaki tüm konteynerleri ve ağları durduracak ve kaldıracaktır. Devam etmek istiyor musunuz?',
composeEnvHelper1: 'Mevcut ortam değişkenlerini düzenlemek için çift tıklayın.',
composeEnvHelper2:
'Bu düzenleme 1Panel Uygulama Mağazası tarafından oluşturuldu. Lütfen ortam değişkenlerini yüklü uygulamalarda değiştirin.',

setting: 'Ayar | Ayarlar',
goSetting: 'Düzenlemeye git',
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/lang/modules/zh-Hant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -813,8 +813,6 @@ const message = {
emptyUser: '為空時,將使用容器預設的使用者登入',
privileged: '特權模式',
privilegedHelper: '允許容器在主機上執行某些特權操作,可能會增加容器風險,請謹慎開啟!',
editComposeHelper:
'注意:環境變數儲存至 1panel.env 檔案,需在 compose 中透過 env_file 引用。\n變數僅在容器內部生效,不參與 compose 檔案的 ${VAR} 替換。',

upgradeHelper: '倉庫名稱/鏡像名稱:鏡像版本',
upgradeWarning2: '升級操作需要重建容器,任何未持久化的資料將會遺失,是否繼續?',
Expand Down Expand Up @@ -959,6 +957,8 @@ const message = {
composeDetailHelper: '該 compose 為 1Panel 編排外部建立。暫不支援啟停操作。',
composeOperatorHelper: '將對 {0} 進行 {1} 操作,是否繼續?',
composeDownHelper: '將停止並刪除 {0} 編排下所有容器及網路,是否繼續?',
composeEnvHelper1: '雙擊以編輯現有環境變數。',
composeEnvHelper2: '該編排為 1Panel 應用商店建立,請在已安裝應用中修改環境變數。',

setting: '配置',
goSetting: '去修改',
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/lang/modules/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -814,8 +814,6 @@ const message = {
emptyUser: '为空时,将使用容器默认的用户登录',
privileged: '特权模式',
privilegedHelper: '允许容器在主机上执行某些特权操作,可能会增加容器风险,谨慎开启!',
editComposeHelper:
'注意:环境变量保存至 1panel.env 文件,需在 compose 中通过 env_file 引用。\n变量仅在容器内部生效,不参与 compose 文件的 ${VAR} 替换。',

upgradeHelper: '仓库名称/镜像名称:镜像版本',
upgradeWarning2: '升级操作需要重建容器,任何未持久化的数据将会丢失,是否继续?',
Expand Down Expand Up @@ -961,6 +959,8 @@ const message = {
composeDetailHelper: '该 compose 为 1Panel 编排外部创建。暂不支持启停操作。',
composeOperatorHelper: '将对 {0} 进行 {1} 操作,是否继续?',
composeDownHelper: '将停止并删除 {0} 编排下所有容器及网络,是否继续?',
composeEnvHelper1: '双击以编辑已有环境变量。',
composeEnvHelper2: '该编排为 1Panel 应用商店创建,请在已安装应用中修改环境变量。',

setting: '配置',
goSetting: '去修改',
Expand Down
Loading
Loading