Skip to content

Commit

Permalink
ok
Browse files Browse the repository at this point in the history
  • Loading branch information
HUAHUAI23 committed Jul 20, 2024
1 parent c3dc4b3 commit d40f887
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,13 @@ export class DedicatedDatabaseTaskService {
const waitingTime = Date.now() - data.updatedAt.getTime()

if (!manifest || manifest.spec.componentSpecs[0].replicas === 0) {
await this.dbService.applyDeployManifest(region, user, appid)
try {
await this.dbService.applyDeployManifest(region, user, appid)
} catch (error) {
this.logger.error(
`apply dedicated database ${appid} yaml error:\n ${error.message}`,
)
}
await this.relock(appid, waitingTime)
return
}
Expand Down Expand Up @@ -329,7 +335,17 @@ export class DedicatedDatabaseTaskService {
await this.dbService.getKubeBlockOpsRequestManifest(region, user, appid)

if (!OpsRequestManifest) {
await this.dbService.applyKubeBlockOpsRequestManifest(region, user, appid)
try {
await this.dbService.applyKubeBlockOpsRequestManifest(
region,
user,
appid,
)
} catch (error) {
this.logger.error(
`apply dedicated database restart ${appid} yaml error:\n ${error.message}`,
)
}
await this.relock(appid, waitingTime)
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,22 +82,22 @@ const AddDependenceModal = () => {

const addPackageMutation = useAddPackageMutation(() => {
onClose();
globalStore.updateCurrentApp(
globalStore.currentApp!,
globalStore.currentApp!.state === APP_STATUS.Stopped
? APP_STATUS.Running
: APP_STATUS.Restarting,
);
if (globalStore.currentApp!.state === APP_STATUS.Stopped) {
globalStore.updateCurrentApp(globalStore.currentApp!, APP_STATUS.Running);
}
if (globalStore.currentApp.state === APP_STATUS.Running) {
globalStore.updateCurrentApp(globalStore.currentApp!, APP_STATUS.Restarting, true);
}
});

const editPackageMutation = useEditPackageMutation(() => {
onClose();
globalStore.updateCurrentApp(
globalStore.currentApp!,
globalStore.currentApp!.state === APP_STATUS.Stopped
? APP_STATUS.Running
: APP_STATUS.Restarting,
);
if (globalStore.currentApp!.state === APP_STATUS.Stopped) {
globalStore.updateCurrentApp(globalStore.currentApp!, APP_STATUS.Running);
}
if (globalStore.currentApp.state === APP_STATUS.Running) {
globalStore.updateCurrentApp(globalStore.currentApp!, APP_STATUS.Restarting, true);
}
});

const packageSearchQuery = usePackageSearchQuery(name, (data) => {
Expand Down
12 changes: 6 additions & 6 deletions web/src/pages/app/functions/mods/DependencePanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ export default function DependenceList() {
const globalStore = useGlobalStore((state: State) => state);

const delPackageMutation = useDelPackageMutation(() => {
globalStore.updateCurrentApp(
globalStore.currentApp!,
globalStore.currentApp!.state === APP_STATUS.Stopped
? APP_STATUS.Running
: APP_STATUS.Restarting,
);
if (globalStore.currentApp!.state === APP_STATUS.Stopped) {
globalStore.updateCurrentApp(globalStore.currentApp!, APP_STATUS.Running);
}
if (globalStore.currentApp.state === APP_STATUS.Running) {
globalStore.updateCurrentApp(globalStore.currentApp!, APP_STATUS.Restarting, true);
}
});

const { t } = useTranslation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,20 @@ const UseTemplateModal = (props: { children: any; templateId: string; packageLis
});

if (isAnyPackageNotInDependencyList && packageList.length > 0) {
updateAppStateMutation.mutate({
appid: appItem.appid,
state: appItem.phase === APP_STATUS.Stopped ? APP_STATUS.Running : APP_STATUS.Restarting,
});
if (appItem.phase === APP_STATUS.Stopped) {
updateAppStateMutation.mutate({
appid: appItem.appid,
state: APP_STATUS.Running,
});
}

if (appItem.phase === APP_STATUS.Running) {
updateAppStateMutation.mutate({
appid: appItem.appid,
state: APP_STATUS.Restarting,
onlyRuntimeFlag: true,
});
}
}

if (!res.error) {
Expand Down

0 comments on commit d40f887

Please sign in to comment.