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
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ const useStyles = makeStyles((theme) => ({
content: {
flex: 1,
},
env: {
color: theme.palette.text.secondary,
marginLeft: theme.spacing(1),
},
appSyncState: {
marginRight: theme.spacing(1),
},
Expand Down
10 changes: 2 additions & 8 deletions pkg/app/web/src/components/application-form/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ export const validationSchema = yup.object().shape({

export interface ApplicationFormValue {
name: string;
env: string;
kind: ApplicationKind;
pipedId: string;
repoPath: string;
Expand All @@ -317,7 +316,6 @@ export type ApplicationFormProps = FormikProps<ApplicationFormValue> & {

export const emptyFormValues: ApplicationFormValue = {
name: "",
env: "",
kind: ApplicationKind.KUBERNETES,
pipedId: "",
repoPath: "",
Expand Down Expand Up @@ -384,13 +382,10 @@ export const ApplicationForm: FC<ApplicationFormProps> = memo(
label="Kind"
value={`${values.kind}`}
items={Object.keys(APPLICATION_KIND_TEXT).map((key) => ({
name:
APPLICATION_KIND_TEXT[(key as unknown) as ApplicationKind],
name: APPLICATION_KIND_TEXT[(key as unknown) as ApplicationKind],
value: key,
}))}
onChange={({ value }) =>
setFieldValue("kind", parseInt(value, 10))
}
onChange={({ value }) => setFieldValue("kind", parseInt(value, 10))}
disabled={isSubmitting || disableApplicationInfo}
/>

Expand All @@ -404,7 +399,6 @@ export const ApplicationForm: FC<ApplicationFormProps> = memo(
...emptyFormValues,
name: values.name,
kind: values.kind,
env: values.env,
pipedId: value,
});
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ const useStyles = makeStyles(() => ({
paddingLeft: 2,
marginBottom: -4,
},
environment: {
minWidth: 150,
},
}));

const PAGER_ROWS_PER_PAGE = [20, 50, { label: "All", value: -1 }];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export const EditApplicationDrawer: FC<EditApplicationDrawerProps> = memo(
initialValues: app
? {
name: app.name,
env: app.envId,
kind: app.kind,
pipedId: app.pipedId,
repoPath: app.gitPath?.path || "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ const useStyles = makeStyles((theme) => ({
textMargin: {
marginLeft: theme.spacing(1),
},
env: {
color: theme.palette.text.secondary,
marginLeft: theme.spacing(1),
},
age: {
color: theme.palette.text.secondary,
marginLeft: theme.spacing(1),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const fakeDeployment: Deployment.AsObject = {
id: DEPLOYMENT_ID,
applicationId: "debug-project/development/debug-app",
applicationName: "demo-app",
envId: "development",
envId: "",
pipedId: "debug-piped",
projectId: "debug-project",
kind: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export const Overview = Template.bind({});
Overview.args = {
options: {
applicationId: undefined,
envId: undefined,
kind: undefined,
status: undefined,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const EditPipedDrawer: FC<EditPipedDrawerProps> = memo(
initialValues: {
name: piped?.name || "",
desc: piped?.desc || "",
envIds: piped?.envIdsList || [],
envIds: [],
},
enableReinitialize: true,
validationSchema,
Expand Down
3 changes: 0 additions & 3 deletions pkg/app/web/src/constants/toast-text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,3 @@ export const UPGRADE_PIPEDS_SUCCESS =

// Application
export const DELETE_APPLICATION_SUCCESS = "Successfully deleted Application.";

// Environment
export const DELETE_ENVIRONMENT_SUCCESS = "Successfully deleted Environment.";
4 changes: 1 addition & 3 deletions pkg/app/web/src/modules/applications/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ describe("fetchApplications", () => {
it("should get applications by options", async () => {
const store = createStore({});

await store.dispatch(
fetchApplications({ activeStatus: "enabled", envId: "env-1" })
);
await store.dispatch(fetchApplications({ activeStatus: "enabled" }));

expect(store.getActions()).toEqual(
expect.arrayContaining([
Expand Down
41 changes: 10 additions & 31 deletions pkg/app/web/src/modules/applications/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export const { selectAll, selectById } = applicationsAdapter.getSelectors();
export interface ApplicationsFilterOptions {
activeStatus?: string;
kind?: string;
envId?: string;
syncStatus?: string;
name?: string;
// Suppose to be like ["key-1:value-1"]
Expand All @@ -54,7 +53,7 @@ export const fetchApplications = createAsyncThunk<
}
const req = {
options: {
envIdsList: options.envId ? [options.envId] : [],
envIdsList: [],
kindsList: options.kind
? [parseInt(options.kind, 10) as ApplicationKind]
: [],
Expand All @@ -72,22 +71,6 @@ export const fetchApplications = createAsyncThunk<
return applicationsList as Application.AsObject[];
});

export const fetchApplicationsByEnv = createAsyncThunk<
Application.AsObject[],
{ envId: string }
>(`${MODULE_NAME}/fetchListByEnv`, async ({ envId }) => {
const { applicationsList } = await applicationsAPI.getApplications({
options: {
envIdsList: [envId],
kindsList: [],
name: "",
syncStatusesList: [],
labelsMap: [],
},
});
return applicationsList as Application.AsObject[];
});

export const fetchApplication = createAsyncThunk<
Application.AsObject | undefined,
string
Expand All @@ -111,7 +94,6 @@ export const addApplication = createAsyncThunk<
string,
{
name: string;
env: string;
pipedId: string;
repo: ApplicationGitRepository.AsObject;
repoPath: string;
Expand All @@ -124,7 +106,7 @@ export const addApplication = createAsyncThunk<
>(`${MODULE_NAME}/add`, async (props) => {
const { applicationId } = await applicationsAPI.addApplication({
name: props.name,
envId: props.env,
envId: "",
pipedId: props.pipedId,
gitPath: {
repo: props.repo,
Expand Down Expand Up @@ -235,17 +217,14 @@ export const applicationsSlice = createSlice({
.addCase(disableApplication.rejected, (state, action) => {
state.disabling[action.meta.arg.applicationId] = false;
})
.addMatcher(
isFulfilled(fetchApplications, fetchApplicationsByEnv),
(state, action) => {
applicationsAdapter.removeAll(state);
applicationsAdapter.upsertMany(
state,
action.payload.filter((app) => app.deleted === false)
);
state.loading = false;
}
);
.addMatcher(isFulfilled(fetchApplications), (state, action) => {
applicationsAdapter.removeAll(state);
applicationsAdapter.upsertMany(
state,
action.payload.filter((app) => app.deleted === false)
);
state.loading = false;
});
},
});

Expand Down
3 changes: 1 addition & 2 deletions pkg/app/web/src/modules/deployments/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export interface DeploymentFilterOptions {
status?: string;
kind?: string;
applicationId?: string;
envId?: string;
applicationName?: string;
// Suppose to be like ["key-1:value-1"]
// sindresorhus/query-string doesn't support multidimensional arrays, that's why the format is a bit tricky.
Expand Down Expand Up @@ -109,7 +108,7 @@ const convertFilterOptions = (
return {
applicationName: options.applicationName ?? "",
applicationIdsList: options.applicationId ? [options.applicationId] : [],
envIdsList: options.envId ? [options.envId] : [],
envIdsList: [],
kindsList: options.kind
? [parseInt(options.kind, 10) as ApplicationKind]
: [],
Expand Down
4 changes: 2 additions & 2 deletions pkg/app/web/src/modules/pipeds/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ export const fetchPipeds = createAsyncThunk<Piped.AsObject[], boolean>(

export const addPiped = createAsyncThunk<
RegisteredPiped,
{ name: string; desc: string; envIds: string[] }
{ name: string; desc: string }
>(`${MODULE_NAME}/add`, async (props) => {
const res = await pipedsApi.registerPiped({
desc: props.desc,
envIdsList: props.envIds,
name: props.name,
envIdsList: [],
});
return { ...res, isNewKey: false };
});
Expand Down
3 changes: 1 addition & 2 deletions pkg/app/web/src/modules/update-application/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export const updateApplication = createAsyncThunk<
{
applicationId: string;
name: string;
env: string;
pipedId: string;
repo: ApplicationGitRepository.AsObject;
repoPath: string;
Expand All @@ -33,7 +32,7 @@ export const updateApplication = createAsyncThunk<
await applicationAPI.updateApplication({
applicationId: values.applicationId,
name: values.name,
envId: values.env,
envId: "",
pipedId: values.pipedId,
cloudProvider: values.cloudProvider,
kind: values.kind,
Expand Down