Skip to content

Commit 61fface

Browse files
committed
Update delete to archive. Allow archive of project w/stages.
1 parent 4911536 commit 61fface

File tree

10 files changed

+54
-57
lines changed

10 files changed

+54
-57
lines changed

Diff for: client/components/projects/ProjectTable.tsx

+12-14
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ interface IProjectTableProps {
2121

2222
updateProject?(project: IProject): any;
2323
duplicateProject?(id: string): any;
24-
deleteProject?(id: string): any;
24+
archiveProject?(id: string): any;
2525
}
2626

2727
interface IProjectTableState {
@@ -162,20 +162,20 @@ export class ProjectTable extends React.Component<IProjectTableProps, IProjectTa
162162
}
163163

164164
private onCompleteDeleteProject = (data) => {
165-
if (data.deleteProject.error) {
166-
toast.error(toastError("Delete", data.deleteProject.error), {autoClose: false});
165+
if (data.archiveProject.error) {
166+
toast.error(toastError("Archive", data.archiveProject.error), {autoClose: false});
167167
} else {
168168
if (PreferencesManager.Instance.PreferredProjectId === this.state.selectedProject.id) {
169169
this.setState({selectedProject: null});
170170
PreferencesManager.Instance.PreferredProjectId = AllProjectsId;
171171
}
172172

173-
toast.success(toastSuccess("Delete"), {autoClose: 3000});
173+
toast.success(toastSuccess("Archive"), {autoClose: 3000});
174174
}
175175
};
176176

177177
private onDeleteProjectError = (error) => {
178-
toast.error(toastError("Delete", error), {autoClose: false});
178+
toast.error(toastError("Archive", error), {autoClose: false});
179179
};
180180

181181
private onClearDeleteConfirmation() {
@@ -186,23 +186,23 @@ export class ProjectTable extends React.Component<IProjectTableProps, IProjectTa
186186
return (
187187
<Mutation mutation={DeleteProjectMutation} onCompleted={this.onCompleteDeleteProject}
188188
onError={this.onDeleteProjectError}
189-
update={(cache, {data: {deleteProject: {id}}}) => {
189+
update={(cache, {data: {archiveProject: {id}}}) => {
190190
const data: any = cache.readQuery({query: BaseQuery});
191191
cache.writeQuery({
192192
query: BaseQuery,
193193
data: Object.assign(data, {projects: data.projects.filter(t => t.id !== id)})
194194
});
195195
}}>
196-
{(deleteProject) => {
196+
{(archiveProject) => {
197197
if (!this.state.isDeleteDialogShown) {
198198
return null;
199199
}
200200
return (
201-
<Confirm open={this.state.isDeleteDialogShown} header="Delete Pipeline"
202-
content={`Are you sure you want to delete ${this.state.selectedProject.name} as a pipeline?`}
203-
confirmButton="Delete" onCancel={() => this.onClearDeleteConfirmation()}
201+
<Confirm open={this.state.isDeleteDialogShown} header="Archive Pipeline"
202+
content={`Are you sure you want to archive ${this.state.selectedProject.name}?`}
203+
confirmButton="Archive" onCancel={() => this.onClearDeleteConfirmation()}
204204
onConfirm={() => {
205-
deleteProject({variables: {id: this.state.selectedProject.id}});
205+
archiveProject({variables: {id: this.state.selectedProject.id}});
206206
this.setState({isDeleteDialogShown: false});
207207
}}/>
208208
)
@@ -219,8 +219,6 @@ export class ProjectTable extends React.Component<IProjectTableProps, IProjectTa
219219

220220
const disabled_active = disabled || this.state.selectedProject.is_processing;
221221

222-
const disabled_stages = disabled_active || this.state.selectedProject.stages.length > 0;
223-
224222
return (
225223
<Menu size="mini" style={{borderBottom: "none", borderRadius: 0, marginBottom: 0, boxShadow: "none"}}>
226224
<Mutation mutation={UpdateProjectMutation} onCompleted={this.onCompleteUpdateProject}
@@ -250,7 +248,7 @@ export class ProjectTable extends React.Component<IProjectTableProps, IProjectTa
250248
PreferencesManager.Instance.PreferredProjectId = AllProjectsId;
251249
}}/>
252250
<Menu.Menu position="right">
253-
<MenuItem size="mini" content="Delete" icon="trash" disabled={disabled_stages}
251+
<MenuItem size="mini" content="Archive" icon="trash" disabled={disabled_active}
254252
onClick={(evt) => this.onClickDeleteProject(evt)}/>
255253
</Menu.Menu>
256254
</Menu>

Diff for: client/components/stages/PipelineStageTable.tsx

+15-15
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {Mutation} from "react-apollo";
44
import ReactTable from "react-table";
55
import {toast} from "react-toastify";
66

7-
import {IPipelineStage, IPipelineStageTileStatus} from "../../models/pipelineStage";
7+
import {IPipelineStage} from "../../models/pipelineStage";
88
import {AllProjectsId} from "../helpers/ProjectMenu";
99
import {ITaskDefinition} from "../../models/taskDefinition";
1010
import {IProject} from "../../models/project";
@@ -83,19 +83,19 @@ export class PipelineStageTable extends React.Component<IPipelineStageTableProps
8383
}
8484

8585
private onCompleteDeletePipelineStage = (data) => {
86-
if (data.deletePipelineStage.error) {
87-
toast.error(toastError("Delete", data.deletePipelineStage.error), {autoClose: false});
86+
if (data.archivePipelineStage.error) {
87+
toast.error(toastError("Archive", data.archivePipelineStage.error), {autoClose: false});
8888
} else {
89-
if (PreferencesManager.Instance.PreferredProjectId === this.state.selectedStage.id) {
89+
if (this.state.selectedStage && PreferencesManager.Instance.PreferredStageId === this.state.selectedStage.id) {
9090
this.setState({selectedStage: null});
9191
}
9292

93-
toast.success(toastSuccess("Delete"), {autoClose: 3000});
93+
toast.success(toastSuccess("Archive"), {autoClose: 3000});
9494
}
9595
};
9696

9797
private onDeletePipelineStageError = (error) => {
98-
toast.error(toastError("Delete", error), {autoClose: false});
98+
toast.error(toastError("Archive", error), {autoClose: false});
9999
};
100100

101101
private onClearDeleteConfirmation() {
@@ -106,23 +106,23 @@ export class PipelineStageTable extends React.Component<IPipelineStageTableProps
106106
return (
107107
<Mutation mutation={DeletePipelineStageMutation} onCompleted={this.onCompleteDeletePipelineStage}
108108
onError={this.onDeletePipelineStageError}
109-
update={(cache, {data: {deletePipelineStage: {id}}}) => {
109+
update={(cache, {data: {archivePipelineStage: {id}}}) => {
110110
const data: any = cache.readQuery({query: BaseQuery});
111111
cache.writeQuery({
112112
query: BaseQuery,
113113
data: Object.assign(data, {pipelineStages: data.pipelineStages.filter(t => t.id !== id)})
114114
});
115115
}}>
116-
{(deletePipelineStage) => {
116+
{(archivePipelineStage) => {
117117
if (!this.state.isDeleteDialogShown) {
118118
return null;
119119
}
120120

121-
return (<Confirm open={this.state.isDeleteDialogShown} header="Delete Stage"
122-
content={`Are you sure you want to delete ${this.state.selectedStage.name} as a stage?`}
123-
confirmButton="Delete" onCancel={() => this.onClearDeleteConfirmation()}
121+
return (<Confirm open={this.state.isDeleteDialogShown} header="Archive Stage"
122+
content={`Are you sure you want to archive ${this.state.selectedStage.name}?`}
123+
confirmButton="Archive" onCancel={() => this.onClearDeleteConfirmation()}
124124
onConfirm={() => {
125-
deletePipelineStage({variables: {id: this.state.selectedStage.id}});
125+
archivePipelineStage({variables: {id: this.state.selectedStage.id}});
126126
this.setState({isDeleteDialogShown: false});
127127
}}/>
128128
)
@@ -164,7 +164,7 @@ export class PipelineStageTable extends React.Component<IPipelineStageTableProps
164164
<TableSelectionHeader item={this.state.selectedStage}
165165
onClick={() => this.setState({selectedStage: null})}/>
166166
<Menu.Menu position="right">
167-
<MenuItem size="mini" content="Delete" icon="trash" disabled={disabled_active}
167+
<MenuItem size="mini" content="Archive" icon="trash" disabled={disabled_active}
168168
onClick={(evt) => this.onClickDeletePipelineStage(evt)}/>
169169
</Menu.Menu>
170170
</Menu>
@@ -185,13 +185,13 @@ export class PipelineStageTable extends React.Component<IPipelineStageTableProps
185185
if (this.state.selectedStage === null) {
186186
const id = PreferencesManager.Instance.PreferredStageId;
187187

188-
const stages = this.filterStages(props).filter(s => s.id === id);
188+
const stages = this.filterStages(props).filter(s => s.id === id) || null;
189189

190190
if (stages.length > 0) {
191191
this.onSelectStage(stages[0]);
192192
}
193193
} else {
194-
const stage = this.filterStages(props).find(s => s.id === this.state.selectedStage.id);
194+
const stage = this.filterStages(props).find(s => s.id === this.state.selectedStage.id) || null;
195195
this.onSelectStage(stage);
196196
}
197197

Diff for: client/components/tasks/definitions/TaskDefinitionTable.tsx

+11-11
Original file line numberDiff line numberDiff line change
@@ -141,16 +141,16 @@ export class TaskDefinitionsTable extends React.Component<ITaskDefinitionsTableP
141141
}
142142

143143
private onCompleteDeleteDefinition = (data) => {
144-
if (data.deleteTaskDefinition.error) {
145-
toast.error(toastError("Delete", data.deleteTaskDefinition.error), {autoClose: false});
144+
if (data.archiveTaskDefinition.error) {
145+
toast.error(toastError("Archive", data.archiveTaskDefinition.error), {autoClose: false});
146146
} else {
147147
this.setState({selectedTask: null});
148-
toast.success(toastSuccess("Delete"), {autoClose: 3000});
148+
toast.success(toastSuccess("Archive"), {autoClose: 3000});
149149
}
150150
};
151151

152152
private onDeleteDefinitionError = (error) => {
153-
toast.error(toastError("Delete", error), {autoClose: false});
153+
toast.error(toastError("Archive", error), {autoClose: false});
154154
};
155155

156156
private onClearDeleteConfirmation() {
@@ -161,23 +161,23 @@ export class TaskDefinitionsTable extends React.Component<ITaskDefinitionsTableP
161161
return (
162162
<Mutation mutation={DeleteTaskDefinitionMutation} onCompleted={this.onCompleteDeleteDefinition}
163163
onError={this.onDeleteDefinitionError}
164-
update={(cache, {data: {deleteTaskDefinition: {id}}}) => {
164+
update={(cache, {data: {archiveTaskDefinition: {id}}}) => {
165165
const data: any = cache.readQuery({query: BaseQuery});
166166
cache.writeQuery({
167167
query: BaseQuery,
168168
data: Object.assign(data, {taskDefinitions: data.taskDefinitions.filter(t => t.id !== id)})
169169
});
170170
}}>
171-
{(deleteTaskDefinition) => {
171+
{(archiveTaskDefinition) => {
172172
if (!this.state.isDeleteDialogShown) {
173173
return null;
174174
}
175175
return (
176-
<Confirm open={this.state.isDeleteDialogShown} header="Delete Task"
177-
content={`Are you sure you want to delete ${this.state.selectedTask.name} as a task?`}
178-
confirmButton="Delete" onCancel={() => this.onClearDeleteConfirmation()}
176+
<Confirm open={this.state.isDeleteDialogShown} header="Archive Task"
177+
content={`Are you sure you want to archive ${this.state.selectedTask.name}?`}
178+
confirmButton="Archive" onCancel={() => this.onClearDeleteConfirmation()}
179179
onConfirm={() => {
180-
deleteTaskDefinition({variables: {id: this.state.selectedTask.id}});
180+
archiveTaskDefinition({variables: {id: this.state.selectedTask.id}});
181181
this.setState({isDeleteDialogShown: false});
182182
}}/>
183183
)
@@ -227,7 +227,7 @@ export class TaskDefinitionsTable extends React.Component<ITaskDefinitionsTableP
227227
<MenuItem size="mini" content="Duplicate" icon="clone" disabled={disabled}
228228
onClick={(evt) => this.onDuplicateTask(evt)}/>
229229
<Menu.Menu position="right">
230-
<MenuItem size="mini" content="Delete" icon="trash" disabled={disabled_delete}
230+
<MenuItem size="mini" content="Archive" icon="trash" disabled={disabled_delete}
231231
onClick={(evt) => this.onClickDeleteTaskDefinition(evt)}/>
232232
</Menu.Menu>
233233
</Menu>

Diff for: client/components/tasks/repository/TaskRepositoryTable.tsx

+11-11
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,16 @@ export class TaskRepositoryTable extends React.Component<ITaskRepositoryTablePro
5959
}
6060

6161
private onCompleteDeleteRepository = (data) => {
62-
if (data.deleteTaskRepository.error) {
63-
toast.error(toastError("Delete", data.deleteTaskRepository.error), {autoClose: false});
62+
if (data.archiveTaskRepository.error) {
63+
toast.error(toastError("Archive", data.archiveTaskRepository.error), {autoClose: false});
6464
} else {
6565
this.setState({selectedRepository: null});
66-
toast.success(toastSuccess("Delete"), {autoClose: 3000});
66+
toast.success(toastSuccess("Archive"), {autoClose: 3000});
6767
}
6868
};
6969

7070
private onDeleteRepositoryError = (error) => {
71-
toast.error(toastError("Delete", error), {autoClose: false});
71+
toast.error(toastError("Archive", error), {autoClose: false});
7272
};
7373

7474
private onClearDeleteConfirmation() {
@@ -79,23 +79,23 @@ export class TaskRepositoryTable extends React.Component<ITaskRepositoryTablePro
7979
return (
8080
<Mutation mutation={DeleteTaskRepositoryMutation} onCompleted={this.onCompleteDeleteRepository}
8181
onError={this.onDeleteRepositoryError}
82-
update={(cache, {data: {deleteTaskRepository: {id}}}) => {
82+
update={(cache, {data: {archiveTaskRepository: {id}}}) => {
8383
const data: any = cache.readQuery({query: BaseQuery});
8484
cache.writeQuery({
8585
query: BaseQuery,
8686
data: Object.assign(data, {taskRepositories: data.taskRepositories.filter(t => t.id !== id)})
8787
});
8888
}}>
89-
{(deleteTaskRepository) => {
89+
{(archiveTaskRepository) => {
9090
if (!this.state.isDeleteDialogShown) {
9191
return null;
9292
}
9393
return (
94-
<Confirm open={this.state.isDeleteDialogShown} header="Delete Repository"
95-
content={`Are you sure you want to delete ${this.state.selectedRepository.name} as a repository?`}
96-
confirmButton="Delete" onCancel={() => this.onClearDeleteConfirmation()}
94+
<Confirm open={this.state.isDeleteDialogShown} header="Archive Repository"
95+
content={`Are you sure you want to archive ${this.state.selectedRepository.name}?`}
96+
confirmButton="Archive" onCancel={() => this.onClearDeleteConfirmation()}
9797
onConfirm={() => {
98-
deleteTaskRepository({variables: {id: this.state.selectedRepository.id}});
98+
archiveTaskRepository({variables: {id: this.state.selectedRepository.id}});
9999
this.setState({isDeleteDialogShown: false});
100100
}}/>
101101
)
@@ -141,7 +141,7 @@ export class TaskRepositoryTable extends React.Component<ITaskRepositoryTablePro
141141
</div>
142142
</Menu.Header> : null}
143143
<Menu.Menu position="right">
144-
<MenuItem size="mini" content="Delete" icon="trash" disabled={disabled_delete}
144+
<MenuItem size="mini" content="Archive" icon="trash" disabled={disabled_delete}
145145
onClick={(evt) => this.onClickDeleteRepository(evt)}/>
146146
</Menu.Menu>
147147
</Menu>

Diff for: client/graphql/pipelineStage.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ ${PipelineStageRequiredFieldsFragment}
112112

113113
export const DeletePipelineStageMutation = gql`
114114
mutation DeletePipelineStageMutation($id: String!) {
115-
deletePipelineStage(id: $id) {
115+
archivePipelineStage(id: $id) {
116116
id
117117
error
118118
}

Diff for: client/graphql/project.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ ${PipelineStageRequiredFieldsFragment}
7979

8080
export const DeleteProjectMutation = gql`
8181
mutation DeleteProjectMutation($id: String!) {
82-
deleteProject(id: $id) {
82+
archiveProject(id: $id) {
8383
id
8484
error
8585
}

Diff for: client/graphql/taskDefinition.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ ${TaskDefinitionFragment}
6262
`;
6363

6464
export const DeleteTaskDefinitionMutation = gql`mutation DeleteTaskDefinition($id: String!) {
65-
deleteTaskDefinition(id: $id) {
65+
archiveTaskDefinition(id: $id) {
6666
id
6767
error
6868
}

Diff for: client/graphql/taskRepository.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ ${TaskRepositoryFragment}
4141
`;
4242

4343
export const DeleteTaskRepositoryMutation = gql`mutation DeleteTaskRepository($id: String!) {
44-
deleteTaskRepository(id: $id) {
44+
archiveTaskRepository(id: $id) {
4545
id
4646
error
4747
}

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pipeline-ui",
3-
"version": "1.4.3",
3+
"version": "1.4.4",
44
"description": "",
55
"keywords": [],
66
"author": "Patrick Edson <[email protected]> (http://github.com/pedson)",

Diff for: server/pipelineClientServer.ts

-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ function startSocketIOServer(server = null) {
8383
const io = require("socket.io")(server);
8484

8585
io.on("connection", (socket) => {
86-
debug("socket.io connection");
8786
socket.on("stopMicroscopeAcquisition", () => {
8887
});
8988
socket.on("restartHubProxy", () => {

0 commit comments

Comments
 (0)