Skip to content
Snippets Groups Projects
Commit b4bea90c authored by Tom Robinson's avatar Tom Robinson
Browse files

Add setArchived for segment/metric now that it's been implemented in the backend

parent 59ca49b6
No related branches found
No related tags found
No related merge requests found
......@@ -3,11 +3,24 @@ import { createEntity } from "metabase/lib/entities";
import { MetricSchema } from "metabase/schema";
import colors from "metabase/lib/colors";
export default createEntity({
const Metrics = createEntity({
name: "metrics",
path: "/api/metric",
schema: MetricSchema,
objectActions: {
setArchived: ({ id }, archived, opts) =>
Metrics.actions.update(
{ id },
{
archived,
// NOTE: this is still required by the endpoint even though we don't really use it
revision_message: archived ? "(Archive)" : "(Unarchive)",
},
opts,
),
},
objectSelectors: {
getName: segment => segment && segment.name,
getUrl: segment => null,
......@@ -15,3 +28,5 @@ export default createEntity({
getIcon: question => "sum",
},
});
export default Metrics;
/* @flow */
import { createEntity } from "metabase/lib/entities";
import { createEntity, undo } from "metabase/lib/entities";
import { SegmentSchema } from "metabase/schema";
import colors from "metabase/lib/colors";
export default createEntity({
const Segments = createEntity({
name: "segments",
path: "/api/segment",
schema: SegmentSchema,
objectActions: {
setArchived: ({ id }, archived, opts) =>
Segments.actions.update(
{ id },
{
archived,
// NOTE: this is still required by the endpoint even though we don't really use it
revision_message: archived ? "(Archive)" : "(Unarchive)"
},
opts
),
},
objectSelectors: {
getName: segment => segment && segment.name,
getUrl: segment => null,
......@@ -17,3 +31,5 @@ export default createEntity({
getIcon: question => "segment",
},
});
export default Segments
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment