Skip to content

Commit

Permalink
Merge branch 'master' into feature/password-reset
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Jan 10, 2023
2 parents 640bc1d + 60cfba8 commit ec75929
Show file tree
Hide file tree
Showing 762 changed files with 22,452 additions and 8,169 deletions.
59 changes: 40 additions & 19 deletions config/sql/native-new/postgres-new-upgrade.sql
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,19 @@ $aa$);
-- Simulations
call apply_change(12, $aa$
ALTER TYPE ObjectType ADD VALUE IF NOT EXISTS 'SIMULATION_RESULT' AFTER 'SHADOW';
$aa);
ALTER TYPE ObjectType ADD VALUE IF NOT EXISTS 'TAG' AFTER 'SYSTEM_CONFIGURATION';
ALTER TYPE ContainerType ADD VALUE IF NOT EXISTS 'SIMULATION_RESULT_PROCESSED_OBJECT' AFTER 'OPERATION_EXECUTION';
$aa$);

call apply_change(13, $aa$
-- TODO delete before release
DROP TABLE IF EXISTS m_simulation_result CASCADE;
DROP TABLE IF EXISTS m_simulation_result_processed_object_default CASCADE;
DROP TABLE IF EXISTS m_simulation_result_processed_object CASCADE;
DROP TABLE IF EXISTS m_tag CASCADE;
DROP TYPE IF EXISTS ObjectProcessingStateType;
-- TODO end of the block

CREATE TABLE m_simulation_result (
oid UUID NOT NULL PRIMARY KEY REFERENCES m_object_oid(oid),
objectType ObjectType GENERATED ALWAYS AS ('SIMULATION_RESULT') STORED
Expand All @@ -183,39 +193,36 @@ CREATE TABLE m_simulation_result (
)
INHERITS (m_object);

CREATE TRIGGER m_simulation_result_oid_insert_tr BEFORE INSERT ON m_message_template
CREATE TRIGGER m_simulation_result_oid_insert_tr BEFORE INSERT ON m_simulation_result
FOR EACH ROW EXECUTE FUNCTION insert_object_oid();
CREATE TRIGGER m_simulation_result_update_tr BEFORE UPDATE ON m_message_template
CREATE TRIGGER m_simulation_result_update_tr BEFORE UPDATE ON m_simulation_result
FOR EACH ROW EXECUTE FUNCTION before_update_object();
CREATE TRIGGER m_simulation_result_oid_delete_tr AFTER DELETE ON m_message_template
CREATE TRIGGER m_simulation_result_oid_delete_tr AFTER DELETE ON m_simulation_result
FOR EACH ROW EXECUTE FUNCTION delete_object_oid();

CREATE TYPE ObjectProcessingStateType AS ENUM ('UNMODIFIED', 'ADDED', 'MODIFIED', 'DELETED' );

ALTER TYPE ContainerType ADD VALUE IF NOT EXISTS 'SIMULATION_RESULT_PROCESSED_OBJECT' AFTER 'OPERATION_EXECUTION';
CREATE TYPE ObjectProcessingStateType AS ENUM ('UNMODIFIED', 'ADDED', 'MODIFIED', 'DELETED');

CREATE TABLE m_simulation_result_processed_object (
-- Default OID value is covered by INSERT triggers. No PK defined on abstract tables.
-- Owner does not have to be the direct parent of the container.
ownerOid UUID NOT NULL,
-- use like this on the concrete table:
-- ownerOid UUID NOT NULL REFERENCES m_object_oid(oid),
ownerOid UUID NOT NULL REFERENCES m_simulation_result(oid) ON DELETE CASCADE,

-- Container ID, unique in the scope of the whole object (owner).
-- While this provides it for sub-tables we will repeat this for clarity, it's part of PK.
cid BIGINT NOT NULL,
containerType ContainerType GENERATED ALWAYS AS ('SIMULATION_RESULT_PROCESSED_OBJECT') STORED
CHECK (containerType = 'SIMULATION_RESULT_PROCESSED_OBJECT'),
oid UUID NOT NULL,
oid UUID,
objectType ObjectType,
nameOrig TEXT NOT NULL,
nameNorm TEXT NOT NULL,
nameOrig TEXT,
nameNorm TEXT,
state ObjectProcessingStateType,
metricIdentifiers TEXT[],
fullObject BYTEA,
objectBefore BYTEA,
objectAfter BYTEA,


PRIMARY KEY (ownerOid, cid)
) PARTITION BY LIST(ownerOid);
Expand All @@ -227,7 +234,7 @@ CREATE OR REPLACE FUNCTION m_simulation_result_create_partition() RETURNS trigge
DECLARE
partition TEXT;
BEGIN
partition := 'm_simulation_result_processed_object_' || REPLACE(new.oid::text,'-','_');
partition := 'm_sr_processed_object_' || REPLACE(new.oid::text,'-','_');
IF new.partitioned AND NOT EXISTS(SELECT relname FROM pg_class WHERE relname=partition) THEN
RAISE NOTICE 'A partition has been created %',partition;
EXECUTE 'CREATE TABLE ' || partition || ' partition of ' || 'm_simulation_result_processed_object' || ' for values in (''' || new.oid|| ''');';
Expand All @@ -240,16 +247,14 @@ LANGUAGE plpgsql;
CREATE TRIGGER m_simulation_result_create_partition AFTER INSERT ON m_simulation_result
FOR EACH ROW EXECUTE FUNCTION m_simulation_result_create_partition();



--- Trigger which deletes processed objects partition when whole simulation is deleted

CREATE OR REPLACE FUNCTION m_simulation_result_delete_partition() RETURNS trigger AS
$BODY$
DECLARE
partition TEXT;
BEGIN
partition := 'm_simulation_result_processed_object_' || REPLACE(OLD.oid::text,'-','_');
partition := 'm_sr_processed_object_' || REPLACE(OLD.oid::text,'-','_');
IF OLD.partitioned AND EXISTS(SELECT relname FROM pg_class WHERE relname=partition) THEN
RAISE NOTICE 'A partition has been deleted %',partition;
EXECUTE 'DROP TABLE IF EXISTS ' || partition || ';';
Expand All @@ -259,11 +264,27 @@ CREATE OR REPLACE FUNCTION m_simulation_result_delete_partition() RETURNS trigge
$BODY$
LANGUAGE plpgsql;

CREATE TRIGGER baseline_delete_partition BEFORE DELETE ON m_simulation_result
FOR EACH ROW EXECUTE FUNCTION baseline_delete_partition();
CREATE TRIGGER m_simulation_result_delete_partition BEFORE DELETE ON m_simulation_result
FOR EACH ROW EXECUTE FUNCTION m_simulation_result_delete_partition();


CREATE TABLE m_tag (
oid UUID NOT NULL PRIMARY KEY REFERENCES m_object_oid(oid),
objectType ObjectType GENERATED ALWAYS AS ('TAG') STORED
CHECK (objectType = 'TAG')
)
INHERITS (m_assignment_holder);

CREATE TRIGGER m_tag_oid_insert_tr BEFORE INSERT ON m_tag
FOR EACH ROW EXECUTE FUNCTION insert_object_oid();
CREATE TRIGGER m_tag_update_tr BEFORE UPDATE ON m_tag
FOR EACH ROW EXECUTE FUNCTION before_update_object();
CREATE TRIGGER m_tag_oid_delete_tr AFTER DELETE ON m_tag
FOR EACH ROW EXECUTE FUNCTION delete_object_oid();



$aa);
$aa$, true); -- TODO remove `true` before M2 or before RC1! (Also, the first 3 table drops)


-- WRITE CHANGES ABOVE ^^
Expand Down
110 changes: 110 additions & 0 deletions config/sql/native-new/postgres-new.sql
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ CREATE TYPE ContainerType AS ENUM (
'INDUCEMENT',
'LOOKUP_TABLE_ROW',
'OPERATION_EXECUTION',
'SIMULATION_RESULT_PROCESSED_OBJECT',
'TRIGGER');

-- NOTE: Keep in sync with the same enum in postgres-new-audit.sql!
Expand Down Expand Up @@ -77,7 +78,9 @@ CREATE TYPE ObjectType AS ENUM (
'SEQUENCE',
'SERVICE',
'SHADOW',
'SIMULATION_RESULT',
'SYSTEM_CONFIGURATION',
'TAG',
'TASK',
'USER',
'VALUE_POLICY');
Expand Down Expand Up @@ -1865,6 +1868,113 @@ CREATE INDEX m_operation_execution_timestamp_idx ON m_operation_execution (times
-- TODO: index for status is questionable, don't we want WHERE status = ... to another index instead?
-- endregion


-- region Simulations Support

CREATE TABLE m_simulation_result (
oid UUID NOT NULL PRIMARY KEY REFERENCES m_object_oid(oid),
objectType ObjectType GENERATED ALWAYS AS ('SIMULATION_RESULT') STORED
CHECK (objectType = 'SIMULATION_RESULT'),
partitioned boolean
)
INHERITS (m_object);

CREATE TRIGGER m_simulation_result_oid_insert_tr BEFORE INSERT ON m_simulation_result
FOR EACH ROW EXECUTE FUNCTION insert_object_oid();
CREATE TRIGGER m_simulation_result_update_tr BEFORE UPDATE ON m_simulation_result
FOR EACH ROW EXECUTE FUNCTION before_update_object();
CREATE TRIGGER m_simulation_result_oid_delete_tr AFTER DELETE ON m_simulation_result
FOR EACH ROW EXECUTE FUNCTION delete_object_oid();

CREATE TYPE ObjectProcessingStateType AS ENUM ('UNMODIFIED', 'ADDED', 'MODIFIED', 'DELETED');

CREATE TABLE m_simulation_result_processed_object (
-- Default OID value is covered by INSERT triggers. No PK defined on abstract tables.
-- Owner does not have to be the direct parent of the container.
-- use like this on the concrete table:
-- ownerOid UUID NOT NULL REFERENCES m_object_oid(oid),
ownerOid UUID NOT NULL REFERENCES m_simulation_result(oid) ON DELETE CASCADE,

-- Container ID, unique in the scope of the whole object (owner).
-- While this provides it for sub-tables we will repeat this for clarity, it's part of PK.
cid BIGINT NOT NULL,
containerType ContainerType GENERATED ALWAYS AS ('SIMULATION_RESULT_PROCESSED_OBJECT') STORED
CHECK (containerType = 'SIMULATION_RESULT_PROCESSED_OBJECT'),
oid UUID,
objectType ObjectType,
nameOrig TEXT,
nameNorm TEXT,
state ObjectProcessingStateType,
metricIdentifiers TEXT[],
fullObject BYTEA,
objectBefore BYTEA,
objectAfter BYTEA,

PRIMARY KEY (ownerOid, cid)
) PARTITION BY LIST(ownerOid);

CREATE TABLE m_simulation_result_processed_object_default PARTITION OF m_simulation_result_processed_object DEFAULT;

CREATE OR REPLACE FUNCTION m_simulation_result_create_partition() RETURNS trigger AS
$BODY$
DECLARE
partition TEXT;
BEGIN
partition := 'm_sr_processed_object_' || REPLACE(new.oid::text,'-','_');
IF new.partitioned AND NOT EXISTS(SELECT relname FROM pg_class WHERE relname=partition) THEN
RAISE NOTICE 'A partition has been created %',partition;
EXECUTE 'CREATE TABLE ' || partition || ' partition of ' || 'm_simulation_result_processed_object' || ' for values in (''' || new.oid|| ''');';
END IF;
RETURN NULL;
END;
$BODY$
LANGUAGE plpgsql;

CREATE TRIGGER m_simulation_result_create_partition AFTER INSERT ON m_simulation_result
FOR EACH ROW EXECUTE FUNCTION m_simulation_result_create_partition();

--- Trigger which deletes processed objects partition when whole simulation is deleted

CREATE OR REPLACE FUNCTION m_simulation_result_delete_partition() RETURNS trigger AS
$BODY$
DECLARE
partition TEXT;
BEGIN
partition := 'm_sr_processed_object_' || REPLACE(OLD.oid::text,'-','_');
IF OLD.partitioned AND EXISTS(SELECT relname FROM pg_class WHERE relname=partition) THEN
RAISE NOTICE 'A partition has been deleted %',partition;
EXECUTE 'DROP TABLE IF EXISTS ' || partition || ';';
END IF;
RETURN OLD;
END;
$BODY$
LANGUAGE plpgsql;

CREATE TRIGGER m_simulation_result_delete_partition BEFORE DELETE ON m_simulation_result
FOR EACH ROW EXECUTE FUNCTION m_simulation_result_delete_partition();


-- endregion

-- region Tag

CREATE TABLE m_tag (
oid UUID NOT NULL PRIMARY KEY REFERENCES m_object_oid(oid),
objectType ObjectType GENERATED ALWAYS AS ('TAG') STORED
CHECK (objectType = 'TAG')
)
INHERITS (m_assignment_holder);

CREATE TRIGGER m_tag_oid_insert_tr BEFORE INSERT ON m_tag
FOR EACH ROW EXECUTE FUNCTION insert_object_oid();
CREATE TRIGGER m_tag_update_tr BEFORE UPDATE ON m_tag
FOR EACH ROW EXECUTE FUNCTION before_update_object();
CREATE TRIGGER m_tag_oid_delete_tr AFTER DELETE ON m_tag
FOR EACH ROW EXECUTE FUNCTION delete_object_oid();


-- endregion

-- region Extension support
-- Catalog table of known indexed extension items.
-- While itemName and valueType are both Q-names they are not cached via m_uri because this
Expand Down
12 changes: 10 additions & 2 deletions gui/admin-gui/src/frontend/scss/midpoint.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1479,9 +1479,7 @@ td .prism-property-value {
}
.compositedButton > .compositedButtonIcon {
//background-color: #f1f1f1;
margin: 10px;
text-align: center;
line-height: 75px;
font-size: 50px;
width: 115px;
}
Expand Down Expand Up @@ -1774,3 +1772,13 @@ th.debug-list-buttons {
}
}
}

@each $breakpoint in map-keys($grid-breakpoints) {
$infix: breakpoint-infix($breakpoint, $grid-breakpoints);
@include media-breakpoint-up($breakpoint, $grid-breakpoints) {

.col#{$infix}-2\.4 {
@include make-col(2.4, $grid-columns);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,17 @@ private List<CompiledObjectCollectionView> compileDefaultCollectionViews(Collect
if (collectionInstance == null) {
continue;
}
ObjectTypes objectType = ObjectTypes.getObjectType(collectionInstance.applicableForType());

Class<? extends Containerable> applicableForType = collectionInstance.applicableForType();
QName type;
if (ObjectType.class.isAssignableFrom(applicableForType)) {
ObjectTypes objectType = ObjectTypes.getObjectType((Class<? extends ObjectType>) applicableForType);
type = objectType.getTypeQName();
} else {
type = prismContext.getSchemaRegistry().determineTypeForClass(applicableForType);
}
CompiledObjectCollectionView defaultCollectionView =
new CompiledObjectCollectionView(objectType.getTypeQName(), collectionInstance.identifier());
new CompiledObjectCollectionView(type, collectionInstance.identifier());
defaultCollectionView.setDisplay(createDisplayType(collectionInstance.display()));
compiledObjectCollectionViews.add(defaultCollectionView);
defaultCollectionView.setDefaultView(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.List;
import javax.xml.namespace.QName;

import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.util.QNameUtil;

import org.apache.commons.collections4.CollectionUtils;
Expand Down Expand Up @@ -425,9 +426,9 @@ private boolean isAddButtonEnabled(){
return false;
}

private void executeMemberOperation(AbstractRoleType targetObject, ObjectQuery query,
protected Task executeMemberOperation(AbstractRoleType targetObject, ObjectQuery query,
@NotNull QName relation, QName type, AjaxRequestTarget target, PageBase pageBase) {
MemberOperationsHelper.createAndSubmitAssignMembersTask(targetObject, type, query,
return MemberOperationsHelper.createAndSubmitAssignMembersTask(targetObject, type, query,
relation, target, pageBase);
}

Expand Down

0 comments on commit ec75929

Please sign in to comment.